[Mesa-dev] [PATCH 1/5] wayland-drm: add picture structure.

Gwenole Beauchesne gwenole.beauchesne at intel.com
Mon Jul 30 09:45:15 PDT 2012


Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 src/egl/wayland/wayland-drm/wayland-drm.c   |   22 +++++++++++++++++++++-
 src/egl/wayland/wayland-drm/wayland-drm.h   |   10 ++++++++++
 src/egl/wayland/wayland-drm/wayland-drm.xml |   19 +++++++++++++++++++
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 45b307f..8eaa57a 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -112,6 +112,7 @@ create_buffer(struct wl_client *client, struct wl_resource *resource,
 	buffer->buffer.width = width;
 	buffer->buffer.height = height;
 	buffer->format = format;
+	buffer->picture_structure = WL_DRM_PICTURE_STRUCTURE_FRAME;
 	buffer->offset[0] = offset0;
 	buffer->stride[0] = stride0;
 	buffer->offset[1] = offset1;
@@ -190,6 +191,24 @@ drm_create_planar_buffer(struct wl_client *client,
 }
 
 static void
+drm_buffer_set_picture_structure(struct wl_client *client,
+                                 struct wl_resource *resource,
+                                 struct wl_resource *buffer_resource,
+                                 uint32_t picture_structure)
+{
+        struct wl_drm_buffer * const buffer = buffer_resource->data;
+
+        if (!wayland_buffer_is_drm(&buffer->buffer)) {
+                wl_resource_post_error(resource,
+                                       WL_DRM_ERROR_INVALID_BUFFER,
+                                       "invalid buffer");
+                return;
+        }
+
+        buffer->picture_structure = picture_structure;
+}
+
+static void
 drm_authenticate(struct wl_client *client,
 		 struct wl_resource *resource, uint32_t id)
 {
@@ -206,7 +225,8 @@ drm_authenticate(struct wl_client *client,
 const static struct wl_drm_interface drm_interface = {
 	drm_authenticate,
 	drm_create_buffer,
-        drm_create_planar_buffer
+        drm_create_planar_buffer,
+        drm_buffer_set_picture_structure
 };
 
 static void
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h b/src/egl/wayland/wayland-drm/wayland-drm.h
index 3e8f951..25b5292 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.h
+++ b/src/egl/wayland/wayland-drm/wayland-drm.h
@@ -67,12 +67,22 @@ enum wl_drm_format {
 };
 #endif /* WL_DRM_FORMAT_ENUM */
 
+#ifndef WL_DRM_PICTURE_STRUCTURE_ENUM
+#define WL_DRM_PICTURE_STRUCTURE_ENUM
+enum wl_drm_picture_structure {
+	WL_DRM_PICTURE_STRUCTURE_FRAME = 0,
+	WL_DRM_PICTURE_STRUCTURE_TOP_FIELD = 1,
+	WL_DRM_PICTURE_STRUCTURE_BOTTOM_FIELD = 2,
+};
+#endif /* WL_DRM_PICTURE_STRUCTURE_ENUM */
+
 struct wl_drm;
 
 struct wl_drm_buffer {
 	struct wl_buffer buffer;
 	struct wl_drm *drm;
 	uint32_t format;
+	uint32_t picture_structure;
         const void *driver_format;
         int32_t offset[3];
         int32_t stride[3];
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.xml b/src/egl/wayland/wayland-drm/wayland-drm.xml
index 265d4f8..b31acd4 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.xml
+++ b/src/egl/wayland/wayland-drm/wayland-drm.xml
@@ -34,6 +34,7 @@
       <entry name="authenticate_fail" value="0"/>
       <entry name="invalid_format" value="1"/>
       <entry name="invalid_name" value="2"/>
+      <entry name="invalid_buffer" value="3"/>
     </enum>
 
     <enum name="format">
@@ -100,6 +101,18 @@
       <entry name="yvu444" value="0x34325659"/>
     </enum>
 
+    <enum name="picture_structure">
+      <description summary="buffer picture structure">
+        Picture structure.
+      </description>
+      <entry name="frame" value="0"
+             summary="Buffer represents the whole frame"/>
+      <entry name="top_field" value="1"
+             summary="Buffer represents the top field"/>
+      <entry name="bottom_field" value="2"
+             summary="Buffer represents the bottom field"/>
+    </enum>
+
     <!-- Call this request with the magic received from drmGetMagic().
          It will be passed on to the drmAuthMagic() or
          DRIAuthConnection() call.  This authentication must be
@@ -135,6 +148,12 @@
       <arg name="stride2" type="int"/>
     </request>
 
+    <!-- Assign picture structure to DRM buffer -->
+    <request name="buffer_set_picture_structure">
+      <arg name="buffer" type="object" interface="wl_buffer"/>
+      <arg name="picture_structure" type="uint"/>
+    </request>
+
     <!-- Notification of the path of the drm device which is used by
          the server.  The client should use this device for creating
          local buffers.  Only buffers created from this device should
-- 
1.7.9.5



More information about the mesa-dev mailing list