xwayland: Keep the CVT timings for non-standard modes

The current code, as changed by commit ad2d461de „Do not round
non-standard modes“ is reported to be logically incongruent.

We should either drop libxcvt entirely or simply fix the size, keeping
the CVT timings unchanged.

For backward compatibility and simplicity, I'd rather simply fix the
hdisplay/vdisplay to match the given size.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Fixes: ad2d461de - xwayland: Do not round non-standard modes
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1549
This commit is contained in:
Olivier Fourdan 2023-05-15 09:23:57 +02:00
parent 2713383548
commit 814a04927d

View File

@ -53,17 +53,6 @@ xwayland_modeinfo_from_cvt(xRRModeInfo *modeinfo,
free(libxcvt_mode_info);
}
static void
xwayland_modeinfo_from_values(xRRModeInfo *modeinfo,
int hdisplay, int vdisplay, float vrefresh)
{
modeinfo->width = hdisplay;
modeinfo->height = vdisplay;
modeinfo->hTotal = hdisplay;
modeinfo->vTotal = vdisplay;
modeinfo->dotClock = hdisplay * vdisplay * vrefresh;
}
RRModePtr
xwayland_cvt(int hdisplay, int vdisplay, float vrefresh, Bool reduced,
Bool interlaced)
@ -75,14 +64,13 @@ xwayland_cvt(int hdisplay, int vdisplay, float vrefresh, Bool reduced,
hdisplay, vdisplay, vrefresh, reduced, interlaced);
/* Horizontal granularity in libxcvt is 8, so if our horizontal size is not
* divisible by 8, libxcvt will round it down, and we will advertise a wrong
* size to our XRandR clients. Fallback to a simpler method in that case.
* divisible by 8, libxcvt will round it up, and we will advertise a wrong
* size to our XRandR clients.
* Force the width/height (i.e. simply increase blanking which should not
* hurt anything), keeping the rest of the CVT mode timings unchanged.
*/
if (modeinfo.width != hdisplay || modeinfo.height != vdisplay) {
memset(&modeinfo, 0, sizeof(xRRModeInfo));
xwayland_modeinfo_from_values(&modeinfo,
hdisplay, vdisplay, vrefresh);
}
modeinfo.width = hdisplay;
modeinfo.height = vdisplay;
snprintf(name, sizeof name, "%dx%d",
modeinfo.width, modeinfo.height);