* [PATCH libdrm] xf86drmMode: Create drmModeCreatePropertyBlobWithFlags
@ 2022-05-12 15:45 Mark Yacoub
2022-05-12 15:57 ` Simon Ser
0 siblings, 1 reply; 2+ messages in thread
From: Mark Yacoub @ 2022-05-12 15:45 UTC (permalink / raw)
To: dri-devel; +Cc: markyacoub, seanpaul, markyacoub
[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@chromium.org>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH libdrm] xf86drmMode: Create drmModeCreatePropertyBlobWithFlags
2022-05-12 15:45 [PATCH libdrm] xf86drmMode: Create drmModeCreatePropertyBlobWithFlags Mark Yacoub
@ 2022-05-12 15:57 ` Simon Ser
0 siblings, 0 replies; 2+ messages in thread
From: Simon Ser @ 2022-05-12 15:57 UTC (permalink / raw)
To: Mark Yacoub; +Cc: seanpaul, dri-devel, markyacoub
Note, the headers in include/drm/ must be updated in a special manner
from the kernel. See the README in the subdir for details.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-12 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 15:45 [PATCH libdrm] xf86drmMode: Create drmModeCreatePropertyBlobWithFlags Mark Yacoub
2022-05-12 15:57 ` Simon Ser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).