From 060f1f1154aa094219e541cc3621245b9c2440f6 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 4 Dec 2023 16:16:16 +0100 Subject: [PATCH] xwayland: Always create the XrandR CRTCs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running rootful, Xwayland would simply skip the creation of the CRTC for the "real" outputs. Instead, create the CRTC regardless of all outputs in rootful mode, but mark them as disconnected when running rootful. Signed-off-by: Olivier Fourdan Acked-by: Michel Dänzer --- hw/xwayland/xwayland-output.c | 50 +++++++++++++++++------------------ hw/xwayland/xwayland-output.h | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 923745144..60a997d76 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -831,7 +831,7 @@ xwl_output_from_wl_output(struct xwl_screen *xwl_screen, struct xwl_output * xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, - Bool with_xrandr, uint32_t version) + Bool connected, uint32_t version) { struct xwl_output *xwl_output; char name[MAX_OUTPUT_NAME] = { 0 }; @@ -854,31 +854,31 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, xwl_output->xwl_screen = xwl_screen; - if (with_xrandr) { - xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output); - if (!xwl_output->randr_crtc) { - ErrorF("Failed creating RandR CRTC\n"); - goto err; - } - RRCrtcSetRotations (xwl_output->randr_crtc, ALL_ROTATIONS); - - /* Allocate MAX_OUTPUT_NAME data for the output name, all filled with zeros */ - xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name, - MAX_OUTPUT_NAME, xwl_output); - if (!xwl_output->randr_output) { - ErrorF("Failed creating RandR Output\n"); - goto err; - } - /* Set the default output name to a sensible value */ - snprintf(name, MAX_OUTPUT_NAME, "XWAYLAND%d", - xwl_screen_get_next_output_serial(xwl_screen)); - xwl_output_set_name(xwl_output, name); - xwl_output_set_emulated(xwl_output); - - RRCrtcGammaSetSize(xwl_output->randr_crtc, 256); - RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1); - RROutputSetConnection(xwl_output->randr_output, RR_Connected); + xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output); + if (!xwl_output->randr_crtc) { + ErrorF("Failed creating RandR CRTC\n"); + goto err; } + RRCrtcSetRotations (xwl_output->randr_crtc, ALL_ROTATIONS); + + /* Allocate MAX_OUTPUT_NAME data for the output name, all filled with zeros */ + xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name, + MAX_OUTPUT_NAME, xwl_output); + if (!xwl_output->randr_output) { + ErrorF("Failed creating RandR Output\n"); + goto err; + } + /* Set the default output name to a sensible value */ + snprintf(name, MAX_OUTPUT_NAME, "XWAYLAND%d", + xwl_screen_get_next_output_serial(xwl_screen)); + xwl_output_set_name(xwl_output, name); + xwl_output_set_emulated(xwl_output); + + RRCrtcGammaSetSize(xwl_output->randr_crtc, 256); + RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1); + RROutputSetConnection(xwl_output->randr_output, + connected ? RR_Connected : RR_Disconnected); + /* We want the output to be in the list as soon as created so we can * use it when binding to the xdg-output protocol... */ diff --git a/hw/xwayland/xwayland-output.h b/hw/xwayland/xwayland-output.h index bcdf25bec..fd3179db0 100644 --- a/hw/xwayland/xwayland-output.h +++ b/hw/xwayland/xwayland-output.h @@ -88,7 +88,7 @@ struct xwl_output *xwl_output_from_wl_output(struct xwl_screen *xwl_screen, struct wl_output* wl_output); struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen, - uint32_t id, Bool with_xrandr, + uint32_t id, Bool connected, uint32_t version); void xwl_output_destroy(struct xwl_output *xwl_output);