aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stone2015-06-22 11:26:03 -0500
committerEmil Velikov2015-06-29 13:19:22 -0500
commit32471b265c6fbce6d519f0420a0ffeb608296502 (patch)
tree6b90d9feb55c077d5a5a5b7b4390604025551f0d /xf86drmMode.c
parented44e0b9585c563905447eceed12af9c1c7ca8d4 (diff)
downloadexternal-libgbm-32471b265c6fbce6d519f0420a0ffeb608296502.tar.gz
external-libgbm-32471b265c6fbce6d519f0420a0ffeb608296502.tar.xz
external-libgbm-32471b265c6fbce6d519f0420a0ffeb608296502.zip
Add blob property create/destroy ioctl wrappers
v2: Use memclear to zero out structure. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'xf86drmMode.c')
-rw-r--r--xf86drmMode.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/xf86drmMode.c b/xf86drmMode.c
index a75eca33..73c86958 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -1387,3 +1387,37 @@ out:
1387 1387
1388 return ret; 1388 return ret;
1389} 1389}
1390
1391int
1392drmModeCreatePropertyBlob(int fd, const void *data, size_t length, uint32_t *id)
1393{
1394 struct drm_mode_create_blob create;
1395 int ret;
1396
1397 if (length >= 0xffffffff)
1398 return -ERANGE;
1399
1400 memclear(create);
1401
1402 create.length = length;
1403 create.data = (uintptr_t) data;
1404 create.blob_id = 0;
1405 *id = 0;
1406
1407 ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create);
1408 if (ret != 0)
1409 return ret;
1410
1411 *id = create.blob_id;
1412 return 0;
1413}
1414
1415int
1416drmModeDestroyPropertyBlob(int fd, uint32_t id)
1417{
1418 struct drm_mode_destroy_blob destroy;
1419
1420 memclear(destroy);
1421 destroy.blob_id = id;
1422 return DRM_IOCTL(fd, DRM_IOCTL_MODE_DESTROYPROPBLOB, &destroy);
1423}