summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2017-12-11 11:12:12 +0100
committerThomas Hellstrom <thellstrom@vmware.com>2017-12-22 13:21:53 +0100
commit8213d56c59972da5296d4f10df12da556aa2eb57 (patch)
tree685d11f7981bb09afe7638e6eaa5ce4bcae1eb74
parente46db665a4a3212c477b5c982f70f6ae71d14e47 (diff)
vmwgfx: Replace the backend treatment of legacy hotspots
Assuming now that cursor hotspots are always present in the plane state, we don't need to add in the legacy hotspots in the backend code anymore. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--vmwgfx_drv.c2
-rw-r--r--vmwgfx_drv.h2
-rw-r--r--vmwgfx_kms.c32
3 files changed, 28 insertions, 8 deletions
diff --git a/vmwgfx_drv.c b/vmwgfx_drv.c
index f2c5456..4cf3eb7 100644
--- a/vmwgfx_drv.c
+++ b/vmwgfx_drv.c
@@ -1574,6 +1574,8 @@ static struct drm_driver driver = {
.prime_fd_to_handle = vmw_prime_fd_to_handle,
.prime_handle_to_fd = vmw_prime_handle_to_fd,
+ .legacy_hotspot = vmw_kms_legacy_hotspot,
+
.fops = &vmwgfx_driver_fops,
.name = VMWGFX_DRIVER_NAME,
.desc = VMWGFX_DRIVER_DESC,
diff --git a/vmwgfx_drv.h b/vmwgfx_drv.h
index a0251b0..b2e90a5 100644
--- a/vmwgfx_drv.h
+++ b/vmwgfx_drv.h
@@ -940,6 +940,8 @@ int vmw_kms_present(struct vmw_private *dev_priv,
int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv);
+void vmw_kms_legacy_hotspot(struct drm_device *dev, struct drm_file *file_priv,
+ int crtc_id, __s32 *hot_x, __s32 *hot_y);
int vmw_dumb_create(struct drm_file *file_priv,
struct drm_device *dev,
diff --git a/vmwgfx_kms.c b/vmwgfx_kms.c
index bf0d0ec..19f9cc6 100644
--- a/vmwgfx_kms.c
+++ b/vmwgfx_kms.c
@@ -248,6 +248,22 @@ void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv)
drm_modeset_unlock_all(dev);
}
+void vmw_kms_legacy_hotspot(struct drm_device *dev, struct drm_file *file_priv,
+ int crtc_id, __s32 *hot_x, __s32 *hot_y)
+{
+ struct drm_crtc *crtc = drm_crtc_find(dev, crtc_id);
+
+ if (!crtc) {
+ *hot_x = 0;
+ *hot_y = 0;
+ } else {
+ struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
+
+ *hot_x = du->hotspot_x;
+ *hot_y = du->hotspot_y;
+ }
+}
+
void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv)
{
struct drm_device *dev = dev_priv->dev;
@@ -266,8 +282,8 @@ void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv)
vmw_cursor_update_image(dev_priv,
du->cursor_surface->snooper.image,
64, 64,
- du->hotspot_x + du->core_hotspot_x,
- du->hotspot_y + du->core_hotspot_y);
+ du->core_hotspot_x,
+ du->core_hotspot_y);
}
mutex_unlock(&dev->mode_config.mutex);
@@ -382,12 +398,12 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
int ret = 0;
- hotspot_x = du->hotspot_x;
- hotspot_y = du->hotspot_y;
-
- if (plane->fb) {
- hotspot_x += plane->fb->hot_x;
- hotspot_y += plane->fb->hot_y;
+ if (plane->state->fb) {
+ hotspot_x = plane->state->fb->hot_x;
+ hotspot_y = plane->state->fb->hot_y;
+ } else {
+ hotspot_x = 0;
+ hotspot_y = 0;
}
du->cursor_surface = vps->surf;