xserver: Branch 'master' - 3 commits

Adam Jackson ajax at kemper.freedesktop.org
Tue Jun 21 13:45:02 UTC 2016


 hw/xfree86/modes/xf86Crtc.h    |   39 ++++++++++++++++++++++-----------------
 hw/xfree86/modes/xf86Cursors.c |   40 ++++++++++++++++++----------------------
 hw/xfree86/modes/xf86Rotate.c  |    4 ++--
 3 files changed, 42 insertions(+), 41 deletions(-)

New commits:
commit 263c5333a54107efac702a54d7e6329ae25ff4e0
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Dec 25 18:32:46 2015 +0900

    xfree86/modes: Simplify in_range logic in xf86_crtc_set_cursor_position
    
    Consolidate to a single if/else statement and eliminate the redundant
    local variable in_range and assignments to x/y.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index c71ac97..d1e3302 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -395,7 +395,6 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
     xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
     DisplayModePtr mode = &crtc->mode;
     int crtc_x = x, crtc_y = y;
-    Bool in_range;
 
     /*
      * Transform position of cursor on screen
@@ -410,25 +409,18 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
     /*
      * Disable the cursor when it is outside the viewport
      */
-    in_range = TRUE;
     if (crtc_x >= mode->HDisplay || crtc_y >= mode->VDisplay ||
         crtc_x <= -cursor_info->MaxWidth || crtc_y <= -cursor_info->MaxHeight) {
-        in_range = FALSE;
-        x = 0;
-        y = 0;
-    }
-
-    crtc->cursor_in_range = in_range;
-
-    if (in_range) {
+        crtc->cursor_in_range = FALSE;
+        xf86_crtc_hide_cursor(crtc);
+    } else {
+        crtc->cursor_in_range = TRUE;
         if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorPosition)
             crtc->funcs->set_cursor_position(crtc, x, y);
         else
             crtc->funcs->set_cursor_position(crtc, crtc_x, crtc_y);
         xf86_crtc_show_cursor(crtc);
     }
-    else
-        xf86_crtc_hide_cursor(crtc);
 }
 
 static void
commit a991b1ec30344c16d318d2c0640f9e5d380193e0
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Mon Feb 1 16:07:22 2016 +0900

    xfree86/modes: Disambiguate driverIsPerformingTransform
    
    The driver can now specify exactly which aspects of the transform it
    wants to handle via XF86DriverTransform* flags.
    
    Since the driver can now choose whether it wants to receive transformed
    or untransformed cursor coordinates, xf86CrtcTransformCursorPos no
    longer needs to be available to drivers, so make it static.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index bdcfa13..fb1dd4f 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -70,6 +70,14 @@ typedef enum _xf86OutputStatus {
     XF86OutputStatusUnknown
 } xf86OutputStatus;
 
+typedef enum _xf86DriverTransforms {
+    XF86DriverTransformNone = 0,
+    XF86DriverTransformOutput = 1 << 0,
+    XF86DriverTransformCursorImage = 1 << 1,
+    XF86DriverTransformCursorPosition = 1 << 2,
+} xf86DriverTransforms;
+
+
 struct xf86CrtcTileInfo {
     uint32_t group_id;
     uint32_t flags;
@@ -237,7 +245,7 @@ typedef struct _xf86CrtcFuncs {
 
 } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
 
-#define XF86_CRTC_VERSION 6
+#define XF86_CRTC_VERSION 7
 
 struct _xf86Crtc {
     /**
@@ -377,17 +385,22 @@ struct _xf86Crtc {
     Bool shadowClear;
 
     /**
-     * Indicates that the driver is handling the transform, so the shadow
-     * surface should be disabled.  The driver writes this field before calling
-     * xf86CrtcRotate to indicate that it is handling the transform (including
-     * rotation and reflection).
+     * Indicates that the driver is handling some or all transforms:
+     *
+     * XF86DriverTransformOutput: The driver handles the output transform, so
+     * the shadow surface should be disabled.  The driver writes this field
+     * before calling xf86CrtcRotate to indicate that it is handling the
+     * transform (including rotation and reflection).
+     *
+     * XF86DriverTransformCursorImage: Setting this flag causes the server to
+     * pass the untransformed cursor image to the driver hook.
      *
-     * Setting this flag also causes the server to stop adjusting the cursor
-     * image and position.
+     * XF86DriverTransformCursorPosition: Setting this flag causes the server
+     * to pass the untransformed cursor position to the driver hook.
      *
-     * Added in ABI version 4
+     * Added in ABI version 4, changed to xf86DriverTransforms in ABI version 7
      */
-    Bool driverIsPerformingTransform;
+    xf86DriverTransforms driverIsPerformingTransform;
 
     /* Added in ABI version 5
      */
@@ -991,14 +1004,6 @@ extern _X_EXPORT void
 extern _X_EXPORT void
  xf86_cursors_fini(ScreenPtr screen);
 
-/**
- * Transform the cursor's coordinates based on the crtc transform.  Normally
- * this is done by the server, but if crtc->driverIsPerformingTransform is TRUE,
- * then the server does not transform the cursor position automatically.
- */
-extern _X_EXPORT void
- xf86CrtcTransformCursorPos(xf86CrtcPtr crtc, int *x, int *y);
-
 #ifdef XV
 /*
  * For overlay video, compute the relevant CRTC and
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index c1e9144..c71ac97 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -54,7 +54,7 @@
 static Rotation
 xf86_crtc_cursor_rotation(xf86CrtcPtr crtc)
 {
-    if (crtc->driverIsPerformingTransform)
+    if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorImage)
         return RR_Rotate_0;
     return crtc->rotation;
 }
@@ -357,8 +357,8 @@ xf86_show_cursors(ScrnInfoPtr scrn)
     }
 }
 
-void
-xf86CrtcTransformCursorPos(xf86CrtcPtr crtc, int *x, int *y)
+static void
+xf86_crtc_transform_cursor_position(xf86CrtcPtr crtc, int *x, int *y)
 {
     ScrnInfoPtr scrn = crtc->scrn;
     ScreenPtr screen = scrn->pScreen;
@@ -401,7 +401,7 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
      * Transform position of cursor on screen
      */
     if (crtc->transform_in_use)
-        xf86CrtcTransformCursorPos(crtc, &crtc_x, &crtc_y);
+        xf86_crtc_transform_cursor_position(crtc, &crtc_x, &crtc_y);
     else {
         crtc_x -= crtc->x;
         crtc_y -= crtc->y;
@@ -421,7 +421,7 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
     crtc->cursor_in_range = in_range;
 
     if (in_range) {
-        if (crtc->driverIsPerformingTransform)
+        if (crtc->driverIsPerformingTransform & XF86DriverTransformCursorPosition)
             crtc->funcs->set_cursor_position(crtc, x, y);
         else
             crtc->funcs->set_cursor_position(crtc, crtc_x, crtc_y);
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 4aa8f8d..fbd3c32 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -57,7 +57,7 @@ xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
     BoxPtr b = RegionRects(region);
     XID include_inferiors = IncludeInferiors;
 
-    if (crtc->driverIsPerformingTransform)
+    if (crtc->driverIsPerformingTransform & XF86DriverTransformOutput)
         return;
 
     src = CreatePicture(None,
@@ -387,7 +387,7 @@ xf86CrtcRotate(xf86CrtcPtr crtc)
         new_height = 0;
     }
     else {
-        if (crtc->driverIsPerformingTransform) {
+        if (crtc->driverIsPerformingTransform & XF86DriverTransformOutput) {
             xf86RotateDestroy(crtc);
         }
         else {
commit aad96f85005f8eab27df62049d619092865a9b16
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Dec 25 18:28:47 2015 +0900

    xfree86/modes: Fix HW cursor clipping for driverIsPerformingTransform (v2)
    
    Even if the driver is handling the transform, we still need to transform
    the cursor position for clipping, otherwise we may hide the HW cursor
    when the cursor is actually inside the area covered by the CRTC.
    
    v2: Use crtc_x/y local variables for clarity
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 6293b73..c1e9144 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -394,24 +394,25 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
     DisplayModePtr mode = &crtc->mode;
+    int crtc_x = x, crtc_y = y;
     Bool in_range;
 
     /*
      * Transform position of cursor on screen
      */
-    if (crtc->transform_in_use && !crtc->driverIsPerformingTransform)
-        xf86CrtcTransformCursorPos(crtc, &x, &y);
+    if (crtc->transform_in_use)
+        xf86CrtcTransformCursorPos(crtc, &crtc_x, &crtc_y);
     else {
-        x -= crtc->x;
-        y -= crtc->y;
+        crtc_x -= crtc->x;
+        crtc_y -= crtc->y;
     }
 
     /*
      * Disable the cursor when it is outside the viewport
      */
     in_range = TRUE;
-    if (x >= mode->HDisplay || y >= mode->VDisplay ||
-        x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight) {
+    if (crtc_x >= mode->HDisplay || crtc_y >= mode->VDisplay ||
+        crtc_x <= -cursor_info->MaxWidth || crtc_y <= -cursor_info->MaxHeight) {
         in_range = FALSE;
         x = 0;
         y = 0;
@@ -420,7 +421,10 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
     crtc->cursor_in_range = in_range;
 
     if (in_range) {
-        crtc->funcs->set_cursor_position(crtc, x, y);
+        if (crtc->driverIsPerformingTransform)
+            crtc->funcs->set_cursor_position(crtc, x, y);
+        else
+            crtc->funcs->set_cursor_position(crtc, crtc_x, crtc_y);
         xf86_crtc_show_cursor(crtc);
     }
     else


More information about the xorg-commit mailing list