[PATCH libdrm] xf86drmMode: Create drmModeCreatePropertyBlobWithFlags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Why]
The kernel has support for creating a blob with flags, particularly
write only flag.
The user space should use libdrm library to make use of the blob flags.

[How]
Create drmModeCreatePropertyBlobWithFlags which has the same
implementation as the existing drmModeCreatePropertyBlob but with a flag
argument.

Signed-off-by: Mark Yacoub <markyacoub@xxxxxxxxxxxx>
---
 include/drm/drm_mode.h | 6 ++++++
 xf86drmMode.c          | 7 +++++++
 xf86drmMode.h          | 3 +++
 3 files changed, 16 insertions(+)

diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 9b6722d4..b0df381f 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -991,6 +991,9 @@ struct drm_format_modifier {
 	__u64 modifier;
 };
 
+#define DRM_MODE_CREATE_BLOB_WRITE_ONLY                                        \
+	(1 << 0) /* data of the blob can't be read by user space */
+
 /**
  * struct drm_mode_create_blob - Create New blob property
  *
@@ -1004,6 +1007,9 @@ struct drm_mode_create_blob {
 	__u32 length;
 	/** @blob_id: Return: new property ID. */
 	__u32 blob_id;
+	/** Flags for special handling. */
+	__u32 flags;
+	__u32 pad;
 };
 
 /**
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 87e96603..072b395c 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -1592,6 +1592,12 @@ drm_public int
 drmModeCreatePropertyBlob(int fd, const void *data, size_t length,
                                      uint32_t *id)
 {
+  	return drmModeCreatePropertyBlobWithFlags(fd, data, length, id, 0);
+}
+
+extern int drmModeCreatePropertyBlobWithFlags(int fd, const void *data,
+                                              size_t length, uint32_t *id,
+                                              uint32_t flags) {
 	struct drm_mode_create_blob create;
 	int ret;
 
@@ -1603,6 +1609,7 @@ drmModeCreatePropertyBlob(int fd, const void *data, size_t length,
 	create.length = length;
 	create.data = (uintptr_t) data;
 	create.blob_id = 0;
+	create.flags = flags;
 	*id = 0;
 
 	ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create);
diff --git a/xf86drmMode.h b/xf86drmMode.h
index 19bf91dd..f22b8174 100644
--- a/xf86drmMode.h
+++ b/xf86drmMode.h
@@ -450,6 +450,9 @@ extern int drmModeAtomicCommit(int fd,
 
 extern int drmModeCreatePropertyBlob(int fd, const void *data, size_t size,
 				     uint32_t *id);
+extern int drmModeCreatePropertyBlobWithFlags(int fd, const void *data,
+                                              size_t size, uint32_t *id,
+                                              uint32_t flags);
 extern int drmModeDestroyPropertyBlob(int fd, uint32_t id);
 
 /*
-- 
2.36.0.512.ge40c2bad7a-goog




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux