[Mesa-dev] [PATCH 2/5] wayland: handle picture structure.
Gwenole Beauchesne
gwenole.beauchesne at intel.com
Mon Jul 30 09:45:16 PDT 2012
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
src/egl/drivers/dri2/egl_dri2.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f86ed0b..4ae2856 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1135,7 +1135,7 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
EGLint err;
uint32_t format;
int32_t offset, stride, plane, width, height;
- int cpp, index;
+ int cpp, index, structure;
const struct wl_drm_format_descriptor *f;
if (!wayland_buffer_is_drm(&buffer->buffer))
@@ -1148,6 +1148,22 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
+ switch (buffer->picture_structure) {
+ case WL_DRM_PICTURE_STRUCTURE_FRAME:
+ structure = __DRI_IMAGE_STRUCTURE_FRAME;
+ break;
+ case WL_DRM_PICTURE_STRUCTURE_TOP_FIELD:
+ structure = __DRI_IMAGE_STRUCTURE_TOP_FIELD;
+ break;
+ case WL_DRM_PICTURE_STRUCTURE_BOTTOM_FIELD:
+ structure = __DRI_IMAGE_STRUCTURE_BOTTOM_FIELD;
+ break;
+ default:
+ _eglError(EGL_BAD_PARAMETER,
+ "dri2_create_image_wayland_wl_buffer (invalid picture structure)");
+ return NULL;
+ }
+
f = buffer->driver_format;
if (plane < 0 || plane >= f->nplanes) {
_eglError(EGL_BAD_PARAMETER,
@@ -1163,6 +1179,9 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
offset = buffer->offset[index];
stride = buffer->stride[index];
+ if (dri2_dpy->image->base.version >= 6)
+ format |= structure;
+
dri_image = dri2_dpy->image->createSubImage(buffer->driver_buffer,
width, height, format,
offset, stride / cpp, NULL);
--
1.7.9.5
More information about the mesa-dev
mailing list