diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2023-04-25 11:33:12 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2023-05-11 17:01:52 +0200 |
commit | eb20ba039a1acca8a291eef095388893e327adc0 (patch) | |
tree | c6e6c93f3548aa620662a49848ed97ff5bb8d55b /hw | |
parent | ad2d461dec84b33a7fa0784776f3eee7bd6c55f4 (diff) | |
download | xserver-eb20ba039a1acca8a291eef095388893e327adc0.tar.gz |
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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xwayland/xwayland-output.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 661e1828d..738c3320f 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -1086,11 +1086,8 @@ xwl_randr_add_modes_fixed(struct xwl_output *xwl_output, { RRModePtr *modes = NULL; RRModePtr mode; - xRRModeInfo mode_info = { 0, }; - char mode_name[128]; int i, nmodes, current; - modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr)); if (!modes) { ErrorF("Failed to allocated RandR modes\n"); @@ -1115,21 +1112,11 @@ xwl_randr_add_modes_fixed(struct xwl_output *xwl_output, } if (!current) { - /* 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 - * 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", - current_width, current_height); - mode_info.nameLength = strlen(mode_name); + /* Add the current mode as it's not part of the fake modes. */ + mode = xwayland_cvt(current_width, current_height, 60, 0, 0); - modes[nmodes++] = RRModeGet(&mode_info, mode_name); + if (mode) + modes[nmodes++] = mode; } qsort(modes, nmodes, sizeof(RRModePtr), mode_sort); |