summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2007-12-06 10:44:51 +1000
committerDave Airlie <airlied@redhat.com>2007-12-06 10:44:51 +1000
commit67f6eb1eb8d3dc5bb5fdb097655d3da326f637c1 (patch)
tree86656d6f79feea5919194e62c38880a4adebfa2f /libdrm
parentc9cda51af5a8bea1d30ce575ae260de52950fe2f (diff)
add property blobs and edid reporting support
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drmMode.c41
-rw-r--r--libdrm/xf86drmMode.h3
2 files changed, 44 insertions, 0 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index f4ec004c..03bd15f1 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -470,3 +470,44 @@ void drmModeFreeProperty(drmModePropertyPtr ptr)
drmFree(ptr->enums);
drmFree(ptr);
}
+
+drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id)
+{
+ struct drm_mode_get_blob blob;
+ drmModePropertyBlobPtr r;
+
+ blob.length = 0;
+ blob.data = 0;
+ blob.blob_id = blob_id;
+
+ if (ioctl(fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob))
+ return NULL;
+
+ if (blob.length)
+ blob.data = VOID2U64(drmMalloc(blob.length));
+
+ if (ioctl(fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob)) {
+ r = NULL;
+ goto err_allocs;
+ }
+
+ if (!(r = drmMalloc(sizeof(*r))))
+ return NULL;
+
+ r->id = blob.blob_id;
+ r->length = blob.length;
+ r->data = drmAllocCpy(U642VOID(blob.data), 1, blob.length);
+
+err_allocs:
+ drmFree(U642VOID(blob.data));
+ return r;
+}
+
+void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr)
+{
+ if (!ptr)
+ return;
+
+ drmFree(ptr->data);
+ drmFree(ptr);
+}
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h
index e936044b..6fcf6a19 100644
--- a/libdrm/xf86drmMode.h
+++ b/libdrm/xf86drmMode.h
@@ -220,3 +220,6 @@ extern int drmModeDetachMode(int fd, uint32_t outputId, struct drm_mode_modeinfo
extern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId);
extern void drmModeFreeProperty(drmModePropertyPtr ptr);
+
+extern drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id);
+extern void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr);