summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-07-29 14:29:07 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-08-02 15:30:08 +0200
commita5726183955aa79175291baa5c78126228a5df0c (patch)
treeb156e74095c4278bbe674933f26188acb79e5a12
parentfaa172bd1670130bfe0b054942e9e3f228e9801a (diff)
egl_dri2: wip yuvyuv
-rw-r--r--include/GL/internal/dri_interface.h1
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c14
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c5
3 files changed, 17 insertions, 3 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 4fe9e943b5..c411cf261a 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -814,6 +814,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_RGB565 0x1001
#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
#define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
+#define __DRI_IMAGE_FORMAT_A8 0x1004
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index fadf972f9d..30b1043443 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1198,11 +1198,19 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
_EGLDisplay *disp = user_data;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
__DRIimage *image;
+ int pitch = stride / 4;
+ int format = __DRI_IMAGE_FORMAT_ARGB8888;
+
+ /* FIXME Hack: Imply YUV A8 when pitch isnt sufficient for A/XRGB8888 */
+ if (pitch < width) {
+ height += (height + 1) / 2;
+ pitch = stride;
+ format = __DRI_IMAGE_FORMAT_A8;
+ }
image = dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
- width, height,
- __DRI_IMAGE_FORMAT_ARGB8888,
- name, stride / 4,
+ width, height, format,
+ name, pitch,
NULL);
return image;
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index bd8d574a29..be5af5cb55 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -152,6 +152,11 @@ intel_create_image_from_name(__DRIscreen *screen,
image->internal_format = GL_RGBA;
image->data_type = GL_UNSIGNED_BYTE;
break;
+ case __DRI_IMAGE_FORMAT_A8:
+ image->format = MESA_FORMAT_A8;
+ image->internal_format = GL_ALPHA;
+ image->data_type = GL_UNSIGNED_BYTE;
+ break;
default:
free(image);
return NULL;