i965: Create mock implementation of GL_OES_EGL_image_external
authorChad Versace <chad.versace@linux.intel.com>
Thu, 22 Dec 2011 02:34:19 +0000 (18:34 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Tue, 27 Dec 2011 18:20:25 +0000 (10:20 -0800)
In Android IceCreamSandwich, SurfaceFlinger requires GL_OES_image_external
for basic compositing tasks. Without the extension, SurfaceFlinger fails
to start.

Despite the incompleteness of the extension's implementation introduced by
this patch, it is good enough to enable SurfaceFlinger and to unblock the
people who need to begin testing Mesa on IceCreamSandwich.

To enable the extension, set the environment variable
MESA_EXTENSION_OVERRIDE="+GL_OES_EGL_image_external". Ideally, Android
should set this in init.rc.

WARNING: This implementation of GL_OES_EGL_image_external is not complete.
Some of it is even incorrect. When we begin to really implement
GL_OES_EGL_image_external, much of the patch will need reverting.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/brw_wm_emit.c
src/mesa/drivers/dri/i965/brw_wm_pass1.c
src/mesa/drivers/dri/i965/brw_wm_surface_state.c
src/mesa/drivers/dri/intel/intel_tex_image.c

index 80ed1ff956b7a97ebbb98b3ffe6f8ab80e85d45a..270e32142de6e6c7e284a7a00acb6ff18ab0f704 100644 (file)
@@ -1078,6 +1078,7 @@ void emit_tex(struct brw_wm_compile *c,
    case TEXTURE_2D_INDEX:
    case TEXTURE_1D_ARRAY_INDEX:
    case TEXTURE_RECT_INDEX:
+   case TEXTURE_EXTERNAL_INDEX:
       emit = WRITEMASK_XY;
       nr_texcoords = 2;
       break;
@@ -1212,6 +1213,7 @@ void emit_txb(struct brw_wm_compile *c,
       break;
    case TEXTURE_2D_INDEX:
    case TEXTURE_RECT_INDEX:
+   case TEXTURE_EXTERNAL_INDEX:
       brw_MOV(p, brw_message_reg(2 + 0 * mrf_per_channel), arg[0]);
       brw_MOV(p, brw_message_reg(2 + 1 * mrf_per_channel), arg[1]);
       brw_MOV(p, brw_message_reg(2 + 2 * mrf_per_channel), brw_imm_f(0));
index ee7a627455f9b3762c004d3234ea1cc3d78ad4dc..e96e9ed3e8bd5f2c563a67b586476613344eea59 100644 (file)
@@ -94,6 +94,7 @@ static GLuint get_texcoord_mask( GLuint tex_idx )
       return WRITEMASK_X;
    case TEXTURE_2D_INDEX:
    case TEXTURE_1D_ARRAY_INDEX:
+   case TEXTURE_EXTERNAL_INDEX:
       return WRITEMASK_XY;
    case TEXTURE_3D_INDEX:
    case TEXTURE_2D_ARRAY_INDEX:
index e908430650e443fffe9d88c3622a11f11c9b0f2e..dedf59437c9513dd00acada3b76069901e46f3f3 100644 (file)
@@ -58,6 +58,7 @@ translate_tex_target(GLenum target)
 
    case GL_TEXTURE_2D: 
    case GL_TEXTURE_2D_ARRAY_EXT:
+   case GL_TEXTURE_EXTERNAL_OES:
       return BRW_SURFACE_2D;
 
    case GL_TEXTURE_3D: 
index dd0c6d34c63ab1d600752b2093568bf1904f4943..107d3147279e97043d5da8517d45d3884f146da6 100644 (file)
@@ -84,6 +84,8 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
          intelImage->base.Base.Level == firstLevel &&
          (intel->gen < 4 || firstLevel == 0)) {
         lastLevel = firstLevel;
+      } else if (intelObj->base.Target == GL_TEXTURE_EXTERNAL_OES) {
+        lastLevel = firstLevel;
       } else {
         lastLevel = firstLevel + _mesa_logbase2(MAX2(MAX2(width, height), depth));
       }