[PATCH] RFC: drm: Create a alloc helper flags blob

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

 



From: "Hsia-Jun(Randy) Li" <randy.li@xxxxxxxxxxxxx>

In Android, we could also call gralloc to allocate a
graphics buffer for the decoder, display or encoder.
In the GNU Linux, we don't have such framework, the only
thing we could have is the GBM.
Unfortunately, some platforms don't have a GPU may not
ship the gbm library or the GBM is a part of proprietary
GPU driver. They may not know the allocation requirement
for the other display device.

So it would be better to offer an generic interfaces
for the application allocating the buffer from the 3rd place,
likes DMA-heap or DRM dumb.

The storage of this blob would is different to the modifier
blob, userspace would likes the format key and modifiers
data relation. It would be better to let application seek
the allocation flags they want.

Signed-off-by: Hsia-Jun(Randy) Li <randy.li@xxxxxxxxxxxxx>
---
 include/uapi/drm/drm_mode.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 46becedf5b2f..ee5b4d5aee0a 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -218,6 +218,11 @@ extern "C" {
 #define DRM_MODE_CONTENT_PROTECTION_DESIRED     1
 #define DRM_MODE_CONTENT_PROTECTION_ENABLED     2
 
+/* DRM buffer allocation flags */
+#define DRM_BUF_ALLOC_FLAG_DUMB_IMPORT		(1UL << 63)
+#define DRM_BUF_ALLOC_FLAG_SEPARATE_PLANE	(1UL << 62)
+/* bits 0~31 were reserved for DMA-heap heap_flags */
+
 /**
  * struct drm_mode_modeinfo - Display mode information.
  * @clock: pixel clock in kHz
@@ -1168,6 +1173,37 @@ struct drm_format_modifier {
 	__u64 modifier;
 };
 
+struct drm_buf_alloc_flags_blob {
+#define FORMAT_BLOB_CURRENT 1
+	/* Version of this blob format */
+	__u32 version;
+
+	/* Flags */
+	__u32 flags;
+
+	/* Number of fourcc formats supported */
+	__u32 count_formats;
+
+	/* Where in this blob the formats exist (in bytes) */
+	__u32 formats_offset;
+
+	/* Number of drm_buf_alloc_flags */
+	__u32 count_alloc_flags;
+
+	/* Where in this blob the modifiers exist (in bytes) */
+	__u32 alloc_flags_offset;
+
+	/* __u32 formats[] */
+	/* struct drm_buf_alloc_flags alloc_flags[] */
+};
+
+struct drm_buf_alloc_flags {
+	__u32 format;
+	__u32 pad;
+	__u64 modifier_mask;
+	__u64 flags;
+};
+
 /**
  * struct drm_mode_create_blob - Create New blob property
  *
-- 
2.17.1




[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