[Mesa-dev] [PATCH 3/6] egl wayland: add YUYV support
Zhao halley
halley.zhao at intel.com
Thu May 31 02:24:00 PDT 2012
---
src/egl/drivers/dri2/egl_dri2.c | 17 ++++++++++++++---
src/egl/drivers/dri2/platform_wayland.c | 8 +++++++-
2 files changed, 21 insertions(+), 4 deletions(-)
mode change 100644 => 100755 src/egl/drivers/dri2/egl_dri2.c
mode change 100644 => 100755 src/egl/drivers/dri2/platform_wayland.c
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
old mode 100644
new mode 100755
index 4a02838..a058046
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1096,9 +1096,15 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
switch (wayland_drm_buffer_get_format(buffer)) {
case WL_DRM_FORMAT_ARGB8888:
format = __DRI_IMAGE_FORMAT_ARGB8888;
+ pitch = stride / 4;
break;
case WL_DRM_FORMAT_XRGB8888:
format = __DRI_IMAGE_FORMAT_XRGB8888;
+ pitch = stride / 4;
+ break;
+ case WL_DRM_FORMAT_YUYV:
+ format = __DRI_IMAGE_FORMAT_YUYV;
+ pitch = stride / 2;
break;
default:
_eglError(EGL_BAD_PARAMETER,
@@ -1106,8 +1112,6 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
- pitch = stride / 4;
-
return dri2_create_image_drm_name(disp, ctx, name, &attrs, format, pitch);
}
#endif
@@ -1270,21 +1274,28 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
__DRIimage *image;
int dri_format;
+ int pitch = 0;
switch (format) {
case WL_DRM_FORMAT_ARGB8888:
dri_format =__DRI_IMAGE_FORMAT_ARGB8888;
+ pitch = stride/4;
break;
case WL_DRM_FORMAT_XRGB8888:
dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
+ pitch = stride/4;
break;
+ case WL_DRM_FORMAT_YUYV:
+ dri_format = __DRI_IMAGE_FORMAT_YUYV;
+ pitch = stride/2;
+ break;
default:
return NULL;
}
image = dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
width, height,
- dri_format, name, stride / 4,
+ dri_format, name, pitch,
NULL);
return image;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
old mode 100644
new mode 100755
index d291f0f..6d330b7
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -42,7 +42,9 @@
enum wl_drm_format_flags {
HAS_ARGB8888 = 1,
- HAS_XRGB8888 = 2
+ HAS_XRGB8888 = (1 << 1),
+ HAS_YUYV = (1 << 2)
+
};
static void
@@ -778,6 +780,9 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
case WL_DRM_FORMAT_XRGB8888:
dri2_dpy->formats |= HAS_XRGB8888;
break;
+ case WL_DRM_FORMAT_YUYV:
+ dri2_dpy->formats |= HAS_YUYV;
+ break;
}
}
@@ -878,6 +883,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
dri2_add_config(disp, config, i + 1, 0, types, NULL, rgb_masks);
if (dri2_dpy->formats & HAS_ARGB8888)
dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks);
+ // XXXX, should we do something for YUYV here?
}
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
--
1.7.5.4
More information about the mesa-dev
mailing list