xwayland: Use our CVT function for fixed mode as well

Now that our CVT function is able to deal with non-standard modes, we
can safely use it for the fixed mode as well.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Olivier Fourdan 2023-04-25 11:33:12 +02:00
parent ad2d461dec
commit eb20ba039a

View File

@ -1086,11 +1086,8 @@ xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
{ {
RRModePtr *modes = NULL; RRModePtr *modes = NULL;
RRModePtr mode; RRModePtr mode;
xRRModeInfo mode_info = { 0, };
char mode_name[128];
int i, nmodes, current; int i, nmodes, current;
modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr)); modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr));
if (!modes) { if (!modes) {
ErrorF("Failed to allocated RandR modes\n"); ErrorF("Failed to allocated RandR modes\n");
@ -1115,21 +1112,11 @@ xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
} }
if (!current) { if (!current) {
/* Add the current mode as it's not part of the fake modes. /* Add the current mode as it's not part of the fake modes. */
* Not using libcvt as the size is set from the command line and mode = xwayland_cvt(current_width, current_height, 60, 0, 0);
* may not be a valid CVT mode.
*/
mode_info.width = current_width;
mode_info.height = current_height;
mode_info.hTotal = current_width;
mode_info.vTotal = current_height;
mode_info.dotClock = 60 * 1000 * 1000;
snprintf(mode_name, sizeof(mode_name), "%dx%d", if (mode)
current_width, current_height); modes[nmodes++] = mode;
mode_info.nameLength = strlen(mode_name);
modes[nmodes++] = RRModeGet(&mode_info, mode_name);
} }
qsort(modes, nmodes, sizeof(RRModePtr), mode_sort); qsort(modes, nmodes, sizeof(RRModePtr), mode_sort);