[Mesa-dev,2/2] i965: add support for EXT_image_dma_buf_import revision #7.

Submitted by Gwenole Beauchesne on March 19, 2014, 6:31 p.m.

Details

Message ID 1395253869-29517-2-git-send-email-gwenole.beauchesne@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Gwenole Beauchesne March 19, 2014, 6:31 p.m.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
---
 src/mesa/drivers/dri/i965/intel_screen.c |   32 +++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 4e9a775..5223c9d 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -269,7 +269,37 @@  static struct intel_image_format intel_image_formats[] = {
     * sampling from plane 1. */
    { __DRI_IMAGE_FOURCC_YUYV, __DRI_IMAGE_COMPONENTS_Y_XUXV, 2,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_GR88, 2 },
-       { 0, 1, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } }
+       { 0, 1, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } },
+
+   /* GL internal formats, which are essentially packed */
+#define DEF_FORMAT(GL_FORMAT, MESA_FORMAT, COMPONENTS, BPC)             \
+   { __DRI_IMAGE_FOURCC_GL_FORMAT(GL_##GL_FORMAT),                      \
+     __DRI_IMAGE_COMPONENTS_##COMPONENTS, 1,                            \
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_MESA(MESA_FORMAT_##MESA_FORMAT), BPC } } }
+
+#define DEF_FORMAT_C(GL_COMPS, COMPS)                           \
+   DEF_FORMAT(GL_COMPS##8,       GL_COMPS##_UNORM8,  COMPS, 1), \
+   DEF_FORMAT(GL_COMPS##8I,      GL_COMPS##_SINT8,   COMPS, 1), \
+   DEF_FORMAT(GL_COMPS##8UI,     GL_COMPS##_UINT8,   COMPS, 1), \
+   DEF_FORMAT(GL_COMPS##8_SNORM, GL_COMPS##_SNORM8,  COMPS, 1), \
+   DEF_FORMAT(GL_COMPS##16I,     GL_COMPS##_SINT16,  COMPS, 2), \
+   DEF_FORMAT(GL_COMPS##16UI,    GL_COMPS##_UINT16,  COMPS, 2), \
+   DEF_FORMAT(GL_COMPS##16F,     GL_COMPS##_FLOAT16, COMPS, 2), \
+   DEF_FORMAT(GL_COMPS##32I,     GL_COMPS##_SINT32,  COMPS, 4), \
+   DEF_FORMAT(GL_COMPS##32UI,    GL_COMPS##_UINT32,  COMPS, 4), \
+   DEF_FORMAT(GL_COMPS##32F,     GL_COMPS##_FLOAT32, COMPS, 4)
+
+#define MESA_FORMAT_RG_UNORM8    MESA_FORMAT_R8G8_UNORM
+#define MESA_FORMAT_RG_SNORM8    MESA_FORMAT_R8G8_SNORM
+#define MESA_FORMAT_RGBA_UNORM8  MESA_FORMAT_R8G8B8A8_UNORM
+#define MESA_FORMAT_RGBA_SNORM8  MESA_FORMAT_R8G8B8A8_SNORM
+
+   DEF_FORMAT_C(R,      X),
+   DEF_FORMAT_C(RG,     XY),
+   DEF_FORMAT_C(RGBA,   XYZW),
+
+#undef DEF_FORMAT_C
+#undef DEF_FORMAT
 };
 
 static struct intel_image_format *