summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-02-21 11:27:19 +1000
committerDave Airlie <airlied@redhat.com>2011-03-04 15:25:51 +1000
commit5c6c6913d1260024e5d156db7973c9e46fe1ff03 (patch)
tree5db622ccb0cbb5c8b80ca53782cdb0b1abcc031d
parent4473a7e8234da6d16f4ccfa660fbd72ff1b7dd95 (diff)
Implement drmGetCap() to query device/driver capabilities
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--include/drm/drm.h9
-rw-r--r--xf86drm.c12
-rw-r--r--xf86drm.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/include/drm/drm.h b/include/drm/drm.h
index c968dc81..416673af 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -612,6 +612,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'
@@ -632,6 +638,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)
@@ -747,6 +754,8 @@ struct drm_event_vblank {
__u32 reserved;
};
+#define DRM_CAP_DUMB_BUFFER 0x1
+
/* typedef area */
typedef struct drm_clip_rect drm_clip_rect_t;
typedef struct drm_drawable_info drm_drawable_info_t;
diff --git a/xf86drm.c b/xf86drm.c
index 799fcddf..bc7a97fe 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -810,6 +810,18 @@ drmVersionPtr drmGetLibVersion(int fd)
return (drmVersionPtr)version;
}
+int drmGetCap(int fd, uint64_t capability, uint64_t *value)
+{
+ struct drm_get_cap cap = { capability, 0 };
+ int ret;
+
+ ret = drmIoctl(fd, DRM_IOCTL_GET_CAP, &cap);
+ if (ret)
+ return ret;
+
+ *value = cap.value;
+ return cap.value;
+}
/**
* Free the bus ID information.
diff --git a/xf86drm.h b/xf86drm.h
index 9b89f562..bf0d5df8 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -542,6 +542,7 @@ extern int drmOpenControl(int minor);
extern int drmClose(int fd);
extern drmVersionPtr drmGetVersion(int fd);
extern drmVersionPtr drmGetLibVersion(int fd);
+extern int drmGetCap(int fd, uint64_t capability, uint64_t *value);
extern void drmFreeVersion(drmVersionPtr);
extern int drmGetMagic(int fd, drm_magic_t * magic);
extern char *drmGetBusid(int fd);