xserver-multidpi/glamor
Zhigang Gong 3add375065 gles2: Fixed color conversion for the formats except 1555 and 2101010.
This patch fixed two major problems when we do the color convesion with
GLES2.

1. lack of necessary formats in FBO pool.
GLES2 has three different possible texture formats, GL_RGBA,
GL_BGRA and GL_ALPHA. Previous implementation only has one bucket
for all the three formats which may reuse a incorrect texture format
when do the cache lookup. After this fix, we can enable fbo safely
when running with GLES2.

2. Refine the format matching method in
glamor_get_tex_format_type_from_pictformat.
If both revertion and swap_rb are needed, for example use GL_RGBA
to represent PICT_b8g8r8a8. Then the downloading and uploading should
be handled differently.

    The picture's format is PICT_b8g8r8a8,
    Then the expecting color layout is as below (little endian):
    0   1       2       3   : address
    a   r       g       b

    Now the in GLES2 the supported color format is GL_RGBA, type is
    GL_UNSIGNED_TYPE, then we need to shuffle the fragment
    color as :
        frag_color = sample(texture).argb;
    before we use glReadPixel to get it back.

    For the uploading process, the shuffle is a revert shuffle.
    We still use GL_RGBA, GL_UNSIGNED_BYTE to upload the color
    to a texture, then let's see
    0   1       2       3   : address
    a   r       g       b   : correct colors
    R   G       B       A   : GL_RGBA with GL_UNSIGNED_BYTE

    Now we need to shuffle again, the mapping rule is
    r = G, g = B, b = A, a = R. Then the uploading shuffle is as
    below:
        frag_color = sample(texture).gbar;

After this commit, gles2 version can pass render check with all
the formats except those 1555/2101010.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:49 -08:00
..
glamor_addtraps.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_copyarea.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_copyplane.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_copywindow.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_core.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_debug.h glamor_fbo: Introduce glamor fbo to manage all the fb/tex. 2013-12-18 11:23:47 -08:00
glamor_egl.c For DRI swap buffers. 2013-12-18 11:23:49 -08:00
glamor_eglmodule.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_fbo.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_fill.c glamor_fill: Should restore alu to GXcopy. 2013-12-18 11:23:49 -08:00
glamor_fillspans.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_getimage.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_getspans.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_gl_dispatch.c Prepare for modification of gradient using shader. 2013-12-18 11:23:49 -08:00
glamor_gl_dispatch.h Prepare for modification of gradient using shader. 2013-12-18 11:23:49 -08:00
glamor_glext.h glamor: Re-arrange some macros/definitions in header files. 2011-09-26 16:47:02 +08:00
glamor_glyphblt.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_glyphs.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_picture.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_pixmap.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_polyfillrect.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_polylines.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_polyops.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_priv.h gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_putimage.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_render.c glamor_render: Disable gradient shader conversion due to bug. 2013-12-18 11:23:49 -08:00
glamor_setspans.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_tile.c glamor_tile/composite: Modify fs to re-calculate texture coords. 2013-12-18 11:23:48 -08:00
glamor_triangles.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor_utils.h gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor_window.c Fixup glx support 2013-12-18 11:23:48 -08:00
glamor.c gles2: Fixed color conversion for the formats except 1555 and 2101010. 2013-12-18 11:23:49 -08:00
glamor.h For DRI swap buffers. 2013-12-18 11:23:49 -08:00
glapi.h GLX: Enable glx support. 2013-12-18 11:23:48 -08:00
Makefile.am GLX: Enable glx support. 2013-12-18 11:23:48 -08:00