media-libs/mesa-img: Update for img-ddk 1.6@3459742 [chromiumos/overlays/chromiumos-overlay : master]

151 views
Skip to first unread message

Daniel Kurtz (Gerrit)

unread,
Mar 19, 2015, 9:20:42 AM3/19/15
to chromium-...@chromium.org
Daniel Kurtz has uploaded a new change for review.

https://chromium-review.googlesource.com/261138

Change subject: media-libs/mesa-img: Update for img-ddk 1.6@3459742
......................................................................

media-libs/mesa-img: Update for img-ddk 1.6@3459742

This version of Mesa includes the PowerVR DRI driver, and some additonal
EGL and GLES extension entry points not currently available in upstream
Mesa.
(The IMG DDK uses mesa to provide EGL and GLX interfaces.)

BUG=chrome-os-partner:38153
TEST=Installed on IMG testchip and Mediatek Oak devices, booted to X.

Change-Id: Ie2581787687fffe3b7fc3391eb103a7e9805b305
---
M media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
R
media-libs/mesa-img/files/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
R media-libs/mesa-img/files/0001-Extend-EGL-KHR-sync-object-support.patch
A
media-libs/mesa-img/files/0049-egl-dri-Add-a-bad-access-error-code-to-the-DRI-inter.patch
A
media-libs/mesa-img/files/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
A
media-libs/mesa-img/files/10.3-egl-dri2-add-support-for-image-config-query.patch
A
media-libs/mesa-img/files/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
A
media-libs/mesa-img/files/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
A
media-libs/mesa-img/files/10.3-egl-dri2-try-to-use-render-node-if-available.patch
A
media-libs/mesa-img/files/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch
A
media-libs/mesa-img/files/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
M media-libs/mesa-img/mesa-img-9999.ebuild
12 files changed, 1,434 insertions(+), 595 deletions(-)



diff --git
a/media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
b/media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
index c4958ef..03d1894 100644
---
a/media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
+++
b/media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
@@ -1,6 +1,6 @@
diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2014-09-19 18:23:33.000000000 +0000
-+++ b/configure.ac 2014-11-25 12:31:06.196527152 +0000
++++ b/configure.ac 2015-02-27 14:29:03.541109249 +0000
@@ -30,6 +30,7 @@
LIBDRM_REQUIRED=2.4.38
LIBDRM_RADEON_REQUIRED=2.4.56
@@ -39,7 +39,7 @@
src/mesa/drivers/osmesa/osmesa.pc
diff -Naur a/src/mesa/drivers/dri/Makefile.am
b/src/mesa/drivers/dri/Makefile.am
--- a/src/mesa/drivers/dri/Makefile.am 2014-09-19 18:06:52.000000000 +0000
-+++ b/src/mesa/drivers/dri/Makefile.am 2014-11-25 12:31:06.197525552 +0000
++++ b/src/mesa/drivers/dri/Makefile.am 2015-02-27 14:29:03.541109249 +0000
@@ -36,6 +36,12 @@
MEGADRIVERS += radeon_dri.so
endif
@@ -55,7 +55,7 @@
MEGADRIVERS_DEPS += swrast/libswrast_dri.la
diff -Naur a/src/mesa/drivers/dri/pvr/Makefile.am
b/src/mesa/drivers/dri/pvr/Makefile.am
--- a/src/mesa/drivers/dri/pvr/Makefile.am 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/Makefile.am 2014-11-25 12:31:06.323510851
+0000
++++ b/src/mesa/drivers/dri/pvr/Makefile.am 2015-02-27 14:29:03.679113949
+0000
@@ -0,0 +1,24 @@
+
+include Makefile.sources
@@ -83,7 +83,7 @@
+
diff -Naur a/src/mesa/drivers/dri/pvr/Makefile.sources
b/src/mesa/drivers/dri/pvr/Makefile.sources
--- a/src/mesa/drivers/dri/pvr/Makefile.sources 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/Makefile.sources 2014-11-25
12:31:06.327511551 +0000
++++ b/src/mesa/drivers/dri/pvr/Makefile.sources 2015-02-27
14:29:03.683115549 +0000
@@ -0,0 +1,13 @@
+pvr_INCLUDES = \
+ $(MESA_TOP)/src \
@@ -100,7 +100,7 @@
+ pvr_object_cache.c
diff -Naur a/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h
b/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h
--- a/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h 2014-11-25
12:31:06.319509651 +0000
++++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h 2015-02-27
14:29:03.675114349 +0000
@@ -0,0 +1,1130 @@
+#ifndef __g_pvrogl_set_mesa_dispatch_h_
+#define __g_pvrogl_set_mesa_dispatch_h_
@@ -1234,7 +1234,7 @@
+#endif /* __g_pvrogl_set_mesa_dispatch_h_ */
diff -Naur a/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h
b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h
--- a/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h 2014-11-25
12:31:06.327511551 +0000
++++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h 2015-02-27
14:29:03.685116349 +0000
@@ -0,0 +1,364 @@
+#ifndef __g_pvrogles1_set_mesa_dispatch_h_
+#define __g_pvrogles1_set_mesa_dispatch_h_
@@ -1602,8 +1602,8 @@
+#endif /* __g_pvrogles1_set_mesa_dispatch_h_ */
diff -Naur a/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h
b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h
--- a/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h 2014-11-25
12:31:06.320511351 +0000
-@@ -0,0 +1,512 @@
++++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h 2015-02-27
14:29:03.677115649 +0000
+@@ -0,0 +1,585 @@
+#ifndef __g_pvrogles2_set_mesa_dispatch_h_
+#define __g_pvrogles2_set_mesa_dispatch_h_
+
@@ -1722,6 +1722,7 @@
+ pvrogles2_add_mesa_dispatch(psTab, "glGetShaderInfoLog",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetShaderPrecisionFormat",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetShaderSource", psScreenImpl,
pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetString", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetTexParameterfv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetTexParameteriv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetUniformfv", psScreenImpl,
pvLibHandle, pfGetProcAddress);
@@ -1818,6 +1819,7 @@
+ pvrogles2_add_mesa_dispatch(psTab, "glBlitFramebuffer", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+
pvrogles2_add_mesa_dispatch(psTab, "glRenderbufferStorageMultisample",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glFramebufferTextureLayer",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glMapBufferRange", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glFlushMappedBufferRange",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glBindVertexArray", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glDeleteVertexArrays",
psScreenImpl, pvLibHandle, pfGetProcAddress);
@@ -1851,6 +1853,7 @@
+ pvrogles2_add_mesa_dispatch(psTab, "glClearBufferuiv", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glClearBufferfv", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glClearBufferfi", psScreenImpl,
pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetStringi", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glCopyBufferSubData",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetUniformIndices",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetActiveUniformsiv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
@@ -1894,6 +1897,74 @@
+ pvrogles2_add_mesa_dispatch(psTab, "glTexStorage2D", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glTexStorage3D", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetInternalformativ",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glDispatchCompute", psScreenImpl,
pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glDispatchComputeIndirect",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glDrawArraysIndirect",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glDrawElementsIndirect",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glFramebufferParameteri",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetFramebufferParameteriv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetProgramInterfaceiv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetProgramResourceIndex",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetProgramResourceName",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetProgramResourceiv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetProgramResourceLocation",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glUseProgramStages",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glActiveShaderProgram",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glCreateShaderProgramv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glBindProgramPipeline",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glDeleteProgramPipelines",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGenProgramPipelines",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glIsProgramPipeline",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetProgramPipelineiv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform1i",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform2i",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform3i",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform4i",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform1ui",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform2ui",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform3ui",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform4ui",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform1f",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform2f",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform3f",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform4f",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform1iv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform2iv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform3iv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform4iv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform1uiv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform2uiv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform3uiv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform4uiv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform1fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform2fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform3fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniform4fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix2fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix3fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix4fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix2x3fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix3x2fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix2x4fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix4x2fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix3x4fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glProgramUniformMatrix4x3fv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glValidateProgramPipeline",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetProgramPipelineInfoLog",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glBindImageTexture",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetBooleani_v", psScreenImpl,
pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glMemoryBarrier", psScreenImpl,
pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glMemoryBarrierByRegion",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glTexStorage2DMultisample",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetMultisamplefv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glSampleMaski", psScreenImpl,
pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetTexLevelParameteriv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glGetTexLevelParameterfv",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glBindVertexBuffer",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glVertexAttribFormat",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glVertexAttribIFormat",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glVertexAttribBinding",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glVertexBindingDivisor",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glBlendBarrierKHR", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glDebugMessageControlKHR",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glDebugMessageInsertKHR",
psScreenImpl, pvLibHandle, pfGetProcAddress);
@@ -1910,6 +1981,7 @@
+
pvrogles2_add_mesa_dispatch(psTab, "glEGLImageTargetRenderbufferStorageOES",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetProgramBinaryOES",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glProgramBinaryOES",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glMapBufferOES", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glUnmapBufferOES", psScreenImpl,
pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glGetBufferPointervOES",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glMinSampleShadingOES",
psScreenImpl, pvLibHandle, pfGetProcAddress);
@@ -1982,6 +2054,7 @@
+ pvrogles2_add_mesa_dispatch(psTab, "glDrawElementsInstancedEXT",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glFramebufferTextureEXT",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glVertexAttribDivisorEXT",
psScreenImpl, pvLibHandle, pfGetProcAddress);
++ pvrogles2_add_mesa_dispatch(psTab, "glMapBufferRangeEXT",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glFlushMappedBufferRangeEXT",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glMultiDrawArraysEXT",
psScreenImpl, pvLibHandle, pfGetProcAddress);
+ pvrogles2_add_mesa_dispatch(psTab, "glMultiDrawElementsEXT",
psScreenImpl, pvLibHandle, pfGetProcAddress);
@@ -2118,8 +2191,8 @@
+#endif /* __g_pvrogles2_set_mesa_dispatch_h_ */
diff -Naur a/src/mesa/drivers/dri/pvr/imgpixfmts.h
b/src/mesa/drivers/dri/pvr/imgpixfmts.h
--- a/src/mesa/drivers/dri/pvr/imgpixfmts.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/imgpixfmts.h 2014-11-25 12:31:06.315511951
+0000
-@@ -0,0 +1,338 @@
++++ b/src/mesa/drivers/dri/pvr/imgpixfmts.h 2015-02-27 14:29:03.671116849
+0000
+@@ -0,0 +1,66 @@

+/*************************************************************************/
/*!
+@File
+@Title Pixel formats
@@ -2155,216 +2228,21 @@
+
****************************************************************************/
+
+#include "imgyuv.h"
-+
-+/**
-+ * Pixel formats.
-+ *
-+ * The layout of the components in memory is taken from the name of the
-+ * enumeration, where the order is from LSB to MSB when the entire
-+ * element is read as a single word on a little-endian machine.
-+ *
-+ * For example, take the format IMG_PIXFMT_D32_FLOAT_S8_UINT_X24_TYPELESS:
-+ *
-+ * This is a 64bit format, so read as a 64bit word.
-+ * Bits 0-31 are D32, bits 32-39 are S8, bits 40-63 are X24
-+ * In memory, first four bytes are D32, fifth byte is S8,
-+ * remaining 3 bytes are X24.
-+ *
-+ * Similarly, IMG_PIXFMT_B5G6R5_UNORM:
-+ *
-+ * 16bit word, Bits 0-4 are B, bits 5-10 are G, bits 11-15 are R.
-+ *
-+ *
-+ * Each format also specifies the interpretation of the bits:
-+ * TYPELESS - No interpretation, pixel can only be copied verbatim.
-+ * FLOAT - Floating point
-+ * UINT - Unsigned integer
-+ * SINT - Signed integer
-+ * UNORM - Normalised value in range 0 - 1.0f
-+ * SNORM - Normalised value in range -1.0f - 1.0f
-+ * UNORM_SRGB - As UNORM, but with gamma correction
-+ */
-+#if !defined(_IMGPIXFMTS_H_)
-+#define _IMGPIXFMTS_H_
++#if !defined(_IMGPIXFMTS_KM_H_)
++#define _IMGPIXFMTS_KM_H_
+
+typedef enum _IMG_PIXFMT_
+{
+ IMG_PIXFMT_UNKNOWN = 0,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_R32G32B32A32_TYPELESS = 1,
-+ IMG_PIXFMT_R32G32B32A32_FLOAT = 2,
-+ IMG_PIXFMT_R32G32B32A32_UINT = 3,
-+ IMG_PIXFMT_R32G32B32A32_SINT = 4,
-+ IMG_PIXFMT_R32G32B32_TYPELESS = 5,
-+ IMG_PIXFMT_R32G32B32_FLOAT = 6,
-+ IMG_PIXFMT_R32G32B32_UINT = 7,
-+ IMG_PIXFMT_R32G32B32_SINT = 8,
-+ IMG_PIXFMT_R16G16B16A16_TYPELESS = 9,
-+ IMG_PIXFMT_R16G16B16A16_FLOAT = 10,
-+ IMG_PIXFMT_R16G16B16A16_UNORM = 11,
-+ IMG_PIXFMT_R16G16B16A16_UINT = 12,
-+ IMG_PIXFMT_R16G16B16A16_SNORM = 13,
-+ IMG_PIXFMT_R16G16B16A16_SINT = 14,
-+ IMG_PIXFMT_R16G16B16_FLOAT = 15,
-+ IMG_PIXFMT_R32G32_TYPELESS = 16,
-+ IMG_PIXFMT_R32G32_FLOAT = 17,
-+ IMG_PIXFMT_R32G32_UINT = 18,
-+ IMG_PIXFMT_R32G32_SINT = 19,
-+ IMG_PIXFMT_R32G8X24_TYPELESS = 20,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_D32_FLOAT_S8_UINT_X24_TYPELESS = 21,
-+ IMG_PIXFMT_R32_FLOAT_X8X24_TYPELESS = 22,
-+ IMG_PIXFMT_X32_TYPELESS_G8_UINT_X24_TYPELESS = 23,
-+ IMG_PIXFMT_R10G10B10A2_TYPELESS = 24,
-+ IMG_PIXFMT_R10G10B10A2_UNORM = 25,
-+ IMG_PIXFMT_R10G10B10A2_UINT = 26,
-+ IMG_PIXFMT_R11G11B10_FLOAT = 27,
-+ IMG_PIXFMT_B10G10R10A2_UNORM = 28,
-+ IMG_PIXFMT_B10G10R10X2_UNORM = 29,
-+ IMG_PIXFMT_R8G8B8A8_TYPELESS = 30,
+ IMG_PIXFMT_R8G8B8A8_UNORM = 31,
-+ IMG_PIXFMT_R8G8B8A8_UNORM_SRGB = 32,
-+ IMG_PIXFMT_R8G8B8A8_UINT = 33,
-+ IMG_PIXFMT_R8G8B8A8_SNORM = 34,
-+ IMG_PIXFMT_R8G8B8A8_SINT = 35,
+ IMG_PIXFMT_R8G8B8X8_UNORM = 36,
-+ IMG_PIXFMT_R8G8B8X8_UNORM_SRGB = 37,
-+ IMG_PIXFMT_R5G5B5A1_UNORM = 38,
-+ IMG_PIXFMT_A1R5G5B5_UNORM = 39,
-+ IMG_PIXFMT_A1B5G5R5_UNORM = 40,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_A4R4G4B4_UNORM = 41,
-+ IMG_PIXFMT_A4B4G4R4_UNORM = 42,
-+ IMG_PIXFMT_R16G16_TYPELESS = 43,
-+ IMG_PIXFMT_R16G16_FLOAT = 44,
-+ IMG_PIXFMT_R16G16_UNORM = 45,
-+ IMG_PIXFMT_R16G16_UINT = 46,
-+ IMG_PIXFMT_R16G16_SNORM = 47,
-+ IMG_PIXFMT_R16G16_SINT = 48,
-+ IMG_PIXFMT_R32_TYPELESS = 49,
-+ IMG_PIXFMT_D32_FLOAT = 50,
-+ IMG_PIXFMT_R32_FLOAT = 51,
-+ IMG_PIXFMT_R32_UINT = 52,
-+ IMG_PIXFMT_R32_SINT = 53,
-+ IMG_PIXFMT_R24G8_TYPELESS = 54,
-+ IMG_PIXFMT_D24_UNORM_S8_UINT = 55,
-+ IMG_PIXFMT_S8_UINT_D24_UNORM = 56,
-+ IMG_PIXFMT_D24_UNORM_X8_TYPELESS = 57,
-+ IMG_PIXFMT_R24_UNORM_X8_TYPELESS = 58,
-+ IMG_PIXFMT_X24_TYPELESS_G8_UINT = 59,
-+ IMG_PIXFMT_R8G8_TYPELESS = 60,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_R8G8_UNORM = 61,
-+ IMG_PIXFMT_R8G8_UINT = 62,
-+ IMG_PIXFMT_R8G8_SNORM = 63,
-+ IMG_PIXFMT_R8G8_SINT = 64,
-+ IMG_PIXFMT_R16_TYPELESS = 65,
-+ IMG_PIXFMT_R16_FLOAT = 66,
-+ IMG_PIXFMT_D16_UNORM = 67,
-+ IMG_PIXFMT_D16_FLOAT = 68,
-+ IMG_PIXFMT_R16_UNORM = 69,
-+ IMG_PIXFMT_R16_UINT = 70,
-+ IMG_PIXFMT_R16_SNORM = 71,
-+ IMG_PIXFMT_R16_SINT = 72,
-+ IMG_PIXFMT_R8_TYPELESS = 73,
+ IMG_PIXFMT_R8_UNORM = 74,
-+ IMG_PIXFMT_R8_UINT = 75,
-+ IMG_PIXFMT_R8_SNORM = 76,
-+ IMG_PIXFMT_R8_SINT = 77,
-+ IMG_PIXFMT_S8_UINT = 78,
-+ IMG_PIXFMT_A8_UNORM = 79,
-+ IMG_PIXFMT_R1_UNORM = 80,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_R9G9B9E5_SHAREDEXP = 81,
+ IMG_PIXFMT_B5G6R5_UNORM = 82,
+ IMG_PIXFMT_B5G5R5A1_UNORM = 83,
+ IMG_PIXFMT_B5G5R5X1_UNORM = 84,
+ IMG_PIXFMT_B8G8R8A8_UNORM = 85,
+ IMG_PIXFMT_B8G8R8X8_UNORM = 86,
-+ IMG_PIXFMT_R10G10B10_XR_BIAS_A2_UNORM = 87,
-+ IMG_PIXFMT_R10G10B10_XR_BIAS_A2_UNORM_SRGB = 88,
-+ IMG_PIXFMT_B8G8R8A8_TYPELESS = 89,
-+ IMG_PIXFMT_B8G8R8A8_UNORM_SRGB = 90,
-+ IMG_PIXFMT_B8G8R8X8_TYPELESS = 91,
-+ IMG_PIXFMT_B8G8R8X8_UNORM_SRGB = 92,
-+ IMG_PIXFMT_BC1_TYPELESS = 93,
-+ IMG_PIXFMT_BC1_UNORM = 94,
-+ IMG_PIXFMT_BC1_UNORM_SRGB = 95,
-+ IMG_PIXFMT_BC2_TYPELESS = 96,
-+ IMG_PIXFMT_BC2_UNORM = 97,
-+ IMG_PIXFMT_BC2_UNORM_SRGB = 98,
-+ IMG_PIXFMT_BC3_TYPELESS = 99,
-+ IMG_PIXFMT_BC3_UNORM = 100,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_BC3_UNORM_SRGB = 101,
-+ IMG_PIXFMT_BC4_TYPELESS = 102,
-+ IMG_PIXFMT_BC4_UNORM = 103,
-+ IMG_PIXFMT_BC4_SNORM = 104,
-+ IMG_PIXFMT_BC5_TYPELESS = 105,
-+ IMG_PIXFMT_BC5_UNORM = 106,
-+ IMG_PIXFMT_BC5_SNORM = 107,
-+ IMG_PIXFMT_BC6H_TYPELESS = 108,
-+ IMG_PIXFMT_BC6H_UF16 = 109,
-+ IMG_PIXFMT_BC6H_SF16 = 110,
-+ IMG_PIXFMT_BC7_TYPELESS = 111,
-+ IMG_PIXFMT_BC7_UNORM = 112,
-+ IMG_PIXFMT_BC7_UNORM_SRGB = 113,
-+ IMG_PIXFMT_PVRT2 = 114,
-+ IMG_PIXFMT_PVRT4 = 115,
-+ IMG_PIXFMT_PVRTII2 = 116,
-+ IMG_PIXFMT_PVRTII4 = 117,
-+ IMG_PIXFMT_PVRT2_SRGB = 118,
-+ IMG_PIXFMT_PVRT4_SRGB = 119,
-+ IMG_PIXFMT_PVRTII2_SRGB = 120,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_PVRTII4_SRGB = 121,
-+ IMG_PIXFMT_ETC2_RGB_UNORM = 122,
-+ IMG_PIXFMT_ETC2_RGB_UNORM_SRGB = 123,
-+ IMG_PIXFMT_ETC2A_RGBA_UNORM = 124,
-+ IMG_PIXFMT_ETC2A_RGBA_UNORM_SRGB = 125,
-+ IMG_PIXFMT_ETC2_PUNCHTHROUGHA_UNORM = 126,
-+ IMG_PIXFMT_ETC2_PUNCHTHROUGHA_UNORM_SRGB = 127,
-+ IMG_PIXFMT_EAC_R11_UNSIGNED = 128,
-+ IMG_PIXFMT_EAC_R11_SIGNED = 129,
-+ IMG_PIXFMT_EAC_RG11_UNSIGNED = 130,
-+ IMG_PIXFMT_EAC_RG11_SIGNED = 131,
-+ IMG_PIXFMT_L8_UNORM = 132,
-+ IMG_PIXFMT_L16_UNORM = 133,
-+ IMG_PIXFMT_L8A8_UNORM = 134,
-+ IMG_PIXFMT_L4A4 = 135,
-+ IMG_PIXFMT_U5V5L6_UNORM = 136,
-+ IMG_PIXFMT_U8V8L8X8_UNORM = 137,
-+ IMG_PIXFMT_U8V8L8A8_UNORM = 138,
-+ IMG_PIXFMT_U8V8W8Q8_SNORM = 139,
-+ IMG_PIXFMT_A16_UNORM = 140,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
+ IMG_PIXFMT_B4G4R4A4_UNORM = 141,
-+ IMG_PIXFMT_B4G4R4X4_UNORM = 142,
-+ IMG_PIXFMT_B2G3R3A8 = 143,
-+ IMG_PIXFMT_P8A8 = 144,
-+ IMG_PIXFMT_P8 = 145,
-+ IMG_PIXFMT_I8_UNORM = 146,
-+ IMG_PIXFMT_I16_FLOAT = 147,
-+ IMG_PIXFMT_I32_FLOAT = 148,
-+ IMG_PIXFMT_L16_FLOAT = 149,
-+ IMG_PIXFMT_L32_FLOAT = 150,
-+ IMG_PIXFMT_L32_FLOAT_S8_UINT_X24_TYPELESS = 151,
-+ IMG_PIXFMT_A16_FLOAT = 152,
-+ IMG_PIXFMT_A32_FLOAT = 153,
-+ IMG_PIXFMT_L32A32_FLOAT = 154,
-+ IMG_PIXFMT_L16A16_FLOAT = 155,
-+ IMG_PIXFMT_R8G8B8_UNORM = 156,
-+ IMG_PIXFMT_R8G8B8_UNORM_SRGB = 157,
-+ IMG_PIXFMT_R8G8B8_SINT = 158,
-+ IMG_PIXFMT_R8G8B8_UINT = 159,
-+ IMG_PIXFMT_R8G8B8_SNORM = 160,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_R16G16B16_SINT = 161,
-+ IMG_PIXFMT_R16G16B16_SNORM = 162,
-+ IMG_PIXFMT_R16G16B16_UINT = 163,
-+ IMG_PIXFMT_R16G16B16_UNORM = 164,
-+ IMG_PIXFMT_R8G8_B8G8_UNORM = 165,
-+ IMG_PIXFMT_G8R8_G8B8_UNORM = 166,
+ IMG_PIXFMT_UYVY = 167,
+ IMG_PIXFMT_VYUY = 168,
+ IMG_PIXFMT_YUYV = 169,
@@ -2374,93 +2252,16 @@
+ IMG_PIXFMT_YVU420_2PLANE_MACRO_BLOCK = 173,
+ IMG_PIXFMT_YUV420_3PLANE = 174,
+ IMG_PIXFMT_YVU420_3PLANE = 175,
-+ IMG_PIXFMT_YV32_4PLANE = 176,
-+ IMG_PIXFMT_4BIT_ALPHA = 177,
-+ IMG_PIXFMT_1BIT_MASK = 178,
-+ IMG_PIXFMT_B8G8R8_UINT = 179,
+ IMG_PIXFMT_V8U8Y8A8 = 180,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_24BPP_RAW = 181,
-+ IMG_PIXFMT_64BPP_RAW = 182,
-+ IMG_PIXFMT_128BPP_RAW = 183,
-+ IMG_PIXFMT_256BPP_RAW = 184,
-+ IMG_PIXFMT_512BPP_RAW = 185,
-+ IMG_PIXFMT_1024BPP_RAW = 186,
-+ IMG_PIXFMT_B8G8R8_SINT = 187,
-+ IMG_PIXFMT_R10G10B10_UINT = 188,
-+ IMG_PIXFMT_R10G10B10_SNORM = 189,
-+ IMG_PIXFMT_P4A4 = 190,
-+ IMG_PIXFMT_A4P4 = 191,
-+ IMG_PIXFMT_DL32_FLOAT_S8_UINT_X24_TYPELESS = 192,
-+ IMG_PIXFMT_DL32_FLOAT = 193,
-+ IMG_PIXFMT_NULL = 194,
-+ IMG_PIXFMT_R16G16B16A16_XR10 = 195,
-+ IMG_PIXFMT_R16G16B16A16_XR10_SRGB = 196,
-+ IMG_PIXFMT_YVU8_422_2PLANE_PACK8 = 197,
-+ IMG_PIXFMT_YVU8_444_2PLANE_PACK8 = 198,
-+ IMG_PIXFMT_YVU10_444_1PLANE_PACK10 = 199,
-+ IMG_PIXFMT_YVU10_420_2PLANE_PACK16 = 200,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_YVU10_422_2PLANE_PACK16 = 201,
-+ IMG_PIXFMT_YVU10_444_2PLANE_PACK16 = 202,
-+ IMG_PIXFMT_YUV8_422_2PLANE_PACK8 = 203,
-+ IMG_PIXFMT_YVU8_444_3PLANE_PACK8 = 204,
-+ IMG_PIXFMT_YVU10_444_3PLANE_PACK16 = 205,
-+ IMG_PIXFMT_YVU10_420_2PLANE_PACK10 = 206,
-+ IMG_PIXFMT_YUV10_420_2PLANE_PACK10 = 207,
-+ IMG_PIXFMT_YVU10_422_2PLANE_PACK10 = 208,
-+ IMG_PIXFMT_YUV10_422_2PLANE_PACK10 = 209,
-+ IMG_PIXFMT_YUV10_444_3PLANE_PACK10 = 210,
-+ IMG_PIXFMT_ASTC_4X4 = 211,
-+ IMG_PIXFMT_ASTC_4X4_SRGB = 212,
-+ IMG_PIXFMT_ASTC_5X4 = 213,
-+ IMG_PIXFMT_ASTC_5X4_SRGB = 214,
-+ IMG_PIXFMT_ASTC_5X5 = 215,
-+ IMG_PIXFMT_ASTC_5X5_SRGB = 216,
-+ IMG_PIXFMT_ASTC_6X5 = 217,
-+ IMG_PIXFMT_ASTC_6X5_SRGB = 218,
-+ IMG_PIXFMT_ASTC_6X6 = 219,
-+ IMG_PIXFMT_ASTC_6X6_SRGB = 220,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_ASTC_8X5 = 221,
-+ IMG_PIXFMT_ASTC_8X5_SRGB = 222,
-+ IMG_PIXFMT_ASTC_8X6 = 223,
-+ IMG_PIXFMT_ASTC_8X6_SRGB = 224,
-+ IMG_PIXFMT_ASTC_8X8 = 225,
-+ IMG_PIXFMT_ASTC_8X8_SRGB = 226,
-+ IMG_PIXFMT_ASTC_10X5 = 227,
-+ IMG_PIXFMT_ASTC_10X5_SRGB = 228,
-+ IMG_PIXFMT_ASTC_10X6 = 229,
-+ IMG_PIXFMT_ASTC_10X6_SRGB = 230,
-+ IMG_PIXFMT_ASTC_10X8 = 231,
-+ IMG_PIXFMT_ASTC_10X8_SRGB = 232,
-+ IMG_PIXFMT_ASTC_10X10 = 233,
-+ IMG_PIXFMT_ASTC_10X10_SRGB = 234,
-+ IMG_PIXFMT_ASTC_12X10 = 235,
-+ IMG_PIXFMT_ASTC_12X10_SRGB = 236,
-+ IMG_PIXFMT_ASTC_12X12 = 237,
-+ IMG_PIXFMT_ASTC_12X12_SRGB = 238,
-+ IMG_PIXFMT_YVU10_420_2PLANE_PACK10_R = 239,
-+ IMG_PIXFMT_YVU10_420_2PLANE_PACK10_T = 240,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_YVU8_420_2PLANE_PACK8_P = 241,
-+ IMG_PIXFMT_YVU8_420_2PLANE_PACK8_F = 242,
-+ IMG_PIXFMT_YUV10_420_2PLANE_PACK10_R = 243,
-+ IMG_PIXFMT_YUV10_420_2PLANE_PACK10_T = 244,
-+ IMG_PIXFMT_YUV8_420_2PLANE_PACK8_P = 245,
-+ IMG_PIXFMT_YUV8_420_2PLANE_PACK8_F = 246,
-+ IMG_PIXFMT_YVU10_420_2PLANE_PACK10_CUST1 = 247,
+ IMG_PIXFMT_UYVY10_422_1PLANE_PACK10_CUST1 = 248,
-+ /* This enum is AUTOGENERATED - DO NOT EDIT */
-+ IMG_PIXFMT_ENUM_COUNT = 249
+} IMG_PIXFMT;
+
+
+
-+#endif /* _IMGPIXFMTS_H_ */
++#endif /* _IMGPIXFMTS_KM_H_ */
diff -Naur a/src/mesa/drivers/dri/pvr/imgyuv.h
b/src/mesa/drivers/dri/pvr/imgyuv.h
--- a/src/mesa/drivers/dri/pvr/imgyuv.h 1970-01-01 00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/imgyuv.h 2014-11-25 12:31:06.314518351 +0000
++++ b/src/mesa/drivers/dri/pvr/imgyuv.h 2015-02-27 14:29:03.670116949 +0000
@@ -0,0 +1,48 @@

+/*************************************************************************/
/*!
+@File
@@ -2512,7 +2313,7 @@
+#endif /* _IMGYUV_H_ */
diff -Naur a/src/mesa/drivers/dri/pvr/mesa_context.c
b/src/mesa/drivers/dri/pvr/mesa_context.c
--- a/src/mesa/drivers/dri/pvr/mesa_context.c 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/mesa_context.c 2014-11-25
12:31:06.316512151 +0000
++++ b/src/mesa/drivers/dri/pvr/mesa_context.c 2015-02-27
14:29:03.671116849 +0000
@@ -0,0 +1,215 @@
+/**
+ * \file context.c
@@ -2731,8 +2532,8 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvr_dri_support.h
b/src/mesa/drivers/dri/pvr/pvr_dri_support.h
--- a/src/mesa/drivers/dri/pvr/pvr_dri_support.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvr_dri_support.h 2014-11-25
12:31:06.324511351 +0000
-@@ -0,0 +1,346 @@
++++ b/src/mesa/drivers/dri/pvr/pvr_dri_support.h 2015-02-27
14:29:03.680116049 +0000
+@@ -0,0 +1,348 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI interface definition
@@ -2785,7 +2586,7 @@
+typedef enum
+{
+ PVRDRI_IMAGE = 1,
-+ PVRDRI_IMAGE_FROM_NAME,
++ PVRDRI_IMAGE_FROM_NAMES,
+ PVRDRI_IMAGE_FROM_EGLIMAGE,
+ PVRDRI_IMAGE_FROM_FD,
+} PVRDRIImageType;
@@ -2876,16 +2677,18 @@
+
+bool PVRScreenGlobalInit(void);
+void PVRScreenGlobalDeinit(void);
-+bool PVRSetConnectionFd(int fd);
+
+uint32_t PVRScreenCountInc(void);
+uint32_t PVRScreenCountDec(void);
+
++uint32_t PVRDRIPixFmtGetDepth(IMG_PIXFMT eFmt);
+uint32_t PVRDRIPixFmtGetBPP(IMG_PIXFMT eFmt);
++uint32_t PVRDRIPixFmtGetBlockSize(IMG_PIXFMT eFmt);
+
+/* ScreenImpl functions */
-+PVRDRIScreenImpl *PVRDRICreateScreenImpl(void);
++PVRDRIScreenImpl *PVRDRICreateScreenImpl(int iFd);
+void PVRDRIDestroyScreenImpl(PVRDRIScreenImpl *psScreenImpl);
++bool PVRDRIScreenImplInitRenderContext(PVRDRIScreenImpl *psScreenImpl,
uint32_t uiPriority);
+
+/* EGL function table functions */
+bool PVRDRIEGLGetPVROGLFunctionTable(PVRDRIScreenImpl *psScreenImpl, void
*pvLibHandle);
@@ -2990,20 +2793,20 @@
+ PVRBM_BUFFER **ppsBMBuffer,
+ unsigned int *puiMemHandle,
+ unsigned int *puiExportHandle,
-+ unsigned int *puiPitch);
++ unsigned int *puiStride);
+PVRBM_BUFFER *PVRDRICreateBMBufferFromExport(PVRDRIScreenImpl
*psScreenImpl,
+ uint32_t uiName,
+ uint32_t uiWidth,
+ uint32_t uiHeight,
-+ uint32_t uiPitch,
++ uint32_t uiStride,
+ IMG_PIXFMT
ePixelFormat);
+PVRBM_BUFFER *PVRDRICreateBMBufferFromSecureExport(PVRDRIScreenImpl
*psScreenImpl,
+ int fd,
+ uint32_t
uiWidth,
+ uint32_t
uiHeight,
++ uint32_t
uiStride,
+ IMG_PIXFMT
ePixelFormat);
+void PVRDRIReleaseBMBuffer(PVRBM_BUFFER *psBMBuffer);
-+void PVRDRIGetBufferAttribs(PVRBM_BUFFER *psBMBuffer, PVRDRIBufferAttribs
*psAttribs);
+bool PVRDRIGetBufferExportHandle(PVRBM_BUFFER *psBMBuffer, int *value);
+
+/* Image functions */
@@ -3081,7 +2884,7 @@
+#endif /* defined(__PVRDRIIFCE_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvr_mesa_version.h
b/src/mesa/drivers/dri/pvr/pvr_mesa_version.h
--- a/src/mesa/drivers/dri/pvr/pvr_mesa_version.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvr_mesa_version.h 2014-11-25
12:31:06.314518351 +0000
++++ b/src/mesa/drivers/dri/pvr/pvr_mesa_version.h 2015-02-27
14:29:03.670116949 +0000
@@ -0,0 +1,37 @@

+/*************************************************************************/
/*!
+@File pvr_mesa_version.h
@@ -3122,7 +2925,7 @@
+#endif /* defined(__PVR_MESA_VERSION_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvr_object_cache.c
b/src/mesa/drivers/dri/pvr/pvr_object_cache.c
--- a/src/mesa/drivers/dri/pvr/pvr_object_cache.c 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvr_object_cache.c 2014-11-25
12:31:06.316512151 +0000
++++ b/src/mesa/drivers/dri/pvr/pvr_object_cache.c 2015-02-27
14:29:03.672116549 +0000
@@ -0,0 +1,309 @@

+/*************************************************************************/
/*!
+@File pvr_object_cache.c
@@ -3435,7 +3238,7 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvr_object_cache.h
b/src/mesa/drivers/dri/pvr/pvr_object_cache.h
--- a/src/mesa/drivers/dri/pvr/pvr_object_cache.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvr_object_cache.h 2014-11-25
12:31:06.319509651 +0000
++++ b/src/mesa/drivers/dri/pvr/pvr_object_cache.h 2015-02-27
14:29:03.675114349 +0000
@@ -0,0 +1,135 @@

+/*************************************************************************/
/*!
+@File pvr_object_cache.h
@@ -3574,8 +3377,8 @@
+#endif /* defined(__PVR_OBJECT_CACHE_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrdrawable.c
b/src/mesa/drivers/dri/pvr/pvrdrawable.c
--- a/src/mesa/drivers/dri/pvr/pvrdrawable.c 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrdrawable.c 2014-11-25 12:31:06.325511451
+0000
-@@ -0,0 +1,658 @@
++++ b/src/mesa/drivers/dri/pvr/pvrdrawable.c 2015-02-27 14:29:03.681115949
+0000
+@@ -0,0 +1,656 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI Surface/Drawable code
@@ -3687,7 +3490,7 @@
+ }
+
+ if (!psDRIScreen->image.loader->getBuffers(psDRIDrawable,
-+ PVRDRIIMGtoDRIPixFmt(psPVRDrawable->ePixelFormat),
++ PVRDRIIMGPixelToDRIImageFormat(psPVRDrawable->ePixelFormat),
+ NULL,
+ psDRIDrawable->loaderPrivate,
+ uiBufferMask,
@@ -3707,8 +3510,8 @@
+ }
+
+ psImage = (sImages.back) ? sImages.back : sImages.front;
-+ PVRDRIGetBufferAttribs(PVRDRIImageGetSharedBuffer(psImage),
&sBufferAttribs);
-+ uBytesPerPixel = PVRDRIPixFmtGetBPP(sBufferAttribs.ePixFormat);
++ PVRDRIEGLImageGetAttribs(PVRDRIImageGetEGLImage(psImage),
&sBufferAttribs);
++ uBytesPerPixel = PVRDRIPixFmtGetBlockSize(sBufferAttribs.ePixFormat);
+
+ if (!bUpdate ||
+ (psPVRBuffer && psPVRBuffer->uBacking.sImage.psImage !=
sImages.front) ||
@@ -3854,20 +3657,20 @@
+ case PVRDRI_SURFACE_PIXMAP:
+ uiAttachment = __DRI_BUFFER_FRONT_LEFT;
+ auiAttachmentReq[0] = __DRI_BUFFER_FRONT_LEFT;
-+ auiAttachmentReq[1] = PVRDRIPixFmtGetBPP(psPVRDrawable->ePixelFormat);
++ auiAttachmentReq[1] =
PVRDRIPixFmtGetDepth(psPVRDrawable->ePixelFormat);
+ break;
+ case PVRDRI_SURFACE_PBUFFER:
+ if (psPVRDrawable->bDoubleBuffered)
+ {
+ uiAttachment = __DRI_BUFFER_BACK_LEFT;
+ auiAttachmentReq[0] = __DRI_BUFFER_BACK_LEFT;
-+ auiAttachmentReq[1] = PVRDRIPixFmtGetBPP(psPVRDrawable->ePixelFormat);
++ auiAttachmentReq[1] =
PVRDRIPixFmtGetDepth(psPVRDrawable->ePixelFormat);
+ }
+ else
+ {
+ uiAttachment = __DRI_BUFFER_FRONT_LEFT;
+ auiAttachmentReq[0] = __DRI_BUFFER_FRONT_LEFT;
-+ auiAttachmentReq[1] = PVRDRIPixFmtGetBPP(psPVRDrawable->ePixelFormat);
++ auiAttachmentReq[1] =
PVRDRIPixFmtGetDepth(psPVRDrawable->ePixelFormat);
+ }
+ break;
+ case PVRDRI_SURFACE_WINDOW:
@@ -3875,7 +3678,7 @@
+ {
+ uiAttachment = __DRI_BUFFER_BACK_LEFT;
+ auiAttachmentReq[0] = __DRI_BUFFER_BACK_LEFT;
-+ auiAttachmentReq[1] = PVRDRIPixFmtGetBPP(psPVRDrawable->ePixelFormat);
++ auiAttachmentReq[1] =
PVRDRIPixFmtGetDepth(psPVRDrawable->ePixelFormat);
+ }
+ else
+ {
@@ -3885,7 +3688,7 @@
+ */
+ uiAttachment = __DRI_BUFFER_FAKE_FRONT_LEFT;
+ auiAttachmentReq[0] = __DRI_BUFFER_FRONT_LEFT;
-+ auiAttachmentReq[1] = PVRDRIPixFmtGetBPP(psPVRDrawable->ePixelFormat);
++ auiAttachmentReq[1] =
PVRDRIPixFmtGetDepth(psPVRDrawable->ePixelFormat);
+ }
+ break;
+ default:
@@ -4020,7 +3823,7 @@
+ PVRDRIBuffer *psPVRBuffer;
+ __DRIbuffer *psDRIBuffer = pvInsertData;
+
-+ if (PVRDRIPixFmtGetBPP(psPVRDrawable->ePixelFormat) != (psDRIBuffer->cpp
* 8))
++ if (PVRDRIPixFmtGetBlockSize(psPVRDrawable->ePixelFormat) !=
psDRIBuffer->cpp)
+ {
+ errorMessage("%s: DRI buffer format doesn't match drawable format\n",
__func__);
+ return NULL;
@@ -4189,9 +3992,11 @@
+
+ psPVRDrawable->bInitialised = false;
+}
++
+PVRBM_BUFFER *PVRDRIDrawableGetBackingBuffer(PVRDRIDrawable
*psPVRDrawable)
+{
+ PVRDRIBuffer *psPVRBuffer =
PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 0);
++
+ return PVRGetBackingBuffer(psPVRBuffer);
+}
+
@@ -4201,19 +4006,19 @@
+ PVRDRIBufferAttribs *psAttribs,
+ pvrdri_surface_type *eSurfaceType)
+{
-+ PVRDRIBuffer *psPVRBuffer;
+ __DRIdrawable *psDRIDrawable = psPVRDrawable->psDRIDrawable;
++ PVRDRIBuffer *psPVRBuffer;
+
-+ psPVRBuffer = PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 0);;
++ psPVRBuffer = PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 0);
+
+ *psDstBuffer = PVRGetBackingBuffer(psPVRBuffer);
+ if (*psDstBuffer == NULL)
+ {
+ errorMessage("%s: Couldn't get render buffer from cache\n", __func__);
-+ goto ExitErrorUnlock;
++ return false;
+ }
+
-+ psPVRBuffer = PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 1);
++ psPVRBuffer = PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 1);
+
+ *psAccumBuffer = PVRGetBackingBuffer(psPVRBuffer);
+ if (*psAccumBuffer == NULL)
@@ -4229,15 +4034,11 @@
+ psAttribs->uiStrideInBytes = psPVRDrawable->uStride;
+
+ return true;
-+
-+ExitErrorUnlock:
-+ //PVRDRIScreenUnlock(psPVRScreen);
-+ return false;
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvrdri.c
b/src/mesa/drivers/dri/pvr/pvrdri.c
--- a/src/mesa/drivers/dri/pvr/pvrdri.c 1970-01-01 00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvrdri.c 2014-11-25 12:31:06.322511151 +0000
-@@ -0,0 +1,1502 @@
++++ b/src/mesa/drivers/dri/pvr/pvrdri.c 2015-02-27 14:29:03.679113949 +0000
+@@ -0,0 +1,1489 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI Mesa Driver
@@ -5045,20 +4846,14 @@
+ return NULL;
+ }
+
-+
+ PVRDRIRegisterCallbacks(&sDRICallbacks);
-+
-+ if (!PVRSetConnectionFd(psDRIScreen->fd))
-+ {
-+ goto ErrorScreenGlobalDeinit;
-+ }
+
+ psPVRScreen = calloc(1, sizeof(*psPVRScreen));
+ if (psPVRScreen == NULL)
+ {
+ __driUtilMessage("%s: Couldn't allocate PVRDRIScreen",
+ __func__);
-+ goto ErrorScreenClearConnectionFd;
++ goto ErrorScreenGlobalDeinit;
+ }
+
+ DRIScreenPrivate(psDRIScreen) = psPVRScreen;
@@ -5082,7 +4877,7 @@
+
+ psDRIScreen->extensions = apsScreenExtensions;
+
-+ psPVRScreen->psImpl = PVRDRICreateScreenImpl();
++ psPVRScreen->psImpl = PVRDRICreateScreenImpl(psDRIScreen->fd);
+ if (psPVRScreen->psImpl == NULL)
+ {
+ goto ErrorScreenMutexDeinit;
@@ -5125,10 +4920,6 @@
+ErrorScreenFree:
+ free(psPVRScreen);
+
-+ErrorScreenClearConnectionFd:
-+ /* Set the Services connection FD to an invalid FD value */
-+ (void)PVRSetConnectionFd(-1);
-+
+ErrorScreenGlobalDeinit:
+ PVRScreenGlobalDeinit();
+
@@ -5160,9 +4951,6 @@
+ PVRMutexDeinit(&psPVRScreen->sMutex);
+
+ PVRScreenGlobalDeinit();
-+
-+ /* Set the Services connection FD to an invalid FD value */
-+ (void)PVRSetConnectionFd(-1);
+
+ free(psPVRScreen);
+}
@@ -5571,7 +5359,7 @@
+ IMG_PIXFMT ePixFormat;
+ PVRBuffer *psBuffer;
+
-+ ePixFormat = PVRDRIBPPToIMGPixFmt(uFormat);
++ ePixFormat = PVRDRIBPPToIMGPixelFormat(uFormat);
+ if (ePixFormat == IMG_PIXFMT_UNKNOWN)
+ {
+ __driUtilMessage("%s: Unknown pixel format: %u",
@@ -5742,8 +5530,8 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvrdri.h
b/src/mesa/drivers/dri/pvr/pvrdri.h
--- a/src/mesa/drivers/dri/pvr/pvrdri.h 1970-01-01 00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvrdri.h 2014-11-25 12:31:06.316512151 +0000
-@@ -0,0 +1,248 @@
++++ b/src/mesa/drivers/dri/pvr/pvrdri.h 2015-02-27 14:29:03.672116549 +0000
+@@ -0,0 +1,251 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI Mesa Driver
@@ -5960,9 +5748,12 @@
+
+const __DRIconfig **PVRDRICreateConfigs(void);
+
-+IMG_PIXFMT PVRDRIBPPToIMGPixFmt(unsigned uFormat);
-+IMG_PIXFMT PVRDRIDRIToIMGPixFmt(int iDRIFormat);
-+int PVRDRIIMGtoDRIPixFmt(IMG_PIXFMT eIMGFormat);
++IMG_PIXFMT PVRDRIBPPToIMGPixelFormat(unsigned uFormat);
++IMG_PIXFMT PVRDRIDRIFourCCToIMGPixelFormat(int iDRIFourCC);
++IMG_PIXFMT PVRDRIDRIImageToIMGPixelFormat(int iDRIFormat);
++int PVRDRIIMGPixelFormatToDRIFourCC(IMG_PIXFMT eIMGPixelFormat);
++uint32_t PVRDRIIMGPixelFormatToDRIImageComponents(IMG_PIXFMT
eIMGPixelFormat);
++int PVRDRIIMGPixelToDRIImageFormat(IMG_PIXFMT eIMGPixelFormat);
+
+

+/*************************************************************************/
/*!
@@ -5994,8 +5785,8 @@
+#endif /* defined(__PVRDRI2_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrext.c
b/src/mesa/drivers/dri/pvr/pvrext.c
--- a/src/mesa/drivers/dri/pvr/pvrext.c 1970-01-01 00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvrext.c 2014-11-25 12:31:06.326511551 +0000
-@@ -0,0 +1,287 @@
++++ b/src/mesa/drivers/dri/pvr/pvrext.c 2015-02-27 14:29:03.683115549 +0000
+@@ -0,0 +1,284 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI driver extension support
@@ -6067,7 +5858,7 @@
+/* Maximum version numbers for each supported extension */
+#define PVR_DRI_TEX_BUFFER_VERSION 2
+#define PVR_DRI2_FLUSH_VERSION 4
-+#define PVR_DRI_IMAGE_VERSION 7
++#define PVR_DRI_IMAGE_VERSION 8
+#define PVR_DRI2_ROBUSTNESS_VERSION 1
+#define PVR_DRI_PRIORITY_VERSION 1
+#define PVR_DRI_SYNCOBJ_VERSION 1
@@ -6214,12 +6005,9 @@
+ .createImageFromTexture = PVRDRICreateImageFromTexture,
+ .createImageFromFds = PVRDRICreateImageFromFds,
+#if defined(PVR_OCL_LIB)
-+#if defined(EGL_EXTENSION_IMG_CL_IMAGE)
+ .createImageFromBuffer = PVRDRICreateImageFromBuffer,
-+#else
-+ .createImageFromBuffer = NULL,
+#endif
-+#endif
++ .createImageFromDmaBufs = PVRDRICreateImageFromDmaBufs,
+};
+
+static __DRIrobustnessExtension pvrDRIRobustness =
@@ -6285,7 +6073,7 @@
+};
diff -Naur a/src/mesa/drivers/dri/pvr/pvrimage.c
b/src/mesa/drivers/dri/pvr/pvrimage.c
--- a/src/mesa/drivers/dri/pvr/pvrimage.c 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrimage.c 2014-11-25 12:31:06.326511551
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrimage.c 2015-02-27 14:29:03.683115549
+0000
@@ -0,0 +1,959 @@

+/*************************************************************************/
/*!
+@File
@@ -6353,62 +6141,14 @@
+ EGLImage *psEGLImage;
+};
+
-+static unsigned IMGBytesPerPixel(IMG_PIXFMT eFmt)
-+{
-+ unsigned bpp = PVRDRIPixFmtGetBPP(eFmt);
-+
-+ assert((bpp % 8) == 0);
-+
-+ return bpp / 8;
-+}
-+
-+static IMG_PIXFMT DRIFourCCToIMGPixFmt(int format)
-+{
-+ switch (format)
-+ {
-+ case __DRI_IMAGE_FOURCC_RGB565:
-+ return IMG_PIXFMT_B5G6R5_UNORM;
-+ case __DRI_IMAGE_FOURCC_XRGB8888:
-+ return IMG_PIXFMT_B8G8R8X8_UNORM;
-+ case __DRI_IMAGE_FOURCC_ARGB8888:
-+ return IMG_PIXFMT_B8G8R8A8_UNORM;
-+ case __DRI_IMAGE_FOURCC_ABGR8888:
-+ return IMG_PIXFMT_R8G8B8A8_UNORM;
-+ case __DRI_IMAGE_FOURCC_XBGR8888:
-+ return IMG_PIXFMT_R8G8B8X8_UNORM;
-+ default:
-+ break;
-+ }
-+
-+ return IMG_PIXFMT_UNKNOWN;
-+}
-+
-+static uint32_t IMGtoDRIImgComp(IMG_PIXFMT eIMGPixFmt)
-+{
-+ switch (eIMGPixFmt)
-+ {
-+ case IMG_PIXFMT_B5G6R5_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGB;
-+ case IMG_PIXFMT_B8G8R8X8_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGB;
-+ case IMG_PIXFMT_B8G8R8A8_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGBA;
-+ case IMG_PIXFMT_R8G8B8X8_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGB;
-+ case IMG_PIXFMT_R8G8B8A8_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGBA;
-+ default:
-+ break;
-+ }
-+
-+ return 0;
-+}
+
+/* Only used in asserts, hence __attribute__((unused)) tag */
+static uint32_t __attribute__((unused)) GetEGLImageStride(EGLImage
*psEGLImage)
+{
+ PVRDRIBufferAttribs sAttribs;
++
+ PVRDRIEGLImageGetAttribs(psEGLImage, &sAttribs);
++
+ return sAttribs.uiStrideInBytes;
+}
+
@@ -6420,23 +6160,22 @@
+ struct PVRDRIImageShared *shared;
+
+ shared = calloc(1, sizeof(*shared));
-+ if (shared == NULL)
++ if (!shared)
+ {
+ return NULL;
+ }
+
-+ shared->eType = eType;
-+ shared->psPVRScreen = DRIScreenPrivate(screen);
-+ shared->format = format;
-+ shared->eIMGPixFmt = PVRDRIDRIToIMGPixFmt(format);
-+
++ shared->eIMGPixFmt = PVRDRIDRIImageToIMGPixelFormat(format);
+ if (shared->eIMGPixFmt == IMG_PIXFMT_UNKNOWN)
+ {
+ errorMessage("%s: Unknown DRI IMAGE pixel format: %d\n", __func__,
format);
+ goto error;
+ }
+
-+ shared->components = IMGtoDRIImgComp(shared->eIMGPixFmt);
++ shared->psPVRScreen = DRIScreenPrivate(screen);
++ shared->eType = eType;
++ shared->format = format;
++ shared->components =
PVRDRIIMGPixelFormatToDRIImageComponents(shared->eIMGPixFmt);
+ shared->iRefCount = 1;
+
+ return shared;
@@ -6460,7 +6199,7 @@
+
+ switch (shared->eType)
+ {
-+ case PVRDRI_IMAGE_FROM_NAME:
++ case PVRDRI_IMAGE_FROM_NAMES:
+ case PVRDRI_IMAGE_FROM_FD:
+ case PVRDRI_IMAGE:
+ PVRDRIReleaseBMBuffer(shared->psBuffer);
@@ -6487,15 +6226,15 @@
+ int format;
+
+ PVRDRIEGLImageGetAttribs(psEGLImage, &sAttribs);
-+ format = PVRDRIIMGtoDRIPixFmt(sAttribs.ePixFormat);
+
-+ if (format == __DRI_IMAGE_FORMAT_NONE)
++ format = PVRDRIIMGPixelToDRIImageFormat(sAttribs.ePixFormat);
++ if (!format)
+ {
+ return NULL;
+ }
+
+ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_EGLIMAGE, screen,
format);
-+ if (shared == NULL)
++ if (!shared)
+ {
+ return NULL;
+ }
@@ -6506,33 +6245,42 @@
+}
+
+static struct PVRDRIImageShared *
-+CreateImageSharedFromName(__DRIscreen *screen,
-+ int width,
-+ int height,
-+ int format,
-+ int name)
++CreateImageSharedFromNames(__DRIscreen *screen,
++ int width,
++ int height,
++ int format,
++ int *names,
++ int num_names,
++ int *strides,
++ int *offsets)
+{
+ struct PVRDRIImageShared *shared;
+
-+ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_NAME, screen, format);
-+ if (shared == NULL)
++ if (num_names != 1 || offsets[0] != 0)
++ {
++ errorMessage("%s: Unsupported parameters (num names: %d, first
offset: %d)\n",
++ __func__, num_names, offsets[0]);
++ return NULL;
++ }
++
++ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_NAMES, screen, format);
++ if (!shared)
+ {
+ return NULL;
+ }
+
+ shared->psBuffer =
PVRDRICreateBMBufferFromExport(shared->psPVRScreen->psImpl,
-+ name,
++ names[0],
+ width,
+ height,
-+ 0,
++ strides[0],
+ shared->eIMGPixFmt);
-+
-+ if (shared->psBuffer == NULL)
++ if (!shared->psBuffer)
+ {
+ errorMessage("%s: Failed to create shared image\n", __func__);
+ goto ErrorDestroyImage;
+ }
-+
++
+ return shared;
+
+ErrorDestroyImage:
@@ -6545,13 +6293,14 @@
+CreateImageSharedFromFd(__DRIscreen *screen,
+ int width,
+ int height,
++ int stride,
+ int format,
+ int fd)
+{
+ struct PVRDRIImageShared *shared;
+
+ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_FD, screen, format);
-+ if (shared == NULL)
++ if (!shared)
+ {
+ return NULL;
+ }
@@ -6560,9 +6309,9 @@
+ fd,
+ width,
+ height,
++ stride,
+
shared->eIMGPixFmt);
-+
-+ if (shared->psBuffer == NULL)
++ if (!shared->psBuffer)
+ {
+ errorMessage("%s: Failed to create shared image\n", __func__);
+ goto ErrorDestroyImage;
@@ -6581,10 +6330,12 @@
+ int width,
+ int height,
+ int format,
-+ unsigned int use)
++ unsigned int use,
++ int *piStride)
+{
+ struct PVRDRIImageShared *shared;
+ PVRDRI_BUFFER_FLAGS uiFlags = 0;
++ unsigned int uiStride;
+
+ if ((use & __DRI_IMAGE_USE_CURSOR) && (use & __DRI_IMAGE_USE_SCANOUT))
+ {
@@ -6592,7 +6343,7 @@
+ }
+
+ shared = CommonImageSharedSetup(PVRDRI_IMAGE, screen, format);
-+ if (shared == NULL)
++ if (!shared)
+ {
+ return NULL;
+ }
@@ -6619,12 +6370,13 @@
+ &shared->psBuffer,
+ &shared->ui32Handle,
+ &shared->ui32Name,
-+ NULL))
++ &uiStride))
+ {
-+ errorMessage("%s: Failed to create buffer\n",
-+ __func__);
++ errorMessage("%s: Failed to create buffer\n", __func__);
+ goto ErrorDestroyImage;
+ }
++
++ *piStride = uiStride;
+
+ return shared;
+
@@ -6649,13 +6401,12 @@
+ struct __DRIimageRec *image;
+
+ image = calloc(1, sizeof(*image));
-+ if (image == NULL)
++ if (!image)
+ {
+ return NULL;
+ }
+
+ image->loaderPrivate = loaderPrivate;
-+
+ image->iRefCount = 1;
+
+ return image;
@@ -6672,7 +6423,7 @@
+ return;
+ }
+
-+ if (image->psShared != NULL)
++ if (image->psShared)
+ {
+ DestroyImageShared(image->psShared);
+ }
@@ -6686,37 +6437,25 @@
+ int name, int pitch,
+ void *loaderPrivate)
+{
-+ struct __DRIimageRec *image;
++ IMG_PIXFMT eIMGPixFmt;
++ int iFourCC;
++ int iStride;
++ int iOffset;
+
-+ image = CommonImageSetup(loaderPrivate);
-+
-+ if (image == NULL)
++ eIMGPixFmt = PVRDRIDRIImageToIMGPixelFormat(format);
++ iFourCC = PVRDRIIMGPixelFormatToDRIFourCC(eIMGPixFmt);
++ if (!iFourCC)
+ {
++ errorMessage("%s: Unsupported DRI image format (format = %d)\n",
++ __func__, format);
+ return NULL;
+ }
+
-+ image->psShared = CreateImageSharedFromName(screen, width, height,
format, name);
++ iStride = pitch * PVRDRIPixFmtGetBlockSize(eIMGPixFmt);
++ iOffset = 0;
+
-+ if (image->psShared == NULL)
-+ {
-+ PVRDRIDestroyImage(image);
-+ return NULL;
-+ }
-+
-+ image->psEGLImage =
PVRDRIEGLImageCreateFromBuffer(image->psShared->psBuffer);
-+
-+ if (image->psEGLImage == NULL)
-+ {
-+ PVRDRIDestroyImage(image);
-+ return NULL;
-+ }
-+
-+ PVRDRIEGLImageSetCallbackData(image->psEGLImage, image);
-+
-+ (void)pitch;
-+ assert(GetEGLImageStride(image->psEGLImage) == (pitch *
IMGBytesPerPixel(image->psShared->eIMGPixFmt)));
-+
-+ return image;
++ return PVRDRICreateImageFromNames(screen, width, height, iFourCC,
++ &name, 1, &iStride, &iOffset, loaderPrivate);
+}
+
+static PVRDRIImageError GetImageSourceError(PVRDRIImageError e)
@@ -6778,13 +6517,13 @@
+ struct __DRIimageRec *image;
+
+ image = CommonImageSetup(loaderPrivate);
-+ if (image == NULL)
++ if (!image)
+ {
+ return NULL;
+ }
+
+ psEGLImage = PVRDRIEGLImageCreate();
-+ if (psEGLImage == NULL)
++ if (!psEGLImage)
+ {
+ PVRDRIDestroyImage(image);
+ return NULL;
@@ -6812,15 +6551,13 @@
+ * renderbuffer now has a reference to it.
+ */
+ image->psShared = CreateImageSharedFromEGLImage(screen, psEGLImage);
-+
-+ if (image->psShared == NULL)
++ if (!image->psShared)
+ {
+ return NULL;
+ }
+
+ image->psEGLImage = PVRDRIEGLImageDup(image->psShared->psEGLImage);
-+
-+ if (image->psEGLImage == NULL)
++ if (!image->psEGLImage)
+ {
+ return NULL;
+ }
@@ -6836,33 +6573,31 @@
+ void *loaderPrivate)
+{
+ struct __DRIimageRec *image;
-+
-+ (void)use;
++ int iStride;
+
+ image = CommonImageSetup(loaderPrivate);
-+
-+ if (image == NULL)
++ if (!image)
+ {
+ return NULL;
+ }
+
-+ image->psShared = CreateImageShared(screen, width, height, format, use);
-+
-+ if (image->psShared == NULL)
++ image->psShared = CreateImageShared(screen, width, height, format, use,
&iStride);
++ if (!image->psShared)
+ {
+ PVRDRIDestroyImage(image);
+ return NULL;
+ }
+
+ image->psEGLImage =
PVRDRIEGLImageCreateFromBuffer(image->psShared->psBuffer);
-+
-+ if (image->psEGLImage == NULL)
++ if (!image->psEGLImage)
+ {
+ PVRDRIDestroyImage(image);
+ return NULL;
+ }
+
+ PVRDRIEGLImageSetCallbackData(image->psEGLImage, image);
++
++ assert(GetEGLImageStride(image->psEGLImage) == iStride);
+
+ return image;
+}
@@ -6872,7 +6607,7 @@
+ struct PVRDRIImageShared *shared = image->psShared;
+ PVRDRIBufferAttribs sAttribs;
+
-+ PVRDRIEGLImageGetAttribs(image->psEGLImage, &sAttribs);
++ PVRDRIEGLImageGetAttribs(image->psEGLImage, &sAttribs);
+
+ switch (attrib)
+ {
@@ -6916,15 +6651,15 @@
+ struct __DRIimageRec *image;
+
+ image = CommonImageSetup(loaderPrivate);
-+ if (image == NULL)
++ if (!image)
+ {
+ return NULL;
+ }
+
+ image->psShared = RefImageShared(srcImage->psShared);
-+ image->psEGLImage = PVRDRIEGLImageDup(srcImage->psEGLImage);
+
-+ if (image->psEGLImage == NULL)
++ image->psEGLImage = PVRDRIEGLImageDup(srcImage->psEGLImage);
++ if (!image->psEGLImage)
+ {
+ PVRDRIDestroyImage(image);
+ return NULL;
@@ -6949,29 +6684,43 @@
+ int *strides, int *offsets,
+ void *loaderPrivate)
+{
++ struct __DRIimageRec *image;
+ IMG_PIXFMT eIMGPixFmt;
+ int format;
-+ int pitch;
+
-+ if (num_names != 1 || offsets[0] != 0)
++ eIMGPixFmt = PVRDRIDRIFourCCToIMGPixelFormat(fourcc);
++ format = PVRDRIIMGPixelToDRIImageFormat(eIMGPixFmt);
++ if (!format)
+ {
-+ errorMessage("%s: Unsupported parameters (num names %d, first
offset: %d)\n", __func__, num_names, offsets[0]);
++ errorMessage("%s: Unsupported DRI image FourCC (fourcc = %d)\n",
++ __func__, fourcc);
+ return NULL;
+ }
+
-+ eIMGPixFmt = DRIFourCCToIMGPixFmt(fourcc);
-+ if (eIMGPixFmt == IMG_PIXFMT_UNKNOWN)
++ image = CommonImageSetup(loaderPrivate);
++ if (!image)
+ {
-+ errorMessage("%s: Unknown DRI IMAGE FourCC pixel format: %d\n",
__func__, fourcc);
+ return NULL;
+ }
+
-+ format = PVRDRIIMGtoDRIPixFmt(eIMGPixFmt);
++ image->psShared = CreateImageSharedFromNames(screen, width, height,
format,
++ names, num_names, strides, offsets);
++ if (!image->psShared)
++ {
++ PVRDRIDestroyImage(image);
++ return NULL;
++ }
+
-+ pitch = strides[0] / IMGBytesPerPixel(eIMGPixFmt);
++ image->psEGLImage =
PVRDRIEGLImageCreateFromBuffer(image->psShared->psBuffer);
++ if (!image->psEGLImage)
++ {
++ PVRDRIDestroyImage(image);
++ return NULL;
++ }
+
-+ return PVRDRICreateImageFromName(screen, width, height, format,
-+ names[0], pitch, loaderPrivate);
++ PVRDRIEGLImageSetCallbackData(image->psEGLImage, image);
++
++ return image;
+}
+
+__DRIimage *PVRDRIFromPlanar(__DRIimage *image, int plane,
@@ -7016,14 +6765,13 @@
+ }
+
+ image = CommonImageSetup(loaderPrivate);
-+
-+ if (image == NULL)
++ if (!image)
+ {
+ return NULL;
+ }
+
+ psEGLImage = PVRDRIEGLImageCreate();
-+ if (psEGLImage == NULL)
++ if (!psEGLImage)
+ {
+ PVRDRIDestroyImage(image);
+ return NULL;
@@ -7052,15 +6800,13 @@
+ * texture now has a reference to it.
+ */
+ image->psShared = CreateImageSharedFromEGLImage(screen, psEGLImage);
-+
-+ if (image->psShared == NULL)
++ if (!image->psShared)
+ {
+ return NULL;
+ }
+
+ image->psEGLImage = PVRDRIEGLImageDup(image->psShared->psEGLImage);
-+
-+ if (image->psEGLImage == NULL)
++ if (!image->psEGLImage)
+ {
+ return NULL;
+ }
@@ -7079,49 +6825,44 @@
+ struct __DRIimageRec *image;
+ IMG_PIXFMT eIMGPixFmt;
+ int format;
-+ int pitch;
+
+ if (num_fds != 1 || offsets[0] != 0)
+ {
-+ errorMessage("%s: Unsupported parameters (num fds %d, first
offset: %d)\n", __func__, num_fds, offsets[0]);
++ errorMessage("%s: Unsupported parameters (num fds %d, first
offset: %d)\n",
++ __func__, num_fds, offsets[0]);
+ return NULL;
+ }
+
-+ eIMGPixFmt = DRIFourCCToIMGPixFmt(fourcc);
++ eIMGPixFmt = PVRDRIDRIFourCCToIMGPixelFormat(fourcc);
+ if (eIMGPixFmt == IMG_PIXFMT_UNKNOWN)
+ {
+ errorMessage("%s: Unknown DRI IMAGE FourCC pixel format: %d\n",
__func__, fourcc);
+ return NULL;
+ }
+
-+ format = PVRDRIIMGtoDRIPixFmt(eIMGPixFmt);
-+ pitch = strides[0] / IMGBytesPerPixel(eIMGPixFmt);
++ format = PVRDRIIMGPixelToDRIImageFormat(eIMGPixFmt);
+
+ image = CommonImageSetup(loaderPrivate);
-+
-+ if (image == NULL)
++ if (!image)
+ {
+ return NULL;
+ }
+
-+ image->psShared = CreateImageSharedFromFd(screen, width, height, format,
fds[0]);
-+
-+ if (image->psShared == NULL)
++ image->psShared = CreateImageSharedFromFd(screen, width, height,
strides[0], format, fds[0]);
++ if (!image->psShared)
+ {
+ PVRDRIDestroyImage(image);
+ return NULL;
+ }
+
+ image->psEGLImage =
PVRDRIEGLImageCreateFromBuffer(image->psShared->psBuffer);
-+
-+ if (image->psEGLImage == NULL)
++ if (!image->psEGLImage)
+ {
+ PVRDRIDestroyImage(image);
+ return NULL;
+ }
+
-+ (void)pitch;
-+ assert(GetEGLImageStride(image->psEGLImage) == (pitch *
IMGBytesPerPixel(image->psShared->eIMGPixFmt)));
++ assert(GetEGLImageStride(image->psEGLImage) == strides[0]);
+
+ return image;
+}
@@ -7151,20 +6892,19 @@
+ }
+
+ image = CommonImageSetup(loaderPrivate);
-+ if (image == NULL)
++ if (!image)
+ {
+ return NULL;
+ }
+
+ psEGLImage = PVRDRIEGLImageCreate();
-+ if (psEGLImage == NULL)
++ if (!psEGLImage)
+ {
+ PVRDRIDestroyImage(image);
+ return NULL;
+ }
+
+ *error = GetImageSourceOCL(psPVRContext, target, buffer, psEGLImage);
-+
+ if (*error != __DRI_IMAGE_ERROR_SUCCESS)
+ {
+ PVRDRIEGLImageFree(psEGLImage);
@@ -7179,20 +6919,68 @@
+ * OCL image now has a reference to it.
+ */
+ image->psShared = CreateImageSharedFromEGLImage(screen, psEGLImage);
-+
-+ if (image->psShared == NULL)
++ if (!image->psShared)
+ {
+ return NULL;
+ }
+
+ image->psEGLImage = PVRDRIEGLImageDup(image->psShared->psEGLImage);
-+
-+ if (image->psEGLImage == NULL)
++ if (!image->psEGLImage)
+ {
+ return NULL;
+ }
+
+ image->iRefCount++;
++
++ return image;
++}
++
++__DRIimage *PVRDRICreateImageFromDmaBufs(__DRIscreen *screen,
++ int width, int height, int
fourcc,
++ int *fds, int num_fds,
++ int *strides, int *offsets,
++ enum __DRIYUVColorSpace
color_space,
++ enum __DRISampleRange
sample_range,
++ enum __DRIChromaSiting
horiz_siting,
++ enum __DRIChromaSiting
vert_siting,
++ unsigned *error,
++ void *loaderPrivate)
++{
++ __DRIimage *image;
++ IMG_PIXFMT eIMGPixFmt;
++ int i;
++
++ eIMGPixFmt = PVRDRIDRIFourCCToIMGPixelFormat(fourcc);
++ if (eIMGPixFmt == IMG_PIXFMT_UNKNOWN)
++ {
++ errorMessage("%s: Unsupported DRI image FourCC: %d\n", __func__,
fourcc);
++ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
++ return NULL;
++ }
++
++ for (i = 0; i < num_fds; i++)
++ {
++ if (offsets[i] != 0)
++ {
++ errorMessage("%s: Offset %d unsupported (value = %d)\n",
++ __func__, i, offsets[i]);
++ *error = __DRI_IMAGE_ERROR_BAD_ACCESS;
++ return NULL;
++ }
++ }
++
++ image = PVRDRICreateImageFromFds(screen,
++ width, height, fourcc,
++ fds, num_fds,
++ strides, offsets,
++ loaderPrivate);
++ if (!image)
++ {
++ *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
++ return NULL;
++ }
++
++ *error = __DRI_IMAGE_ERROR_SUCCESS;
+
+ return image;
+}
@@ -7236,7 +7024,7 @@
+{
+ PVRDRIScreen *psPVRScreen = PVRDRIThreadGetCurrentScreen();
+
-+ if (psPVRScreen == NULL)
++ if (!psPVRScreen)
+ {
+ return NULL;
+ }
@@ -7248,8 +7036,8 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvrimage.h
b/src/mesa/drivers/dri/pvr/pvrimage.h
--- a/src/mesa/drivers/dri/pvr/pvrimage.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrimage.h 2014-11-25 12:31:06.314518351
+0000
-@@ -0,0 +1,83 @@
++++ b/src/mesa/drivers/dri/pvr/pvrimage.h 2015-02-27 14:29:03.670116949
+0000
+@@ -0,0 +1,94 @@

+/*************************************************************************/
/*!
+@File
+@Title DRI IMAGE support
@@ -7332,10 +7120,21 @@
+ unsigned *error,
+ void *loaderPrivate);
+
++__DRIimage *PVRDRICreateImageFromDmaBufs(__DRIscreen *screen,
++ int width, int height, int
fourcc,
++ int *fds, int num_fds,
++ int *strides, int *offsets,
++ enum __DRIYUVColorSpace
color_space,
++ enum __DRISampleRange
sample_range,
++ enum __DRIChromaSiting
horiz_siting,
++ enum __DRIChromaSiting
vert_siting,
++ unsigned *error,
++ void *loaderPrivate);
++
+#endif /* !defined(__PVRIMAGE_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrmesa.h
b/src/mesa/drivers/dri/pvr/pvrmesa.h
--- a/src/mesa/drivers/dri/pvr/pvrmesa.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrmesa.h 2014-11-25 12:31:06.323510851
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrmesa.h 2015-02-27 14:29:03.680116049
+0000
@@ -0,0 +1,41 @@

+/*************************************************************************/
/*!
+@File
@@ -7380,7 +7179,7 @@
+#endif /* !defined(__PVRMESA_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrqueue.h
b/src/mesa/drivers/dri/pvr/pvrqueue.h
--- a/src/mesa/drivers/dri/pvr/pvrqueue.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrqueue.h 2014-11-25 12:31:06.323510851
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrqueue.h 2015-02-27 14:29:03.680116049
+0000
@@ -0,0 +1,72 @@

+/*************************************************************************/
/*!
+@File pvrqueue.h
@@ -7456,7 +7255,7 @@
+#endif /* defined(__PVRQUEUE_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrsyncobj.c
b/src/mesa/drivers/dri/pvr/pvrsyncobj.c
--- a/src/mesa/drivers/dri/pvr/pvrsyncobj.c 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrsyncobj.c 2014-11-25 12:31:06.315511951
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrsyncobj.c 2015-02-27 14:29:03.671116849
+0000
@@ -0,0 +1,151 @@

+/*************************************************************************/
/*!
+@File
@@ -7611,7 +7410,7 @@
+#endif /* defined(__DRI_SYNCOBJ) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrsyncobj.h
b/src/mesa/drivers/dri/pvr/pvrsyncobj.h
--- a/src/mesa/drivers/dri/pvr/pvrsyncobj.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrsyncobj.h 2014-11-25 12:31:06.327511551
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrsyncobj.h 2015-02-27 14:29:03.684115949
+0000
@@ -0,0 +1,45 @@

+/*************************************************************************/
/*!
+@File
@@ -7660,8 +7459,8 @@
+#endif /* !defined(__PVRSYNCOBJ_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrutil.c
b/src/mesa/drivers/dri/pvr/pvrutil.c
--- a/src/mesa/drivers/dri/pvr/pvrutil.c 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrutil.c 2014-11-25 12:31:06.319509651
+0000
-@@ -0,0 +1,270 @@
++++ b/src/mesa/drivers/dri/pvr/pvrutil.c 2015-02-27 14:29:03.676116349
+0000
+@@ -0,0 +1,322 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI utility functions
@@ -7698,25 +7497,7 @@
+#include "GL/gl.h"
+
+#include "pvrdri.h"
-+#include "pvr_dri_support.h"
+
-+static struct
-+{
-+ mesa_format ePixelFormat;
-+ IMG_PIXFMT ePVRPixelFormat;
-+} asPixelFormatIMG2OGL[] =
-+{
-+#if defined(PVR_DRI_FORCE_XRGB8888)
-+ { MESA_FORMAT_B8G8R8X8_UNORM, IMG_PIXFMT_B8G8R8X8_UNORM },
-+#elif defined(PVR_DRI_FORCE_XRGB8888_AS_ARGB8888)
-+ { MESA_FORMAT_B8G8R8X8_UNORM, IMG_PIXFMT_B8G8R8X8_UNORM },
-+#else
-+ { MESA_FORMAT_B8G8R8A8_UNORM, IMG_PIXFMT_B8G8R8A8_UNORM },
-+#endif
-+ { MESA_FORMAT_B5G6R5_UNORM, IMG_PIXFMT_B5G6R5_UNORM },
-+ /* The following element must come last */
-+ { MESA_FORMAT_NONE, IMG_PIXFMT_UNKNOWN }
-+};
+
+/* Standard error message */
+void __attribute__((format(printf, 1, 2))) errorMessage(const char
*f, ...)
@@ -7809,9 +7590,18 @@
+const __DRIconfig **PVRDRICreateConfigs(void)
+{
+ static const GLenum asBackBufferModes[] = { GLX_NONE, GLX_SWAP_COPY_OML
};
-+ uint8_t auDepthBits[] = { 0, 32 };
-+ uint8_t auStencilBits[] = { 0, 8 };
-+ uint8_t auMSAASamples[] = { 0, 2, 4, 8 };
++ mesa_format aePixelFormats[] =
++ {
++#if defined(PVR_DRI_FORCE_XRGB8888)
++ MESA_FORMAT_B8G8R8X8_UNORM,
++#else
++ MESA_FORMAT_B8G8R8A8_UNORM,
++#endif
++ MESA_FORMAT_B5G6R5_UNORM
++ };
++ uint8_t auDepthBits[] = { 0, 32 };
++ uint8_t auStencilBits[] = { 0, 8 };
++ uint8_t auMSAASamples[] = { 0, 2, 4, 8 };
+ unsigned uNumBackBufferModes;
+ unsigned uNumDepthStencilBits;
+ unsigned uNumMSAASamples;
@@ -7826,9 +7616,9 @@
+ /* The size of the depth and stencil arrays should be the same */
+ assert(ARRAY_SIZE(auStencilBits) == uNumDepthStencilBits);
+
-+ for (i = 0; asPixelFormatIMG2OGL[i].ePVRPixelFormat !=
IMG_PIXFMT_UNKNOWN; i++)
++ for (i = 0; i < ARRAY_SIZE(aePixelFormats); i++)
+ {
-+ ppsNewConfigs = driCreateConfigs(asPixelFormatIMG2OGL[i].ePixelFormat,
++ ppsNewConfigs = driCreateConfigs(aePixelFormats[i],
+ auDepthBits,
+ auStencilBits,
+ uNumDepthStencilBits,
@@ -7856,7 +7646,7 @@
+ return (const __DRIconfig **)ppsConfigs;
+}
+
-+IMG_PIXFMT PVRDRIBPPToIMGPixFmt(unsigned uFormat)
++IMG_PIXFMT PVRDRIBPPToIMGPixelFormat(unsigned uFormat)
+{
+ switch (uFormat)
+ {
@@ -7864,14 +7654,33 @@
+ return IMG_PIXFMT_B8G8R8A8_UNORM;
+ case 16:
+ return IMG_PIXFMT_B5G6R5_UNORM;
-+ case 8:
-+ return IMG_PIXFMT_R8_UNORM;
+ default:
+ return IMG_PIXFMT_UNKNOWN;
+ }
+}
+
-+IMG_PIXFMT PVRDRIDRIToIMGPixFmt(int iDRIFormat)
++IMG_PIXFMT PVRDRIDRIFourCCToIMGPixelFormat(int iDRIFourCC)
++{
++ switch (iDRIFourCC)
++ {
++ case __DRI_IMAGE_FOURCC_RGB565:
++ return IMG_PIXFMT_B5G6R5_UNORM;
++ case __DRI_IMAGE_FOURCC_XRGB8888:
++ return IMG_PIXFMT_B8G8R8X8_UNORM;
++ case __DRI_IMAGE_FOURCC_ARGB8888:
++ return IMG_PIXFMT_B8G8R8A8_UNORM;
++ case __DRI_IMAGE_FOURCC_ABGR8888:
++ return IMG_PIXFMT_R8G8B8A8_UNORM;
++ case __DRI_IMAGE_FOURCC_XBGR8888:
++ return IMG_PIXFMT_R8G8B8X8_UNORM;
++ default:
++ break;
++ }
++
++ return IMG_PIXFMT_UNKNOWN;
++}
++
++IMG_PIXFMT PVRDRIDRIImageToIMGPixelFormat(int iDRIFormat)
+{
+ switch (iDRIFormat)
+ {
@@ -7902,9 +7711,51 @@
+ return IMG_PIXFMT_UNKNOWN;
+}
+
-+int PVRDRIIMGtoDRIPixFmt(IMG_PIXFMT eIMGFormat)
++int PVRDRIIMGPixelFormatToDRIFourCC(IMG_PIXFMT eIMGPixelFormat)
+{
-+ switch (eIMGFormat)
++ switch (eIMGPixelFormat)
++ {
++ case IMG_PIXFMT_B5G6R5_UNORM:
++ return __DRI_IMAGE_FOURCC_RGB565;
++ case IMG_PIXFMT_B8G8R8X8_UNORM:
++ return __DRI_IMAGE_FOURCC_XRGB8888;
++ case IMG_PIXFMT_B8G8R8A8_UNORM:
++ return __DRI_IMAGE_FOURCC_ARGB8888;
++ case IMG_PIXFMT_R8G8B8A8_UNORM:
++ return __DRI_IMAGE_FOURCC_ABGR8888;
++ case IMG_PIXFMT_R8G8B8X8_UNORM:
++ return __DRI_IMAGE_FOURCC_XBGR8888;
++ default:
++ break;
++ }
++
++ return 0;
++}
++
++uint32_t PVRDRIIMGPixelFormatToDRIImageComponents(IMG_PIXFMT
eIMGPixelFormat)
++{
++ switch (eIMGPixelFormat)
++ {
++ case IMG_PIXFMT_B5G6R5_UNORM:
++ return __DRI_IMAGE_COMPONENTS_RGB;
++ case IMG_PIXFMT_B8G8R8X8_UNORM:
++ return __DRI_IMAGE_COMPONENTS_RGB;
++ case IMG_PIXFMT_B8G8R8A8_UNORM:
++ return __DRI_IMAGE_COMPONENTS_RGBA;
++ case IMG_PIXFMT_R8G8B8X8_UNORM:
++ return __DRI_IMAGE_COMPONENTS_RGB;
++ case IMG_PIXFMT_R8G8B8A8_UNORM:
++ return __DRI_IMAGE_COMPONENTS_RGBA;
++ default:
++ break;
++ }
++
++ return 0;
++}
++
++int PVRDRIIMGPixelToDRIImageFormat(IMG_PIXFMT eIMGPixelFormat)
++{
++ switch (eIMGPixelFormat)
+ {
+ case IMG_PIXFMT_B5G6R5_UNORM:
+ return __DRI_IMAGE_FORMAT_RGB565;
@@ -7930,5 +7781,5 @@
+ break;
+ }
+
-+ return __DRI_IMAGE_FORMAT_NONE;
++ return 0;
+}
diff --git
a/media-libs/mesa-img/files/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
b/media-libs/mesa-img/files/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
similarity index 89%
rename from
media-libs/mesa-img/files/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
rename to
media-libs/mesa-img/files/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
index b6cebd3..d8e47ed 100644
---
a/media-libs/mesa-img/files/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
+++
b/media-libs/mesa-img/files/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
@@ -1,7 +1,7 @@
-From 0b8f8eb89e62f4127aaf283b74a876299834a774 Mon Sep 17 00:00:00 2001
+From cdda2f5d57775ab538fa035de504542bd0b29c60 Mon Sep 17 00:00:00 2001
From: Brendan King <Brenda...@imgtec.com>
Date: Tue, 11 Mar 2014 11:31:26 +0000
-Subject: [PATCH 07/29] Add EGL_IMG_context_priority EGL extension.
+Subject: [PATCH] Add EGL_IMG_context_priority EGL extension.

Add support for the EGL_IMG_context_priority extension to EGL, and the
DRI2 EGL driver.
@@ -18,7 +18,7 @@
9 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h
b/include/GL/internal/dri_interface.h
-index 7c28c13..6e7cc47 100644
+index 8c5ceb9..8da1278 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -926,6 +926,21 @@ struct __DRIdri2LoaderExtensionRec {
@@ -43,7 +43,7 @@
* \name Reasons that __DRIdri2Extension::createContextAttribs might fail
*/
/*@{*/
-@@ -1446,4 +1461,19 @@ struct __DRIimageDriverExtensionRec {
+@@ -1461,4 +1476,19 @@ struct __DRIimageDriverExtensionRec {
__DRIgetAPIMaskFunc getAPIMask;
};

@@ -64,7 +64,7 @@
+
#endif
diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
-index cc7531c..6348ad8 100644
+index 6a7121b..2472291 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -515,6 +515,9 @@ dri2_setup_screen(_EGLDisplay *disp)
@@ -77,17 +77,17 @@
}

if (dri2_dpy->image) {
-@@ -592,6 +595,9 @@ dri2_create_screen(_EGLDisplay *disp)
- if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) {
- dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i];
- }
-+ if (strcmp(extensions[i]->name, __DRI_PRIORITY) == 0) {
-+ dri2_dpy->priority = (__DRIpriorityExtension *) extensions[i];
-+ }
+@@ -612,6 +615,9 @@ dri2_create_screen(_EGLDisplay *disp)
+ if (strcmp(extensions[i]->name, __DRI_IMAGE) == 0) {
+ dri2_dpy->image = (__DRIimageExtension *) extensions[i];
}
- } else {
- assert(dri2_dpy->swrast);
-@@ -854,7 +860,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay
*disp, _EGLConfig *conf,
++ if (strcmp(extensions[i]->name, __DRI_PRIORITY) == 0) {
++ dri2_dpy->priority = (__DRIpriorityExtension *) extensions[i];
++ }
+ }
+
+ dri2_setup_screen(disp);
+@@ -886,7 +892,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay
*disp, _EGLConfig *conf,
if (dri2_dpy->dri2->base.version >= 3) {
unsigned error;
unsigned num_attribs = 0;
@@ -96,7 +96,7 @@

ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
ctx_attribs[num_attribs++] = dri2_ctx->base.ClientMajorVersion;
-@@ -890,6 +896,28 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay
*disp, _EGLConfig *conf,
+@@ -922,6 +928,28 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay
*disp, _EGLConfig *conf,
ctx_attribs[num_attribs++] = __DRI_CTX_RESET_LOSE_CONTEXT;
}

@@ -126,7 +126,7 @@

dri2_ctx->dri_context =
diff --git a/src/egl/drivers/dri2/egl_dri2.h
b/src/egl/drivers/dri2/egl_dri2.h
-index 0dd9d69..9ea3b03 100644
+index 8521885..79d9acb 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -162,6 +162,7 @@ struct dri2_egl_display
@@ -138,7 +138,7 @@

int own_device;
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
-index 70277ab..3bcc964 100644
+index 514b91a..ff463b4 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -197,6 +197,20 @@ _eglParseContextAttribList(_EGLContext *ctx,
_EGLDisplay *dpy,
@@ -162,7 +162,7 @@
default:
err = EGL_BAD_ATTRIBUTE;
break;
-@@ -377,6 +391,7 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy,
_EGLConfig *conf,
+@@ -380,6 +394,7 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy,
_EGLConfig *conf,
ctx->Flags = 0;
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
ctx->ResetNotificationStrategy = EGL_NO_RESET_NOTIFICATION_KHR;
@@ -170,7 +170,7 @@

err = _eglParseContextAttribList(ctx, dpy, attrib_list);
if (err == EGL_SUCCESS && ctx->Config) {
-@@ -437,6 +452,9 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLContext *c,
+@@ -440,6 +455,9 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLContext *c,
case EGL_RENDER_BUFFER:
*value = _eglQueryContextRenderBuffer(c);
break;
@@ -218,7 +218,7 @@
}

diff --git a/src/mesa/drivers/dri/common/dri_util.c
b/src/mesa/drivers/dri/common/dri_util.c
-index 6c78928..4865f0d 100644
+index d6e875f..70c5fce 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -310,6 +310,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
@@ -239,7 +239,7 @@
default:
/* We can't create a context that satisfies the requirements of an
* attribute that we don't understand. Return failure.
-@@ -431,6 +435,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
+@@ -429,6 +433,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
context->driScreenPriv = screen;
context->driDrawablePriv = NULL;
context->driReadablePriv = NULL;
diff --git
a/media-libs/mesa-img/files/0008-Extend-EGL-KHR-sync-object-support.patch
b/media-libs/mesa-img/files/0001-Extend-EGL-KHR-sync-object-support.patch
similarity index 94%
rename from
media-libs/mesa-img/files/0008-Extend-EGL-KHR-sync-object-support.patch
rename to
media-libs/mesa-img/files/0001-Extend-EGL-KHR-sync-object-support.patch
index 98204a1..0dce497 100644
---
a/media-libs/mesa-img/files/0008-Extend-EGL-KHR-sync-object-support.patch
+++
b/media-libs/mesa-img/files/0001-Extend-EGL-KHR-sync-object-support.patch
@@ -1,7 +1,7 @@
-From 014c9e5aaaff158b5b422debf8c7863d6641e548 Mon Sep 17 00:00:00 2001
+From 2eb5457df31eff647b8387a39216d1e0fd16fee2 Mon Sep 17 00:00:00 2001
From: Brendan King <Brenda...@imgtec.com>
Date: Tue, 11 Mar 2014 11:41:07 +0000
-Subject: [PATCH 08/29] Extend EGL KHR sync object support.
+Subject: [PATCH] Extend EGL KHR sync object support.

Extend EGL_KHR_fence_sync support in the DRI2 EGL driver.
Add EGL_KHR_wait_sync support to EGL and the DRI2 EGL driver.
@@ -18,10 +18,10 @@
9 files changed, 237 insertions(+), 5 deletions(-)

diff --git a/include/GL/internal/dri_interface.h
b/include/GL/internal/dri_interface.h
-index 6e7cc47..76e9683 100644
+index 8da1278..f7bb179 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
-@@ -1476,4 +1476,38 @@ struct __DRIpriorityExtensionRec {
+@@ -1491,4 +1491,38 @@ struct __DRIpriorityExtensionRec {
__DRIextension base;
};

@@ -61,7 +61,7 @@
+
#endif
diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
-index 6348ad8..3697579 100644
+index 2472291..1b577ac 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -518,6 +518,13 @@ dri2_setup_screen(_EGLDisplay *disp)
@@ -78,17 +78,17 @@
}

if (dri2_dpy->image) {
-@@ -598,6 +605,9 @@ dri2_create_screen(_EGLDisplay *disp)
- if (strcmp(extensions[i]->name, __DRI_PRIORITY) == 0) {
- dri2_dpy->priority = (__DRIpriorityExtension *) extensions[i];
- }
-+ if (strcmp(extensions[i]->name, __DRI_SYNCOBJ) == 0) {
-+ dri2_dpy->syncobj = (__DRIsyncObjExtension *) extensions[i];
-+ }
+@@ -618,6 +625,9 @@ dri2_create_screen(_EGLDisplay *disp)
+ if (strcmp(extensions[i]->name, __DRI_PRIORITY) == 0) {
+ dri2_dpy->priority = (__DRIpriorityExtension *) extensions[i];
}
- } else {
- assert(dri2_dpy->swrast);
-@@ -2109,6 +2119,144 @@ dri2_query_wayland_buffer_wl(_EGLDriver *drv,
_EGLDisplay *disp,
++ if (strcmp(extensions[i]->name, __DRI_SYNCOBJ) == 0) {
++ dri2_dpy->syncobj = (__DRIsyncObjExtension *) extensions[i];
++ }
+ }
+
+ dri2_setup_screen(disp);
+@@ -2116,6 +2126,144 @@ dri2_query_wayland_buffer_wl(_EGLDriver *drv,
_EGLDisplay *disp,
}
#endif

@@ -233,7 +233,7 @@
static void
dri2_unload(_EGLDriver *drv)
{
-@@ -2220,6 +2368,12 @@ _eglBuiltInDriverDRI2(const char *args)
+@@ -2227,6 +2375,12 @@ _eglBuiltInDriverDRI2(const char *args)
#endif
dri2_drv->base.API.GetSyncValuesCHROMIUM =
dri2_get_sync_values_chromium;

@@ -247,7 +247,7 @@
dri2_drv->base.Unload = dri2_unload;

diff --git a/src/egl/drivers/dri2/egl_dri2.h
b/src/egl/drivers/dri2/egl_dri2.h
-index 9ea3b03..b50ada1 100644
+index 79d9acb..e158d2c 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -72,6 +72,7 @@
@@ -266,7 +266,7 @@
int fd;

int own_device;
-@@ -287,9 +289,17 @@ struct dri2_egl_image
+@@ -288,9 +290,17 @@ struct dri2_egl_image
#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
#define DRI_CONF_VBLANK_ALWAYS_SYNC 3

diff --git
a/media-libs/mesa-img/files/0049-egl-dri-Add-a-bad-access-error-code-to-the-DRI-inter.patch
b/media-libs/mesa-img/files/0049-egl-dri-Add-a-bad-access-error-code-to-the-DRI-inter.patch
new file mode 100644
index 0000000..fdbba28
--- /dev/null
+++
b/media-libs/mesa-img/files/0049-egl-dri-Add-a-bad-access-error-code-to-the-DRI-inter.patch
@@ -0,0 +1,63 @@
+From 577d32993af1d3cfee685889c8bbd57d3a2b3837 Mon Sep 17 00:00:00 2001
+From: Frank Binns <frank...@imgtec.com>
+Date: Tue, 24 Feb 2015 12:03:27 +0000
+Subject: [PATCH 49/49] egl/dri: Add a bad access error code to the DRI
+ interface and hook this up in EGL
+
+The EGL_EXT_image_dma_buf_import extension allows eglCreateImageKHR to
fail with
+an EGL_BAD_ACCESS error if a plane's pitch or offset is unsupported. As
this is
+determined on a driver by driver basis, add a new
__DRI_IMAGE_ERROR_BAD_ACCESS
+error for drivers to use and hook this up in EGL.
+---
+ include/GL/internal/dri_interface.h | 8 ++++++--
+ src/egl/drivers/dri2/egl_dri2.c | 4 ++++
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/include/GL/internal/dri_interface.h
b/include/GL/internal/dri_interface.h
+index 927c579..1721207 100644
+--- a/include/GL/internal/dri_interface.h
++++ b/include/GL/internal/dri_interface.h
+@@ -1134,7 +1134,8 @@ enum __DRIChromaSiting {
+ };
+
+ /**
+- * \name Reasons that __DRIimageExtensionRec::createImageFromTexture
might fail
++ * \name Reasons that __DRIimageExtensionRec::createImageFromTexture or
++ * __DRIimageExtensionRec::createImageFromDmaBufs might fail
+ */
+ /*@{*/
+ /** Success! */
+@@ -1143,11 +1144,14 @@ enum __DRIChromaSiting {
+ /** Memory allocation failure */
+ #define __DRI_IMAGE_ERROR_BAD_ALLOC 1
+
+-/** Client requested an invalid attribute for a texture object */
++/** Client requested an invalid attribute */
+ #define __DRI_IMAGE_ERROR_BAD_MATCH 2
+
+ /** Client requested an invalid texture object */
+ #define __DRI_IMAGE_ERROR_BAD_PARAMETER 3
++
++/** Client requested an invalid pitch and/or offset */
++#define __DRI_IMAGE_ERROR_BAD_ACCESS 4
+ /*@}*/
+
+ /**
+diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
+index 0e8a46e..740766f 100644
+--- a/src/egl/drivers/dri2/egl_dri2.c
++++ b/src/egl/drivers/dri2/egl_dri2.c
+@@ -1491,6 +1491,10 @@ dri2_create_image_khr_error(int dri_error)
+ egl_error = EGL_BAD_PARAMETER;
+ break;
+
++ case __DRI_IMAGE_ERROR_BAD_ACCESS:
++ egl_error = EGL_BAD_ACCESS;
++ break;
++
+ default:
+ assert(0);
+ egl_error = EGL_BAD_MATCH;
+--
+1.8.5.4.gfdaaaa2
+
diff --git
a/media-libs/mesa-img/files/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
b/media-libs/mesa-img/files/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
new file mode 100644
index 0000000..4fd0081
--- /dev/null
+++
b/media-libs/mesa-img/files/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
@@ -0,0 +1,521 @@
+From 639b602a74d9c4e4d5b79edeb10609af711cb757 Mon Sep 17 00:00:00 2001
+From: Zach Reizner <za...@chromium.org>
+Date: Fri, 23 Jan 2015 10:43:26 -0800
+Subject: dri: add swrast support on top of prime imported buffers
+
+TEST=null_platform_test /dev/dri/card0
+BUG=chromium:394868
+CQ-DEPEND=CL:242570
+
+Change-Id: I89cc8b4ba8e7120a1a1e7ed8b76c34632488aa88
+---
+ src/gallium/state_trackers/dri/Makefile.am | 1 +
+ src/gallium/state_trackers/dri/drisw.c | 126 +++++++++++++++++
+ src/gallium/winsys/sw/dri/Makefile.am | 5 +
+ src/gallium/winsys/sw/dri/dri_sw_winsys.c | 220
+++++++++++++++++++++++++++--
+ 4 files changed, 337 insertions(+), 15 deletions(-)
+
+diff --git a/src/gallium/state_trackers/dri/Makefile.am
b/src/gallium/state_trackers/dri/Makefile.am
+index 5d701f7..865de78 100644
+--- a/src/gallium/state_trackers/dri/Makefile.am
++++ b/src/gallium/state_trackers/dri/Makefile.am
+@@ -30,6 +30,7 @@ AM_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/mapi \
+ -I$(top_srcdir)/src/mesa \
++ -I$(top_srcdir)/src/gallium/include/state_tracker \
+ -I$(top_srcdir)/src/gallium/state_trackers/dri/common \
+ -I$(top_srcdir)/src/mesa/drivers/dri/common \
+ -I$(top_builddir)/src/mesa/drivers/dri/common \
+diff --git a/src/gallium/state_trackers/dri/drisw.c
b/src/gallium/state_trackers/dri/drisw.c
+index 8d9acd6..c36fa8b 100644
+--- a/src/gallium/state_trackers/dri/drisw.c
++++ b/src/gallium/state_trackers/dri/drisw.c
+@@ -47,6 +47,8 @@
+ #include "dri_drawable.h"
+ #include "dri_query_renderer.h"
+
++#include "drm_driver.h"
++
+ DEBUG_GET_ONCE_BOOL_OPTION(swrast_no_present, "SWRAST_NO_PRESENT", FALSE);
+ static boolean swrast_no_present = FALSE;
+
+@@ -326,6 +328,125 @@ drisw_update_tex_buffer(struct dri_drawable
*drawable,
+ pipe_transfer_unmap(pipe, transfer);
+ }
+
++
++static __DRIimage *
++drisw_lookup_egl_image(struct dri_screen *screen, void *handle)
++{
++ const __DRIimageLookupExtension *loader = screen->sPriv->dri2.image;
++ __DRIimage *img;
++
++ if (!loader->lookupEGLImage)
++ return NULL;
++
++ img = loader->lookupEGLImage(screen->sPriv,
++ handle, screen->sPriv->loaderPrivate);
++
++ return img;
++}
++
++static __DRIimage *
++drisw_create_image_from_dma_bufs(__DRIscreen *screen,
++ int width, int height, int fourcc,
++ int *fds, int num_fds,
++ int *strides, int *offsets,
++ enum __DRIYUVColorSpace color_space,
++ enum __DRISampleRange sample_range,
++ enum __DRIChromaSiting horiz_siting,
++ enum __DRIChromaSiting vert_siting,
++ unsigned *error,
++ void *loaderPrivate)
++{
++ struct dri_screen *ds = dri_screen(screen);
++ struct pipe_screen *ps = ds->base.screen;
++ uint32_t dri_format;
++
++ struct pipe_resource templat;
++ memset(&templat, 0, sizeof(templat));
++
++ templat.target = PIPE_TEXTURE_2D;
++ switch (fourcc) {
++ case __DRI_IMAGE_FOURCC_ARGB8888:
++ dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
++ templat.format = PIPE_FORMAT_BGRA8888_UNORM;
++ break;
++ case __DRI_IMAGE_FOURCC_XRGB8888:
++ dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
++ templat.format = PIPE_FORMAT_BGRX8888_UNORM;
++ break;
++ case __DRI_IMAGE_FOURCC_ABGR8888:
++ dri_format = __DRI_IMAGE_FORMAT_ABGR8888;
++ templat.format = PIPE_FORMAT_RGBA8888_UNORM;
++ break;
++ case __DRI_IMAGE_FOURCC_XBGR8888:
++ dri_format = __DRI_IMAGE_FORMAT_XBGR8888;
++ templat.format = PIPE_FORMAT_RGBX8888_UNORM;
++ break;
++ default:
++ if (error)
++ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
++ return NULL;
++ }
++
++ templat.width0 = width;
++ templat.height0 = height;
++ templat.depth0 = 1;
++ templat.array_size = 1;
++
++ templat.last_level = 0;
++ templat.nr_samples = 0;
++ templat.usage = PIPE_USAGE_DEFAULT;
++
++ templat.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET |
++ PIPE_BIND_SAMPLER_VIEW;
++ templat.flags = 0;
++
++ struct winsys_handle handle;
++ memset(&handle, 0, sizeof(handle));
++ handle.type = DRM_API_HANDLE_TYPE_FD;
++ handle.handle = fds[0];
++ handle.stride = strides[0];
++
++ __DRIimage * img = CALLOC_STRUCT(__DRIimageRec);
++ if (!img) {
++ if (error)
++ *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
++ return NULL;
++ }
++
++ img->texture = ps->resource_from_handle(ps, &templat, &handle);
++
++ if (!img->texture) {
++ FREE(img);
++ if (error)
++ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
++ return NULL;
++ }
++
++ img->level = 0;
++ img->layer = 0;
++ img->dri_format = dri_format;
++ img->loader_private = loaderPrivate;
++
++ if (error)
++ *error = __DRI_IMAGE_ERROR_SUCCESS;
++
++ return img;
++}
++
++static void
++drisw_destroy_image(__DRIimage *img)
++{
++ pipe_resource_reference(&img->texture, NULL);
++ FREE(img);
++}
++
++static __DRIimageExtension dri2ImageExtension = {
++ .base = { __DRI_IMAGE, 8 },
++
++ .createImageFromDmaBufs = drisw_create_image_from_dma_bufs,
++ .destroyImage = drisw_destroy_image,
++};
++
+ /*
+ * Backend function for init_screen.
+ */
+@@ -333,6 +454,9 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
+ static const __DRIextension *drisw_screen_extensions[] = {
+ &driTexBufferExtension.base,
+ &dri2RendererQueryExtension.base,
++#ifdef HAVE_LIBDRM
++ &dri2ImageExtension.base,
++#endif
+ NULL
+ };
+
+@@ -367,6 +491,8 @@ drisw_init_screen(__DRIscreen * sPriv)
+ if (!configs)
+ goto fail;
+
++ screen->lookup_egl_image = drisw_lookup_egl_image;
++
+ return configs;
+ fail:
+ dri_destroy_screen_helper(screen);
+diff --git a/src/gallium/winsys/sw/dri/Makefile.am
b/src/gallium/winsys/sw/dri/Makefile.am
+index a7d3253..a0fe9d3 100644
+--- a/src/gallium/winsys/sw/dri/Makefile.am
++++ b/src/gallium/winsys/sw/dri/Makefile.am
+@@ -24,8 +24,13 @@ include Makefile.sources
+ include $(top_srcdir)/src/gallium/Automake.inc
+
+ AM_CFLAGS = \
++ -I$(top_srcdir)/src/gallium/include/state_tracker \
+ $(GALLIUM_WINSYS_CFLAGS)
+
++if HAVE_LIBDRM
++AM_CFLAGS += $(LIBDRM_CFLAGS)
++endif
++
+ noinst_LTLIBRARIES = libswdri.la
+
+ libswdri_la_SOURCES = $(C_SOURCES)
+diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+index 6fed22b..4e8b4cb 100644
+--- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
++++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+@@ -26,6 +26,17 @@
+ *
+
**************************************************************************/
+
++#include <fcntl.h>
++#include <stdio.h>
++#include <sys/mman.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <unistd.h>
++
++#if defined(HAVE_LIBDRM)
++#include <xf86drm.h>
++#endif
++
+ #include "pipe/p_compiler.h"
+ #include "pipe/p_format.h"
+ #include "util/u_inlines.h"
+@@ -36,14 +47,25 @@
+ #include "state_tracker/sw_winsys.h"
+ #include "dri_sw_winsys.h"
+
++#include "drm_driver.h"
++
++enum displaytarget_type {
++ DISPLAYTARGET_TYPE_USER,
++ DISPLAYTARGET_TYPE_PRIME,
++};
+
+ struct dri_sw_displaytarget
+ {
++ enum displaytarget_type type;
+ enum pipe_format format;
+ unsigned width;
+ unsigned height;
+ unsigned stride;
+
++#if defined(HAVE_LIBDRM)
++ uint32_t vgem_handle;
++#endif
++
+ void *data;
+ void *mapped;
+ };
+@@ -53,8 +75,75 @@ struct dri_sw_winsys
+ struct sw_winsys base;
+
+ struct drisw_loader_funcs *lf;
++
++#if defined(HAVE_LIBDRM)
++ int vgem_fd;
++#endif
+ };
+
++#if defined(HAVE_LIBDRM)
++
++const char g_sys_card_path_format[] =
++ "/sys/bus/platform/devices/vgem/drm/card%d";
++const char g_dev_card_path_format[] =
++ "/dev/dri/card%d";
++
++static int
++drm_open_vgem()
++{
++ char *name;
++ int i, fd;
++
++ for (i = 0; i < 16; i++) {
++ struct stat _stat;
++ int ret;
++ ret = asprintf(&name, g_sys_card_path_format, i);
++ assert(ret != -1);
++
++ if (stat(name, &_stat) == -1) {
++ free(name);
++ continue;
++ }
++
++ free(name);
++ ret = asprintf(&name, g_dev_card_path_format, i);
++ assert(ret != -1);
++
++ fd = open(name, O_RDWR);
++ free(name);
++ if (fd < 0)
++ continue;
++ return fd;
++ }
++ return -1;
++}
++
++static void *
++mmap_dumb_bo(int fd, int handle, size_t size)
++{
++ struct drm_mode_map_dumb mmap_arg;
++ void *ptr;
++ int ret;
++
++ memset(&mmap_arg, 0, sizeof(mmap_arg));
++
++ mmap_arg.handle = handle;
++
++ ret = drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &mmap_arg);
++ if (ret)
++ return NULL;
++
++ ptr = mmap(NULL, size, (PROT_READ|PROT_WRITE), MAP_SHARED, fd,
++ mmap_arg.offset);
++
++ if (ptr == MAP_FAILED)
++ return NULL;
++
++ return ptr;
++}
++
++#endif
++
+ static INLINE struct dri_sw_displaytarget *
+ dri_sw_displaytarget( struct sw_displaytarget *dt )
+ {
+@@ -92,6 +181,7 @@ dri_sw_displaytarget_create(struct sw_winsys *winsys,
+ if(!dri_sw_dt)
+ goto no_dt;
+
++ dri_sw_dt->type = DISPLAYTARGET_TYPE_USER;
+ dri_sw_dt->format = format;
+ dri_sw_dt->width = width;
+ dri_sw_dt->height = height;
+@@ -115,25 +205,30 @@ no_dt:
+ return NULL;
+ }
+
+-static void
+-dri_sw_displaytarget_destroy(struct sw_winsys *ws,
+- struct sw_displaytarget *dt)
+-{
+- struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
+-
+- FREE(dri_sw_dt->data);
+-
+- FREE(dri_sw_dt);
+-}
+-
+ static void *
+ dri_sw_displaytarget_map(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ unsigned flags)
+ {
++ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
+- dri_sw_dt->mapped = dri_sw_dt->data;
+- return dri_sw_dt->mapped;
++ if (dri_sw_dt->type == DISPLAYTARGET_TYPE_USER)
++ return dri_sw_dt->data;
++
++#if defined(HAVE_LIBDRM)
++ if (dri_sw_dt->type == DISPLAYTARGET_TYPE_PRIME && dri_sw_ws->vgem_fd
>= 0) {
++
++ if (dri_sw_dt->mapped)
++ return dri_sw_dt->mapped;
++
++ dri_sw_dt->mapped = mmap_dumb_bo(dri_sw_ws->vgem_fd,
++ dri_sw_dt->vgem_handle,
++ dri_sw_dt->height *
dri_sw_dt->stride);
++ return dri_sw_dt->mapped;
++ }
++#endif
++
++ return NULL;
+ }
+
+ static void
+@@ -141,25 +236,112 @@ dri_sw_displaytarget_unmap(struct sw_winsys *ws,
+ struct sw_displaytarget *dt)
+ {
+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
++
++#if defined(HAVE_LIBDRM)
++ if (dri_sw_dt->mapped)
++ munmap(dri_sw_dt->mapped, dri_sw_dt->height * dri_sw_dt->stride);
++#endif
++
+ dri_sw_dt->mapped = NULL;
+ }
+
++static void
++dri_sw_displaytarget_destroy(struct sw_winsys *ws,
++ struct sw_displaytarget *dt)
++{
++ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
++ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
++
++ if (dri_sw_dt->mapped) {
++ dri_sw_displaytarget_unmap(ws, dt);
++ }
++
++#if defined(HAVE_LIBDRM)
++ if (dri_sw_dt->type == DISPLAYTARGET_TYPE_PRIME && dri_sw_ws->vgem_fd
>= 0) {
++ struct drm_gem_close arg;
++ memset(&arg, 0, sizeof(arg));
++ arg.handle = dri_sw_dt->vgem_handle;
++
++ drmIoctl(dri_sw_ws->vgem_fd, DRM_IOCTL_GEM_CLOSE, &arg);
++ }
++#endif
++
++ FREE(dri_sw_dt->data);
++
++ FREE(dri_sw_dt);
++}
++
+ static struct sw_displaytarget *
+-dri_sw_displaytarget_from_handle(struct sw_winsys *winsys,
++dri_sw_displaytarget_from_handle(struct sw_winsys *ws,
+ const struct pipe_resource *templ,
+ struct winsys_handle *whandle,
+ unsigned *stride)
+ {
++#if defined(HAVE_LIBDRM)
++ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
++ uint32_t imported_handle;
++ struct dri_sw_displaytarget *dri_sw_dt;
++
++ if (whandle->type != DRM_API_HANDLE_TYPE_FD || dri_sw_ws->vgem_fd < 0)
{
++ return NULL;
++ }
++
++ dri_sw_dt = CALLOC_STRUCT(dri_sw_displaytarget);
++ if(!dri_sw_dt)
++ return NULL;
++
++ int ret = drmPrimeFDToHandle(dri_sw_ws->vgem_fd, whandle->handle,
++ &imported_handle);
++ if (ret) {
++ FREE(dri_sw_dt);
++ return NULL;
++ }
++
++ dri_sw_dt->type = DISPLAYTARGET_TYPE_PRIME;
++ dri_sw_dt->format = templ->format;
++ dri_sw_dt->width = templ->width0;
++ dri_sw_dt->height = templ->height0;
++ dri_sw_dt->vgem_handle = imported_handle;
++ dri_sw_dt->stride = whandle->stride;
++
++ *stride = dri_sw_dt->stride;
++ return (struct sw_displaytarget *)dri_sw_dt;
++#else
+ assert(0);
+ return NULL;
++#endif
+ }
+
+ static boolean
+-dri_sw_displaytarget_get_handle(struct sw_winsys *winsys,
++dri_sw_displaytarget_get_handle(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ struct winsys_handle *whandle)
+ {
++#if defined(HAVE_LIBDRM)
++ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
++ if (dri_sw_ws->vgem_fd < 0)
++ return FALSE;
++
++ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
++ if (whandle->type == DRM_API_HANDLE_TYPE_FD &&
++ dri_sw_dt->type == DISPLAYTARGET_TYPE_PRIME) {
++ int prime_fd;
++ int ret = drmPrimeHandleToFD(dri_sw_ws->vgem_fd,
++ dri_sw_dt->vgem_handle,
++ DRM_CLOEXEC,
++ &prime_fd);
++ if (ret || prime_fd < 0)
++ return FALSE;
++
++ whandle->handle = (unsigned)prime_fd;
++ whandle->stride = dri_sw_dt->stride;
++
++ return TRUE;
++ }
++#else
+ assert(0);
++#endif
++
+ return FALSE;
+ }
+
+@@ -196,6 +378,11 @@ dri_sw_displaytarget_display(struct sw_winsys *ws,
+ static void
+ dri_destroy_sw_winsys(struct sw_winsys *winsys)
+ {
++#if defined(HAVE_LIBDRM)
++ int vgem_fd = dri_sw_winsys(winsys)->vgem_fd;
++ if (vgem_fd >= 0)
++ close(vgem_fd);
++#endif
+ FREE(winsys);
+ }
+
+@@ -209,6 +396,9 @@ dri_create_sw_winsys(struct drisw_loader_funcs *lf)
+ return NULL;
+
+ ws->lf = lf;
++#if defined(HAVE_LIBDRM)
++ ws->vgem_fd = drm_open_vgem();
++#endif
+ ws->base.destroy = dri_destroy_sw_winsys;
+
+ ws->base.is_displaytarget_format_supported =
dri_sw_is_displaytarget_format_supported;
+--
+2.1.2
+
diff --git
a/media-libs/mesa-img/files/10.3-egl-dri2-add-support-for-image-config-query.patch
b/media-libs/mesa-img/files/10.3-egl-dri2-add-support-for-image-config-query.patch
new file mode 100644
index 0000000..25732e7
--- /dev/null
+++
b/media-libs/mesa-img/files/10.3-egl-dri2-add-support-for-image-config-query.patch
@@ -0,0 +1,98 @@
+From 489fa6439e41bbee6523756652214676760fe68f Mon Sep 17 00:00:00 2001
+From: Zach Reizner <za...@chromium.org>
+Date: Wed, 21 Jan 2015 13:23:58 -0800
+Subject: egl/dri2: add support for image, config query, and robustness
+ extensions
+
+BUG=chromium:394868
+TEST=None
+
+Change-Id: I769c52aaad75221719df5ffd9c0d5c50dcdabe2c
+---
+ src/egl/drivers/dri2/egl_dri2.c | 23 +++++++++++++----------
+ src/egl/drivers/dri2/platform_null.c | 12 +++++++++---
+ 2 files changed, 22 insertions(+), 13 deletions(-)
+
+diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
+index e59709f..ee106f8 100644
+--- a/src/egl/drivers/dri2/egl_dri2.c
++++ b/src/egl/drivers/dri2/egl_dri2.c
+@@ -552,6 +552,7 @@ dri2_create_screen(_EGLDisplay *disp)
+ {
+ const __DRIextension **extensions;
+ struct dri2_egl_display *dri2_dpy;
++ unsigned i;
+
+ dri2_dpy = disp->DriverData;
+
+@@ -592,25 +593,27 @@ dri2_create_screen(_EGLDisplay *disp)
+ extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen);
+
+ if (dri2_dpy->dri2) {
+- unsigned i;
+
+ if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions,
extensions))
+ goto cleanup_dri_screen;
+-
+- for (i = 0; extensions[i]; i++) {
+- if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) {
+- dri2_dpy->robustness = (__DRIrobustnessExtension *)
extensions[i];
+- }
+- if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) {
+- dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i];
+- }
+- }
+ } else {
+ assert(dri2_dpy->swrast);
+ if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions,
extensions))
+ goto cleanup_dri_screen;
+ }
+
++ for (i = 0; extensions[i]; i++) {
++ if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) {
++ dri2_dpy->robustness = (__DRIrobustnessExtension *)
extensions[i];
++ }
++ if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) {
++ dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i];
++ }
++ if (strcmp(extensions[i]->name, __DRI_IMAGE) == 0) {
++ dri2_dpy->image = (__DRIimageExtension *) extensions[i];
++ }
++ }
++
+ dri2_setup_screen(disp);
+
+ return EGL_TRUE;
+diff --git a/src/egl/drivers/dri2/platform_null.c
b/src/egl/drivers/dri2/platform_null.c
+index 9c59809..56bc82b 100644
+--- a/src/egl/drivers/dri2/platform_null.c
++++ b/src/egl/drivers/dri2/platform_null.c
+@@ -103,8 +103,13 @@ dri2_initialize_null(_EGLDriver *drv, _EGLDisplay
*disp)
+ }
+
+ if (!driver_loaded) {
+- err = "DRI2: failed to load driver";
+- goto cleanup_display;
++ dri2_dpy->driver_name = strdup("swrast");
++ if (!dri2_load_driver_swrast(disp))
++ {
++ err = "DRI2: failed to load driver";
++ free(dri2_dpy->driver_name);
++ goto cleanup_display;
++ }
+ }
+
+ dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
+@@ -148,7 +153,8 @@ dri2_initialize_null(_EGLDriver *drv, _EGLDisplay
*disp)
+ cleanup_driver:
+ dlclose(dri2_dpy->driver);
+ free(dri2_dpy->driver_name);
+- close(dri2_dpy->fd);
++ if (dri2_dpy->fd >= 0)
++ close(dri2_dpy->fd);
+ cleanup_display:
+ free(dri2_dpy);
+
+--
+2.1.2
+
diff --git
a/media-libs/mesa-img/files/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
b/media-libs/mesa-img/files/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
new file mode 100644
index 0000000..2271fb5
--- /dev/null
+++
b/media-libs/mesa-img/files/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
@@ -0,0 +1,40 @@
+From 24a2a2a86a8c290e57979b346c66de499ae25342 Mon Sep 17 00:00:00 2001
+From: Haixia Shi <hs...@chromium.org>
+Date: Tue, 27 Jan 2015 14:23:08 -0800
+Subject: [PATCH] CHROMIUM: egl/dri2: platform_drm should also try render
node
+ first.
+
+BUG=chromium:446653
+TEST=build chrome with use_mesa_platform_null=1 and mesa with
+platform_gbm and verify that chrome still works
+
+Change-Id: I7d845a7b993f59bfd0595ddc3d18d5091bb74ec5
+---
+ src/egl/drivers/dri2/platform_drm.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/egl/drivers/dri2/platform_drm.c
b/src/egl/drivers/dri2/platform_drm.c
+index 753c60f..3d24deb 100644
+--- a/src/egl/drivers/dri2/platform_drm.c
++++ b/src/egl/drivers/dri2/platform_drm.c
+@@ -589,6 +589,8 @@ static struct dri2_egl_display_vtbl
dri2_drm_display_vtbl = {
+ .get_sync_values = dri2_fallback_get_sync_values,
+ };
+
++#define DRM_RENDER_DEV_NAME "%s/renderD%d"
++
+ EGLBoolean
+ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
+ {
+@@ -608,7 +610,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
+ gbm = disp->PlatformDisplay;
+ if (gbm == NULL) {
+ char buf[64];
+- int n = snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, 0);
++ int n = snprintf(buf, sizeof(buf), DRM_RENDER_DEV_NAME,
DRM_DIR_NAME, 128);
+ if (n != -1 && n < sizeof(buf))
+ fd = open(buf, O_RDWR);
+ if (fd < 0)
+--
+2.1.2
+
diff --git
a/media-libs/mesa-img/files/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
b/media-libs/mesa-img/files/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
new file mode 100644
index 0000000..f9a77ef
--- /dev/null
+++
b/media-libs/mesa-img/files/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
@@ -0,0 +1,26 @@
+From a4433d6dc9c5ab1369da4e7de79a76bc16e32c16 Mon Sep 17 00:00:00 2001
+From: Haixia Shi <hs...@chromium.org>
+Date: Wed, 21 Jan 2015 16:14:41 -0800
+Subject: [PATCH] Report DMABUF_IMPORT
+
+Change-Id: Ib361e9d0f16b33735310e3784c1767a1f5455402
+---
+ src/egl/drivers/dri2/egl_dri2.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
+index e59709f..931ced9 100644
+--- a/src/egl/drivers/dri2/egl_dri2.c
++++ b/src/egl/drivers/dri2/egl_dri2.c
+@@ -534,7 +534,7 @@ dri2_setup_screen(_EGLDisplay *disp)
+ disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
+ disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE;
+ }
+-#ifdef HAVE_DRM_PLATFORM
++#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_NULL_PLATFORM)
+ if (dri2_dpy->image->base.version >= 8 &&
+ dri2_dpy->image->createImageFromDmaBufs) {
+ disp->Extensions.EXT_image_dma_buf_import = EGL_TRUE;
+--
+2.1.2
+
diff --git
a/media-libs/mesa-img/files/10.3-egl-dri2-try-to-use-render-node-if-available.patch
b/media-libs/mesa-img/files/10.3-egl-dri2-try-to-use-render-node-if-available.patch
new file mode 100644
index 0000000..99db028
--- /dev/null
+++
b/media-libs/mesa-img/files/10.3-egl-dri2-try-to-use-render-node-if-available.patch
@@ -0,0 +1,95 @@
+From 0a7438a87787d33717e57c13b3346c4239fb9f64 Mon Sep 17 00:00:00 2001
+From: Haixia Shi <hs...@chromium.org>
+Date: Thu, 15 Jan 2015 17:41:05 -0800
+Subject: [PATCH] egl/dri2: try to use render node if available.
+
+Let mesa platform_null try render node first (/dev/dri/renderD%d) and
+use it if available. If not then fall back to the normal nodes
+(/dev/dri/card%d).
+
+BUG=chromium:448623
+TEST=null_platform_test with chronos
+
+Change-Id: I3eb2087ea70307a36613b884645fab428fb5c203
+---
+ src/egl/drivers/dri2/platform_null.c | 49
+++++++++++++++++++++++-------------
+ 1 file changed, 31 insertions(+), 18 deletions(-)
+
+diff --git a/src/egl/drivers/dri2/platform_null.c
b/src/egl/drivers/dri2/platform_null.c
+index ab5ef49..9d4742a 100644
+--- a/src/egl/drivers/dri2/platform_null.c
++++ b/src/egl/drivers/dri2/platform_null.c
+@@ -55,12 +55,16 @@ null_get_buffers_with_format(__DRIdrawable *
driDrawable,
+ return dri2_surf->buffers;
+ }
+
++static const char* node_path_fmt_card = "/dev/dri/card%d";
++static const char* node_path_fmt_render = "/dev/dri/renderD%d";
++
+ EGLBoolean
+ dri2_initialize_null(_EGLDriver *drv, _EGLDisplay *disp)
+ {
+ struct dri2_egl_display *dri2_dpy;
+ const char* err;
+- int i;
++ int i, render_node;
++ int driver_loaded = 0;
+
+ loader_set_logger(_eglLog);
+
+@@ -70,26 +74,35 @@ dri2_initialize_null(_EGLDriver *drv, _EGLDisplay
*disp)
+
+ disp->DriverData = (void *) dri2_dpy;
+
+- for (i = 0; i < 16; ++i) {
+- char *card_path;
+- if (asprintf(&card_path, "/dev/dri/card%d", i) < 0)
+- continue;
+-
+- dri2_dpy->fd = open(card_path, O_RDWR);
+- free(card_path);
+- if (dri2_dpy->fd < 0)
+- continue;
+-
+- dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd, 0);
+- if (dri2_dpy->driver_name) {
+- if (dri2_load_driver(disp))
+- break;
+- free(dri2_dpy->driver_name);
++ for (render_node = 1; render_node >= 0; --render_node) {
++ const char* node_path_fmt =
++ render_node ? node_path_fmt_render : node_path_fmt_card;
++ const int base = render_node ? 128 : 0;
++ for (i = 0; i < 16; ++i) {
++ char *card_path;
++ if (asprintf(&card_path, node_path_fmt, base + i) < 0)
++ continue;
++
++ dri2_dpy->fd = open(card_path, O_RDWR);
++ free(card_path);
++ if (dri2_dpy->fd < 0)
++ continue;
++
++ dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd,
0);
++ if (dri2_dpy->driver_name) {
++ if (dri2_load_driver(disp)) {
++ driver_loaded = 1;
++ break;
++ }
++ free(dri2_dpy->driver_name);
++ }
++ close(dri2_dpy->fd);
+ }
+- close(dri2_dpy->fd);
++ if (driver_loaded)
++ break;
+ }
+
+- if (i >= 16) {
++ if (!driver_loaded) {
+ err = "DRI2: failed to load driver";
+ goto cleanup_display;
+ }
+--
+2.1.2
+
diff --git
a/media-libs/mesa-img/files/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch
b/media-libs/mesa-img/files/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch
new file mode 100644
index 0000000..68d4e80
--- /dev/null
+++
b/media-libs/mesa-img/files/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch
@@ -0,0 +1,44 @@
+From 7fd17035a7f9c5b6219f1885a41c0385d861d159 Mon Sep 17 00:00:00 2001
+From: Frank Henigman <fjhen...@gmail.com>
+Date: Thu, 19 Feb 2015 10:09:25 -0800
+Subject: [PATCH] intel: fix EGLImage renderbuffer _BaseFormat
+
+Correctly set _BaseFormat field when creating a gl_renderbuffer
+with EGLImage storage.
+
+Signed-off-by: Frank Henigman <fjhen...@google.com>
+---
+ src/mesa/drivers/dri/i915/intel_fbo.c | 3 +--
+ src/mesa/drivers/dri/i965/intel_fbo.c | 2 +-
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c
b/src/mesa/drivers/dri/i915/intel_fbo.c
+index ead1b17..6c2e181 100644
+--- a/src/mesa/drivers/dri/i915/intel_fbo.c
++++ b/src/mesa/drivers/dri/i915/intel_fbo.c
+@@ -287,8 +287,7 @@ intel_image_target_renderbuffer_storage(struct
gl_context *ctx,
+ rb->Width = image->region->width;
+ rb->Height = image->region->height;
+ rb->Format = image->format;
+- rb->_BaseFormat = _mesa_base_fbo_format(&intel->ctx,
+- image->internal_format);
++ rb->_BaseFormat = _mesa_get_format_base_format(image->format);
+ rb->NeedsFinishRenderTexture = true;
+ }
+
+diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c
b/src/mesa/drivers/dri/i965/intel_fbo.c
+index 174cea0..9394018 100644
+--- a/src/mesa/drivers/dri/i965/intel_fbo.c
++++ b/src/mesa/drivers/dri/i965/intel_fbo.c
+@@ -398,7 +398,7 @@ intel_image_target_renderbuffer_storage(struct
gl_context *ctx,
+ rb->Width = image->width;
+ rb->Height = image->height;
+ rb->Format = image->format;
+- rb->_BaseFormat = _mesa_base_fbo_format(ctx, image->internal_format);
++ rb->_BaseFormat = _mesa_get_format_base_format(image->format);
+ rb->NeedsFinishRenderTexture = true;
+ irb->layer_count = 1;
+ }
+--
+2.2.0.rc0.207.ga3a616c
+
diff --git
a/media-libs/mesa-img/files/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
b/media-libs/mesa-img/files/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
new file mode 100644
index 0000000..590c08b
--- /dev/null
+++
b/media-libs/mesa-img/files/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
@@ -0,0 +1,93 @@
+From 6fd2b4291bb87a5dfd89dc2da226d27c2b514d95 Mon Sep 17 00:00:00 2001
+From: Rob Clark <robc...@freedesktop.org>
+Date: Fri, 29 Aug 2014 17:09:29 -0400
+Subject: [PATCH]
+ 10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
+
+---
+ src/gallium/drivers/freedreno/a2xx/fd2_texture.c | 1 +
+ src/gallium/drivers/freedreno/a3xx/fd3_texture.c | 1 +
+ src/gallium/drivers/freedreno/a4xx/fd4_texture.c | 1 +
+ src/gallium/drivers/freedreno/freedreno_surface.c | 1 +
+ src/gallium/drivers/freedreno/freedreno_texture.c | 2 +-
+ src/gallium/drivers/freedreno/freedreno_texture.h | 3 +++
+ 6 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
+index b70eaa6..0a2e3c3 100644
+--- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
++++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
+@@ -135,6 +135,7 @@ fd2_sampler_view_create(struct pipe_context *pctx,
struct pipe_resource *prsc,
+ so->base.texture = prsc;
+ so->base.reference.count = 1;
+ so->base.context = pctx;
++ so->base.sampler_view_destroy = fd_sampler_view_destroy;
+
+ so->tex_resource = rsc;
+ so->fmt = fd2_pipe2surface(cso->format);
+diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
+index 567f6c7..4428333 100644
+--- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
++++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
+@@ -221,6 +221,7 @@ fd3_sampler_view_create(struct pipe_context *pctx,
struct pipe_resource *prsc,
+ so->base.texture = prsc;
+ so->base.reference.count = 1;
+ so->base.context = pctx;
++ so->base.sampler_view_destroy = fd_sampler_view_destroy;
+
+ so->tex_resource = rsc;
+
+diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
+index f9b6dcc..f05c6f1 100644
+--- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
++++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
+@@ -159,6 +159,7 @@ fd4_sampler_view_create(struct pipe_context *pctx,
struct pipe_resource *prsc,
+ so->base.texture = prsc;
+ so->base.reference.count = 1;
+ so->base.context = pctx;
++ so->base.sampler_view_destroy = fd_sampler_view_destroy;
+
+ so->tex_resource = rsc;
+
+diff --git a/src/gallium/drivers/freedreno/freedreno_surface.c
b/src/gallium/drivers/freedreno/freedreno_surface.c
+index 250fe4b..a16f13c 100644
+--- a/src/gallium/drivers/freedreno/freedreno_surface.c
++++ b/src/gallium/drivers/freedreno/freedreno_surface.c
+@@ -51,6 +51,7 @@ fd_create_surface(struct pipe_context *pctx,
+ pipe_resource_reference(&psurf->texture, ptex);
+
+ psurf->context = pctx;
++ psurf->surface_destroy = fd_surface_destroy;
+ psurf->format = surf_tmpl->format;
+ psurf->width = u_minify(ptex->width0, level);
+ psurf->height = u_minify(ptex->height0, level);
+diff --git a/src/gallium/drivers/freedreno/freedreno_texture.c
b/src/gallium/drivers/freedreno/freedreno_texture.c
+index eaa6629..40095b4 100644
+--- a/src/gallium/drivers/freedreno/freedreno_texture.c
++++ b/src/gallium/drivers/freedreno/freedreno_texture.c
+@@ -41,7 +41,7 @@ fd_sampler_state_delete(struct pipe_context *pctx, void
*hwcso)
+ FREE(hwcso);
+ }
+
+-static void
++void
+ fd_sampler_view_destroy(struct pipe_context *pctx,
+ struct pipe_sampler_view *view)
+ {
+diff --git a/src/gallium/drivers/freedreno/freedreno_texture.h
b/src/gallium/drivers/freedreno/freedreno_texture.h
+index 43571a9..a1007d1 100644
+--- a/src/gallium/drivers/freedreno/freedreno_texture.h
++++ b/src/gallium/drivers/freedreno/freedreno_texture.h
+@@ -39,6 +39,9 @@ void fd_set_sampler_views(struct pipe_context *pctx,
unsigned shader,
+ unsigned start, unsigned nr,
+ struct pipe_sampler_view **views);
+
++void fd_sampler_view_destroy(struct pipe_context *pctx,
++ struct pipe_sampler_view *view);
++
+ void fd_texture_init(struct pipe_context *pctx);
+
+ #endif /* FREEDRENO_TEXTURE_H_ */
+--
+2.1.2
+
diff --git a/media-libs/mesa-img/mesa-img-9999.ebuild
b/media-libs/mesa-img/mesa-img-9999.ebuild
index 9aa2f65..ff0dc60 100644
--- a/media-libs/mesa-img/mesa-img-9999.ebuild
+++ b/media-libs/mesa-img/mesa-img-9999.ebuild
@@ -114,6 +114,7 @@
epatch "${FILESDIR}"/10.0-cross-compile.patch
epatch "${FILESDIR}"/9.1-mesa-st-no-flush-front.patch

epatch "${FILESDIR}"/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer.patch
+
epatch "${FILESDIR}"/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
epatch "${FILESDIR}"/10.0-force_s3tc_enable.patch

epatch "${FILESDIR}"/9.0-i965-Allow-the-case-where-multiple-flush-types-are-e.patch
epatch "${FILESDIR}"/8.1-dead-code-local-hack.patch
@@ -137,19 +138,26 @@
epatch "${FILESDIR}"/10.3-egl-dri2-implement-platform_null.patch

epatch "${FILESDIR}"/10.5-Revert-i965-Delete-CACHE_NEW_BLORP_CONST_COLOR_PROG.patch

epatch "${FILESDIR}"/10.5-UPSTREAM-i965-Restore-brw_blorp_clear-for-gen6.patch
+
epatch "${FILESDIR}"/10.3-egl-dri2-try-to-use-render-node-if-available.patch
+
epatch "${FILESDIR}"/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
+
epatch "${FILESDIR}"/10.3-egl-dri2-add-support-for-image-config-query.patch
+
epatch "${FILESDIR}"/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
+
epatch "${FILESDIR}"/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
+
epatch "${FILESDIR}"/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch

# IMG patches
epatch "${FILESDIR}"/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch

epatch "${FILESDIR}"/0004-Ensure-x-creates-pbuffers-with-non-zero-size.patch

epatch "${FILESDIR}"/0005-Generate-options.h-if-any-DRI-driver-is-built.patch
- epatch "${FILESDIR}"/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
- epatch "${FILESDIR}"/0008-Extend-EGL-KHR-sync-object-support.patch
+ epatch "${FILESDIR}"/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
+ epatch "${FILESDIR}"/0001-Extend-EGL-KHR-sync-object-support.patch
epatch "${FILESDIR}"/0015-dri-Add-some-new-image-formats.patch

epatch "${FILESDIR}"/0024-egl-Add-eglQuerySurface-surface-type-check-for-EGL_L.patch
epatch "${FILESDIR}"/0025-egl-clamp-size-to-0-in-_eglFlattenArray.patch
epatch "${FILESDIR}"/0027-egl-x11-Open-the-device-node-only-once.patch

epatch "${FILESDIR}"/0028-dri-set-the-__DRI_API_OPENGL-bit-based-on-max-gl-com.patch
epatch "${FILESDIR}"/0001-GL_EXT_robustness-entry-points.patch
+
epatch "${FILESDIR}"/0049-egl-dri-Add-a-bad-access-error-code-to-the-DRI-inter.patch

base_src_prepare


--
To view, visit https://chromium-review.googlesource.com/261138
To unsubscribe, visit https://chromium-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2581787687fffe3b7fc3391eb103a7e9805b305
Gerrit-PatchSet: 1
Gerrit-Project: chromiumos/overlays/chromiumos-overlay
Gerrit-Branch: master
Gerrit-Owner: Daniel Kurtz <djk...@chromium.org>

Daniel Kurtz (Gerrit)

unread,
Mar 25, 2015, 3:17:49 PM3/25/15
to chromium-...@chromium.org
Daniel Kurtz has uploaded a new change for review.

https://chromium-review.googlesource.com/262446

Change subject: media-libs/mesa-img: Update for img-ddk 1.6@3490026
......................................................................

media-libs/mesa-img: Update for img-ddk 1.6@3490026

mesa-img update for img-ddk release 1.6@3490026

Signed-off-by: Daniel Kurtz <djk...@chromium.org>
Signed-off-by: Rufus Hamade <rufus....@imgtec.com>

BUG=chrome-os-partner:38375
TEST=build image w/ matching img-ddk & kernel-mediatek
=> boots to UI

Change-Id: Ief25ae31585c9fab23b441949715676c4fffd8f4
---
M media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
R
media-libs/mesa-img/files/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
R media-libs/mesa-img/files/0008-Extend-EGL-KHR-sync-object-support.patch
R
media-libs/mesa-img/files/0019-dri-Add-some-new-DRI-formats-and-fourccs.patch
D
media-libs/mesa-img/files/0027-egl-x11-Open-the-device-node-only-once.patch
A media-libs/mesa-img/files/0050-dri-Add-MT12-DRI-fourcc.patch
D
media-libs/mesa-img/files/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
D
media-libs/mesa-img/files/10.3-egl-dri2-add-support-for-image-config-query.patch
D
media-libs/mesa-img/files/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
D
media-libs/mesa-img/files/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
D
media-libs/mesa-img/files/10.3-egl-dri2-try-to-use-render-node-if-available.patch
D
media-libs/mesa-img/files/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch
D
media-libs/mesa-img/files/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
M media-libs/mesa-img/mesa-img-9999.ebuild
14 files changed, 940 insertions(+), 1,672 deletions(-)



diff --git
a/media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
b/media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
index 03d1894..2dfc47b 100644
---
a/media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
+++
b/media-libs/mesa-img/files/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch
@@ -1,6 +1,6 @@
diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2014-09-19 18:23:33.000000000 +0000
-+++ b/configure.ac 2015-02-27 14:29:03.541109249 +0000
++++ b/configure.ac 2015-03-20 17:23:29.710795983 +0000
@@ -30,6 +30,7 @@
LIBDRM_REQUIRED=2.4.38
LIBDRM_RADEON_REQUIRED=2.4.56
@@ -39,7 +39,7 @@
src/mesa/drivers/osmesa/osmesa.pc
diff -Naur a/src/mesa/drivers/dri/Makefile.am
b/src/mesa/drivers/dri/Makefile.am
--- a/src/mesa/drivers/dri/Makefile.am 2014-09-19 18:06:52.000000000 +0000
-+++ b/src/mesa/drivers/dri/Makefile.am 2015-02-27 14:29:03.541109249 +0000
++++ b/src/mesa/drivers/dri/Makefile.am 2015-03-20 17:23:29.710795983 +0000
@@ -36,6 +36,12 @@
MEGADRIVERS += radeon_dri.so
endif
@@ -55,7 +55,7 @@
MEGADRIVERS_DEPS += swrast/libswrast_dri.la
diff -Naur a/src/mesa/drivers/dri/pvr/Makefile.am
b/src/mesa/drivers/dri/pvr/Makefile.am
--- a/src/mesa/drivers/dri/pvr/Makefile.am 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/Makefile.am 2015-02-27 14:29:03.679113949
+0000
++++ b/src/mesa/drivers/dri/pvr/Makefile.am 2015-03-20 17:23:30.090794075
+0000
@@ -0,0 +1,24 @@
+
+include Makefile.sources
@@ -83,7 +83,7 @@
+
diff -Naur a/src/mesa/drivers/dri/pvr/Makefile.sources
b/src/mesa/drivers/dri/pvr/Makefile.sources
--- a/src/mesa/drivers/dri/pvr/Makefile.sources 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/Makefile.sources 2015-02-27
14:29:03.683115549 +0000
++++ b/src/mesa/drivers/dri/pvr/Makefile.sources 2015-03-20
17:23:30.094794475 +0000
@@ -0,0 +1,13 @@
+pvr_INCLUDES = \
+ $(MESA_TOP)/src \
@@ -100,7 +100,7 @@
+ pvr_object_cache.c
diff -Naur a/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h
b/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h
--- a/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h 2015-02-27
14:29:03.675114349 +0000
++++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogl_dispatch.h 2015-03-20
17:23:30.086794575 +0000
@@ -0,0 +1,1130 @@
+#ifndef __g_pvrogl_set_mesa_dispatch_h_
+#define __g_pvrogl_set_mesa_dispatch_h_
@@ -1234,7 +1234,7 @@
+#endif /* __g_pvrogl_set_mesa_dispatch_h_ */
diff -Naur a/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h
b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h
--- a/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h 2015-02-27
14:29:03.685116349 +0000
++++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles1_dispatch.h 2015-03-20
17:23:30.095796375 +0000
@@ -0,0 +1,364 @@
+#ifndef __g_pvrogles1_set_mesa_dispatch_h_
+#define __g_pvrogles1_set_mesa_dispatch_h_
@@ -1602,7 +1602,7 @@
+#endif /* __g_pvrogles1_set_mesa_dispatch_h_ */
diff -Naur a/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h
b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h
--- a/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h 2015-02-27
14:29:03.677115649 +0000
++++ b/src/mesa/drivers/dri/pvr/g_set_mesa_ogles2_dispatch.h 2015-03-20
17:23:30.088795775 +0000
@@ -0,0 +1,585 @@
+#ifndef __g_pvrogles2_set_mesa_dispatch_h_
+#define __g_pvrogles2_set_mesa_dispatch_h_
@@ -2191,8 +2191,8 @@
+#endif /* __g_pvrogles2_set_mesa_dispatch_h_ */
diff -Naur a/src/mesa/drivers/dri/pvr/imgpixfmts.h
b/src/mesa/drivers/dri/pvr/imgpixfmts.h
--- a/src/mesa/drivers/dri/pvr/imgpixfmts.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/imgpixfmts.h 2015-02-27 14:29:03.671116849
+0000
-@@ -0,0 +1,66 @@
++++ b/src/mesa/drivers/dri/pvr/imgpixfmts.h 2015-03-20 17:23:30.082798075
+0000
+@@ -0,0 +1,68 @@

+/*************************************************************************/
/*!
+@File
+@Title Pixel formats
@@ -2236,6 +2236,7 @@
+ IMG_PIXFMT_UNKNOWN = 0,
+ IMG_PIXFMT_R8G8B8A8_UNORM = 31,
+ IMG_PIXFMT_R8G8B8X8_UNORM = 36,
++ IMG_PIXFMT_R8G8_UNORM = 61,
+ IMG_PIXFMT_R8_UNORM = 74,
+ IMG_PIXFMT_B5G6R5_UNORM = 82,
+ IMG_PIXFMT_B5G5R5A1_UNORM = 83,
@@ -2253,6 +2254,7 @@
+ IMG_PIXFMT_YUV420_3PLANE = 174,
+ IMG_PIXFMT_YVU420_3PLANE = 175,
+ IMG_PIXFMT_V8U8Y8A8 = 180,
++ IMG_PIXFMT_YUV8_420_2PLANE_PACK8_P = 245,
+ IMG_PIXFMT_UYVY10_422_1PLANE_PACK10_CUST1 = 248,
+} IMG_PIXFMT;
+
@@ -2261,8 +2263,8 @@
+#endif /* _IMGPIXFMTS_KM_H_ */
diff -Naur a/src/mesa/drivers/dri/pvr/imgyuv.h
b/src/mesa/drivers/dri/pvr/imgyuv.h
--- a/src/mesa/drivers/dri/pvr/imgyuv.h 1970-01-01 00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/imgyuv.h 2015-02-27 14:29:03.670116949 +0000
-@@ -0,0 +1,48 @@
++++ b/src/mesa/drivers/dri/pvr/imgyuv.h 2015-03-20 17:23:30.081875075 +0000
+@@ -0,0 +1,50 @@

+/*************************************************************************/
/*!
+@File
+@Title YUV defines
@@ -2295,25 +2297,27 @@
+
+typedef enum
+{
++ IMG_COLORSPACE_UNDEFINED = 0,
+ IMG_COLORSPACE_BT601_CONFORMANT_RANGE = 1,
+ IMG_COLORSPACE_BT601_FULL_RANGE = 2,
+ IMG_COLORSPACE_BT709_CONFORMANT_RANGE = 3,
+ IMG_COLORSPACE_BT709_FULL_RANGE = 4
-+}IMG_YUV_COLORSPACE;
++} IMG_YUV_COLORSPACE;
+
+typedef enum
+{
++ IMG_CHROMA_INTERP_UNDEFINED = 0,
+ IMG_CHROMA_INTERP_ZERO = 1,
+ IMG_CHROMA_INTERP_QUARTER = 2,
+ IMG_CHROMA_INTERP_HALF = 3,
+ IMG_CHROMA_INTERP_THREEQUARTERS = 4
-+}IMG_YUV_CHROMA_INTERP;
++} IMG_YUV_CHROMA_INTERP;
+
+
+#endif /* _IMGYUV_H_ */
diff -Naur a/src/mesa/drivers/dri/pvr/mesa_context.c
b/src/mesa/drivers/dri/pvr/mesa_context.c
--- a/src/mesa/drivers/dri/pvr/mesa_context.c 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/mesa_context.c 2015-02-27
14:29:03.671116849 +0000
++++ b/src/mesa/drivers/dri/pvr/mesa_context.c 2015-03-20
17:23:30.082798075 +0000
@@ -0,0 +1,215 @@
+/**
+ * \file context.c
@@ -2532,7 +2536,7 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvr_dri_support.h
b/src/mesa/drivers/dri/pvr/pvr_dri_support.h
--- a/src/mesa/drivers/dri/pvr/pvr_dri_support.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvr_dri_support.h 2015-02-27
14:29:03.680116049 +0000
++++ b/src/mesa/drivers/dri/pvr/pvr_dri_support.h 2015-03-20
17:23:30.091796475 +0000
@@ -0,0 +1,348 @@

+/*************************************************************************/
/*!
+@File
@@ -2569,6 +2573,10 @@
+
+#include "imgpixfmts.h"
+
++#if !defined(ARRAY_SIZE)
++#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
++#endif
++
+typedef enum
+{
+ PVRDRI_API_GL,
@@ -2588,7 +2596,7 @@
+ PVRDRI_IMAGE = 1,
+ PVRDRI_IMAGE_FROM_NAMES,
+ PVRDRI_IMAGE_FROM_EGLIMAGE,
-+ PVRDRI_IMAGE_FROM_FD,
++ PVRDRI_IMAGE_FROM_DMABUFS,
+} PVRDRIImageType;
+
+typedef enum
@@ -2599,41 +2607,11 @@
+ PVRDRI_IMAGE_ERROR_BAD_ALLOC,
+} PVRDRIImageError;
+
-+typedef enum
-+{
-+ PVDRI_BUFFER_FLAG_INVALID = 0,
-+
-+ /*
-+ * The buffer is intended for software use only.
-+ * This means that the buffer might not be device compatible.
-+ * This flag should not be used with any other _USE_ flags.
-+ */
-+ PVRDRI_BUFFER_FLAG_USE_SW_ONLY = (1 << 0),
-+
-+ /*
-+ * The buffer is intended to be scanned out by display hardware.
-+ * This means that it must be compatible with the display.
-+ */
-+ PVRDRI_BUFFER_FLAG_USE_SCANOUT = (1 << 1),
-+
-+ /*
-+ * The buffer is intended to be used for a hardware cursor.
-+ * This flag should not be used with any other _USE_ flag.
-+ */
-+ PVRDRI_BUFFER_FLAG_USE_CURSOR = (1 << 2),
-+
-+ /*
-+ * The buffer is intended for rendering.
-+ * This means that it must be compatible with the device
-+ * for which the buffer manager context was created.
-+ */
-+ PVRDRI_BUFFER_FLAG_USE_RENDER = (1 << 3),
-+
-+ /*
-+ * The buffer should be zeroed on creation.
-+ */
-+ PVRDRI_BUFFER_FLAG_CLEAR_ON_CREATE = (1 << 16),
-+} PVRDRI_BUFFER_FLAGS;
++/* The buffer flags should match the __DRI_IMAGE_USE_* flags */
++#define PVDRI_BUFFER_USE_SHARE 0x0001
++#define PVDRI_BUFFER_USE_SCANOUT 0x0002
++#define PVDRI_BUFFER_USE_CURSOR 0x0004
++#define PVDRI_BUFFER_USE_LINEAR 0x0008
+
+typedef struct
+{
@@ -2670,7 +2648,7 @@
+typedef struct PVRDRIScreenImplRec PVRDRIScreenImpl;
+typedef struct PVRDRIContextImplRec PVRDRIContextImpl;
+typedef struct PVRDRIDrawableImplRec PVRDRIDrawableImpl;
-+typedef struct _PVRBM_BUFFER_ PVRBM_BUFFER;
++typedef struct PVRDRIBufferImplRec PVRDRIBufferImpl;
+typedef struct PVRSRV_CLIENT_SYNC_PRIM PVRSRV_CLIENT_SYNC_PRIM;
+
+typedef struct PVRDRIDrawable_TAG PVRDRIDrawable;
@@ -2785,33 +2763,54 @@
+void PVREGLDrawableDestroyConfig(PVRDRIDrawableImpl *psDrawableImpl);
+
+/* Buffer functions */
-+bool PVRDRIAllocateBMBuffer(PVRDRIScreenImpl *psScreenImpl,
-+ int iWidth,
-+ int iHeight,
-+ IMG_PIXFMT ePixFormat,
-+ PVRDRI_BUFFER_FLAGS use,
-+ PVRBM_BUFFER **ppsBMBuffer,
-+ unsigned int *puiMemHandle,
-+ unsigned int *puiExportHandle,
-+ unsigned int *puiStride);
-+PVRBM_BUFFER *PVRDRICreateBMBufferFromExport(PVRDRIScreenImpl
*psScreenImpl,
-+ uint32_t uiName,
-+ uint32_t uiWidth,
-+ uint32_t uiHeight,
-+ uint32_t uiStride,
-+ IMG_PIXFMT
ePixelFormat);
-+PVRBM_BUFFER *PVRDRICreateBMBufferFromSecureExport(PVRDRIScreenImpl
*psScreenImpl,
-+ int fd,
-+ uint32_t
uiWidth,
-+ uint32_t
uiHeight,
-+ uint32_t
uiStride,
-+ IMG_PIXFMT
ePixelFormat);
-+void PVRDRIReleaseBMBuffer(PVRBM_BUFFER *psBMBuffer);
-+bool PVRDRIGetBufferExportHandle(PVRBM_BUFFER *psBMBuffer, int *value);
++PVRDRIBufferImpl *PVRDRIBufferCreate(PVRDRIScreenImpl *psScreenImpl,
++ int iWidth,
++ int iHeight,
++ IMG_PIXFMT ePixFormat,
++ unsigned int uiUseFlags,
++ unsigned int *puiStride);
++
++PVRDRIBufferImpl *PVRDRIBufferCreateFromName(PVRDRIScreenImpl
*psScreenImpl,
++ int iName,
++ int iWidth,
++ int iHeight,
++ unsigned int uiStride,
++ IMG_PIXFMT ePixFormat);
++
++PVRDRIBufferImpl *PVRDRIBufferCreateFromFd(PVRDRIScreenImpl *psScreenImpl,
++ int iFd,
++ int iWidth,
++ int iHeight,
++ unsigned int uiStride,
++ IMG_PIXFMT ePixFormat);
++
++void PVRDRIBufferDestroy(PVRDRIBufferImpl *psBuffer);
++
++int PVRDRIBufferGetFd(PVRDRIBufferImpl *psBuffer);
++
++int PVRDRIBufferGetHandle(PVRDRIBufferImpl *psBuffer);
++
++int PVRDRIBufferGetName(PVRDRIBufferImpl *psBuffer);
++
++bool PVRDRIBufferAttachNativeWriteSync(PVRDRIBufferImpl *psBuffer);
++
++bool PVRDRIBufferAttachNativeReadSync(PVRDRIBufferImpl *psBuffer);
++
++bool PVRDRIBufferCreateNativeWriteSync(PVRDRIBufferImpl *psBuffer);
++
++bool PVRDRIBufferCreateNativeReadSync(PVRDRIBufferImpl *psBuffer);
+
+/* Image functions */
+EGLImage *PVRDRIEGLImageCreate(void);
-+EGLImage *PVRDRIEGLImageCreateFromBuffer(PVRBM_BUFFER *psBuffer);
++EGLImage *PVRDRIEGLImageCreateFromBuffers(int iWidth,
++ int iHeight,
++ int iStride,
++ IMG_PIXFMT ePixelFormat,
++ IMG_YUV_COLORSPACE eColourSpace,
++ IMG_YUV_CHROMA_INTERP eChromaUInterp,
++ IMG_YUV_CHROMA_INTERP eChromaVInterp,
++ PVRDRIBufferImpl **apsBuffers,
++ int iNumBuffers);
+EGLImage *PVRDRIEGLImageDup(EGLImage *psIn);
+
+void PVRDRIEGLImageSetCallbackData(EGLImage *psEGLImage, __DRIimage
*image);
@@ -2862,21 +2861,26 @@
+/* Callbacks into non-impl layer */
+typedef struct
+{
-+ bool (*DrawableGetInfo)(PVRDRIDrawable *psPVRDrawable, bool
bUpdate);
-+ PVRBM_BUFFER *(*DrawableGetBackingBuffer)(PVRDRIDrawable *psPVRDrawable);
-+ bool (*DrawableGetParameters)(PVRDRIDrawable *psPVRDrawable,
-+ PVRBM_BUFFER **psDstBuffer,
-+ PVRBM_BUFFER **psAccumBuffer,
-+ PVRDRIBufferAttribs *psAttribs,
-+ pvrdri_surface_type *eSurfaceType);
-+
-+ PVRDRIImageType (*ImageGetSharedType)(__DRIimage *image);
-+ PVRBM_BUFFER *(*ImageGetSharedBuffer)(__DRIimage *image);
-+ EGLImage *(*ImageGetSharedEGLImage)(__DRIimage *image);
-+ EGLImage *(*ImageGetEGLImage)(__DRIimage *image);
-+ __DRIimage *(*ScreenGetDRIImage)(void *hEGLImage);
-+ void (*RefImage)(__DRIimage *image);
-+ void (*UnrefImage)(__DRIimage *image);
++ bool (*DrawableGetInfo)(PVRDRIDrawable *psPVRDrawable,
bool bUpdate);
++ PVRDRIBufferImpl *(*DrawableGetDstBuffer)(PVRDRIDrawable
*psPVRDrawable);
++ PVRDRIBufferImpl *(*DrawableGetAccumBuffer)(PVRDRIDrawable
*psPVRDrawable);
++ bool (*DrawableGetParameters)(PVRDRIDrawable
*psPVRDrawable,
++ PVRDRIBufferImpl
**psDstBuffer,
++ PVRDRIBufferImpl
**psAccumBuffer,
++ PVRDRIBufferAttribs
*psAttribs,
++ pvrdri_surface_type
*eSurfaceType);
++
++ PVRDRIImageType (*ImageGetSharedType)(__DRIimage *image);
++ PVRDRIBufferImpl *(*ImageGetSharedBuffer)(__DRIimage *image);
++ EGLImage *(*ImageGetSharedEGLImage)(__DRIimage *image);
++ EGLImage *(*ImageGetEGLImage)(__DRIimage *image);
++ __DRIimage *(*ScreenGetDRIImage)(void *hEGLImage);
++ void (*RefImage)(__DRIimage *image);
++ void (*UnrefImage)(__DRIimage *image);
++
++ bool (*BufferAttachNativeWriteSync)(PVRDRIBufferImpl
*psBuffer);
++ bool (*BufferAttachNativeReadSync)(PVRDRIBufferImpl
*psBuffer);
++
+} PVRDRICallbacks;
+
+void PVRDRIRegisterCallbacks(PVRDRICallbacks *callbacks);
@@ -2884,7 +2888,7 @@
+#endif /* defined(__PVRDRIIFCE_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvr_mesa_version.h
b/src/mesa/drivers/dri/pvr/pvr_mesa_version.h
--- a/src/mesa/drivers/dri/pvr/pvr_mesa_version.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvr_mesa_version.h 2015-02-27
14:29:03.670116949 +0000
++++ b/src/mesa/drivers/dri/pvr/pvr_mesa_version.h 2015-03-20
17:23:30.082798075 +0000
@@ -0,0 +1,37 @@

+/*************************************************************************/
/*!
+@File pvr_mesa_version.h
@@ -2925,7 +2929,7 @@
+#endif /* defined(__PVR_MESA_VERSION_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvr_object_cache.c
b/src/mesa/drivers/dri/pvr/pvr_object_cache.c
--- a/src/mesa/drivers/dri/pvr/pvr_object_cache.c 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvr_object_cache.c 2015-02-27
14:29:03.672116549 +0000
++++ b/src/mesa/drivers/dri/pvr/pvr_object_cache.c 2015-03-20
17:23:30.083797075 +0000
@@ -0,0 +1,309 @@

+/*************************************************************************/
/*!
+@File pvr_object_cache.c
@@ -3238,7 +3242,7 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvr_object_cache.h
b/src/mesa/drivers/dri/pvr/pvr_object_cache.h
--- a/src/mesa/drivers/dri/pvr/pvr_object_cache.h 1970-01-01
00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvr_object_cache.h 2015-02-27
14:29:03.675114349 +0000
++++ b/src/mesa/drivers/dri/pvr/pvr_object_cache.h 2015-03-20
17:23:30.086794575 +0000
@@ -0,0 +1,135 @@

+/*************************************************************************/
/*!
+@File pvr_object_cache.h
@@ -3377,8 +3381,8 @@
+#endif /* defined(__PVR_OBJECT_CACHE_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrdrawable.c
b/src/mesa/drivers/dri/pvr/pvrdrawable.c
--- a/src/mesa/drivers/dri/pvr/pvrdrawable.c 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrdrawable.c 2015-02-27 14:29:03.681115949
+0000
-@@ -0,0 +1,656 @@
++++ b/src/mesa/drivers/dri/pvr/pvrdrawable.c 2015-03-20 17:23:30.092796575
+0000
+@@ -0,0 +1,677 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI Surface/Drawable code
@@ -3413,14 +3417,14 @@
+#include "pvrdri.h"
+#include "pvrimage.h"
+
-+static PVRBM_BUFFER *PVRGetBackingBuffer(PVRDRIBuffer *psPVRBuffer)
++static PVRDRIBufferImpl *PVRGetBackingBuffer(PVRDRIBuffer *psPVRBuffer)
+{
+ if (psPVRBuffer)
+ {
+ switch (psPVRBuffer->eBackingType)
+ {
+ case PVRDRI_BUFFER_BACKING_DRI2:
-+ return psPVRBuffer->uBacking.sDRI2.psBMBuffer;
++ return psPVRBuffer->uBacking.sDRI2.psBuffer;
+ case PVRDRI_BUFFER_BACKING_IMAGE:
+ return
PVRDRIImageGetSharedBuffer(psPVRBuffer->uBacking.sImage.psImage);
+ default:
@@ -3471,6 +3475,7 @@
+ uint32_t uBytesPerPixel;
+ PVRDRIBufferAttribs sBufferAttribs;
+ bool bRecreate = false;
++ const PVRDRIImageFormat *psFormat;
+
+ assert(psDRIScreen->image.loader != NULL);
+ assert(psDRIScreen->image.loader->getBuffers);
@@ -3478,6 +3483,14 @@
+ if (psPVRDrawable->bUseInvalidate
&& !psPVRDrawable->bDrawableInfoInvalid)
+ {
+ return true;
++ }
++
++ psFormat =
PVRDRIIMGPixelFormatToImageFormat(psPVRDrawable->ePixelFormat);
++ if (!psFormat)
++ {
++ errorMessage("%s: Unsupported format (format = %u)\n",
++ __func__, psPVRDrawable->ePixelFormat);
++ return false;
+ }
+
+ if (psPVRDrawable->bDoubleBuffered)
@@ -3490,7 +3503,7 @@
+ }
+
+ if (!psDRIScreen->image.loader->getBuffers(psDRIDrawable,
-+ PVRDRIIMGPixelToDRIImageFormat(psPVRDrawable->ePixelFormat),
++ psFormat->iDRIFormat,
+ NULL,
+ psDRIDrawable->loaderPrivate,
+ uiBufferMask,
@@ -3838,15 +3851,14 @@
+
+ psPVRBuffer->eBackingType = PVRDRI_BUFFER_BACKING_DRI2;
+ psPVRBuffer->uBacking.sDRI2.uiName = psDRIBuffer->name;
-+ psPVRBuffer->uBacking.sDRI2.psBMBuffer =
-+ PVRDRICreateBMBufferFromExport(psPVRScreen->psImpl,
-+ psDRIBuffer->name,
-+ psDRIDrawable->w,
-+ psDRIDrawable->h,
-+ psDRIBuffer->pitch,
-+
psPVRDrawable->ePixelFormat);
-+
-+ if (psPVRBuffer->uBacking.sDRI2.psBMBuffer == NULL)
++ psPVRBuffer->uBacking.sDRI2.psBuffer =
++ PVRDRIBufferCreateFromName(psPVRScreen->psImpl,
++ psDRIBuffer->name,
++ psDRIDrawable->w,
++ psDRIDrawable->h,
++ psDRIBuffer->pitch,
++ psPVRDrawable->ePixelFormat);
++ if (!psPVRBuffer->uBacking.sDRI2.psBuffer)
+ {
+ free(psPVRBuffer);
+ return NULL;
@@ -3872,7 +3884,7 @@
+ }
+ else
+ {
-+ PVRDRIReleaseBMBuffer(psPVRBuffer->uBacking.sDRI2.psBMBuffer);
++ PVRDRIBufferDestroy(psPVRBuffer->uBacking.sDRI2.psBuffer);
+ free(psPVRBuffer);
+ }
+}
@@ -3993,16 +4005,29 @@
+ psPVRDrawable->bInitialised = false;
+}
+
-+PVRBM_BUFFER *PVRDRIDrawableGetBackingBuffer(PVRDRIDrawable
*psPVRDrawable)
++PVRDRIBufferImpl *PVRDRIDrawableGetDstBuffer(PVRDRIDrawable
*psPVRDrawable)
+{
-+ PVRDRIBuffer *psPVRBuffer =
PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 0);
++ PVRDRIBuffer *psBuffer =
PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 0);
+
-+ return PVRGetBackingBuffer(psPVRBuffer);
++ return PVRGetBackingBuffer(psBuffer);
++}
++
++PVRDRIBufferImpl *PVRDRIDrawableGetAccumBuffer(PVRDRIDrawable
*psPVRDrawable)
++{
++ PVRDRIBuffer *psBuffer;
++
++ psBuffer = PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 1);
++ if (!psBuffer)
++ {
++ psBuffer = PVRObjectCacheGetObject(psPVRDrawable->hBufferCache, 0);
++ }
++
++ return PVRGetBackingBuffer(psBuffer);
+}
+
+bool PVRDRIDrawableGetParameters(PVRDRIDrawable *psPVRDrawable,
-+ PVRBM_BUFFER **psDstBuffer,
-+ PVRBM_BUFFER **psAccumBuffer,
++ PVRDRIBufferImpl **psDstBuffer,
++ PVRDRIBufferImpl **psAccumBuffer,
+ PVRDRIBufferAttribs *psAttribs,
+ pvrdri_surface_type *eSurfaceType)
+{
@@ -4037,8 +4062,8 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvrdri.c
b/src/mesa/drivers/dri/pvr/pvrdri.c
--- a/src/mesa/drivers/dri/pvr/pvrdri.c 1970-01-01 00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvrdri.c 2015-02-27 14:29:03.679113949 +0000
-@@ -0,0 +1,1489 @@
++++ b/src/mesa/drivers/dri/pvr/pvrdri.c 2015-03-20 17:23:30.090794075 +0000
+@@ -0,0 +1,1532 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI Mesa Driver
@@ -4086,8 +4111,8 @@
+
+typedef struct PVRBufferRec
+{
-+ __DRIbuffer sDRIBuffer;
-+ PVRBM_BUFFER *psBMBuffer;
++ __DRIbuffer sDRIBuffer;
++ PVRDRIBufferImpl *psImpl;
+} PVRBuffer;
+
+extern const __DRIextension *apsScreenExtensions[];
@@ -4209,13 +4234,47 @@
+ bool bSwapBuffers,
+ bool bWaitForHW)
+{
-+ return PVRDRIEGLFlushBuffers(psPVRContext->eAPI,
++ bool res;
++
++ res = PVRDRIEGLFlushBuffers(psPVRContext->eAPI,
+ psPVRContext->psPVRScreen->psImpl,
+ psPVRContext->psImpl,
+ psPVRDrawable ? psPVRDrawable->psImpl :
NULL,
+ bFlushAllSurfaces,
+ bSwapBuffers,
+ bWaitForHW);
++
++ if (res && bSwapBuffers && !bWaitForHW)
++ {
++ PVRDRIBufferImpl *psBuffer = PVRDRIDrawableGetDstBuffer(psPVRDrawable);
++ if (psBuffer == NULL)
++ {
++ __driUtilMessage("%s: Couldn't get destination buffer",
++ __func__);
++
++ return false;
++ }
++
++ res = PVRDRIBufferCreateNativeWriteSync(psBuffer);
++ if (!res)
++ {
++ __driUtilMessage("%s: Couldn't create native write sync",
++ __func__);
++ }
++
++ psBuffer = PVRDRIDrawableGetAccumBuffer(psPVRDrawable);
++ if (psBuffer != NULL)
++ {
++ res = PVRDRIBufferCreateNativeReadSync(psBuffer);
++ if (!res)
++ {
++ __driUtilMessage("%s: Couldn't create native read sync",
++ __func__);
++ }
++ }
++ }
++
++ return res;
+}
+
+static inline bool
@@ -4299,7 +4358,7 @@
+ switch (psPVRBuffer->eBackingType)
+ {
+ case PVRDRI_BUFFER_BACKING_DRI2:
-+ PVRDRIReleaseBMBuffer(psPVRBuffer->uBacking.sDRI2.psBMBuffer);
++ PVRDRIBufferDestroy(psPVRBuffer->uBacking.sDRI2.psBuffer);
+ break;
+ case PVRDRI_BUFFER_BACKING_IMAGE:
+ PVRDRIUnrefImage(psPVRBuffer->uBacking.sImage.psImage);
@@ -4824,16 +4883,19 @@
+ const __DRIconfig **configs;
+ uint32_t uiDisplayCount;
+ PVRDRICallbacks sDRICallbacks = {
-+ .DrawableGetInfo = PVRDRIDrawableGetInfo,
-+ .DrawableGetBackingBuffer = PVRDRIDrawableGetBackingBuffer,
-+ .DrawableGetParameters = PVRDRIDrawableGetParameters,
-+ .ImageGetSharedType = PVRDRIImageGetSharedType,
-+ .ImageGetSharedBuffer = PVRDRIImageGetSharedBuffer,
-+ .ImageGetSharedEGLImage = PVRDRIImageGetSharedEGLImage,
-+ .ImageGetEGLImage = PVRDRIImageGetEGLImage,
-+ .ScreenGetDRIImage = PVRDRIScreenGetDRIImage,
-+ .RefImage = PVRDRIRefImage,
-+ .UnrefImage = PVRDRIUnrefImage
++ .DrawableGetInfo = PVRDRIDrawableGetInfo,
++ .DrawableGetDstBuffer = PVRDRIDrawableGetDstBuffer,
++ .DrawableGetAccumBuffer = PVRDRIDrawableGetAccumBuffer,
++ .DrawableGetParameters = PVRDRIDrawableGetParameters,
++ .ImageGetSharedType = PVRDRIImageGetSharedType,
++ .ImageGetSharedBuffer = PVRDRIImageGetSharedBuffer,
++ .ImageGetSharedEGLImage = PVRDRIImageGetSharedEGLImage,
++ .ImageGetEGLImage = PVRDRIImageGetEGLImage,
++ .ScreenGetDRIImage = PVRDRIScreenGetDRIImage,
++ .RefImage = PVRDRIRefImage,
++ .UnrefImage = PVRDRIUnrefImage,
++ .BufferAttachNativeWriteSync = PVRDRIBufferAttachNativeWriteSync,
++ .BufferAttachNativeReadSync = PVRDRIBufferAttachNativeReadSync
+ };
+
+ if (!PVRLoaderIsSupported(psDRIScreen))
@@ -4895,6 +4957,8 @@
+ psDRIScreen->max_gl_compat_version = 30;
+ psDRIScreen->max_gl_core_version = 33;
+ }
++#else
++ (void) uiDisplayCount;
+#endif
+
+ psDRIScreen->max_gl_es1_version = 11;
@@ -5363,8 +5427,7 @@
+ if (ePixFormat == IMG_PIXFMT_UNKNOWN)
+ {
+ __driUtilMessage("%s: Unknown pixel format: %u",
-+ __func__,
-+ (unsigned)ePixFormat);
++ __func__, uFormat);
+ return NULL;
+ }
+
@@ -5374,18 +5437,22 @@
+ __driUtilMessage("%s: Failed to allocate buffer", __func__);
+ return NULL;
+ }
-+ if (!PVRDRIAllocateBMBuffer(psPVRScreen->psImpl, iWidth, iHeight,
ePixFormat,
-+ PVRDRI_BUFFER_FLAG_USE_RENDER,
-+ &psBuffer->psBMBuffer,
-+ NULL,
-+ &psBuffer->sDRIBuffer.name,
-+ &psBuffer->sDRIBuffer.pitch))
++
++ psBuffer->psImpl = PVRDRIBufferCreate(psPVRScreen->psImpl,
++ iWidth,
++ iHeight,
++ ePixFormat,
++ PVDRI_BUFFER_USE_SHARE,
++ &psBuffer->sDRIBuffer.pitch);
++ if (!psBuffer->psImpl)
+ {
-+ __driUtilMessage("%s: Failed to allocate BM buffer", __func__);
++ __driUtilMessage("%s: Failed to create backing buffer",
++ __func__);
+ goto ErrorFreeDRIBuffer;
+ }
+
+ psBuffer->sDRIBuffer.attachment = uAttachment;
++ psBuffer->sDRIBuffer.name = PVRDRIBufferGetName(psBuffer->psImpl);
+ psBuffer->sDRIBuffer.cpp = uFormat / 8;
+
+ return &psBuffer->sDRIBuffer;
@@ -5402,7 +5469,8 @@
+ PVRBuffer *psBuffer = (PVRBuffer *)psDRIBuffer;
+
+ (void)psDRIScreen;
-+ PVRDRIReleaseBMBuffer(psBuffer->psBMBuffer);
++
++ PVRDRIBufferDestroy(psBuffer->psImpl);
+ free(psBuffer);
+}
+
@@ -5530,8 +5598,8 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvrdri.h
b/src/mesa/drivers/dri/pvr/pvrdri.h
--- a/src/mesa/drivers/dri/pvr/pvrdri.h 1970-01-01 00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvrdri.h 2015-02-27 14:29:03.672116549 +0000
-@@ -0,0 +1,251 @@
++++ b/src/mesa/drivers/dri/pvr/pvrdri.h 2015-03-20 17:23:30.083797075 +0000
+@@ -0,0 +1,272 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI Mesa Driver
@@ -5575,12 +5643,12 @@
+#include "EGL/egl.h"
+#include "pvr_object_cache.h"
+
++/* This should match EGL_MAX_ALLOCS */
++#define DRI_PLANES_MAX 3
++
+#define DRI2_BUFFERS_MAX (3)
+
+#define DRIScreenPrivate(pScreen) ((pScreen)->driverPrivate)
-+#ifndef ARRAY_SIZE
-+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
-+#endif
+
+/** Our PVR related screen data */
+typedef struct PVRDRIScreen_TAG
@@ -5702,7 +5770,7 @@
+ struct
+ {
+ uint32_t uiName;
-+ PVRBM_BUFFER *psBMBuffer;
++ PVRDRIBufferImpl *psBuffer;
+
+ } sDRI2;
+
@@ -5714,6 +5782,22 @@
+
+ PVRQElem sCacheFlushElem;
+} PVRDRIBuffer;
++
++typedef struct PVRDRIImageFormat_TAG
++{
++ IMG_PIXFMT eIMGPixelFormat;
++ int iDRIFourCC;
++ int iDRIFormat;
++ int iDRIComponents;
++ unsigned uiNumPlanes;
++ struct
++ {
++ IMG_PIXFMT eIMGPixelFormat;
++ int iDRIFormat;
++ unsigned int uiWidthShift;
++ unsigned int uiHeightShift;
++ } sPlanes[DRI_PLANES_MAX];
++} PVRDRIImageFormat;
+
+

+/*************************************************************************/
/*!
@@ -5749,11 +5833,15 @@
+const __DRIconfig **PVRDRICreateConfigs(void);
+
+IMG_PIXFMT PVRDRIBPPToIMGPixelFormat(unsigned uFormat);
-+IMG_PIXFMT PVRDRIDRIFourCCToIMGPixelFormat(int iDRIFourCC);
-+IMG_PIXFMT PVRDRIDRIImageToIMGPixelFormat(int iDRIFormat);
-+int PVRDRIIMGPixelFormatToDRIFourCC(IMG_PIXFMT eIMGPixelFormat);
-+uint32_t PVRDRIIMGPixelFormatToDRIImageComponents(IMG_PIXFMT
eIMGPixelFormat);
-+int PVRDRIIMGPixelToDRIImageFormat(IMG_PIXFMT eIMGPixelFormat);
++const PVRDRIImageFormat *PVRDRIFormatToImageFormat(int iDRIFormat);
++const PVRDRIImageFormat *PVRDRIFourCCToImageFormat(int iDRIFourCC);
++const PVRDRIImageFormat *PVRDRIIMGPixelFormatToImageFormat(IMG_PIXFMT
eIMGPixelFormat);
++
++IMG_YUV_COLORSPACE PVRDRIToIMGColourSpace(const PVRDRIImageFormat
*psFormat,
++ enum __DRIYUVColorSpace eDRIColourSpace,
++ enum __DRISampleRange eDRISampleRange);
++IMG_YUV_CHROMA_INTERP PVRDRIChromaSittingToIMGInterp(const
PVRDRIImageFormat *psFormat,
++ enum __DRIChromaSiting eChromaSitting);
+
+

+/*************************************************************************/
/*!
@@ -5766,15 +5854,16 @@
+
+/* Callbacks into non-impl layer */
+bool PVRDRIDrawableGetInfo(PVRDRIDrawable *psPVRDrawable, bool bUpdate);
-+PVRBM_BUFFER *PVRDRIDrawableGetBackingBuffer(PVRDRIDrawable
*psPVRDrawable);
++PVRDRIBufferImpl *PVRDRIDrawableGetDstBuffer(PVRDRIDrawable
*psPVRDrawable);
++PVRDRIBufferImpl *PVRDRIDrawableGetAccumBuffer(PVRDRIDrawable
*psPVRDrawable);
+bool PVRDRIDrawableGetParameters(PVRDRIDrawable *psPVRDrawable,
-+ PVRBM_BUFFER **psDstBuffer,
-+ PVRBM_BUFFER **psAccumBuffer,
++ PVRDRIBufferImpl **psDstBuffer,
++ PVRDRIBufferImpl **psAccumBuffer,
+ PVRDRIBufferAttribs *psAttribs,
+ pvrdri_surface_type *eSurfaceType);
+
+PVRDRIImageType PVRDRIImageGetSharedType(__DRIimage *image);
-+PVRBM_BUFFER *PVRDRIImageGetSharedBuffer(__DRIimage *image);
++PVRDRIBufferImpl *PVRDRIImageGetSharedBuffer(__DRIimage *image);
+EGLImage *PVRDRIImageGetSharedEGLImage(__DRIimage *image);
+EGLImage *PVRDRIImageGetEGLImage(__DRIimage *image);
+
@@ -5785,7 +5874,7 @@
+#endif /* defined(__PVRDRI2_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrext.c
b/src/mesa/drivers/dri/pvr/pvrext.c
--- a/src/mesa/drivers/dri/pvr/pvrext.c 1970-01-01 00:00:00.000000000 +0000
-+++ b/src/mesa/drivers/dri/pvr/pvrext.c 2015-02-27 14:29:03.683115549 +0000
++++ b/src/mesa/drivers/dri/pvr/pvrext.c 2015-03-20 17:23:30.094794475 +0000
@@ -0,0 +1,284 @@

+/*************************************************************************/
/*!
+@File
@@ -6073,8 +6162,8 @@
+};
diff -Naur a/src/mesa/drivers/dri/pvr/pvrimage.c
b/src/mesa/drivers/dri/pvr/pvrimage.c
--- a/src/mesa/drivers/dri/pvr/pvrimage.c 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrimage.c 2015-02-27 14:29:03.683115549
+0000
-@@ -0,0 +1,959 @@
++++ b/src/mesa/drivers/dri/pvr/pvrimage.c 2015-03-20 17:23:30.093796375
+0000
+@@ -0,0 +1,1064 @@

+/*************************************************************************/
/*!
+@File
+@Title DRI IMAGE extension
@@ -6103,6 +6192,7 @@
+*/
/**************************************************************************/
+
+#include <assert.h>
++#include <xf86drm.h>
+
+#include "dri_util.h"
+
@@ -6117,16 +6207,13 @@
+
+ PVRDRIScreen *psPVRScreen;
+
-+ uint32_t ui32Handle;
-+ uint32_t ui32Name;
-+
-+ int format;
-+ uint32_t components;
-+
-+ IMG_PIXFMT eIMGPixFmt;
+ PVRDRIImageType eType;
++ const PVRDRIImageFormat *psFormat;
++ IMG_YUV_COLORSPACE eColourSpace;
++ IMG_YUV_CHROMA_INTERP eChromaUInterp;
++ IMG_YUV_CHROMA_INTERP eChromaVInterp;
+
-+ PVRBM_BUFFER *psBuffer;
++ PVRDRIBufferImpl *apsBuffers[DRI_PLANES_MAX];
+ EGLImage *psEGLImage;
+};
+
@@ -6142,20 +6229,9 @@
+};
+
+
-+/* Only used in asserts, hence __attribute__((unused)) tag */
-+static uint32_t __attribute__((unused)) GetEGLImageStride(EGLImage
*psEGLImage)
-+{
-+ PVRDRIBufferAttribs sAttribs;
-+
-+ PVRDRIEGLImageGetAttribs(psEGLImage, &sAttribs);
-+
-+ return sAttribs.uiStrideInBytes;
-+}
-+
+static struct PVRDRIImageShared *
+CommonImageSharedSetup(PVRDRIImageType eType,
-+ __DRIscreen *screen,
-+ int format)
++ __DRIscreen *screen)
+{
+ struct PVRDRIImageShared *shared;
+
@@ -6165,30 +6241,21 @@
+ return NULL;
+ }
+
-+ shared->eIMGPixFmt = PVRDRIDRIImageToIMGPixelFormat(format);
-+ if (shared->eIMGPixFmt == IMG_PIXFMT_UNKNOWN)
-+ {
-+ errorMessage("%s: Unknown DRI IMAGE pixel format: %d\n", __func__,
format);
-+ goto error;
-+ }
-+
+ shared->psPVRScreen = DRIScreenPrivate(screen);
+ shared->eType = eType;
-+ shared->format = format;
-+ shared->components =
PVRDRIIMGPixelFormatToDRIImageComponents(shared->eIMGPixFmt);
+ shared->iRefCount = 1;
+
++ assert(shared->eColourSpace == IMG_COLORSPACE_UNDEFINED &&
++ shared->eChromaUInterp == IMG_CHROMA_INTERP_UNDEFINED &&
++ shared->eChromaVInterp == IMG_CHROMA_INTERP_UNDEFINED);
++
+ return shared;
-+
-+error:
-+ free(shared);
-+
-+ return NULL;
+}
+
+static void DestroyImageShared(struct PVRDRIImageShared *shared)
+{
+ int iRefCount = __sync_sub_and_fetch(&shared->iRefCount, 1);
++ int i;
+
+ assert(iRefCount >= 0);
+
@@ -6200,11 +6267,18 @@
+ switch (shared->eType)
+ {
+ case PVRDRI_IMAGE_FROM_NAMES:
-+ case PVRDRI_IMAGE_FROM_FD:
-+ case PVRDRI_IMAGE:
-+ PVRDRIReleaseBMBuffer(shared->psBuffer);
++ case PVRDRI_IMAGE_FROM_DMABUFS:
++ for (i = 0; i < ARRAY_SIZE(shared->apsBuffers); i++)
++ {
++ if (shared->apsBuffers[i])
++ {
++ PVRDRIBufferDestroy(shared->apsBuffers[i]);
++ }
++ }
+ break;
-+
++ case PVRDRI_IMAGE:
++ PVRDRIBufferDestroy(shared->apsBuffers[0]);
++ break;
+ case PVRDRI_IMAGE_FROM_EGLIMAGE:
+ PVRDRIEGLImageDestroyExternal(shared->psPVRScreen->psImpl,
+ shared->psEGLImage);
@@ -6223,23 +6297,24 @@
+{
+ struct PVRDRIImageShared *shared;
+ PVRDRIBufferAttribs sAttribs;
-+ int format;
++ const PVRDRIImageFormat *psFormat;
+
+ PVRDRIEGLImageGetAttribs(psEGLImage, &sAttribs);
+
-+ format = PVRDRIIMGPixelToDRIImageFormat(sAttribs.ePixFormat);
-+ if (!format)
++ psFormat = PVRDRIIMGPixelFormatToImageFormat(sAttribs.ePixFormat);
++ if (!psFormat)
+ {
+ return NULL;
+ }
+
-+ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_EGLIMAGE, screen,
format);
++ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_EGLIMAGE, screen);
+ if (!shared)
+ {
+ return NULL;
+ }
+
+ shared->psEGLImage = psEGLImage;
++ shared->psFormat = psFormat;
+
+ return shared;
+}
@@ -6248,38 +6323,71 @@
+CreateImageSharedFromNames(__DRIscreen *screen,
+ int width,
+ int height,
-+ int format,
++ int fourcc,
+ int *names,
+ int num_names,
+ int *strides,
+ int *offsets)
+{
+ struct PVRDRIImageShared *shared;
++ const PVRDRIImageFormat *psFormat;
++ int i;
+
-+ if (num_names != 1 || offsets[0] != 0)
++ psFormat = PVRDRIFourCCToImageFormat(fourcc);
++ if (!psFormat)
+ {
-+ errorMessage("%s: Unsupported parameters (num names: %d, first
offset: %d)\n",
-+ __func__, num_names, offsets[0]);
++ errorMessage("%s: Unsupported DRI FourCC (fourcc = 0x%X)\n",
++ __func__, fourcc);
+ return NULL;
+ }
+
-+ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_NAMES, screen, format);
++ if (psFormat->uiNumPlanes < num_names)
++ {
++ errorMessage("%s: Unexpected number of names for DRI FourCC (names
= %d, fourcc = 0x%X)\n",
++ __func__, num_names, fourcc);
++ return NULL;
++ }
++
++ for (i = 0; i < num_names; i++)
++ {
++ if (offsets[i] != 0)
++ {
++ errorMessage("%s: Offset %d unsupported (value = %d)\n",
++ __func__, i, offsets[i]);
++ return NULL;
++ }
++ }
++
++ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_NAMES, screen);
+ if (!shared)
+ {
+ return NULL;
+ }
+
-+ shared->psBuffer =
PVRDRICreateBMBufferFromExport(shared->psPVRScreen->psImpl,
-+ names[0],
-+ width,
-+ height,
-+ strides[0],
-+ shared->eIMGPixFmt);
-+ if (!shared->psBuffer)
++ for (i = 0; i < num_names; i++)
+ {
-+ errorMessage("%s: Failed to create shared image\n", __func__);
-+ goto ErrorDestroyImage;
++ shared->apsBuffers[i] =
++ PVRDRIBufferCreateFromName(shared->psPVRScreen->psImpl,
++ names[i],
++ width >> psFormat->sPlanes[i].uiWidthShift,
++ height >> psFormat->sPlanes[i].uiHeightShift,
++ strides[i],
++ psFormat->sPlanes[i].eIMGPixelFormat);
++ if (!shared->apsBuffers[i])
++ {
++ errorMessage("%s: Failed to create plane %d for shared image\n",
__func__, i);
++ goto ErrorDestroyImage;
++ }
+ }
++
++ shared->psFormat = psFormat;
++ shared->eColourSpace = PVRDRIToIMGColourSpace(psFormat,
++ __DRI_YUV_COLOR_SPACE_UNDEFINED,
++ __DRI_YUV_RANGE_UNDEFINED);
++ shared->eChromaUInterp = PVRDRIChromaSittingToIMGInterp(psFormat,
++ __DRI_YUV_RANGE_UNDEFINED);
++ shared->eChromaVInterp = PVRDRIChromaSittingToIMGInterp(psFormat,
++ __DRI_YUV_RANGE_UNDEFINED);
+
+ return shared;
+
@@ -6290,33 +6398,81 @@
+}
+
+static struct PVRDRIImageShared *
-+CreateImageSharedFromFd(__DRIscreen *screen,
-+ int width,
-+ int height,
-+ int stride,
-+ int format,
-+ int fd)
++CreateImageSharedFromDmaBufs(__DRIscreen *screen,
++ int width,
++ int height,
++ int fourcc,
++ int *fds,
++ int num_fds,
++ int *strides,
++ int *offsets,
++ enum __DRIYUVColorSpace color_space,
++ enum __DRISampleRange sample_range,
++ enum __DRIChromaSiting horiz_siting,
++ enum __DRIChromaSiting vert_siting,
++ unsigned *error)
+{
+ struct PVRDRIImageShared *shared;
++ const PVRDRIImageFormat *psFormat;
++ int i;
+
-+ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_FD, screen, format);
-+ if (!shared)
++ psFormat = PVRDRIFourCCToImageFormat(fourcc);
++ if (!psFormat)
+ {
++ errorMessage("%s: Unsupported DRI FourCC (fourcc = 0x%X)\n",
++ __func__, fourcc);
++ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
+ return NULL;
+ }
+
-+ shared->psBuffer =
PVRDRICreateBMBufferFromSecureExport(shared->psPVRScreen->psImpl,
-+ fd,
-+ width,
-+ height,
-+ stride,
-+
shared->eIMGPixFmt);
-+ if (!shared->psBuffer)
++ if (psFormat->uiNumPlanes < num_fds)
+ {
-+ errorMessage("%s: Failed to create shared image\n", __func__);
-+ goto ErrorDestroyImage;
++ errorMessage("%s: Unexpected number of fds for format (fds = %d, fourcc
= 0x%X)\n",
++ __func__, num_fds, fourcc);
++ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
++ return NULL;
+ }
-+
++
++ for (i = 0; i < num_fds; i++)
++ {
++ if (offsets[i] != 0)
++ {
++ errorMessage("%s: Offset %d unsupported (value = %d)\n",
++ __func__, i, offsets[i]);
++ *error = __DRI_IMAGE_ERROR_BAD_ACCESS;
++ return NULL;
++ }
++ }
++
++ shared = CommonImageSharedSetup(PVRDRI_IMAGE_FROM_DMABUFS, screen);
++ if (!shared)
++ {
++ *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
++ return NULL;
++ }
++
++ for (i = 0; i < num_fds; i++)
++ {
++ shared->apsBuffers[i] =
++ PVRDRIBufferCreateFromFd(shared->psPVRScreen->psImpl,
++ fds[i],
++ width >> psFormat->sPlanes[i].uiWidthShift,
++ height >> psFormat->sPlanes[i].uiHeightShift,
++ strides[i],
++ psFormat->sPlanes[i].eIMGPixelFormat);
++ if (!shared->apsBuffers[i])
++ {
++ errorMessage("%s: Failed to create plane %d for shared image\n",
__func__, i);
++ *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
++ goto ErrorDestroyImage;
++ }
++ }
++
++ shared->psFormat = psFormat;
++ shared->eColourSpace = PVRDRIToIMGColourSpace(psFormat, color_space,
sample_range);
++ shared->eChromaUInterp = PVRDRIChromaSittingToIMGInterp(psFormat,
horiz_siting);
++ shared->eChromaVInterp = PVRDRIChromaSittingToIMGInterp(psFormat,
vert_siting);
++
+ return shared;
+
+ErrorDestroyImage:
@@ -6334,7 +6490,7 @@
+ int *piStride)
+{
+ struct PVRDRIImageShared *shared;
-+ PVRDRI_BUFFER_FLAGS uiFlags = 0;
++ const PVRDRIImageFormat *psFormat;
+ unsigned int uiStride;
+
+ if ((use & __DRI_IMAGE_USE_CURSOR) && (use & __DRI_IMAGE_USE_SCANOUT))
@@ -6342,39 +6498,33 @@
+ return NULL;
+ }
+
-+ shared = CommonImageSharedSetup(PVRDRI_IMAGE, screen, format);
++ psFormat = PVRDRIFormatToImageFormat(format);
++ if (!psFormat)
++ {
++ errorMessage("%s: Unsupported DRI image format (format = 0x%X)\n",
++ __func__, format);
++ return NULL;
++ }
++
++ shared = CommonImageSharedSetup(PVRDRI_IMAGE, screen);
+ if (!shared)
+ {
+ return NULL;
+ }
+
-+ if (use & __DRI_IMAGE_USE_CURSOR)
-+ {
-+ uiFlags |= PVRDRI_BUFFER_FLAG_USE_CURSOR;
-+ }
-+ else
-+ {
-+ if (use & __DRI_IMAGE_USE_SCANOUT)
-+ {
-+ uiFlags |= PVRDRI_BUFFER_FLAG_USE_SCANOUT;
-+ }
-+
-+ uiFlags |= PVRDRI_BUFFER_FLAG_USE_RENDER;
-+ }
-+
-+ if (!PVRDRIAllocateBMBuffer(shared->psPVRScreen->psImpl,
-+ width,
-+ height,
-+ shared->eIMGPixFmt,
-+ uiFlags,
-+ &shared->psBuffer,
-+ &shared->ui32Handle,
-+ &shared->ui32Name,
-+ &uiStride))
++ shared->apsBuffers[0] = PVRDRIBufferCreate(shared->psPVRScreen->psImpl,
++ width,
++ height,
++ psFormat->eIMGPixelFormat,
++ use,
++ &uiStride);
++ if (!shared->apsBuffers[0])
+ {
+ errorMessage("%s: Failed to create buffer\n", __func__);
+ goto ErrorDestroyImage;
+ }
++
++ shared->psFormat = psFormat;
+
+ *piStride = uiStride;
+
@@ -6437,24 +6587,22 @@
+ int name, int pitch,
+ void *loaderPrivate)
+{
-+ IMG_PIXFMT eIMGPixFmt;
-+ int iFourCC;
++ const PVRDRIImageFormat *psFormat;
+ int iStride;
+ int iOffset;
+
-+ eIMGPixFmt = PVRDRIDRIImageToIMGPixelFormat(format);
-+ iFourCC = PVRDRIIMGPixelFormatToDRIFourCC(eIMGPixFmt);
-+ if (!iFourCC)
++ psFormat = PVRDRIFormatToImageFormat(format);
++ if (!psFormat)
+ {
-+ errorMessage("%s: Unsupported DRI image format (format = %d)\n",
++ errorMessage("%s: Unsupported DRI image format (format = 0x%X)\n",
+ __func__, format);
+ return NULL;
+ }
+
-+ iStride = pitch * PVRDRIPixFmtGetBlockSize(eIMGPixFmt);
++ iStride = pitch * PVRDRIPixFmtGetBlockSize(psFormat->eIMGPixelFormat);
+ iOffset = 0;
+
-+ return PVRDRICreateImageFromNames(screen, width, height, iFourCC,
++ return PVRDRICreateImageFromNames(screen, width, height,
psFormat->iDRIFourCC,
+ &name, 1, &iStride, &iOffset, loaderPrivate);
+}
+
@@ -6588,7 +6736,13 @@
+ return NULL;
+ }
+
-+ image->psEGLImage =
PVRDRIEGLImageCreateFromBuffer(image->psShared->psBuffer);
++ image->psEGLImage = PVRDRIEGLImageCreateFromBuffers(width, height,
iStride,
++ image->psShared->psFormat->eIMGPixelFormat,
++ image->psShared->eColourSpace,
++ image->psShared->eChromaUInterp,
++ image->psShared->eChromaUInterp,
++ &image->psShared->apsBuffers[0],
++ 1);
+ if (!image->psEGLImage)
+ {
+ PVRDRIDestroyImage(image);
@@ -6597,48 +6751,83 @@
+
+ PVRDRIEGLImageSetCallbackData(image->psEGLImage, image);
+
-+ assert(GetEGLImageStride(image->psEGLImage) == iStride);
-+
+ return image;
+}
+
-+GLboolean PVRDRIQueryImage(__DRIimage *image, int attrib, int *value)
++GLboolean PVRDRIQueryImage(__DRIimage *image, int attrib, int *value_ptr)
+{
+ struct PVRDRIImageShared *shared = image->psShared;
+ PVRDRIBufferAttribs sAttribs;
++ int value;
+
+ PVRDRIEGLImageGetAttribs(image->psEGLImage, &sAttribs);
-+
++
++ if (attrib == __DRI_IMAGE_ATTRIB_HANDLE ||
++ attrib == __DRI_IMAGE_ATTRIB_NAME ||
++ attrib == __DRI_IMAGE_ATTRIB_FD)
++ {
++ if (!shared->psFormat ||
++ shared->psFormat->iDRIComponents != __DRI_IMAGE_COMPONENTS_RGBA ||
++ shared->psFormat->iDRIComponents != __DRI_IMAGE_COMPONENTS_RGB)
++ {
++ return GL_FALSE;
++ }
++ }
++
+ switch (attrib)
+ {
+ case __DRI_IMAGE_ATTRIB_STRIDE:
-+ *value = sAttribs.uiStrideInBytes;
++ *value_ptr = sAttribs.uiStrideInBytes;
+ break;
+ case __DRI_IMAGE_ATTRIB_HANDLE:
-+ *value = (int)shared->ui32Handle;
-+ break;
-+ case __DRI_IMAGE_ATTRIB_NAME:
-+ *value = (int)shared->ui32Name;
-+ break;
-+ case __DRI_IMAGE_ATTRIB_FORMAT:
-+ *value = shared->format;
-+ break;
-+ case __DRI_IMAGE_ATTRIB_WIDTH:
-+ *value = sAttribs.uiWidth;
-+ break;
-+ case __DRI_IMAGE_ATTRIB_HEIGHT:
-+ *value = sAttribs.uiHeight;
-+ break;
-+ case __DRI_IMAGE_ATTRIB_COMPONENTS:
-+ if (shared->components == 0)
++ value = PVRDRIBufferGetHandle(shared->apsBuffers[0]);
++ if (value == -1)
+ {
+ return GL_FALSE;
+ }
+
-+ *value = shared->components;
++ *value_ptr = value;
++ break;
++ case __DRI_IMAGE_ATTRIB_NAME:
++ value = PVRDRIBufferGetName(shared->apsBuffers[0]);
++ if (value == -1)
++ {
++ return GL_FALSE;
++ }
++
++ *value_ptr = value;
++ break;
++ case __DRI_IMAGE_ATTRIB_FORMAT:
++ if (!shared->psFormat)
++ {
++ return GL_FALSE;
++ }
++
++ *value_ptr = shared->psFormat->iDRIFormat;
++ break;
++ case __DRI_IMAGE_ATTRIB_WIDTH:
++ *value_ptr = sAttribs.uiWidth;
++ break;
++ case __DRI_IMAGE_ATTRIB_HEIGHT:
++ *value_ptr = sAttribs.uiHeight;
++ break;
++ case __DRI_IMAGE_ATTRIB_COMPONENTS:
++ if (!shared->psFormat)
++ {
++ return GL_FALSE;
++ }
++
++ *value_ptr = shared->psFormat->iDRIComponents;
+ break;
+ case __DRI_IMAGE_ATTRIB_FD:
-+ return PVRDRIGetBufferExportHandle(shared->psBuffer, value);
++ value = PVRDRIBufferGetFd(shared->apsBuffers[0]);
++ if (value == -1)
++ {
++ return GL_FALSE;
++ }
++
++ *value_ptr = value;
++ break;
+ default:
+ return GL_FALSE;
+ }
@@ -6672,8 +6861,21 @@
+
+GLboolean PVRDRIValidateUsage(__DRIimage *image, unsigned int use)
+{
-+ (void)image;
-+ (void)use;
++ /*
++ * Conditionally compile this code as a temporary workaround to allow
++ * building against an unpatched version of libdrm
++ */
++#if defined(DRM_NODE_RENDER)
++ if (use & (__DRI_IMAGE_USE_SHARE | __DRI_IMAGE_USE_SCANOUT |
__DRI_IMAGE_USE_CURSOR))
++ {
++ __DRIscreen *screen = image->psShared->psPVRScreen->psDRIScreen;
++
++ if (drmGetNodeTypeFromFd(screen->fd) == DRM_NODE_RENDER)
++ {
++ return GL_FALSE;
++ }
++ }
++#endif
+
+ return GL_TRUE;
+}
@@ -6685,17 +6887,7 @@
+ void *loaderPrivate)
+{
+ struct __DRIimageRec *image;
-+ IMG_PIXFMT eIMGPixFmt;
-+ int format;
-+
-+ eIMGPixFmt = PVRDRIDRIFourCCToIMGPixelFormat(fourcc);
-+ format = PVRDRIIMGPixelToDRIImageFormat(eIMGPixFmt);
-+ if (!format)
-+ {
-+ errorMessage("%s: Unsupported DRI image FourCC (fourcc = %d)\n",
-+ __func__, fourcc);
-+ return NULL;
-+ }
++ int iStride;
+
+ image = CommonImageSetup(loaderPrivate);
+ if (!image)
@@ -6703,7 +6895,7 @@
+ return NULL;
+ }
+
-+ image->psShared = CreateImageSharedFromNames(screen, width, height,
format,
++ image->psShared = CreateImageSharedFromNames(screen, width, height,
fourcc,
+ names, num_names, strides, offsets);
+ if (!image->psShared)
+ {
@@ -6711,7 +6903,23 @@
+ return NULL;
+ }
+
-+ image->psEGLImage =
PVRDRIEGLImageCreateFromBuffer(image->psShared->psBuffer);
++ if (image->psShared->psFormat->uiNumPlanes == 1)
++ {
++ iStride = strides[0];
++ }
++ else
++ {
++ iStride = width *
PVRDRIPixFmtGetBlockSize(image->psShared->psFormat->eIMGPixelFormat);
++ }
++
++ image->psEGLImage = PVRDRIEGLImageCreateFromBuffers(width, height,
++ iStride,
++ image->psShared->psFormat->eIMGPixelFormat,
++ image->psShared->eColourSpace,
++ image->psShared->eChromaUInterp,
++ image->psShared->eChromaVInterp,
++ &image->psShared->apsBuffers[0],
++ num_names);
+ if (!image->psEGLImage)
+ {
+ PVRDRIDestroyImage(image);
@@ -6822,49 +7030,16 @@
+ int *strides, int *offsets,
+ void *loaderPrivate)
+{
-+ struct __DRIimageRec *image;
-+ IMG_PIXFMT eIMGPixFmt;
-+ int format;
++ unsigned error;
+
-+ if (num_fds != 1 || offsets[0] != 0)
-+ {
-+ errorMessage("%s: Unsupported parameters (num fds %d, first
offset: %d)\n",
-+ __func__, num_fds, offsets[0]);
-+ return NULL;
-+ }
-+
-+ eIMGPixFmt = PVRDRIDRIFourCCToIMGPixelFormat(fourcc);
-+ if (eIMGPixFmt == IMG_PIXFMT_UNKNOWN)
-+ {
-+ errorMessage("%s: Unknown DRI IMAGE FourCC pixel format: %d\n",
__func__, fourcc);
-+ return NULL;
-+ }
-+
-+ format = PVRDRIIMGPixelToDRIImageFormat(eIMGPixFmt);
-+
-+ image = CommonImageSetup(loaderPrivate);
-+ if (!image)
-+ {
-+ return NULL;
-+ }
-+
-+ image->psShared = CreateImageSharedFromFd(screen, width, height,
strides[0], format, fds[0]);
-+ if (!image->psShared)
-+ {
-+ PVRDRIDestroyImage(image);
-+ return NULL;
-+ }
-+
-+ image->psEGLImage =
PVRDRIEGLImageCreateFromBuffer(image->psShared->psBuffer);
-+ if (!image->psEGLImage)
-+ {
-+ PVRDRIDestroyImage(image);
-+ return NULL;
-+ }
-+
-+ assert(GetEGLImageStride(image->psEGLImage) == strides[0]);
-+
-+ return image;
++ return PVRDRICreateImageFromDmaBufs(screen, width, height, fourcc,
++ fds, num_fds, strides, offsets,
++ __DRI_YUV_COLOR_SPACE_UNDEFINED,
++ __DRI_YUV_RANGE_UNDEFINED,
++ __DRI_YUV_CHROMA_SITING_UNDEFINED,
++ __DRI_YUV_CHROMA_SITING_UNDEFINED,
++ &error,
++ loaderPrivate);
+}
+
+__DRIimage *
@@ -6947,38 +7122,51 @@
+ void *loaderPrivate)
+{
+ __DRIimage *image;
-+ IMG_PIXFMT eIMGPixFmt;
-+ int i;
++ int iStride;
+
-+ eIMGPixFmt = PVRDRIDRIFourCCToIMGPixelFormat(fourcc);
-+ if (eIMGPixFmt == IMG_PIXFMT_UNKNOWN)
-+ {
-+ errorMessage("%s: Unsupported DRI image FourCC: %d\n", __func__,
fourcc);
-+ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
-+ return NULL;
-+ }
-+
-+ for (i = 0; i < num_fds; i++)
-+ {
-+ if (offsets[i] != 0)
-+ {
-+ errorMessage("%s: Offset %d unsupported (value = %d)\n",
-+ __func__, i, offsets[i]);
-+ *error = __DRI_IMAGE_ERROR_BAD_ACCESS;
-+ return NULL;
-+ }
-+ }
-+
-+ image = PVRDRICreateImageFromFds(screen,
-+ width, height, fourcc,
-+ fds, num_fds,
-+ strides, offsets,
-+ loaderPrivate);
++ image = CommonImageSetup(loaderPrivate);
+ if (!image)
+ {
+ *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
+ return NULL;
+ }
++
++ image->psShared = CreateImageSharedFromDmaBufs(screen, width, height,
fourcc,
++ fds, num_fds, strides, offsets,
++ color_space, sample_range,
++ horiz_siting, vert_siting,
++ error);
++ if (!image->psShared)
++ {
++ PVRDRIDestroyImage(image);
++ return NULL;
++ }
++
++ if (image->psShared->psFormat->uiNumPlanes == 1)
++ {
++ iStride = strides[0];
++ }
++ else
++ {
++ iStride = width *
PVRDRIPixFmtGetBlockSize(image->psShared->psFormat->eIMGPixelFormat);
++ }
++
++ image->psEGLImage = PVRDRIEGLImageCreateFromBuffers(width, height,
++ iStride,
++ image->psShared->psFormat->eIMGPixelFormat,
++ image->psShared->eColourSpace,
++ image->psShared->eChromaUInterp,
++ image->psShared->eChromaVInterp,
++ &image->psShared->apsBuffers[0],
++ num_fds);
++ if (!image->psEGLImage)
++ {
++ PVRDRIDestroyImage(image);
++ *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
++ return NULL;
++ }
++
++ PVRDRIEGLImageSetCallbackData(image->psEGLImage, image);
+
+ *error = __DRI_IMAGE_ERROR_SUCCESS;
+
@@ -7003,10 +7191,16 @@
+ return image->psShared->eType;
+}
+
-+PVRBM_BUFFER *PVRDRIImageGetSharedBuffer(__DRIimage *pImage)
++PVRDRIBufferImpl *PVRDRIImageGetSharedBuffer(__DRIimage *pImage)
+{
+ assert(pImage->psShared->eType != PVRDRI_IMAGE_FROM_EGLIMAGE);
-+ return pImage->psShared->psBuffer;
++
++ if (pImage->psShared->psFormat->uiNumPlanes == 1)
++ {
++ return pImage->psShared->apsBuffers[0];
++ }
++
++ return NULL;
+}
+
+EGLImage *PVRDRIImageGetSharedEGLImage(__DRIimage *pImage)
@@ -7036,7 +7230,7 @@
+}
diff -Naur a/src/mesa/drivers/dri/pvr/pvrimage.h
b/src/mesa/drivers/dri/pvr/pvrimage.h
--- a/src/mesa/drivers/dri/pvr/pvrimage.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrimage.h 2015-02-27 14:29:03.670116949
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrimage.h 2015-03-20 17:23:30.081875075
+0000
@@ -0,0 +1,94 @@

+/*************************************************************************/
/*!
+@File
@@ -7134,7 +7328,7 @@
+#endif /* !defined(__PVRIMAGE_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrmesa.h
b/src/mesa/drivers/dri/pvr/pvrmesa.h
--- a/src/mesa/drivers/dri/pvr/pvrmesa.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrmesa.h 2015-02-27 14:29:03.680116049
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrmesa.h 2015-03-20 17:23:30.091796475
+0000
@@ -0,0 +1,41 @@

+/*************************************************************************/
/*!
+@File
@@ -7179,7 +7373,7 @@
+#endif /* !defined(__PVRMESA_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrqueue.h
b/src/mesa/drivers/dri/pvr/pvrqueue.h
--- a/src/mesa/drivers/dri/pvr/pvrqueue.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrqueue.h 2015-02-27 14:29:03.680116049
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrqueue.h 2015-03-20 17:23:30.090794075
+0000
@@ -0,0 +1,72 @@

+/*************************************************************************/
/*!
+@File pvrqueue.h
@@ -7255,7 +7449,7 @@
+#endif /* defined(__PVRQUEUE_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrsyncobj.c
b/src/mesa/drivers/dri/pvr/pvrsyncobj.c
--- a/src/mesa/drivers/dri/pvr/pvrsyncobj.c 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrsyncobj.c 2015-02-27 14:29:03.671116849
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrsyncobj.c 2015-03-20 17:23:30.082798075
+0000
@@ -0,0 +1,151 @@

+/*************************************************************************/
/*!
+@File
@@ -7410,7 +7604,7 @@
+#endif /* defined(__DRI_SYNCOBJ) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrsyncobj.h
b/src/mesa/drivers/dri/pvr/pvrsyncobj.h
--- a/src/mesa/drivers/dri/pvr/pvrsyncobj.h 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrsyncobj.h 2015-02-27 14:29:03.684115949
+0000
++++ b/src/mesa/drivers/dri/pvr/pvrsyncobj.h 2015-03-20 17:23:30.094794475
+0000
@@ -0,0 +1,45 @@

+/*************************************************************************/
/*!
+@File
@@ -7459,8 +7653,8 @@
+#endif /* !defined(__PVRSYNCOBJ_H__) */
diff -Naur a/src/mesa/drivers/dri/pvr/pvrutil.c
b/src/mesa/drivers/dri/pvr/pvrutil.c
--- a/src/mesa/drivers/dri/pvr/pvrutil.c 1970-01-01 00:00:00.000000000
+0000
-+++ b/src/mesa/drivers/dri/pvr/pvrutil.c 2015-02-27 14:29:03.676116349
+0000
-@@ -0,0 +1,322 @@
++++ b/src/mesa/drivers/dri/pvr/pvrutil.c 2015-03-20 17:23:30.087796575
+0000
+@@ -0,0 +1,496 @@

+/*************************************************************************/
/*!
+@File
+@Title PVR DRI utility functions
@@ -7497,6 +7691,159 @@
+#include "GL/gl.h"
+
+#include "pvrdri.h"
++
++static const PVRDRIImageFormat g_asFormats[] =
++{
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B8G8R8A8_UNORM,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_ARGB8888,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_ARGB8888,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_RGBA,
++ .uiNumPlanes = 1,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B8G8R8A8_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_ARGB8888,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ },
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_R8G8B8A8_UNORM,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_ABGR8888,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_ABGR8888,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_RGBA,
++ .uiNumPlanes = 1,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_R8G8B8A8_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_ABGR8888,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ },
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B8G8R8X8_UNORM,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_XRGB8888,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_XRGB8888,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_RGB,
++ .uiNumPlanes = 1,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B8G8R8X8_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_XRGB8888,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ },
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_R8G8B8X8_UNORM,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_XBGR8888,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_XBGR8888,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_RGB,
++ .uiNumPlanes = 1,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_R8G8B8X8_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_XBGR8888,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ },
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B5G6R5_UNORM,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_RGB565,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_RGB565,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_RGB,
++ .uiNumPlanes = 1,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B5G6R5_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_RGB565,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ },
++#if defined(__DRI_IMAGE_FORMAT_ARGB4444)
++ /* We patch this format into Mesa */
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B4G4R4A4_UNORM,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_ARGB4444,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_ARGB4444,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_RGBA,
++ .uiNumPlanes = 1,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B4G4R4A4_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_ARGB4444,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ },
++#endif
++#if defined(__DRI_IMAGE_FORMAT_ARGB1555)
++ /* We patch this format into Mesa */
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B5G5R5A1_UNORM,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_ARGB1555,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_ARGB1555,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_RGBA,
++ .uiNumPlanes = 1,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_B5G5R5A1_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_ARGB1555,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ },
++#endif
++#if defined(__DRI_IMAGE_FOURCC_MT12)
++ /* We patch this format into Mesa */
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_YUV8_420_2PLANE_PACK8_P,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_MT12,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_NONE,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_Y_UV,
++ .uiNumPlanes = 2,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_R8_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_R8,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ .sPlanes[1] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_R8G8_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_GR88,
++ .uiWidthShift = 1,
++ .uiHeightShift = 1
++ },
++ },
++#endif
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_YUV420_2PLANE,
++ .iDRIFourCC = __DRI_IMAGE_FOURCC_NV12,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_NONE,
++ .iDRIComponents = __DRI_IMAGE_COMPONENTS_Y_UV,
++ .uiNumPlanes = 2,
++ .sPlanes[0] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_R8_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_R8,
++ .uiWidthShift = 0,
++ .uiHeightShift = 0
++ },
++ .sPlanes[1] =
++ {
++ .eIMGPixelFormat = IMG_PIXFMT_R8G8_UNORM,
++ .iDRIFormat = __DRI_IMAGE_FORMAT_GR88,
++ .uiWidthShift = 1,
++ .uiHeightShift = 1
++ },
++ },
++};
+
+
+/* Standard error message */
@@ -7659,127 +8006,148 @@
+ }
+}
+
-+IMG_PIXFMT PVRDRIDRIFourCCToIMGPixelFormat(int iDRIFourCC)
++const PVRDRIImageFormat *PVRDRIFormatToImageFormat(int iDRIFormat)
+{
-+ switch (iDRIFourCC)
++ unsigned i;
++
++ for (i = 0; i < ARRAY_SIZE(g_asFormats); i++)
+ {
-+ case __DRI_IMAGE_FOURCC_RGB565:
-+ return IMG_PIXFMT_B5G6R5_UNORM;
-+ case __DRI_IMAGE_FOURCC_XRGB8888:
-+ return IMG_PIXFMT_B8G8R8X8_UNORM;
-+ case __DRI_IMAGE_FOURCC_ARGB8888:
-+ return IMG_PIXFMT_B8G8R8A8_UNORM;
-+ case __DRI_IMAGE_FOURCC_ABGR8888:
-+ return IMG_PIXFMT_R8G8B8A8_UNORM;
-+ case __DRI_IMAGE_FOURCC_XBGR8888:
-+ return IMG_PIXFMT_R8G8B8X8_UNORM;
-+ default:
-+ break;
++ if (g_asFormats[i].iDRIFormat == iDRIFormat)
++ {
++ return &g_asFormats[i];
++ }
+ }
+
-+ return IMG_PIXFMT_UNKNOWN;
++ return NULL;
+}
+
-+IMG_PIXFMT PVRDRIDRIImageToIMGPixelFormat(int iDRIFormat)
++const PVRDRIImageFormat *PVRDRIFourCCToImageFormat(int iDRIFourCC)
+{
-+ switch (iDRIFormat)
++ unsigned i;
++
++ for (i = 0; i < ARRAY_SIZE(g_asFormats); i++)
+ {
-+ case __DRI_IMAGE_FORMAT_RGB565:
-+ return IMG_PIXFMT_B5G6R5_UNORM;
-+ case __DRI_IMAGE_FORMAT_XRGB8888:
-+ return IMG_PIXFMT_B8G8R8X8_UNORM;
-+ case __DRI_IMAGE_FORMAT_ARGB8888:
-+ return IMG_PIXFMT_B8G8R8A8_UNORM;
-+ case __DRI_IMAGE_FORMAT_ABGR8888:
-+ return IMG_PIXFMT_R8G8B8A8_UNORM;
-+ case __DRI_IMAGE_FORMAT_XBGR8888:
-+ return IMG_PIXFMT_R8G8B8X8_UNORM;
-+#if defined(__DRI_IMAGE_FORMAT_ARGB4444)
-+ /* We patch this format into Mesa */
-+ case __DRI_IMAGE_FORMAT_ARGB4444:
-+ return IMG_PIXFMT_B4G4R4A4_UNORM;
-+#endif
-+#if defined(__DRI_IMAGE_FORMAT_ARGB1555)
-+ /* We patch this format into Mesa */
-+ case __DRI_IMAGE_FORMAT_ARGB1555:
-+ return IMG_PIXFMT_B5G5R5A1_UNORM;
-+#endif
-+ default:
-+ break;
++ if (g_asFormats[i].iDRIFourCC == iDRIFourCC)
++ {
++ return &g_asFormats[i];
++ }
+ }
+
-+ return IMG_PIXFMT_UNKNOWN;
++ return NULL;
+}
+
-+int PVRDRIIMGPixelFormatToDRIFourCC(IMG_PIXFMT eIMGPixelFormat)
++const PVRDRIImageFormat *PVRDRIIMGPixelFormatToImageFormat(IMG_PIXFMT
eIMGPixelFormat)
+{
-+ switch (eIMGPixelFormat)
++ unsigned i;
++
++ for (i = 0; i < ARRAY_SIZE(g_asFormats); i++)
+ {
-+ case IMG_PIXFMT_B5G6R5_UNORM:
-+ return __DRI_IMAGE_FOURCC_RGB565;
-+ case IMG_PIXFMT_B8G8R8X8_UNORM:
-+ return __DRI_IMAGE_FOURCC_XRGB8888;
-+ case IMG_PIXFMT_B8G8R8A8_UNORM:
-+ return __DRI_IMAGE_FOURCC_ARGB8888;
-+ case IMG_PIXFMT_R8G8B8A8_UNORM:
-+ return __DRI_IMAGE_FOURCC_ABGR8888;
-+ case IMG_PIXFMT_R8G8B8X8_UNORM:
-+ return __DRI_IMAGE_FOURCC_XBGR8888;
-+ default:
-+ break;
++ if (g_asFormats[i].eIMGPixelFormat == eIMGPixelFormat)
++ {
++ return &g_asFormats[i];
++ }
+ }
+
-+ return 0;
++ return NULL;
+}
+
-+uint32_t PVRDRIIMGPixelFormatToDRIImageComponents(IMG_PIXFMT
eIMGPixelFormat)
++/*
++ * The EGL_EXT_image_dma_buf_import says that if a hint is unspecified
then
++ * the implementation may guess based on the pixel format or may fallback
++ * to some default value. Furthermore, if a hint is unsupported then the
++ * implementation may use whichever settings it wants to achieve the
closest
++ * match.
++ */
++IMG_YUV_COLORSPACE PVRDRIToIMGColourSpace(const PVRDRIImageFormat
*psFormat,
++ enum __DRIYUVColorSpace eDRIColourSpace,
++ enum __DRISampleRange eDRISampleRange)
+{
-+ switch (eIMGPixelFormat)
++ switch (psFormat->iDRIComponents)
+ {
-+ case IMG_PIXFMT_B5G6R5_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGB;
-+ case IMG_PIXFMT_B8G8R8X8_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGB;
-+ case IMG_PIXFMT_B8G8R8A8_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGBA;
-+ case IMG_PIXFMT_R8G8B8X8_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGB;
-+ case IMG_PIXFMT_R8G8B8A8_UNORM:
-+ return __DRI_IMAGE_COMPONENTS_RGBA;
-+ default:
++ case __DRI_IMAGE_COMPONENTS_RGB:
++ case __DRI_IMAGE_COMPONENTS_RGBA:
++ return IMG_COLORSPACE_UNDEFINED;
++ case __DRI_IMAGE_COMPONENTS_Y_U_V:
++ case __DRI_IMAGE_COMPONENTS_Y_UV:
++ case __DRI_IMAGE_COMPONENTS_Y_XUXV:
+ break;
++ default:
++ errorMessage("Unrecognised DRI components (components = 0x%X)\n",
++ psFormat->iDRIComponents);
++ assert(0);
++ return IMG_COLORSPACE_UNDEFINED;
+ }
+
-+ return 0;
++ switch (eDRIColourSpace)
++ {
++ case __DRI_YUV_COLOR_SPACE_UNDEFINED:
++ case __DRI_YUV_COLOR_SPACE_ITU_REC601:
++ switch (eDRISampleRange)
++ {
++ case __DRI_YUV_RANGE_UNDEFINED:
++ case __DRI_YUV_NARROW_RANGE:
++ return IMG_COLORSPACE_BT601_CONFORMANT_RANGE;
++ case __DRI_YUV_FULL_RANGE:
++ return IMG_COLORSPACE_BT601_FULL_RANGE;
++ default:
++ errorMessage("Unrecognised DRI sample range (sample range = 0x%X)\n",
++ eDRISampleRange);
++ assert(0);
++ return IMG_COLORSPACE_UNDEFINED;
++ }
++ case __DRI_YUV_COLOR_SPACE_ITU_REC709:
++ case __DRI_YUV_COLOR_SPACE_ITU_REC2020:
++ switch (eDRISampleRange)
++ {
++ case __DRI_YUV_RANGE_UNDEFINED:
++ case __DRI_YUV_NARROW_RANGE:
++ return IMG_COLORSPACE_BT709_CONFORMANT_RANGE;
++ case __DRI_YUV_FULL_RANGE:
++ return IMG_COLORSPACE_BT709_FULL_RANGE;
++ default:
++ errorMessage("Unrecognised DRI sample range (sample range = 0x%X)\n",
++ eDRISampleRange);
++ assert(0);
++ return IMG_COLORSPACE_UNDEFINED;
++ }
++ default:
++ errorMessage("Unrecognised DRI colour space (colour space = 0x%X)\n",
++ eDRIColourSpace);
++ assert(0);
++ return IMG_COLORSPACE_UNDEFINED;
++ }
+}
+
-+int PVRDRIIMGPixelToDRIImageFormat(IMG_PIXFMT eIMGPixelFormat)
++IMG_YUV_CHROMA_INTERP PVRDRIChromaSittingToIMGInterp(const
PVRDRIImageFormat *psFormat,
++ enum __DRIChromaSiting eChromaSitting)
+{
-+ switch (eIMGPixelFormat)
++ switch (psFormat->iDRIComponents)
+ {
-+ case IMG_PIXFMT_B5G6R5_UNORM:
-+ return __DRI_IMAGE_FORMAT_RGB565;
-+ case IMG_PIXFMT_B8G8R8X8_UNORM:
-+ return __DRI_IMAGE_FORMAT_XRGB8888;
-+ case IMG_PIXFMT_B8G8R8A8_UNORM:
-+ return __DRI_IMAGE_FORMAT_ARGB8888;
-+ case IMG_PIXFMT_R8G8B8A8_UNORM:
-+ return __DRI_IMAGE_FORMAT_ABGR8888;
-+ case IMG_PIXFMT_R8G8B8X8_UNORM:
-+ return __DRI_IMAGE_FORMAT_XBGR8888;
-+#if defined(__DRI_IMAGE_FORMAT_ARGB4444)
-+ /* We patch this format into Mesa */
-+ case IMG_PIXFMT_B4G4R4A4_UNORM:
-+ return __DRI_IMAGE_FORMAT_ARGB4444;
-+#endif
-+#if defined(__DRI_IMAGE_FORMAT_ARGB1555)
-+ /* We patch this format into Mesa */
-+ case IMG_PIXFMT_B5G5R5A1_UNORM:
-+ return __DRI_IMAGE_FORMAT_ARGB1555;
-+#endif
-+ default:
++ case __DRI_IMAGE_COMPONENTS_RGB:
++ case __DRI_IMAGE_COMPONENTS_RGBA:
++ return IMG_CHROMA_INTERP_UNDEFINED;
++ case __DRI_IMAGE_COMPONENTS_Y_U_V:
++ case __DRI_IMAGE_COMPONENTS_Y_UV:
++ case __DRI_IMAGE_COMPONENTS_Y_XUXV:
+ break;
++ default:
++ errorMessage("Unrecognised DRI components (components = 0x%X)\n",
++ psFormat->iDRIComponents);
++ assert(0);
++ return IMG_CHROMA_INTERP_UNDEFINED;
+ }
+
-+ return 0;
++ switch (eChromaSitting)
++ {
++ case __DRI_YUV_CHROMA_SITING_UNDEFINED:
++ case __DRI_YUV_CHROMA_SITING_0:
++ return IMG_CHROMA_INTERP_ZERO;
++ case __DRI_YUV_CHROMA_SITING_0_5:
++ return IMG_CHROMA_INTERP_HALF;
++ default:
++ errorMessage("Unrecognised DRI chroma sitting (chroma sitting =
0x%X)\n",
++ eChromaSitting);
++ assert(0);
++ return IMG_CHROMA_INTERP_UNDEFINED;
++ }
+}
diff --git
a/media-libs/mesa-img/files/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
b/media-libs/mesa-img/files/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
similarity index 89%
rename from
media-libs/mesa-img/files/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
rename to
media-libs/mesa-img/files/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
index d8e47ed..b6cebd3 100644
---
a/media-libs/mesa-img/files/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
+++
b/media-libs/mesa-img/files/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
@@ -1,7 +1,7 @@
-From cdda2f5d57775ab538fa035de504542bd0b29c60 Mon Sep 17 00:00:00 2001
+From 0b8f8eb89e62f4127aaf283b74a876299834a774 Mon Sep 17 00:00:00 2001
From: Brendan King <Brenda...@imgtec.com>
Date: Tue, 11 Mar 2014 11:31:26 +0000
-Subject: [PATCH] Add EGL_IMG_context_priority EGL extension.
+Subject: [PATCH 07/29] Add EGL_IMG_context_priority EGL extension.

Add support for the EGL_IMG_context_priority extension to EGL, and the
DRI2 EGL driver.
@@ -18,7 +18,7 @@
9 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h
b/include/GL/internal/dri_interface.h
-index 8c5ceb9..8da1278 100644
+index 7c28c13..6e7cc47 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -926,6 +926,21 @@ struct __DRIdri2LoaderExtensionRec {
@@ -43,7 +43,7 @@
* \name Reasons that __DRIdri2Extension::createContextAttribs might fail
*/
/*@{*/
-@@ -1461,4 +1476,19 @@ struct __DRIimageDriverExtensionRec {
+@@ -1446,4 +1461,19 @@ struct __DRIimageDriverExtensionRec {
__DRIgetAPIMaskFunc getAPIMask;
};

@@ -64,7 +64,7 @@
+
#endif
diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
-index 6a7121b..2472291 100644
+index cc7531c..6348ad8 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -515,6 +515,9 @@ dri2_setup_screen(_EGLDisplay *disp)
@@ -77,17 +77,17 @@
}

if (dri2_dpy->image) {
-@@ -612,6 +615,9 @@ dri2_create_screen(_EGLDisplay *disp)
- if (strcmp(extensions[i]->name, __DRI_IMAGE) == 0) {
- dri2_dpy->image = (__DRIimageExtension *) extensions[i];
+@@ -592,6 +595,9 @@ dri2_create_screen(_EGLDisplay *disp)
+ if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) {
+ dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i];
+ }
++ if (strcmp(extensions[i]->name, __DRI_PRIORITY) == 0) {
++ dri2_dpy->priority = (__DRIpriorityExtension *) extensions[i];
++ }
}
-+ if (strcmp(extensions[i]->name, __DRI_PRIORITY) == 0) {
-+ dri2_dpy->priority = (__DRIpriorityExtension *) extensions[i];
-+ }
- }
-
- dri2_setup_screen(disp);
-@@ -886,7 +892,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay
*disp, _EGLConfig *conf,
+ } else {
+ assert(dri2_dpy->swrast);
+@@ -854,7 +860,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay
*disp, _EGLConfig *conf,
if (dri2_dpy->dri2->base.version >= 3) {
unsigned error;
unsigned num_attribs = 0;
@@ -96,7 +96,7 @@

ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
ctx_attribs[num_attribs++] = dri2_ctx->base.ClientMajorVersion;
-@@ -922,6 +928,28 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay
*disp, _EGLConfig *conf,
+@@ -890,6 +896,28 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay
*disp, _EGLConfig *conf,
ctx_attribs[num_attribs++] = __DRI_CTX_RESET_LOSE_CONTEXT;
}

@@ -126,7 +126,7 @@

dri2_ctx->dri_context =
diff --git a/src/egl/drivers/dri2/egl_dri2.h
b/src/egl/drivers/dri2/egl_dri2.h
-index 8521885..79d9acb 100644
+index 0dd9d69..9ea3b03 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -162,6 +162,7 @@ struct dri2_egl_display
@@ -138,7 +138,7 @@

int own_device;
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
-index 514b91a..ff463b4 100644
+index 70277ab..3bcc964 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -197,6 +197,20 @@ _eglParseContextAttribList(_EGLContext *ctx,
_EGLDisplay *dpy,
@@ -162,7 +162,7 @@
default:
err = EGL_BAD_ATTRIBUTE;
break;
-@@ -380,6 +394,7 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy,
_EGLConfig *conf,
+@@ -377,6 +391,7 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy,
_EGLConfig *conf,
ctx->Flags = 0;
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
ctx->ResetNotificationStrategy = EGL_NO_RESET_NOTIFICATION_KHR;
@@ -170,7 +170,7 @@

err = _eglParseContextAttribList(ctx, dpy, attrib_list);
if (err == EGL_SUCCESS && ctx->Config) {
-@@ -440,6 +455,9 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLContext *c,
+@@ -437,6 +452,9 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLContext *c,
case EGL_RENDER_BUFFER:
*value = _eglQueryContextRenderBuffer(c);
break;
@@ -218,7 +218,7 @@
}

diff --git a/src/mesa/drivers/dri/common/dri_util.c
b/src/mesa/drivers/dri/common/dri_util.c
-index d6e875f..70c5fce 100644
+index 6c78928..4865f0d 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -310,6 +310,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
@@ -239,7 +239,7 @@
default:
/* We can't create a context that satisfies the requirements of an
* attribute that we don't understand. Return failure.
-@@ -429,6 +433,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
+@@ -431,6 +435,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
context->driScreenPriv = screen;
context->driDrawablePriv = NULL;
context->driReadablePriv = NULL;
diff --git
a/media-libs/mesa-img/files/0001-Extend-EGL-KHR-sync-object-support.patch
b/media-libs/mesa-img/files/0008-Extend-EGL-KHR-sync-object-support.patch
similarity index 94%
rename from
media-libs/mesa-img/files/0001-Extend-EGL-KHR-sync-object-support.patch
rename to
media-libs/mesa-img/files/0008-Extend-EGL-KHR-sync-object-support.patch
index 0dce497..98204a1 100644
---
a/media-libs/mesa-img/files/0001-Extend-EGL-KHR-sync-object-support.patch
+++
b/media-libs/mesa-img/files/0008-Extend-EGL-KHR-sync-object-support.patch
@@ -1,7 +1,7 @@
-From 2eb5457df31eff647b8387a39216d1e0fd16fee2 Mon Sep 17 00:00:00 2001
+From 014c9e5aaaff158b5b422debf8c7863d6641e548 Mon Sep 17 00:00:00 2001
From: Brendan King <Brenda...@imgtec.com>
Date: Tue, 11 Mar 2014 11:41:07 +0000
-Subject: [PATCH] Extend EGL KHR sync object support.
+Subject: [PATCH 08/29] Extend EGL KHR sync object support.

Extend EGL_KHR_fence_sync support in the DRI2 EGL driver.
Add EGL_KHR_wait_sync support to EGL and the DRI2 EGL driver.
@@ -18,10 +18,10 @@
9 files changed, 237 insertions(+), 5 deletions(-)

diff --git a/include/GL/internal/dri_interface.h
b/include/GL/internal/dri_interface.h
-index 8da1278..f7bb179 100644
+index 6e7cc47..76e9683 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
-@@ -1491,4 +1491,38 @@ struct __DRIpriorityExtensionRec {
+@@ -1476,4 +1476,38 @@ struct __DRIpriorityExtensionRec {
__DRIextension base;
};

@@ -61,7 +61,7 @@
+
#endif
diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
-index 2472291..1b577ac 100644
+index 6348ad8..3697579 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -518,6 +518,13 @@ dri2_setup_screen(_EGLDisplay *disp)
@@ -78,17 +78,17 @@
}

if (dri2_dpy->image) {
-@@ -618,6 +625,9 @@ dri2_create_screen(_EGLDisplay *disp)
- if (strcmp(extensions[i]->name, __DRI_PRIORITY) == 0) {
- dri2_dpy->priority = (__DRIpriorityExtension *) extensions[i];
+@@ -598,6 +605,9 @@ dri2_create_screen(_EGLDisplay *disp)
+ if (strcmp(extensions[i]->name, __DRI_PRIORITY) == 0) {
+ dri2_dpy->priority = (__DRIpriorityExtension *) extensions[i];
+ }
++ if (strcmp(extensions[i]->name, __DRI_SYNCOBJ) == 0) {
++ dri2_dpy->syncobj = (__DRIsyncObjExtension *) extensions[i];
++ }
}
-+ if (strcmp(extensions[i]->name, __DRI_SYNCOBJ) == 0) {
-+ dri2_dpy->syncobj = (__DRIsyncObjExtension *) extensions[i];
-+ }
- }
-
- dri2_setup_screen(disp);
-@@ -2116,6 +2126,144 @@ dri2_query_wayland_buffer_wl(_EGLDriver *drv,
_EGLDisplay *disp,
+ } else {
+ assert(dri2_dpy->swrast);
+@@ -2109,6 +2119,144 @@ dri2_query_wayland_buffer_wl(_EGLDriver *drv,
_EGLDisplay *disp,
}
#endif

@@ -233,7 +233,7 @@
static void
dri2_unload(_EGLDriver *drv)
{
-@@ -2227,6 +2375,12 @@ _eglBuiltInDriverDRI2(const char *args)
+@@ -2220,6 +2368,12 @@ _eglBuiltInDriverDRI2(const char *args)
#endif
dri2_drv->base.API.GetSyncValuesCHROMIUM =
dri2_get_sync_values_chromium;

@@ -247,7 +247,7 @@
dri2_drv->base.Unload = dri2_unload;

diff --git a/src/egl/drivers/dri2/egl_dri2.h
b/src/egl/drivers/dri2/egl_dri2.h
-index 79d9acb..e158d2c 100644
+index 9ea3b03..b50ada1 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -72,6 +72,7 @@
@@ -266,7 +266,7 @@
int fd;

int own_device;
-@@ -288,9 +290,17 @@ struct dri2_egl_image
+@@ -287,9 +289,17 @@ struct dri2_egl_image
#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
#define DRI_CONF_VBLANK_ALWAYS_SYNC 3

diff --git
a/media-libs/mesa-img/files/0015-dri-Add-some-new-image-formats.patch
b/media-libs/mesa-img/files/0019-dri-Add-some-new-DRI-formats-and-fourccs.patch
similarity index 72%
rename from
media-libs/mesa-img/files/0015-dri-Add-some-new-image-formats.patch
rename to
media-libs/mesa-img/files/0019-dri-Add-some-new-DRI-formats-and-fourccs.patch
index 8203faa..9f90ade 100644
--- a/media-libs/mesa-img/files/0015-dri-Add-some-new-image-formats.patch
+++
b/media-libs/mesa-img/files/0019-dri-Add-some-new-DRI-formats-and-fourccs.patch
@@ -1,16 +1,16 @@
-From e6eb55f55e1cb595e597732aa9440c13815de23e Mon Sep 17 00:00:00 2001
+From 0994b800bc4cf2ecdaa43258648b6685353a824c Mon Sep 17 00:00:00 2001
From: Frank Binns <frank...@imgtec.com>
Date: Thu, 5 Jun 2014 12:07:01 +0100
-Subject: [PATCH 15/29] dri: Add some new image formats
+Subject: [PATCH 19/49] dri: Add some new DRI formats and fourccs

-Add new __DRI_IMAGE_FORMAT_ARGB4444 and __DRI_IMAGE_FORMAT_ARGB1555
formats.
+Add ARGB4444 and ARGB1555 DRI formats and fourccs.
---
- include/GL/internal/dri_interface.h | 2 ++
+ include/GL/internal/dri_interface.h | 4 ++++
src/mesa/drivers/dri/common/dri_util.c | 8 ++++++++
- 2 files changed, 10 insertions(+)
+ 2 files changed, 12 insertions(+)

diff --git a/include/GL/internal/dri_interface.h
b/include/GL/internal/dri_interface.h
-index 895cd65..88a1dbb 100644
+index 181e1b4..1a3ad04 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1047,6 +1047,8 @@ struct __DRIdri2ExtensionRec {
@@ -22,6 +22,15 @@

#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
+@@ -1061,6 +1063,8 @@ struct __DRIdri2ExtensionRec {
+ * \since 5
+ */
+
++#define __DRI_IMAGE_FOURCC_ARGB4444 0x32315241
++#define __DRI_IMAGE_FOURCC_ARGB1555 0x35315241
+ #define __DRI_IMAGE_FOURCC_RGB565 0x36314752
+ #define __DRI_IMAGE_FOURCC_ARGB8888 0x34325241
+ #define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258
diff --git a/src/mesa/drivers/dri/common/dri_util.c
b/src/mesa/drivers/dri/common/dri_util.c
index 4865f0d..951a391 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
@@ -49,5 +58,5 @@
return MESA_FORMAT_NONE;
}
--
-1.9.1
+1.8.5.4.gfdaaaa2

diff --git
a/media-libs/mesa-img/files/0027-egl-x11-Open-the-device-node-only-once.patch
b/media-libs/mesa-img/files/0027-egl-x11-Open-the-device-node-only-once.patch
deleted file mode 100644
index 493cca5..0000000
---
a/media-libs/mesa-img/files/0027-egl-x11-Open-the-device-node-only-once.patch
+++ /dev/null
@@ -1,223 +0,0 @@
-From 0d9d332ea92fbf31aaf304db9f0c8b09517570fe Mon Sep 17 00:00:00 2001
-From: Frank Binns <frank...@imgtec.com>
-Date: Wed, 9 Jul 2014 10:05:09 +0100
-Subject: [PATCH] egl/x11: Open the device node only once
-
-The PVR driver doesn't support the DRM device node being opened multiple
-times within a single process. For the time being, workaround this by only
-opening the device node once if a process attempts to create multiple EGL
-displays.
----
- src/egl/drivers/dri2/egl_dri2.c | 14 ++---
- src/egl/drivers/dri2/egl_dri2.h | 3 +
- src/egl/drivers/dri2/platform_x11.c | 111
+++++++++++++++++++++++++++++-------
- 3 files changed, 101 insertions(+), 27 deletions(-)
-
-diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
-index f038226..70f77bc 100644
---- a/src/egl/drivers/dri2/egl_dri2.c
-+++ b/src/egl/drivers/dri2/egl_dri2.c
-@@ -716,6 +716,12 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
- _eglReleaseDisplayResources(drv, disp);
- _eglCleanupDisplay(disp);
-
-+#ifdef HAVE_X11_PLATFORM
-+ if (disp->Platform == _EGL_PLATFORM_X11) {
-+ dri2_terminate_x11(drv, disp);
-+ return EGL_TRUE;
-+ }
-+#endif
- if (dri2_dpy->own_dri_screen)
- dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
- if (dri2_dpy->fd)
-@@ -726,13 +732,7 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
- free(dri2_dpy->driver_name);
-
- switch (disp->Platform) {
--#ifdef HAVE_X11_PLATFORM
-- case _EGL_PLATFORM_X11:
-- if (dri2_dpy->own_device) {
-- xcb_disconnect(dri2_dpy->conn);
-- }
-- break;
--#endif
-+
- #ifdef HAVE_DRM_PLATFORM
- case _EGL_PLATFORM_DRM:
- if (dri2_dpy->own_device) {
-diff --git a/src/egl/drivers/dri2/egl_dri2.h
b/src/egl/drivers/dri2/egl_dri2.h
-index e158d2c..0420158 100644
---- a/src/egl/drivers/dri2/egl_dri2.h
-+++ b/src/egl/drivers/dri2/egl_dri2.h
-@@ -334,6 +334,9 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay
*disp,
- EGLBoolean
- dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp);
-
-+void
-+dri2_terminate_x11(_EGLDriver *drv, _EGLDisplay *disp);
-+
- EGLBoolean
- dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp);
-
-diff --git a/src/egl/drivers/dri2/platform_x11.c
b/src/egl/drivers/dri2/platform_x11.c
-index cb305a6..af01545 100644
---- a/src/egl/drivers/dri2/platform_x11.c
-+++ b/src/egl/drivers/dri2/platform_x11.c
-@@ -40,9 +40,14 @@
- #include <sys/types.h>
- #include <sys/stat.h>
-
-+#include "eglglobals.h"
- #include "egl_dri2.h"
- #include "egl_dri2_fallbacks.h"
-
-+static int g_fd_refcnt = 0;
-+static int g_fd = -1;
-+static char *g_fd_devnode;
-+
- static EGLBoolean
- dri2_x11_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface
*surf,
- EGLint interval);
-@@ -633,13 +638,13 @@ dri2_x11_authenticate(_EGLDisplay *disp, uint32_t id)
- }
-
- static EGLBoolean
--dri2_x11_local_authenticate(_EGLDisplay *disp)
-+dri2_x11_local_authenticate(_EGLDisplay *disp, int fd)
- {
- #ifdef HAVE_LIBDRM
- struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
- drm_magic_t magic;
-
-- if (drmGetMagic(dri2_dpy->fd, &magic)) {
-+ if (drmGetMagic(fd, &magic)) {
- _eglLog(_EGL_WARNING, "DRI2: failed to get drm magic");
- return EGL_FALSE;
- }
-@@ -1249,27 +1254,49 @@ dri2_initialize_x11_dri2(_EGLDriver *drv,
_EGLDisplay *disp)
- if (!dri2_load_driver(disp))
- goto cleanup_conn;
-
-+ _eglLockMutex(_eglGlobal.Mutex);
-+ if (g_fd_refcnt == 0) {
-+ assert(g_fd == -1);
-+ assert(g_fd_devnode == NULL);
-+
- #ifdef O_CLOEXEC
-- dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC);
-- if (dri2_dpy->fd == -1 && errno == EINVAL)
-+ g_fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC);
-+ if (g_fd == -1 && errno == EINVAL)
- #endif
-- {
-- dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
-- if (dri2_dpy->fd != -1)
-- fcntl(dri2_dpy->fd, F_SETFD, fcntl(dri2_dpy->fd, F_GETFD) |
-- FD_CLOEXEC);
-- }
-- if (dri2_dpy->fd == -1) {
-- _eglLog(_EGL_WARNING,
-- "DRI2: could not open %s (%s)", dri2_dpy->device_name,
-- strerror(errno));
-- goto cleanup_driver;
-- }
-+ {
-+ g_fd = open(dri2_dpy->device_name, O_RDWR);
-+ if (g_fd != -1)
-+ fcntl(g_fd, F_SETFD, fcntl(g_fd, F_GETFD) |
-+ FD_CLOEXEC);
-+ }
-+ if (g_fd == -1) {
-+ _eglLog(_EGL_WARNING,
-+ "DRI2: could not open %s (%s)", dri2_dpy->device_name,
-+ strerror(errno));
-+ _eglUnlockMutex(_eglGlobal.Mutex);
-+ goto cleanup_driver;
-+ }
-
-- if (dri2_dpy->conn) {
-- if (!dri2_x11_local_authenticate(disp))
-- goto cleanup_fd;
-+ if (dri2_dpy->conn) {
-+ if (!dri2_x11_local_authenticate(disp, g_fd)) {
-+ close(g_fd);
-+ g_fd = -1;
-+ _eglUnlockMutex(_eglGlobal.Mutex);
-+ goto cleanup_driver;
-+ }
-+ }
-+
-+ g_fd_devnode = strdup(dri2_dpy->device_name);
- }
-+ g_fd_refcnt++;
-+ _eglUnlockMutex(_eglGlobal.Mutex);
-+
-+ dri2_dpy->fd = g_fd;
-+
-+ if (strcmp(g_fd_devnode, dri2_dpy->device_name))
-+ _eglLog(_EGL_WARNING,
-+ "DRI2: using %s instead of %s",
-+ g_fd_devnode, dri2_dpy->device_name);
-
- if (dri2_dpy->dri2_minor >= 1) {
- dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
-@@ -1333,7 +1360,17 @@ dri2_initialize_x11_dri2(_EGLDriver *drv,
_EGLDisplay *disp)
- _eglCleanupDisplay(disp);
- dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
- cleanup_fd:
-- close(dri2_dpy->fd);
-+ _eglLockMutex(_eglGlobal.Mutex);
-+ if (--g_fd_refcnt == 0) {
-+ close(g_fd);
-+ g_fd = -1;
-+
-+ if (g_fd_devnode) {
-+ free(g_fd_devnode);
-+ g_fd_devnode = NULL;
-+ }
-+ }
-+ _eglUnlockMutex(_eglGlobal.Mutex);
- cleanup_driver:
- dlclose(dri2_dpy->driver);
- cleanup_conn:
-@@ -1363,3 +1400,37 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay
*disp)
- return initialized;
- }
-
-+void
-+dri2_terminate_x11(_EGLDriver *drv, _EGLDisplay *disp)
-+{
-+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-+
-+ if (dri2_dpy->own_dri_screen)
-+ dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
-+
-+ if (dri2_dpy->fd) {
-+ _eglLockMutex(_eglGlobal.Mutex);
-+ if (--g_fd_refcnt == 0) {
-+ close(g_fd);
-+ g_fd = -1;
-+
-+ if (g_fd_devnode) {
-+ free(g_fd_devnode);
-+ g_fd_devnode = NULL;
-+ }
-+ }
-+ _eglUnlockMutex(_eglGlobal.Mutex);
-+ }
-+
-+ if (dri2_dpy->driver)
-+ dlclose(dri2_dpy->driver);
-+
-+ free(dri2_dpy->device_name);
-+
-+ if (dri2_dpy->own_device)
-+ xcb_disconnect(dri2_dpy->conn);
-+
-+ free(dri2_dpy);
-+ disp->DriverData = NULL;
-+}
-+
---
-1.9.1
-
diff --git a/media-libs/mesa-img/files/0050-dri-Add-MT12-DRI-fourcc.patch
b/media-libs/mesa-img/files/0050-dri-Add-MT12-DRI-fourcc.patch
new file mode 100644
index 0000000..9fb4d9b
--- /dev/null
+++ b/media-libs/mesa-img/files/0050-dri-Add-MT12-DRI-fourcc.patch
@@ -0,0 +1,38 @@
+From 45e161cd5c4d48df2093a84c0adfdbceb1ac6f6e Mon Sep 17 00:00:00 2001
+From: Frank Binns <frank...@imgtec.com>
+Date: Thu, 19 Mar 2015 14:07:23 +0000
+Subject: [PATCH 50/50] dri: Add MT12 DRI fourcc
+
+Add MT12 DRI fourcc that corresponds to DRM_FORMAT_MT12.
+---
+ include/GL/internal/dri_interface.h | 1 +
+ src/egl/drivers/dri2/egl_dri2.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/include/GL/internal/dri_interface.h
b/include/GL/internal/dri_interface.h
+index 18152ac..6a1de35 100644
+--- a/include/GL/internal/dri_interface.h
++++ b/include/GL/internal/dri_interface.h
+@@ -1079,6 +1079,7 @@ struct __DRIdri2ExtensionRec {
+ #define __DRI_IMAGE_FOURCC_NV12 0x3231564e
+ #define __DRI_IMAGE_FOURCC_NV16 0x3631564e
+ #define __DRI_IMAGE_FOURCC_YUYV 0x56595559
++#define __DRI_IMAGE_FOURCC_MT12 0x3231544D
+
+
+ /**
+diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
+index 740766f..876315c 100644
+--- a/src/egl/drivers/dri2/egl_dri2.c
++++ b/src/egl/drivers/dri2/egl_dri2.c
+@@ -1734,6 +1734,7 @@ dri2_check_dma_buf_format(const _EGLImageAttribs
*attrs)
+ case DRM_FORMAT_NV21:
+ case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV61:
++ case DRM_FORMAT_MT12:
+ plane_n = 2;
+ break;
+ case DRM_FORMAT_YUV410:
+--
+1.8.5.4.gfdaaaa2
+
diff --git
a/media-libs/mesa-img/files/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
b/media-libs/mesa-img/files/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
deleted file mode 100644
index 4fd0081..0000000
---
a/media-libs/mesa-img/files/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
+++ /dev/null
@@ -1,521 +0,0 @@
-From 639b602a74d9c4e4d5b79edeb10609af711cb757 Mon Sep 17 00:00:00 2001
-From: Zach Reizner <za...@chromium.org>
-Date: Fri, 23 Jan 2015 10:43:26 -0800
-Subject: dri: add swrast support on top of prime imported buffers
-
-TEST=null_platform_test /dev/dri/card0
-BUG=chromium:394868
-CQ-DEPEND=CL:242570
-
-Change-Id: I89cc8b4ba8e7120a1a1e7ed8b76c34632488aa88
----
- src/gallium/state_trackers/dri/Makefile.am | 1 +
- src/gallium/state_trackers/dri/drisw.c | 126 +++++++++++++++++
- src/gallium/winsys/sw/dri/Makefile.am | 5 +
- src/gallium/winsys/sw/dri/dri_sw_winsys.c | 220
+++++++++++++++++++++++++++--
- 4 files changed, 337 insertions(+), 15 deletions(-)
-
-diff --git a/src/gallium/state_trackers/dri/Makefile.am
b/src/gallium/state_trackers/dri/Makefile.am
-index 5d701f7..865de78 100644
---- a/src/gallium/state_trackers/dri/Makefile.am
-+++ b/src/gallium/state_trackers/dri/Makefile.am
-@@ -30,6 +30,7 @@ AM_CPPFLAGS = \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/src/mapi \
- -I$(top_srcdir)/src/mesa \
-+ -I$(top_srcdir)/src/gallium/include/state_tracker \
- -I$(top_srcdir)/src/gallium/state_trackers/dri/common \
- -I$(top_srcdir)/src/mesa/drivers/dri/common \
- -I$(top_builddir)/src/mesa/drivers/dri/common \
-diff --git a/src/gallium/state_trackers/dri/drisw.c
b/src/gallium/state_trackers/dri/drisw.c
-index 8d9acd6..c36fa8b 100644
---- a/src/gallium/state_trackers/dri/drisw.c
-+++ b/src/gallium/state_trackers/dri/drisw.c
-@@ -47,6 +47,8 @@
- #include "dri_drawable.h"
- #include "dri_query_renderer.h"
-
-+#include "drm_driver.h"
-+
- DEBUG_GET_ONCE_BOOL_OPTION(swrast_no_present, "SWRAST_NO_PRESENT", FALSE);
- static boolean swrast_no_present = FALSE;
-
-@@ -326,6 +328,125 @@ drisw_update_tex_buffer(struct dri_drawable
*drawable,
- pipe_transfer_unmap(pipe, transfer);
- }
-
-+
-+static __DRIimage *
-+drisw_lookup_egl_image(struct dri_screen *screen, void *handle)
-+{
-+ const __DRIimageLookupExtension *loader = screen->sPriv->dri2.image;
-+ __DRIimage *img;
-+
-+ if (!loader->lookupEGLImage)
-+ return NULL;
-+
-+ img = loader->lookupEGLImage(screen->sPriv,
-+ handle, screen->sPriv->loaderPrivate);
-+
-+ return img;
-+}
-+
-+static __DRIimage *
-+drisw_create_image_from_dma_bufs(__DRIscreen *screen,
-+ int width, int height, int fourcc,
-+ int *fds, int num_fds,
-+ int *strides, int *offsets,
-+ enum __DRIYUVColorSpace color_space,
-+ enum __DRISampleRange sample_range,
-+ enum __DRIChromaSiting horiz_siting,
-+ enum __DRIChromaSiting vert_siting,
-+ unsigned *error,
-+ void *loaderPrivate)
-+{
-+ struct dri_screen *ds = dri_screen(screen);
-+ struct pipe_screen *ps = ds->base.screen;
-+ uint32_t dri_format;
-+
-+ struct pipe_resource templat;
-+ memset(&templat, 0, sizeof(templat));
-+
-+ templat.target = PIPE_TEXTURE_2D;
-+ switch (fourcc) {
-+ case __DRI_IMAGE_FOURCC_ARGB8888:
-+ dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
-+ templat.format = PIPE_FORMAT_BGRA8888_UNORM;
-+ break;
-+ case __DRI_IMAGE_FOURCC_XRGB8888:
-+ dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
-+ templat.format = PIPE_FORMAT_BGRX8888_UNORM;
-+ break;
-+ case __DRI_IMAGE_FOURCC_ABGR8888:
-+ dri_format = __DRI_IMAGE_FORMAT_ABGR8888;
-+ templat.format = PIPE_FORMAT_RGBA8888_UNORM;
-+ break;
-+ case __DRI_IMAGE_FOURCC_XBGR8888:
-+ dri_format = __DRI_IMAGE_FORMAT_XBGR8888;
-+ templat.format = PIPE_FORMAT_RGBX8888_UNORM;
-+ break;
-+ default:
-+ if (error)
-+ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
-+ return NULL;
-+ }
-+
-+ templat.width0 = width;
-+ templat.height0 = height;
-+ templat.depth0 = 1;
-+ templat.array_size = 1;
-+
-+ templat.last_level = 0;
-+ templat.nr_samples = 0;
-+ templat.usage = PIPE_USAGE_DEFAULT;
-+
-+ templat.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET |
-+ PIPE_BIND_SAMPLER_VIEW;
-+ templat.flags = 0;
-+
-+ struct winsys_handle handle;
-+ memset(&handle, 0, sizeof(handle));
-+ handle.type = DRM_API_HANDLE_TYPE_FD;
-+ handle.handle = fds[0];
-+ handle.stride = strides[0];
-+
-+ __DRIimage * img = CALLOC_STRUCT(__DRIimageRec);
-+ if (!img) {
-+ if (error)
-+ *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
-+ return NULL;
-+ }
-+
-+ img->texture = ps->resource_from_handle(ps, &templat, &handle);
-+
-+ if (!img->texture) {
-+ FREE(img);
-+ if (error)
-+ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
-+ return NULL;
-+ }
-+
-+ img->level = 0;
-+ img->layer = 0;
-+ img->dri_format = dri_format;
-+ img->loader_private = loaderPrivate;
-+
-+ if (error)
-+ *error = __DRI_IMAGE_ERROR_SUCCESS;
-+
-+ return img;
-+}
-+
-+static void
-+drisw_destroy_image(__DRIimage *img)
-+{
-+ pipe_resource_reference(&img->texture, NULL);
-+ FREE(img);
-+}
-+
-+static __DRIimageExtension dri2ImageExtension = {
-+ .base = { __DRI_IMAGE, 8 },
-+
-+ .createImageFromDmaBufs = drisw_create_image_from_dma_bufs,
-+ .destroyImage = drisw_destroy_image,
-+};
-+
- /*
- * Backend function for init_screen.
- */
-@@ -333,6 +454,9 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
- static const __DRIextension *drisw_screen_extensions[] = {
- &driTexBufferExtension.base,
- &dri2RendererQueryExtension.base,
-+#ifdef HAVE_LIBDRM
-+ &dri2ImageExtension.base,
-+#endif
- NULL
- };
-
-@@ -367,6 +491,8 @@ drisw_init_screen(__DRIscreen * sPriv)
- if (!configs)
- goto fail;
-
-+ screen->lookup_egl_image = drisw_lookup_egl_image;
-+
- return configs;
- fail:
- dri_destroy_screen_helper(screen);
-diff --git a/src/gallium/winsys/sw/dri/Makefile.am
b/src/gallium/winsys/sw/dri/Makefile.am
-index a7d3253..a0fe9d3 100644
---- a/src/gallium/winsys/sw/dri/Makefile.am
-+++ b/src/gallium/winsys/sw/dri/Makefile.am
-@@ -24,8 +24,13 @@ include Makefile.sources
- include $(top_srcdir)/src/gallium/Automake.inc
-
- AM_CFLAGS = \
-+ -I$(top_srcdir)/src/gallium/include/state_tracker \
- $(GALLIUM_WINSYS_CFLAGS)
-
-+if HAVE_LIBDRM
-+AM_CFLAGS += $(LIBDRM_CFLAGS)
-+endif
-+
- noinst_LTLIBRARIES = libswdri.la
-
- libswdri_la_SOURCES = $(C_SOURCES)
-diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
-index 6fed22b..4e8b4cb 100644
---- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
-+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
-@@ -26,6 +26,17 @@
- *
-
**************************************************************************/
-
-+#include <fcntl.h>
-+#include <stdio.h>
-+#include <sys/mman.h>
-+#include <sys/stat.h>
-+#include <sys/types.h>
-+#include <unistd.h>
-+
-+#if defined(HAVE_LIBDRM)
-+#include <xf86drm.h>
-+#endif
-+
- #include "pipe/p_compiler.h"
- #include "pipe/p_format.h"
- #include "util/u_inlines.h"
-@@ -36,14 +47,25 @@
- #include "state_tracker/sw_winsys.h"
- #include "dri_sw_winsys.h"
-
-+#include "drm_driver.h"
-+
-+enum displaytarget_type {
-+ DISPLAYTARGET_TYPE_USER,
-+ DISPLAYTARGET_TYPE_PRIME,
-+};
-
- struct dri_sw_displaytarget
- {
-+ enum displaytarget_type type;
- enum pipe_format format;
- unsigned width;
- unsigned height;
- unsigned stride;
-
-+#if defined(HAVE_LIBDRM)
-+ uint32_t vgem_handle;
-+#endif
-+
- void *data;
- void *mapped;
- };
-@@ -53,8 +75,75 @@ struct dri_sw_winsys
- struct sw_winsys base;
-
- struct drisw_loader_funcs *lf;
-+
-+#if defined(HAVE_LIBDRM)
-+ int vgem_fd;
-+#endif
- };
-
-+#if defined(HAVE_LIBDRM)
-+
-+const char g_sys_card_path_format[] =
-+ "/sys/bus/platform/devices/vgem/drm/card%d";
-+const char g_dev_card_path_format[] =
-+ "/dev/dri/card%d";
-+
-+static int
-+drm_open_vgem()
-+{
-+ char *name;
-+ int i, fd;
-+
-+ for (i = 0; i < 16; i++) {
-+ struct stat _stat;
-+ int ret;
-+ ret = asprintf(&name, g_sys_card_path_format, i);
-+ assert(ret != -1);
-+
-+ if (stat(name, &_stat) == -1) {
-+ free(name);
-+ continue;
-+ }
-+
-+ free(name);
-+ ret = asprintf(&name, g_dev_card_path_format, i);
-+ assert(ret != -1);
-+
-+ fd = open(name, O_RDWR);
-+ free(name);
-+ if (fd < 0)
-+ continue;
-+ return fd;
-+ }
-+ return -1;
-+}
-+
-+static void *
-+mmap_dumb_bo(int fd, int handle, size_t size)
-+{
-+ struct drm_mode_map_dumb mmap_arg;
-+ void *ptr;
-+ int ret;
-+
-+ memset(&mmap_arg, 0, sizeof(mmap_arg));
-+
-+ mmap_arg.handle = handle;
-+
-+ ret = drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &mmap_arg);
-+ if (ret)
-+ return NULL;
-+
-+ ptr = mmap(NULL, size, (PROT_READ|PROT_WRITE), MAP_SHARED, fd,
-+ mmap_arg.offset);
-+
-+ if (ptr == MAP_FAILED)
-+ return NULL;
-+
-+ return ptr;
-+}
-+
-+#endif
-+
- static INLINE struct dri_sw_displaytarget *
- dri_sw_displaytarget( struct sw_displaytarget *dt )
- {
-@@ -92,6 +181,7 @@ dri_sw_displaytarget_create(struct sw_winsys *winsys,
- if(!dri_sw_dt)
- goto no_dt;
-
-+ dri_sw_dt->type = DISPLAYTARGET_TYPE_USER;
- dri_sw_dt->format = format;
- dri_sw_dt->width = width;
- dri_sw_dt->height = height;
-@@ -115,25 +205,30 @@ no_dt:
- return NULL;
- }
-
--static void
--dri_sw_displaytarget_destroy(struct sw_winsys *ws,
-- struct sw_displaytarget *dt)
--{
-- struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
--
-- FREE(dri_sw_dt->data);
--
-- FREE(dri_sw_dt);
--}
--
- static void *
- dri_sw_displaytarget_map(struct sw_winsys *ws,
- struct sw_displaytarget *dt,
- unsigned flags)
- {
-+ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
- struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
-- dri_sw_dt->mapped = dri_sw_dt->data;
-- return dri_sw_dt->mapped;
-+ if (dri_sw_dt->type == DISPLAYTARGET_TYPE_USER)
-+ return dri_sw_dt->data;
-+
-+#if defined(HAVE_LIBDRM)
-+ if (dri_sw_dt->type == DISPLAYTARGET_TYPE_PRIME && dri_sw_ws->vgem_fd
>= 0) {
-+
-+ if (dri_sw_dt->mapped)
-+ return dri_sw_dt->mapped;
-+
-+ dri_sw_dt->mapped = mmap_dumb_bo(dri_sw_ws->vgem_fd,
-+ dri_sw_dt->vgem_handle,
-+ dri_sw_dt->height *
dri_sw_dt->stride);
-+ return dri_sw_dt->mapped;
-+ }
-+#endif
-+
-+ return NULL;
- }
-
- static void
-@@ -141,25 +236,112 @@ dri_sw_displaytarget_unmap(struct sw_winsys *ws,
- struct sw_displaytarget *dt)
- {
- struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
-+
-+#if defined(HAVE_LIBDRM)
-+ if (dri_sw_dt->mapped)
-+ munmap(dri_sw_dt->mapped, dri_sw_dt->height * dri_sw_dt->stride);
-+#endif
-+
- dri_sw_dt->mapped = NULL;
- }
-
-+static void
-+dri_sw_displaytarget_destroy(struct sw_winsys *ws,
-+ struct sw_displaytarget *dt)
-+{
-+ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
-+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
-+
-+ if (dri_sw_dt->mapped) {
-+ dri_sw_displaytarget_unmap(ws, dt);
-+ }
-+
-+#if defined(HAVE_LIBDRM)
-+ if (dri_sw_dt->type == DISPLAYTARGET_TYPE_PRIME && dri_sw_ws->vgem_fd
>= 0) {
-+ struct drm_gem_close arg;
-+ memset(&arg, 0, sizeof(arg));
-+ arg.handle = dri_sw_dt->vgem_handle;
-+
-+ drmIoctl(dri_sw_ws->vgem_fd, DRM_IOCTL_GEM_CLOSE, &arg);
-+ }
-+#endif
-+
-+ FREE(dri_sw_dt->data);
-+
-+ FREE(dri_sw_dt);
-+}
-+
- static struct sw_displaytarget *
--dri_sw_displaytarget_from_handle(struct sw_winsys *winsys,
-+dri_sw_displaytarget_from_handle(struct sw_winsys *ws,
- const struct pipe_resource *templ,
- struct winsys_handle *whandle,
- unsigned *stride)
- {
-+#if defined(HAVE_LIBDRM)
-+ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
-+ uint32_t imported_handle;
-+ struct dri_sw_displaytarget *dri_sw_dt;
-+
-+ if (whandle->type != DRM_API_HANDLE_TYPE_FD || dri_sw_ws->vgem_fd < 0)
{
-+ return NULL;
-+ }
-+
-+ dri_sw_dt = CALLOC_STRUCT(dri_sw_displaytarget);
-+ if(!dri_sw_dt)
-+ return NULL;
-+
-+ int ret = drmPrimeFDToHandle(dri_sw_ws->vgem_fd, whandle->handle,
-+ &imported_handle);
-+ if (ret) {
-+ FREE(dri_sw_dt);
-+ return NULL;
-+ }
-+
-+ dri_sw_dt->type = DISPLAYTARGET_TYPE_PRIME;
-+ dri_sw_dt->format = templ->format;
-+ dri_sw_dt->width = templ->width0;
-+ dri_sw_dt->height = templ->height0;
-+ dri_sw_dt->vgem_handle = imported_handle;
-+ dri_sw_dt->stride = whandle->stride;
-+
-+ *stride = dri_sw_dt->stride;
-+ return (struct sw_displaytarget *)dri_sw_dt;
-+#else
- assert(0);
- return NULL;
-+#endif
- }
-
- static boolean
--dri_sw_displaytarget_get_handle(struct sw_winsys *winsys,
-+dri_sw_displaytarget_get_handle(struct sw_winsys *ws,
- struct sw_displaytarget *dt,
- struct winsys_handle *whandle)
- {
-+#if defined(HAVE_LIBDRM)
-+ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
-+ if (dri_sw_ws->vgem_fd < 0)
-+ return FALSE;
-+
-+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
-+ if (whandle->type == DRM_API_HANDLE_TYPE_FD &&
-+ dri_sw_dt->type == DISPLAYTARGET_TYPE_PRIME) {
-+ int prime_fd;
-+ int ret = drmPrimeHandleToFD(dri_sw_ws->vgem_fd,
-+ dri_sw_dt->vgem_handle,
-+ DRM_CLOEXEC,
-+ &prime_fd);
-+ if (ret || prime_fd < 0)
-+ return FALSE;
-+
-+ whandle->handle = (unsigned)prime_fd;
-+ whandle->stride = dri_sw_dt->stride;
-+
-+ return TRUE;
-+ }
-+#else
- assert(0);
-+#endif
-+
- return FALSE;
- }
-
-@@ -196,6 +378,11 @@ dri_sw_displaytarget_display(struct sw_winsys *ws,
- static void
- dri_destroy_sw_winsys(struct sw_winsys *winsys)
- {
-+#if defined(HAVE_LIBDRM)
-+ int vgem_fd = dri_sw_winsys(winsys)->vgem_fd;
-+ if (vgem_fd >= 0)
-+ close(vgem_fd);
-+#endif
- FREE(winsys);
- }
-
-@@ -209,6 +396,9 @@ dri_create_sw_winsys(struct drisw_loader_funcs *lf)
- return NULL;
-
- ws->lf = lf;
-+#if defined(HAVE_LIBDRM)
-+ ws->vgem_fd = drm_open_vgem();
-+#endif
- ws->base.destroy = dri_destroy_sw_winsys;
-
- ws->base.is_displaytarget_format_supported =
dri_sw_is_displaytarget_format_supported;
---
-2.1.2
-
diff --git
a/media-libs/mesa-img/files/10.3-egl-dri2-add-support-for-image-config-query.patch
b/media-libs/mesa-img/files/10.3-egl-dri2-add-support-for-image-config-query.patch
deleted file mode 100644
index 25732e7..0000000
---
a/media-libs/mesa-img/files/10.3-egl-dri2-add-support-for-image-config-query.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From 489fa6439e41bbee6523756652214676760fe68f Mon Sep 17 00:00:00 2001
-From: Zach Reizner <za...@chromium.org>
-Date: Wed, 21 Jan 2015 13:23:58 -0800
-Subject: egl/dri2: add support for image, config query, and robustness
- extensions
-
-BUG=chromium:394868
-TEST=None
-
-Change-Id: I769c52aaad75221719df5ffd9c0d5c50dcdabe2c
----
- src/egl/drivers/dri2/egl_dri2.c | 23 +++++++++++++----------
- src/egl/drivers/dri2/platform_null.c | 12 +++++++++---
- 2 files changed, 22 insertions(+), 13 deletions(-)
-
-diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
-index e59709f..ee106f8 100644
---- a/src/egl/drivers/dri2/egl_dri2.c
-+++ b/src/egl/drivers/dri2/egl_dri2.c
-@@ -552,6 +552,7 @@ dri2_create_screen(_EGLDisplay *disp)
- {
- const __DRIextension **extensions;
- struct dri2_egl_display *dri2_dpy;
-+ unsigned i;
-
- dri2_dpy = disp->DriverData;
-
-@@ -592,25 +593,27 @@ dri2_create_screen(_EGLDisplay *disp)
- extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen);
-
- if (dri2_dpy->dri2) {
-- unsigned i;
-
- if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions,
extensions))
- goto cleanup_dri_screen;
--
-- for (i = 0; extensions[i]; i++) {
-- if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) {
-- dri2_dpy->robustness = (__DRIrobustnessExtension *)
extensions[i];
-- }
-- if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) {
-- dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i];
-- }
-- }
- } else {
- assert(dri2_dpy->swrast);
- if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions,
extensions))
- goto cleanup_dri_screen;
- }
-
-+ for (i = 0; extensions[i]; i++) {
-+ if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) {
-+ dri2_dpy->robustness = (__DRIrobustnessExtension *)
extensions[i];
-+ }
-+ if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) {
-+ dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i];
-+ }
-+ if (strcmp(extensions[i]->name, __DRI_IMAGE) == 0) {
-+ dri2_dpy->image = (__DRIimageExtension *) extensions[i];
-+ }
-+ }
-+
- dri2_setup_screen(disp);
-
- return EGL_TRUE;
-diff --git a/src/egl/drivers/dri2/platform_null.c
b/src/egl/drivers/dri2/platform_null.c
-index 9c59809..56bc82b 100644
---- a/src/egl/drivers/dri2/platform_null.c
-+++ b/src/egl/drivers/dri2/platform_null.c
-@@ -103,8 +103,13 @@ dri2_initialize_null(_EGLDriver *drv, _EGLDisplay
*disp)
- }
-
- if (!driver_loaded) {
-- err = "DRI2: failed to load driver";
-- goto cleanup_display;
-+ dri2_dpy->driver_name = strdup("swrast");
-+ if (!dri2_load_driver_swrast(disp))
-+ {
-+ err = "DRI2: failed to load driver";
-+ free(dri2_dpy->driver_name);
-+ goto cleanup_display;
-+ }
- }
-
- dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
-@@ -148,7 +153,8 @@ dri2_initialize_null(_EGLDriver *drv, _EGLDisplay
*disp)
- cleanup_driver:
- dlclose(dri2_dpy->driver);
- free(dri2_dpy->driver_name);
-- close(dri2_dpy->fd);
-+ if (dri2_dpy->fd >= 0)
-+ close(dri2_dpy->fd);
- cleanup_display:
- free(dri2_dpy);
-
---
-2.1.2
-
diff --git
a/media-libs/mesa-img/files/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
b/media-libs/mesa-img/files/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
deleted file mode 100644
index 2271fb5..0000000
---
a/media-libs/mesa-img/files/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 24a2a2a86a8c290e57979b346c66de499ae25342 Mon Sep 17 00:00:00 2001
-From: Haixia Shi <hs...@chromium.org>
-Date: Tue, 27 Jan 2015 14:23:08 -0800
-Subject: [PATCH] CHROMIUM: egl/dri2: platform_drm should also try render
node
- first.
-
-BUG=chromium:446653
-TEST=build chrome with use_mesa_platform_null=1 and mesa with
-platform_gbm and verify that chrome still works
-
-Change-Id: I7d845a7b993f59bfd0595ddc3d18d5091bb74ec5
----
- src/egl/drivers/dri2/platform_drm.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/src/egl/drivers/dri2/platform_drm.c
b/src/egl/drivers/dri2/platform_drm.c
-index 753c60f..3d24deb 100644
---- a/src/egl/drivers/dri2/platform_drm.c
-+++ b/src/egl/drivers/dri2/platform_drm.c
-@@ -589,6 +589,8 @@ static struct dri2_egl_display_vtbl
dri2_drm_display_vtbl = {
- .get_sync_values = dri2_fallback_get_sync_values,
- };
-
-+#define DRM_RENDER_DEV_NAME "%s/renderD%d"
-+
- EGLBoolean
- dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
- {
-@@ -608,7 +610,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
- gbm = disp->PlatformDisplay;
- if (gbm == NULL) {
- char buf[64];
-- int n = snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, 0);
-+ int n = snprintf(buf, sizeof(buf), DRM_RENDER_DEV_NAME,
DRM_DIR_NAME, 128);
- if (n != -1 && n < sizeof(buf))
- fd = open(buf, O_RDWR);
- if (fd < 0)
---
-2.1.2
-
diff --git
a/media-libs/mesa-img/files/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
b/media-libs/mesa-img/files/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
deleted file mode 100644
index f9a77ef..0000000
---
a/media-libs/mesa-img/files/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From a4433d6dc9c5ab1369da4e7de79a76bc16e32c16 Mon Sep 17 00:00:00 2001
-From: Haixia Shi <hs...@chromium.org>
-Date: Wed, 21 Jan 2015 16:14:41 -0800
-Subject: [PATCH] Report DMABUF_IMPORT
-
-Change-Id: Ib361e9d0f16b33735310e3784c1767a1f5455402
----
- src/egl/drivers/dri2/egl_dri2.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
-index e59709f..931ced9 100644
---- a/src/egl/drivers/dri2/egl_dri2.c
-+++ b/src/egl/drivers/dri2/egl_dri2.c
-@@ -534,7 +534,7 @@ dri2_setup_screen(_EGLDisplay *disp)
- disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
- disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE;
- }
--#ifdef HAVE_DRM_PLATFORM
-+#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_NULL_PLATFORM)
- if (dri2_dpy->image->base.version >= 8 &&
- dri2_dpy->image->createImageFromDmaBufs) {
- disp->Extensions.EXT_image_dma_buf_import = EGL_TRUE;
---
-2.1.2
-
diff --git
a/media-libs/mesa-img/files/10.3-egl-dri2-try-to-use-render-node-if-available.patch
b/media-libs/mesa-img/files/10.3-egl-dri2-try-to-use-render-node-if-available.patch
deleted file mode 100644
index 99db028..0000000
---
a/media-libs/mesa-img/files/10.3-egl-dri2-try-to-use-render-node-if-available.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From 0a7438a87787d33717e57c13b3346c4239fb9f64 Mon Sep 17 00:00:00 2001
-From: Haixia Shi <hs...@chromium.org>
-Date: Thu, 15 Jan 2015 17:41:05 -0800
-Subject: [PATCH] egl/dri2: try to use render node if available.
-
-Let mesa platform_null try render node first (/dev/dri/renderD%d) and
-use it if available. If not then fall back to the normal nodes
-(/dev/dri/card%d).
-
-BUG=chromium:448623
-TEST=null_platform_test with chronos
-
-Change-Id: I3eb2087ea70307a36613b884645fab428fb5c203
----
- src/egl/drivers/dri2/platform_null.c | 49
+++++++++++++++++++++++-------------
- 1 file changed, 31 insertions(+), 18 deletions(-)
-
-diff --git a/src/egl/drivers/dri2/platform_null.c
b/src/egl/drivers/dri2/platform_null.c
-index ab5ef49..9d4742a 100644
---- a/src/egl/drivers/dri2/platform_null.c
-+++ b/src/egl/drivers/dri2/platform_null.c
-@@ -55,12 +55,16 @@ null_get_buffers_with_format(__DRIdrawable *
driDrawable,
- return dri2_surf->buffers;
- }
-
-+static const char* node_path_fmt_card = "/dev/dri/card%d";
-+static const char* node_path_fmt_render = "/dev/dri/renderD%d";
-+
- EGLBoolean
- dri2_initialize_null(_EGLDriver *drv, _EGLDisplay *disp)
- {
- struct dri2_egl_display *dri2_dpy;
- const char* err;
-- int i;
-+ int i, render_node;
-+ int driver_loaded = 0;
-
- loader_set_logger(_eglLog);
-
-@@ -70,26 +74,35 @@ dri2_initialize_null(_EGLDriver *drv, _EGLDisplay
*disp)
-
- disp->DriverData = (void *) dri2_dpy;
-
-- for (i = 0; i < 16; ++i) {
-- char *card_path;
-- if (asprintf(&card_path, "/dev/dri/card%d", i) < 0)
-- continue;
--
-- dri2_dpy->fd = open(card_path, O_RDWR);
-- free(card_path);
-- if (dri2_dpy->fd < 0)
-- continue;
--
-- dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd, 0);
-- if (dri2_dpy->driver_name) {
-- if (dri2_load_driver(disp))
-- break;
-- free(dri2_dpy->driver_name);
-+ for (render_node = 1; render_node >= 0; --render_node) {
-+ const char* node_path_fmt =
-+ render_node ? node_path_fmt_render : node_path_fmt_card;
-+ const int base = render_node ? 128 : 0;
-+ for (i = 0; i < 16; ++i) {
-+ char *card_path;
-+ if (asprintf(&card_path, node_path_fmt, base + i) < 0)
-+ continue;
-+
-+ dri2_dpy->fd = open(card_path, O_RDWR);
-+ free(card_path);
-+ if (dri2_dpy->fd < 0)
-+ continue;
-+
-+ dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd,
0);
-+ if (dri2_dpy->driver_name) {
-+ if (dri2_load_driver(disp)) {
-+ driver_loaded = 1;
-+ break;
-+ }
-+ free(dri2_dpy->driver_name);
-+ }
-+ close(dri2_dpy->fd);
- }
-- close(dri2_dpy->fd);
-+ if (driver_loaded)
-+ break;
- }
-
-- if (i >= 16) {
-+ if (!driver_loaded) {
- err = "DRI2: failed to load driver";
- goto cleanup_display;
- }
---
-2.1.2
-
diff --git
a/media-libs/mesa-img/files/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch
b/media-libs/mesa-img/files/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch
deleted file mode 100644
index 68d4e80..0000000
---
a/media-libs/mesa-img/files/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 7fd17035a7f9c5b6219f1885a41c0385d861d159 Mon Sep 17 00:00:00 2001
-From: Frank Henigman <fjhen...@gmail.com>
-Date: Thu, 19 Feb 2015 10:09:25 -0800
-Subject: [PATCH] intel: fix EGLImage renderbuffer _BaseFormat
-
-Correctly set _BaseFormat field when creating a gl_renderbuffer
-with EGLImage storage.
-
-Signed-off-by: Frank Henigman <fjhen...@google.com>
----
- src/mesa/drivers/dri/i915/intel_fbo.c | 3 +--
- src/mesa/drivers/dri/i965/intel_fbo.c | 2 +-
- 2 files changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c
b/src/mesa/drivers/dri/i915/intel_fbo.c
-index ead1b17..6c2e181 100644
---- a/src/mesa/drivers/dri/i915/intel_fbo.c
-+++ b/src/mesa/drivers/dri/i915/intel_fbo.c
-@@ -287,8 +287,7 @@ intel_image_target_renderbuffer_storage(struct
gl_context *ctx,
- rb->Width = image->region->width;
- rb->Height = image->region->height;
- rb->Format = image->format;
-- rb->_BaseFormat = _mesa_base_fbo_format(&intel->ctx,
-- image->internal_format);
-+ rb->_BaseFormat = _mesa_get_format_base_format(image->format);
- rb->NeedsFinishRenderTexture = true;
- }
-
-diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c
b/src/mesa/drivers/dri/i965/intel_fbo.c
-index 174cea0..9394018 100644
---- a/src/mesa/drivers/dri/i965/intel_fbo.c
-+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
-@@ -398,7 +398,7 @@ intel_image_target_renderbuffer_storage(struct
gl_context *ctx,
- rb->Width = image->width;
- rb->Height = image->height;
- rb->Format = image->format;
-- rb->_BaseFormat = _mesa_base_fbo_format(ctx, image->internal_format);
-+ rb->_BaseFormat = _mesa_get_format_base_format(image->format);
- rb->NeedsFinishRenderTexture = true;
- irb->layer_count = 1;
- }
---
-2.2.0.rc0.207.ga3a616c
-
diff --git
a/media-libs/mesa-img/files/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
b/media-libs/mesa-img/files/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
deleted file mode 100644
index 590c08b..0000000
---
a/media-libs/mesa-img/files/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 6fd2b4291bb87a5dfd89dc2da226d27c2b514d95 Mon Sep 17 00:00:00 2001
-From: Rob Clark <robc...@freedesktop.org>
-Date: Fri, 29 Aug 2014 17:09:29 -0400
-Subject: [PATCH]
- 10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
-
----
- src/gallium/drivers/freedreno/a2xx/fd2_texture.c | 1 +
- src/gallium/drivers/freedreno/a3xx/fd3_texture.c | 1 +
- src/gallium/drivers/freedreno/a4xx/fd4_texture.c | 1 +
- src/gallium/drivers/freedreno/freedreno_surface.c | 1 +
- src/gallium/drivers/freedreno/freedreno_texture.c | 2 +-
- src/gallium/drivers/freedreno/freedreno_texture.h | 3 +++
- 6 files changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
-index b70eaa6..0a2e3c3 100644
---- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
-+++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
-@@ -135,6 +135,7 @@ fd2_sampler_view_create(struct pipe_context *pctx,
struct pipe_resource *prsc,
- so->base.texture = prsc;
- so->base.reference.count = 1;
- so->base.context = pctx;
-+ so->base.sampler_view_destroy = fd_sampler_view_destroy;
-
- so->tex_resource = rsc;
- so->fmt = fd2_pipe2surface(cso->format);
-diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
-index 567f6c7..4428333 100644
---- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
-+++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c
-@@ -221,6 +221,7 @@ fd3_sampler_view_create(struct pipe_context *pctx,
struct pipe_resource *prsc,
- so->base.texture = prsc;
- so->base.reference.count = 1;
- so->base.context = pctx;
-+ so->base.sampler_view_destroy = fd_sampler_view_destroy;
-
- so->tex_resource = rsc;
-
-diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
-index f9b6dcc..f05c6f1 100644
---- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
-+++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
-@@ -159,6 +159,7 @@ fd4_sampler_view_create(struct pipe_context *pctx,
struct pipe_resource *prsc,
- so->base.texture = prsc;
- so->base.reference.count = 1;
- so->base.context = pctx;
-+ so->base.sampler_view_destroy = fd_sampler_view_destroy;
-
- so->tex_resource = rsc;
-
-diff --git a/src/gallium/drivers/freedreno/freedreno_surface.c
b/src/gallium/drivers/freedreno/freedreno_surface.c
-index 250fe4b..a16f13c 100644
---- a/src/gallium/drivers/freedreno/freedreno_surface.c
-+++ b/src/gallium/drivers/freedreno/freedreno_surface.c
-@@ -51,6 +51,7 @@ fd_create_surface(struct pipe_context *pctx,
- pipe_resource_reference(&psurf->texture, ptex);
-
- psurf->context = pctx;
-+ psurf->surface_destroy = fd_surface_destroy;
- psurf->format = surf_tmpl->format;
- psurf->width = u_minify(ptex->width0, level);
- psurf->height = u_minify(ptex->height0, level);
-diff --git a/src/gallium/drivers/freedreno/freedreno_texture.c
b/src/gallium/drivers/freedreno/freedreno_texture.c
-index eaa6629..40095b4 100644
---- a/src/gallium/drivers/freedreno/freedreno_texture.c
-+++ b/src/gallium/drivers/freedreno/freedreno_texture.c
-@@ -41,7 +41,7 @@ fd_sampler_state_delete(struct pipe_context *pctx, void
*hwcso)
- FREE(hwcso);
- }
-
--static void
-+void
- fd_sampler_view_destroy(struct pipe_context *pctx,
- struct pipe_sampler_view *view)
- {
-diff --git a/src/gallium/drivers/freedreno/freedreno_texture.h
b/src/gallium/drivers/freedreno/freedreno_texture.h
-index 43571a9..a1007d1 100644
---- a/src/gallium/drivers/freedreno/freedreno_texture.h
-+++ b/src/gallium/drivers/freedreno/freedreno_texture.h
-@@ -39,6 +39,9 @@ void fd_set_sampler_views(struct pipe_context *pctx,
unsigned shader,
- unsigned start, unsigned nr,
- struct pipe_sampler_view **views);
-
-+void fd_sampler_view_destroy(struct pipe_context *pctx,
-+ struct pipe_sampler_view *view);
-+
- void fd_texture_init(struct pipe_context *pctx);
-
- #endif /* FREEDRENO_TEXTURE_H_ */
---
-2.1.2
-
diff --git a/media-libs/mesa-img/mesa-img-9999.ebuild
b/media-libs/mesa-img/mesa-img-9999.ebuild
index ff0dc60..9eeda6b 100644
--- a/media-libs/mesa-img/mesa-img-9999.ebuild
+++ b/media-libs/mesa-img/mesa-img-9999.ebuild
@@ -114,7 +114,6 @@
epatch "${FILESDIR}"/10.0-cross-compile.patch
epatch "${FILESDIR}"/9.1-mesa-st-no-flush-front.patch

epatch "${FILESDIR}"/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer.patch
-
epatch "${FILESDIR}"/10.3-state_tracker-gallium-fix-crash-with-st_renderbuffer-freedreno.patch
epatch "${FILESDIR}"/10.0-force_s3tc_enable.patch

epatch "${FILESDIR}"/9.0-i965-Allow-the-case-where-multiple-flush-types-are-e.patch
epatch "${FILESDIR}"/8.1-dead-code-local-hack.patch
@@ -138,26 +137,20 @@
epatch "${FILESDIR}"/10.3-egl-dri2-implement-platform_null.patch

epatch "${FILESDIR}"/10.5-Revert-i965-Delete-CACHE_NEW_BLORP_CONST_COLOR_PROG.patch

epatch "${FILESDIR}"/10.5-UPSTREAM-i965-Restore-brw_blorp_clear-for-gen6.patch
-
epatch "${FILESDIR}"/10.3-egl-dri2-try-to-use-render-node-if-available.patch
-
epatch "${FILESDIR}"/10.3-egl-dri2-report-EXT_image_dma_buf_import-extension.patch
-
epatch "${FILESDIR}"/10.3-egl-dri2-add-support-for-image-config-query.patch
-
epatch "${FILESDIR}"/10.3-egl-dri2-platform_drm-should-also-try-rende.patch
-
epatch "${FILESDIR}"/10.3-dri-add-swrast-support-on-top-of-prime-imported.patch
-
epatch "${FILESDIR}"/10.3-intel-fix-EGLImage-renderbuffer-_BaseFormat.patch

# IMG patches
epatch "${FILESDIR}"/0000-Add-pvr-dri-driver-to-the-Mesa-build.patch

epatch "${FILESDIR}"/0004-Ensure-x-creates-pbuffers-with-non-zero-size.patch

epatch "${FILESDIR}"/0005-Generate-options.h-if-any-DRI-driver-is-built.patch
- epatch "${FILESDIR}"/0001-Add-EGL_IMG_context_priority-EGL-extension.patch
- epatch "${FILESDIR}"/0001-Extend-EGL-KHR-sync-object-support.patch
- epatch "${FILESDIR}"/0015-dri-Add-some-new-image-formats.patch
+ epatch "${FILESDIR}"/0007-Add-EGL_IMG_context_priority-EGL-extension.patch
+ epatch "${FILESDIR}"/0008-Extend-EGL-KHR-sync-object-support.patch
+ epatch "${FILESDIR}"/0019-dri-Add-some-new-DRI-formats-and-fourccs.patch

epatch "${FILESDIR}"/0024-egl-Add-eglQuerySurface-surface-type-check-for-EGL_L.patch
epatch "${FILESDIR}"/0025-egl-clamp-size-to-0-in-_eglFlattenArray.patch
- epatch "${FILESDIR}"/0027-egl-x11-Open-the-device-node-only-once.patch

epatch "${FILESDIR}"/0028-dri-set-the-__DRI_API_OPENGL-bit-based-on-max-gl-com.patch
epatch "${FILESDIR}"/0001-GL_EXT_robustness-entry-points.patch

epatch "${FILESDIR}"/0049-egl-dri-Add-a-bad-access-error-code-to-the-DRI-inter.patch
+ epatch "${FILESDIR}"/0050-dri-Add-MT12-DRI-fourcc.patch

base_src_prepare


--
To view, visit https://chromium-review.googlesource.com/262446
To unsubscribe, visit https://chromium-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief25ae31585c9fab23b441949715676c4fffd8f4

Daniel Kurtz (Gerrit)

unread,
Mar 27, 2015, 7:46:17 PM3/27/15
to Rufus Hamade, David Sodman
Daniel Kurtz has posted comments on this change.

Change subject: media-libs/mesa-img: Update for img-ddk 1.6@3459742
......................................................................


Patch Set 8: Code-Review+2 Commit-Queue+1 Verified+1 Trybot-Ready+1

Let's land mesa-img as ebuild+patches for now, and migrate to mesa-img
repository when things stabilize.
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie2581787687fffe3b7fc3391eb103a7e9805b305
Gerrit-PatchSet: 8
Gerrit-Project: chromiumos/overlays/chromiumos-overlay
Gerrit-Branch: master
Gerrit-Owner: Daniel Kurtz <djk...@chromium.org>
Gerrit-Reviewer: Daniel Kurtz <djk...@chromium.org>
Gerrit-Reviewer: David Sodman <dso...@chromium.org>
Gerrit-HasComments: No

Daniel Kurtz (Gerrit)

unread,
Mar 27, 2015, 7:48:00 PM3/27/15
to Rufus Hamade, David Sodman
Daniel Kurtz has posted comments on this change.

Change subject: media-libs/mesa-img: Update for img-ddk 1.6@3459742
......................................................................


Patch Set 8: -Code-Review -Commit-Queue -Verified -Trybot-Ready
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie2581787687fffe3b7fc3391eb103a7e9805b305
Gerrit-PatchSet: 8
Gerrit-Project: chromiumos/overlays/chromiumos-overlay
Gerrit-Branch: master
Gerrit-Owner: Daniel Kurtz <djk...@chromium.org>

Daniel Kurtz (Gerrit)

unread,
Mar 27, 2015, 10:41:55 PM3/27/15
to Rufus Hamade, David Sodman
Daniel Kurtz has abandoned this change.

Change subject: media-libs/mesa-img: Update for img-ddk 1.6@3459742
......................................................................


Abandoned

All mesa patches have been squashed into CL:248741
Gerrit-MessageType: abandon
Gerrit-Change-Id: Ie2581787687fffe3b7fc3391eb103a7e9805b305
Gerrit-PatchSet: 8
Gerrit-Project: chromiumos/overlays/chromiumos-overlay
Gerrit-Branch: master
Gerrit-Owner: Daniel Kurtz <djk...@chromium.org>

Daniel Kurtz (Gerrit)

unread,
Mar 27, 2015, 10:42:45 PM3/27/15
to Rufus Hamade, Ricky Liang, David Sodman, Frank Binns, cawa cheng, Frank Binns
Daniel Kurtz has abandoned this change.

Change subject: media-libs/mesa-img: Update for img-ddk 1.6@3490026
......................................................................


Abandoned

All mesa patches have been squashed into CL:248741

Gerrit-MessageType: abandon
Gerrit-Change-Id: Ief25ae31585c9fab23b441949715676c4fffd8f4
Gerrit-PatchSet: 5
Gerrit-Project: chromiumos/overlays/chromiumos-overlay
Gerrit-Branch: master
Gerrit-Owner: Daniel Kurtz <djk...@chromium.org>
Gerrit-Reviewer: David Sodman <dso...@chromium.org>
Gerrit-Reviewer: Frank Binns <franci...@gmail.com>
Gerrit-Reviewer: Frank Binns <frank...@imgtec.com>
Gerrit-Reviewer: Ricky Liang <jcl...@chromium.org>
Gerrit-Reviewer: Rufus Hamade <rufus.ham...@gmail.com>
Gerrit-Reviewer: cawa cheng <cawa....@mediatek.com>
Reply all
Reply to author
Forward
0 new messages