summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-02-02 03:11:17 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-02-02 03:11:17 +0000
commit4c95b06e55409662e8d7d12b25e7a6eaf005855f (patch)
tree34a6582d737dbc56ee147063d746c1645251cd45 /sys
parent7d903498af41ddf51746198461dbade0a3cef444 (diff)
drm: Disable the cursor plane on atomic contexts with virtualized drivers
From Zack Rusin 87b3b45ce7b4dd745506f9437b968c5e35b87dda in linux-6.6.y/6.6.15 4e3b70da64a53784683cfcbac2deda5d6e540407 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/drm_plane.c13
-rw-r--r--sys/dev/pci/drm/include/drm/drm_drv.h9
-rw-r--r--sys/dev/pci/drm/include/drm/drm_file.h12
3 files changed, 34 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/drm_plane.c b/sys/dev/pci/drm/drm_plane.c
index 01fbd3fb7b9..311e179904a 100644
--- a/sys/dev/pci/drm/drm_plane.c
+++ b/sys/dev/pci/drm/drm_plane.c
@@ -678,6 +678,19 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data,
!file_priv->universal_planes)
continue;
+ /*
+ * If we're running on a virtualized driver then,
+ * unless userspace advertizes support for the
+ * virtualized cursor plane, disable cursor planes
+ * because they'll be broken due to missing cursor
+ * hotspot info.
+ */
+ if (plane->type == DRM_PLANE_TYPE_CURSOR &&
+ drm_core_check_feature(dev, DRIVER_CURSOR_HOTSPOT) &&
+ file_priv->atomic &&
+ !file_priv->supports_virtualized_cursor_plane)
+ continue;
+
if (drm_lease_held(file_priv, plane->base.id)) {
if (count < plane_resp->count_planes &&
put_user(plane->base.id, plane_ptr + count))
diff --git a/sys/dev/pci/drm/include/drm/drm_drv.h b/sys/dev/pci/drm/include/drm/drm_drv.h
index 89d7dcb543e..5c855a1bce5 100644
--- a/sys/dev/pci/drm/include/drm/drm_drv.h
+++ b/sys/dev/pci/drm/include/drm/drm_drv.h
@@ -112,6 +112,15 @@ enum drm_driver_feature {
* Driver supports user defined GPU VA bindings for GEM objects.
*/
DRIVER_GEM_GPUVA = BIT(8),
+ /**
+ * @DRIVER_CURSOR_HOTSPOT:
+ *
+ * Driver supports and requires cursor hotspot information in the
+ * cursor plane (e.g. cursor plane has to actually track the mouse
+ * cursor and the clients are required to set hotspot in order for
+ * the cursor planes to work correctly).
+ */
+ DRIVER_CURSOR_HOTSPOT = BIT(9),
/* IMPORTANT: Below are all the legacy flags, add new ones above. */
diff --git a/sys/dev/pci/drm/include/drm/drm_file.h b/sys/dev/pci/drm/include/drm/drm_file.h
index 7d5259aef50..6e966a8e86b 100644
--- a/sys/dev/pci/drm/include/drm/drm_file.h
+++ b/sys/dev/pci/drm/include/drm/drm_file.h
@@ -232,6 +232,18 @@ struct drm_file {
bool is_master;
/**
+ * @supports_virtualized_cursor_plane:
+ *
+ * This client is capable of handling the cursor plane with the
+ * restrictions imposed on it by the virtualized drivers.
+ *
+ * This implies that the cursor plane has to behave like a cursor
+ * i.e. track cursor movement. It also requires setting of the
+ * hotspot properties by the client on the cursor plane.
+ */
+ bool supports_virtualized_cursor_plane;
+
+ /**
* @master:
*
* Master this node is currently associated with. Protected by struct