From: Michel Dänzer <michel.daen...@amd.com>

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.

Signed-off-by: Michel Dänzer <michel.daen...@amd.com>
---
 hw/xfree86/modes/xf86Cursors.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 321cde7..27a1b74 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -394,24 +394,33 @@ 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 clip_x, clip_y;
     Bool in_range;
 
     /*
      * Transform position of cursor on screen
      */
-    if (crtc->transform_in_use && !crtc->driverIsPerformingTransform)
-        xf86CrtcTransformCursorPos(crtc, &x, &y);
-    else {
+    if (crtc->transform_in_use) {
+        clip_x = x;
+        clip_y = y;
+        xf86CrtcTransformCursorPos(crtc, &clip_x, &clip_y);
+        if (!crtc->driverIsPerformingTransform) {
+            x = clip_x;
+            y = clip_y;
+        }
+    } else {
         x -= crtc->x;
         y -= crtc->y;
+        clip_x = x;
+        clip_y = 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 (clip_x >= mode->HDisplay || clip_y >= mode->VDisplay ||
+        clip_x <= -cursor_info->MaxWidth || clip_y <= -cursor_info->MaxHeight) 
{
         in_range = FALSE;
         x = 0;
         y = 0;
-- 
2.6.2

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to