According to khronos documentation, "If is not TEXTURE_EXTERNAL_OES, the error INVALID_ENUM is generated." if glEGLImageTargetTexture2DOES is called for an image created by using EGL_KHR_image_pixmap extension. Not only that, but we must use samplerExternalOES and not sampler2D to access such a texture from the fragment shader. In addition we must require GL_OES_EGL_image_external from the shader to be able to use the extension.
Fix the above issues by providing the correct texture unit to function calls in glamor_create_texture_from_image(). Add a flag to glamor_pixmap_fbo that will allow us to provide the correct texture unit when binding that texture. Also, provide separate copy facet for fbos that are created for GL_OES_EGL_image_external backed textures. Add a member to glamor_program_location that allows us to select the correct sampler in the fragment shader. Extend fs_template with extension member var used to request the needed extensions in the fragment shader.
Tested on Motorola Droid4 with TI PVR DDK 1.17 closed blobs.
Signed-off-by: Ivaylo Dimitrov email@example.com