[PATCH v2 3/3] drm/vkms: Enable/Disable cursor support with module option

Haneen Mohammed hamohammed.sa at gmail.com
Thu Sep 6 05:19:11 UTC 2018


Cursor support is not complete yet. Add module option 'enable_cursor'
to enable/disable cursor support which is used for testing currently.

Signed-off-by: Haneen Mohammed <hamohammed.sa at gmail.com>
---
 drivers/gpu/drm/vkms/vkms_drv.c    |  4 ++++
 drivers/gpu/drm/vkms/vkms_drv.h    |  2 ++
 drivers/gpu/drm/vkms/vkms_output.c | 13 ++++++++-----
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index bd9d4b2389bd..2d49ad31ad0b 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -21,6 +21,10 @@
 
 static struct vkms_device *vkms_device;
 
+bool enable_cursor;
+module_param_named(enable_cursor, enable_cursor, bool, 0444);
+MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support");
+
 static const struct file_operations vkms_driver_fops = {
 	.owner		= THIS_MODULE,
 	.open		= drm_open,
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index c9723c069ebf..1c93990693e3 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -16,6 +16,8 @@
 #define XRES_MAX  8192
 #define YRES_MAX  8192
 
+extern bool enable_cursor;
+
 static const u32 vkms_formats[] = {
 	DRM_FORMAT_XRGB8888,
 };
diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 19f9ffcbf9eb..271a0eb9042c 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -56,10 +56,12 @@ int vkms_output_init(struct vkms_device *vkmsdev)
 	if (IS_ERR(primary))
 		return PTR_ERR(primary);
 
-	cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR);
-	if (IS_ERR(cursor)) {
-		ret = PTR_ERR(cursor);
-		goto err_cursor;
+	if (enable_cursor) {
+		cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR);
+		if (IS_ERR(cursor)) {
+			ret = PTR_ERR(cursor);
+			goto err_cursor;
+		}
 	}
 
 	ret = vkms_crtc_init(dev, crtc, primary, cursor);
@@ -112,7 +114,8 @@ int vkms_output_init(struct vkms_device *vkmsdev)
 	drm_crtc_cleanup(crtc);
 
 err_crtc:
-	drm_plane_cleanup(cursor);
+	if (enable_cursor)
+		drm_plane_cleanup(cursor);
 
 err_cursor:
 	drm_plane_cleanup(primary);
-- 
2.17.1



More information about the dri-devel mailing list