[PATCH] [rfc] drm: add some caps for userspace to discover more info for dumb KMS driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dave Airlie <airlied@xxxxxxxxxx>

For the simple KMS driver case we need some more info about argb cursor
limits and a preferred depth and if shadowed framebuffer access is preferred.

I've only added this for intel/radeon which support the dumb ioctls so far.

I really don't want to expose a truck load of info, just enough for X to
start without configuration with a hw cursor.

If you need something really fancy you should be writing a real X.org driver.
---
 drivers/gpu/drm/drm_ioctl.c             |   12 ++++++++++++
 drivers/gpu/drm/i915/intel_display.c    |    5 +++++
 drivers/gpu/drm/radeon/radeon_display.c |    5 +++++
 include/drm/drm.h                       |    4 ++++
 include/drm/drm_crtc.h                  |    4 ++++
 5 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 904d7e9..37d2ce7 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -283,6 +283,18 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
 	case DRM_CAP_VBLANK_HIGH_CRTC:
 		req->value = 1;
 		break;
+	case DRM_CAP_DUMB_ARGB_CURSOR_WIDTH:
+		req->value = dev->mode_config.max_cursor_width;
+		break;
+	case DRM_CAP_DUMB_ARGB_CURSOR_HEIGHT:
+		req->value = dev->mode_config.max_cursor_height;
+		break;
+	case DRM_CAP_DUMB_PREFERRED_DEPTH:
+		req->value = dev->mode_config.preferred_depth;
+		break;
+	case DRM_CAP_DUMB_PREFER_SHADOW:
+		req->value = dev->mode_config.prefer_shadow;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 56a8554..cd169a5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8387,6 +8387,11 @@ void intel_modeset_init(struct drm_device *dev)
 	dev->mode_config.min_width = 0;
 	dev->mode_config.min_height = 0;
 
+	dev->mode_config.max_cursor_width = 64;
+	dev->mode_config.max_cursor_height = 64;
+	dev->mode_config.preferred_depth = 24;
+	dev->mode_config.prefer_shadow = 1;
+
 	dev->mode_config.funcs = (void *)&intel_mode_funcs;
 
 	intel_init_quirks(dev);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 6adb3e5..35bd467 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1310,6 +1310,11 @@ int radeon_modeset_init(struct radeon_device *rdev)
 		rdev->ddev->mode_config.max_height = 4096;
 	}
 
+	rdev->ddev->mode_config.max_cursor_width = 64;
+	rdev->ddev->mode_config.max_cursor_height = 64;
+	rdev->ddev->mode_config.preferred_depth = 24;
+	rdev->ddev->mode_config.prefer_shadow = 1;
+
 	rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
 
 	ret = radeon_modeset_create_props(rdev);
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 4be33b4..adc8174 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -757,6 +757,10 @@ struct drm_event_vblank {
 
 #define DRM_CAP_DUMB_BUFFER 0x1
 #define DRM_CAP_VBLANK_HIGH_CRTC 0x2
+#define DRM_CAP_DUMB_ARGB_CURSOR_WIDTH 0x3
+#define DRM_CAP_DUMB_ARGB_CURSOR_HEIGHT 0x4
+#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x5
+#define DRM_CAP_DUMB_PREFER_SHADOW 0x6
 
 /* typedef area */
 #ifndef __KERNEL__
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 44335e5..ed6f8dc 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -623,6 +623,10 @@ struct drm_mode_config {
 	struct drm_property *scaling_mode_property;
 	struct drm_property *dithering_mode_property;
 	struct drm_property *dirty_info_property;
+
+	/* dumb ioctl parameters */
+	uint32_t max_cursor_width, max_cursor_height;
+	uint32_t preferred_depth, prefer_shadow;
 };
 
 #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
-- 
1.7.6

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux