[PATCH xserver 2/3] xfree86/modes: Disambiguate driverIsPerformingTransform

Michel Dänzer michel at daenzer.net
Fri Mar 25 10:12:35 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

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.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 hw/xfree86/modes/xf86Crtc.h    | 39 ++++++++++++++++++++++-----------------
 hw/xfree86/modes/xf86Cursors.c | 10 +++++-----
 hw/xfree86/modes/xf86Rotate.c  |  4 ++--
 3 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 8b01608..888cf48 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
      */
@@ -995,14 +1008,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 1c7116c..729f927 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 {
-- 
2.8.0.rc3



More information about the xorg-devel mailing list