[Openchrome-devel] drm-openchrome: drivers/gpu/drm include/uapi/drm
James Simmons
jsimmons at kemper.freedesktop.org
Thu Jun 6 10:25:56 PDT 2013
drivers/gpu/drm/via/via_ioc32.c | 39 ++++++++++++++++++++++++++++++++++++---
include/uapi/drm/via_drm.h | 32 ++++++++++++++++++++++++++------
2 files changed, 62 insertions(+), 9 deletions(-)
New commits:
commit 16d4df690a11dfc38e0ec8858564dac76e2f6c7b
Author: James Simmons <jsimmons at infradead.org>
Date: Thu Jun 6 13:25:24 2013 -0400
By default the xorg driver has the ability to know what the pci id of the hardware is. This is not the case for a gallium driver so a GETPARM ioctl is added to handle this. Also consolidated the ioctls together so we have two different ioctl spaces for ums and kms. In the future we can then just move the ioctl numbers over 16.
diff --git a/drivers/gpu/drm/via/via_ioc32.c b/drivers/gpu/drm/via/via_ioc32.c
index c127a1c..03b8508 100644
--- a/drivers/gpu/drm/via/via_ioc32.c
+++ b/drivers/gpu/drm/via/via_ioc32.c
@@ -29,11 +29,41 @@
#include "via_drv.h"
static int
+via_getparam(struct drm_device *dev, void *data,
+ struct drm_file *filp)
+{
+ struct drm_via_private *dev_priv = dev->dev_private;
+ struct drm_via_param *args = data;
+ int ret = 0;
+
+ switch (args->param) {
+ case VIA_PARAM_CHIPSET_ID:
+ args->value = dev->pci_device;
+ break;
+ case VIA_PARAM_REVISION_ID:
+ args->value = dev_priv->revision;
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ return ret;
+}
+
+/* Not yet supported */
+static int
+via_setparam(struct drm_device *dev, void *data,
+ struct drm_file *filp)
+{
+ return -EINVAL;
+}
+
+static int
via_gem_alloc(struct drm_device *dev, void *data,
struct drm_file *filp)
{
struct drm_via_private *dev_priv = dev->dev_private;
- struct drm_gem_create *args = data;
+ struct drm_via_gem_create *args = data;
struct drm_gem_object *obj;
int ret = -ENOMEM;
@@ -61,7 +91,7 @@ static int
via_gem_state(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
struct ttm_buffer_object *bo = NULL;
- struct drm_gem_create *args = data;
+ struct drm_via_gem_create *args = data;
struct drm_gem_object *obj = NULL;
struct ttm_placement placement;
int ret = -EINVAL;
@@ -153,7 +183,7 @@ struct drm_ioctl_desc via_ioctls[] = {
DRM_IOCTL_DEF_DRV(VIA_FB_INIT, via_fb_init, DRM_AUTH | DRM_MASTER),
DRM_IOCTL_DEF_DRV(VIA_MAP_INIT, via_map_init, DRM_AUTH | DRM_MASTER),
DRM_IOCTL_DEF_DRV(VIA_DEC_FUTEX, via_decoder_futex, DRM_AUTH),
- DRM_IOCTL_DEF_DRV(VIA_GEM_CREATE, via_gem_alloc, DRM_AUTH | DRM_UNLOCKED),
+ DRM_IOCTL_DEF_DRV(VIA_OLD_GEM_CREATE, via_gem_alloc, DRM_AUTH | DRM_UNLOCKED),
DRM_IOCTL_DEF_DRV(VIA_DMA_INIT, via_dma_init, DRM_AUTH),
DRM_IOCTL_DEF_DRV(VIA_CMDBUFFER, via_cmdbuffer, DRM_AUTH),
DRM_IOCTL_DEF_DRV(VIA_FLUSH, via_flush_ioctl, DRM_AUTH),
@@ -162,6 +192,9 @@ struct drm_ioctl_desc via_ioctls[] = {
DRM_IOCTL_DEF_DRV(VIA_WAIT_IRQ, via_wait_irq, DRM_AUTH),
DRM_IOCTL_DEF_DRV(VIA_DMA_BLIT, via_dma_blit, DRM_AUTH),
DRM_IOCTL_DEF_DRV(VIA_BLIT_SYNC, via_dma_blit_sync, DRM_AUTH),
+ DRM_IOCTL_DEF_DRV(VIA_GETPARAM, via_getparam, DRM_AUTH | DRM_UNLOCKED),
+ DRM_IOCTL_DEF_DRV(VIA_SETPARAM, via_setparam, DRM_AUTH | DRM_MASTER | DRM_ROOT_ONLY),
+ DRM_IOCTL_DEF_DRV(VIA_GEM_CREATE, via_gem_alloc, DRM_AUTH | DRM_UNLOCKED),
DRM_IOCTL_DEF_DRV(VIA_GEM_WAIT, via_gem_wait, DRM_AUTH),
DRM_IOCTL_DEF_DRV(VIA_GEM_STATE, via_gem_state, DRM_AUTH),
};
diff --git a/include/uapi/drm/via_drm.h b/include/uapi/drm/via_drm.h
index d816de8..73ccb10 100644
--- a/include/uapi/drm/via_drm.h
+++ b/include/uapi/drm/via_drm.h
@@ -65,7 +65,7 @@
#define DRM_VIA_FB_INIT 0x03
#define DRM_VIA_MAP_INIT 0x04
#define DRM_VIA_DEC_FUTEX 0x05
-#define DRM_VIA_GEM_CREATE 0x06
+#define DRM_VIA_OLD_GEM_CREATE 0x06
#define DRM_VIA_DMA_INIT 0x07
#define DRM_VIA_CMDBUFFER 0x08
#define DRM_VIA_FLUSH 0x09
@@ -75,8 +75,13 @@
#define DRM_VIA_WAIT_IRQ 0x0d
#define DRM_VIA_DMA_BLIT 0x0e
#define DRM_VIA_BLIT_SYNC 0x0f
-#define DRM_VIA_GEM_WAIT 0x10
-#define DRM_VIA_GEM_STATE 0x11
+
+/* KMS ioctls */
+#define DRM_VIA_GETPARAM 0x10
+#define DRM_VIA_SETPARAM 0x11
+#define DRM_VIA_GEM_CREATE 0x12
+#define DRM_VIA_GEM_WAIT 0x13
+#define DRM_VIA_GEM_STATE 0x14
#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
#define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t)
@@ -84,7 +89,7 @@
#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t)
#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t)
#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t)
-#define DRM_IOCTL_VIA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_CREATE, struct drm_gem_create)
+#define DRM_IOCTL_VIA_OLD_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_OLD_GEM_CREATE, struct drm_via_gem_create)
#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t)
#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t)
#define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH)
@@ -94,8 +99,13 @@
#define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t)
#define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t)
#define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t)
+
+/* KMS ioctls */
+#define DRM_IOCTL_VIA_GETPARAM DRM_IOR(DRM_COMMAND_BASE + DRM_VIA_GETPARAM, struct drm_via_param)
+#define DRM_IOCTL_VIA_SETPARAM DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_SETPARAM, struct drm_via_param)
+#define DRM_IOCTL_VIA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_CREATE, struct drm_via_gem_create)
#define DRM_IOCTL_VIA_GEM_WAIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_GEM_WAIT, struct drm_via_gem_wait)
-#define DRM_IOCTL_VIA_GEM_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_STATE, struct drm_gem_create)
+#define DRM_IOCTL_VIA_GEM_STATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_STATE, struct drm_via_gem_create)
/* Indices into buf.Setup where various bits of state are mirrored per
* context and per buffer. These can be fired at the card as a unit,
@@ -276,7 +286,17 @@ typedef struct drm_via_dmablit {
drm_via_blitsync_t sync;
} drm_via_dmablit_t;
-struct drm_gem_create {
+/* Ioctl to query kernel params:
+ */
+#define VIA_PARAM_CHIPSET_ID 0
+#define VIA_PARAM_REVISION_ID 1
+
+struct drm_via_param {
+ uint64_t param;
+ uint64_t value;
+};
+
+struct drm_via_gem_create {
/**
* Requested size for the object.
*
More information about the Openchrome-devel
mailing list