diff mbox

[1/2] drm/mgag200: Added the hwcursor parameter to turn hardware cursor on/off.

Message ID 48f006a143feb34fdbaeb489a9c9eaf163d017d6.1393253082.git.jlemire@matrox.com (mailing list archive)
State New, archived
Headers show

Commit Message

Julia Lemire Feb. 24, 2014, 9:14 p.m. UTC
The hwcursor parameter is a boolean variable.  When set to true, the
hardware cursor is enabled.  When set to false, it is disabled.

Signed-off-by: Julia Lemire <jlemire@matrox.com>
---
 drivers/gpu/drm/mgag200/mgag200_cursor.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c
index 9f9780b..c9a94a6 100644
--- a/drivers/gpu/drm/mgag200/mgag200_cursor.c
+++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c
@@ -10,9 +10,17 @@ 
 
 #include <drm/drmP.h>
 #include "mgag200_drv.h"
+#include <linux/moduleparam.h>
+
+static bool hwcursor = true;
 
 static bool warn_transparent = true;
 static bool warn_palette = true;
+static bool warn_user_input = true;
+
+module_param(hwcursor, bool, 0644);
+MODULE_PARM_DESC(hwcursor, "When true, the hardware cursor is enabled.  When false, it is disabled.");
+
 
 /*
   Hide the cursor off screen. We can't disable the cursor hardware because it
@@ -90,6 +98,16 @@  int mga_crtc_cursor_set(struct drm_crtc *crtc,
 		goto out1;
 	}
 
+	if (!hwcursor) {
+		if (warn_user_input) {
+			dev_info(&dev->pdev->dev, "User disabled hardware cursor.\n");
+			warn_user_input = false;
+		}
+		mga_hide_cursor(mdev);
+		ret = -EINVAL;
+		goto out1;
+	}
+
 	/* Move cursor buffers into VRAM if they aren't already */
 	if (!pixels_1->pin_count) {
 		ret = mgag200_bo_pin(pixels_1, TTM_PL_FLAG_VRAM,