glamor: Fix rendering of pixmap textures backed by EGLImageKHR image

According to khronos documentation, "If <target> 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 <>
3 jobs for server-1.20-branch-gbm-bo-render in 4 minutes and 58 seconds (queued for 1 second)