summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drmMode.c24
-rw-r--r--libdrm/xf86drmMode.h11
2 files changed, 28 insertions, 7 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index e5191d8c..f4ec004c 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -406,7 +406,8 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
{
struct drm_mode_get_property prop;
drmModePropertyPtr r;
-
+ struct drm_mode_property_blob *blob_tmp;
+ int i;
prop.prop_id = property_id;
prop.count_enum_blobs = 0;
prop.count_values = 0;
@@ -420,9 +421,14 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
if (prop.count_values)
prop.values_ptr = VOID2U64(drmMalloc(prop.count_values * sizeof(uint64_t)));
- if (prop.count_enum_blobs)
+ if (prop.count_enum_blobs & (prop.flags & DRM_MODE_PROP_ENUM))
prop.enum_blob_ptr = VOID2U64(drmMalloc(prop.count_enum_blobs * sizeof(struct drm_mode_property_enum)));
+ if (prop.count_enum_blobs & (prop.flags & DRM_MODE_PROP_BLOB)) {
+ prop.values_ptr = VOID2U64(drmMalloc(prop.count_enum_blobs * sizeof(uint32_t)));
+ prop.enum_blob_ptr = VOID2U64(drmMalloc(prop.count_enum_blobs * sizeof(uint32_t)));
+ }
+
if (ioctl(fd, DRM_IOCTL_MODE_GETPROPERTY, &prop)) {
r = NULL;
goto err_allocs;
@@ -433,10 +439,18 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
r->prop_id = prop.prop_id;
r->count_values = prop.count_values;
- r->count_enums = prop.count_enum_blobs;
+
r->flags = prop.flags;
- r->values = drmAllocCpy(U642VOID(prop.values_ptr), prop.count_values, sizeof(uint64_t));
- r->enums = drmAllocCpy(U642VOID(prop.enum_blob_ptr), prop.count_enum_blobs, sizeof(struct drm_mode_property_enum));
+ if (prop.count_values)
+ r->values = drmAllocCpy(U642VOID(prop.values_ptr), prop.count_values, sizeof(uint64_t));
+ if (prop.flags & DRM_MODE_PROP_ENUM) {
+ r->count_enums = prop.count_enum_blobs;
+ r->enums = drmAllocCpy(U642VOID(prop.enum_blob_ptr), prop.count_enum_blobs, sizeof(struct drm_mode_property_enum));
+ } else if (prop.flags & DRM_MODE_PROP_ENUM) {
+ r->values = drmAllocCpy(U642VOID(prop.values_ptr), prop.count_enum_blobs, sizeof(uint32_t));
+ r->blob_ids = drmAllocCpy(U642VOID(prop.enum_blob_ptr), prop.count_enum_blobs, sizeof(uint32_t));
+ r->count_blobs = prop.count_enum_blobs;
+ }
strncpy(r->name, prop.name, DRM_PROP_NAME_LEN);
r->name[DRM_PROP_NAME_LEN-1] = 0;
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h
index ec77174b..e936044b 100644
--- a/libdrm/xf86drmMode.h
+++ b/libdrm/xf86drmMode.h
@@ -69,15 +69,22 @@ typedef struct _drmModeRes {
typedef struct drm_mode_fb_cmd drmModeFB, *drmModeFBPtr;
+typedef struct _drmModePropertyBlob {
+ uint32_t id;
+ uint32_t length;
+ void *data;
+} drmModePropertyBlobRes, *drmModePropertyBlobPtr;
+
typedef struct _drmModeProperty {
unsigned int prop_id;
unsigned int flags;
unsigned char name[DRM_PROP_NAME_LEN];
int count_values;
- uint64_t *values;
+ uint64_t *values; // store the blob lengths
int count_enums;
struct drm_mode_property_enum *enums;
-
+ int count_blobs;
+ uint32_t *blob_ids; // store the blob IDs
} drmModePropertyRes, *drmModePropertyPtr;
typedef struct _drmModeCrtc {