virtio-gpu: pick up hotspot from framebuffer
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 31 May 2016 07:36:21 +0000 (09:36 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 7 Jun 2016 08:37:13 +0000 (10:37 +0200)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_plane.c

index 478035458e6bb12af32e311a8bbada8507eb55f2..b7778a78db4b5ed92786a11ecd79a5e4c686a810 100644 (file)
@@ -153,17 +153,23 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
        }
 
        if (plane->state->fb != old_state->fb) {
-               DRM_DEBUG("update, handle %d, +%d+%d\n", handle,
+               DRM_DEBUG("update, handle %d, pos +%d+%d, hot %d,%d\n", handle,
                          plane->state->crtc_x,
-                         plane->state->crtc_y);
+                         plane->state->crtc_y,
+                         plane->state->fb ? plane->state->fb->hot_x : 0,
+                         plane->state->fb ? plane->state->fb->hot_y : 0);
                output->cursor.hdr.type =
                        cpu_to_le32(VIRTIO_GPU_CMD_UPDATE_CURSOR);
                output->cursor.resource_id = cpu_to_le32(handle);
-#if 0
-               /* TODO */
-               output->cursor.hot_x = cpu_to_le32(hot_x);
-               output->cursor.hot_y = cpu_to_le32(hot_y);
-#endif
+               if (plane->state->fb) {
+                       output->cursor.hot_x =
+                               cpu_to_le32(plane->state->fb->hot_x);
+                       output->cursor.hot_y =
+                               cpu_to_le32(plane->state->fb->hot_y);
+               } else {
+                       output->cursor.hot_x = cpu_to_le32(0);
+                       output->cursor.hot_y = cpu_to_le32(0);
+               }
        } else {
                DRM_DEBUG("move +%d+%d\n",
                          plane->state->crtc_x,