drm/vmwgfx: Calculate the cursor position based on the crtc gui origin
authorThomas Hellstrom <thellstrom@vmware.com>
Fri, 12 Feb 2016 08:57:15 +0000 (09:57 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Mon, 14 Mar 2016 13:59:10 +0000 (14:59 +0100)
Base the cursor position on the coordinate of the crtc origin in the
gui coordinate system rather than in the framebuffer coordinate system.

With explicit placement, these may differ (for example when two crtcs
scan out of the same framebuffer location).

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

index 0e2340fbed1768e4c16acc7bacc203e5a5f9b277..4742ec4ead27c71629b806291e0c9b6ce9b10cc8 100644 (file)
@@ -236,8 +236,8 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
        struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
        bool shown = du->cursor_surface || du->cursor_dmabuf ? true : false;
 
-       du->cursor_x = x + crtc->x;
-       du->cursor_y = y + crtc->y;
+       du->cursor_x = x + du->set_gui_x;
+       du->cursor_y = y + du->set_gui_y;
 
        /*
         * FIXME: Unclear whether there's any global state touched by the
index aa21aff9870dca0a8b876cbe62074fdd41a5784e..57203212c501dc0577d45d76661c7fafe6651351 100644 (file)
@@ -179,6 +179,8 @@ struct vmw_display_unit {
        int gui_y;
        bool is_implicit;
        bool active_implicit;
+       int set_gui_x;
+       int set_gui_y;
 };
 
 #define vmw_crtc_to_du(x) \
index 13b104709912ed92f2c637d5bbb27e4cfcb29b9d..63ccd9871ec94266a25ee435b05ef3dd7b20e1b0 100644 (file)
@@ -288,6 +288,8 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
        crtc->y = set->y;
        crtc->mode = *mode;
        crtc->enabled = true;
+       ldu->base.set_gui_x = set->x;
+       ldu->base.set_gui_y = set->y;
 
        vmw_ldu_add_active(dev_priv, ldu, vfb);
 
index 7ca13ec1291e8465633415bd435f3284c0bb7acf..8a3d3c9f2d9f5a1f199a245a175be83015e92b59 100644 (file)
@@ -144,6 +144,8 @@ static int vmw_sou_fifo_create(struct vmw_private *dev_priv,
                cmd->obj.root.x = sou->base.gui_x;
                cmd->obj.root.y = sou->base.gui_y;
        }
+       sou->base.set_gui_x = cmd->obj.root.x;
+       sou->base.set_gui_y = cmd->obj.root.y;
 
        /* Ok to assume that buffer is pinned in vram */
        vmw_bo_get_guest_ptr(&sou->buffer->base, &cmd->obj.backingStore.ptr);
index 1cd88d197840732eb6ec963b70723b722de9b066..fe42a2cefb86638613af32191b00464fe3d68b6a 100644 (file)
@@ -202,6 +202,8 @@ static int vmw_stdu_define_st(struct vmw_private *dev_priv,
                cmd->body.xRoot  = stdu->base.gui_x;
                cmd->body.yRoot  = stdu->base.gui_y;
        }
+       stdu->base.set_gui_x = cmd->body.xRoot;
+       stdu->base.set_gui_y = cmd->body.yRoot;
 
        vmw_fifo_commit(dev_priv, sizeof(*cmd));