[xserver,v3,1/2] xwayland: CRTC should support all rotations

Submitted by Olivier Fourdan on Feb. 7, 2017, 2:31 p.m.

Details

Message ID 20170207143123.20544-1-ofourdan@redhat.com
State Accepted
Commit afeace27d3818274b75d59375771dc964d2f56bb
Headers show
Series "xwayland: Pretend we support all transformations" ( rev: 3 ) in X.org (DEPRECATED - USE GITLAB)

Not browsing as part of any series.

Commit Message

Olivier Fourdan Feb. 7, 2017, 2:31 p.m.
If the Wayland compositor sets a rotation on the output, Xwayland
translates the transformation as an xrandr rotation for the given
output.

However, if the rotation is not supported by the CRTC, this is not
a valid setup and xrandr queries will fail.

Pretend we support all rotations and reflections so that the
configuration remains a valid xrandr setup.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99663
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
---
 v2: We don't need to support all rotatons and reflections, just one
     (RR_Rotate_0) and use it in the current config for rrGetInfo()
 v3: Split the patch in two as there two issues. One being the config
     set by Xwayland when there is a transformation not supported by the
     CRTC, this is this patch.

 hw/xwayland/xwayland-output.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index f3ce763..bdf270a 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -31,6 +31,12 @@ 
 #include <randrstr.h>
 
 #define DEFAULT_DPI 96
+#define ALL_ROTATIONS (RR_Rotate_0   | \
+                       RR_Rotate_90  | \
+                       RR_Rotate_180 | \
+                       RR_Rotate_270 | \
+                       RR_Reflect_X  | \
+                       RR_Reflect_Y)
 
 static Rotation
 wl_transform_to_xrandr(enum wl_output_transform transform)
@@ -266,6 +272,7 @@  xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
         ErrorF("Failed creating RandR CRTC\n");
         goto err;
     }
+    RRCrtcSetRotations (xwl_output->randr_crtc, ALL_ROTATIONS);
 
     xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name,
                                               strlen(name), xwl_output);
@@ -317,7 +324,7 @@  xwl_output_remove(struct xwl_output *xwl_output)
 static Bool
 xwl_randr_get_info(ScreenPtr pScreen, Rotation * rotations)
 {
-    *rotations = 0;
+    *rotations = ALL_ROTATIONS;
 
     return TRUE;
 }