From ff72145badb834e8051719ea66e024784d000cb4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 7 Feb 2011 12:16:14 +1000 Subject: drm: dumb scanout create/mmap for intel/radeon (v3) This is just an idea that might or might not be a good idea, it basically adds two ioctls to create a dumb and map a dumb buffer suitable for scanout. The handle can be passed to the KMS ioctls to create a framebuffer. It looks to me like it would be useful in the following cases: a) in development drivers - we can always provide a shadowfb fallback. b) libkms users - we can clean up libkms a lot and avoid linking to libdrm_*. c) plymouth via libkms is a lot easier. Userspace bits would be just calls + mmaps. We could probably mark these handles somehow as not being suitable for acceleartion so as top stop people who are dumber than dumb. Signed-off-by: Dave Airlie --- include/drm/drm.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/drm/drm.h') diff --git a/include/drm/drm.h b/include/drm/drm.h index e5f70617dec5..8598cc94e169 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h @@ -701,6 +701,10 @@ struct drm_gem_open { #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) +#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) +#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) +#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) + /** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x99. -- cgit v1.2.3 From 9f35421e09c494c36079d7cf5724ae9f832431d7 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 21 Feb 2011 11:17:35 +1000 Subject: drm/core: add ioctl to query device/driver capabilities We're coming to see a need to have a set of generic capability checks in the core DRM, in addition to the driver-specific ioctls that already exist. This patch defines an ioctl to do as such, but does not yet define any capabilities. [airlied: drop the driver callback for now.] Signed-off-by: Ben Skeggs Signed-off-by: Dave Airlie --- drivers/gpu/drm/drm_drv.c | 1 + drivers/gpu/drm/drm_ioctl.c | 11 +++++++++++ include/drm/drm.h | 7 +++++++ include/drm/drmP.h | 2 ++ 4 files changed, 21 insertions(+) (limited to 'include/drm/drm.h') diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 0d04914eb058..93a112d45c1a 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -67,6 +67,7 @@ static struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_GET_MAP, drm_getmap, 0), DRM_IOCTL_DEF(DRM_IOCTL_GET_CLIENT, drm_getclient, 0), DRM_IOCTL_DEF(DRM_IOCTL_GET_STATS, drm_getstats, 0), + DRM_IOCTL_DEF(DRM_IOCTL_GET_CAP, drm_getcap, 0), DRM_IOCTL_DEF(DRM_IOCTL_SET_VERSION, drm_setversion, DRM_MASTER), DRM_IOCTL_DEF(DRM_IOCTL_SET_UNIQUE, drm_setunique, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 117490590f56..d6de9d042b76 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -267,6 +267,17 @@ int drm_getstats(struct drm_device *dev, void *data, return 0; } +/** + * Get device/driver capabilities + */ +int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + struct drm_get_cap *req = data; + + req->value = 0; + return 0; +} + /** * Setversion ioctl. * diff --git a/include/drm/drm.h b/include/drm/drm.h index 8598cc94e169..da4efd162d58 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h @@ -608,6 +608,12 @@ struct drm_gem_open { __u64 size; }; +/** DRM_IOCTL_GET_CAP ioctl argument type */ +struct drm_get_cap { + __u64 capability; + __u64 value; +}; + #include "drm_mode.h" #define DRM_IOCTL_BASE 'd' @@ -628,6 +634,7 @@ struct drm_gem_open { #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) +#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 52a2fd2f7789..835214761d4f 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1276,6 +1276,8 @@ extern int drm_getclient(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_getstats(struct drm_device *dev, void *data, struct drm_file *file_priv); +extern int drm_getcap(struct drm_device *dev, void *data, + struct drm_file *file_priv); extern int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_noop(struct drm_device *dev, void *data, -- cgit v1.2.3 From e73f88af66fcc50083fae4b7e1c39b469179a97a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 4 Mar 2011 14:50:28 +1000 Subject: drm: add cap bit to denote if dumb ioctl is available or not. This allows libkms to make an easier decision. Signed-off-by: Dave Airlie --- drivers/gpu/drm/drm_ioctl.c | 8 ++++++++ include/drm/drm.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'include/drm/drm.h') diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index d6de9d042b76..7f6912a16761 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -275,6 +275,14 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv) struct drm_get_cap *req = data; req->value = 0; + switch (req->capability) { + case DRM_CAP_DUMB_BUFFER: + if (dev->driver->dumb_create) + req->value = 1; + break; + default: + return -EINVAL; + } return 0; } diff --git a/include/drm/drm.h b/include/drm/drm.h index da4efd162d58..9ac431396176 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h @@ -752,6 +752,8 @@ struct drm_event_vblank { __u32 reserved; }; +#define DRM_CAP_DUMB_BUFFER 0x1 + /* typedef area */ #ifndef __KERNEL__ typedef struct drm_clip_rect drm_clip_rect_t; -- cgit v1.2.3