diff options
author | Eric Anholt <eric@anholt.net> | 2014-02-28 13:02:03 -0500 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@gmail.com> | 2014-03-13 21:52:17 +0800 |
commit | 6a2e3aad40d5e5bfb1f5d56c2387b8246ae17480 (patch) | |
tree | a99382c25cbff76c7cac616fe8a716de7d0661c7 | |
parent | f41d70891fccee9bdd915748eb003949945b7416 (diff) |
glamor: Unifdef the picture-format-to-format-and-type functions.
There's no way these should be in a header file, but I'll leave that
cleanup until later.
Ported from Eric's glamor xserver tree.
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/glamor_pixmap.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/glamor_pixmap.c b/src/glamor_pixmap.c index ad94733..7980489 100644 --- a/src/glamor_pixmap.c +++ b/src/glamor_pixmap.c @@ -191,16 +191,13 @@ glamor_set_alu(struct glamor_gl_dispatch *dispatch, unsigned char alu) * * Return 0 if find a matched texture type. Otherwise return -1. **/ -#ifndef GLAMOR_GLES2 static int -glamor_get_tex_format_type_from_pictformat(PictFormatShort format, - GLenum * tex_format, - GLenum * tex_type, - int *no_alpha, - int *revert, - int *swap_rb, - int is_upload) - +glamor_get_tex_format_type_from_pictformat_gl(PictFormatShort format, + GLenum * tex_format, + GLenum * tex_type, + int *no_alpha, + int *revert, + int *swap_rb, int is_upload) { *no_alpha = 0; *revert = REVERT_NONE; @@ -291,17 +288,15 @@ glamor_get_tex_format_type_from_pictformat(PictFormatShort format, return 0; } -#else #define IS_LITTLE_ENDIAN (IMAGE_BYTE_ORDER == LSBFirst) static int -glamor_get_tex_format_type_from_pictformat(PictFormatShort format, - GLenum * tex_format, - GLenum * tex_type, - int *no_alpha, - int *revert, - int *swap_rb, - int is_upload) +glamor_get_tex_format_type_from_pictformat_gles2(PictFormatShort format, + GLenum * tex_format, + GLenum * tex_type, + int *no_alpha, + int *revert, + int *swap_rb, int is_upload) { int need_swap_rb = 0; @@ -459,8 +454,6 @@ glamor_get_tex_format_type_from_pictformat(PictFormatShort format, return 0; } -#endif - static int glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap, GLenum * format, @@ -472,6 +465,8 @@ glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap, { glamor_pixmap_private *pixmap_priv; PictFormatShort pict_format; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); pixmap_priv = glamor_get_pixmap_private(pixmap); if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) @@ -479,12 +474,21 @@ glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap, else pict_format = format_for_depth(pixmap->drawable.depth); - return glamor_get_tex_format_type_from_pictformat(pict_format, - format, type, - no_alpha, - revert, - swap_rb, - is_upload); + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + return glamor_get_tex_format_type_from_pictformat_gl(pict_format, + format, type, + no_alpha, + revert, + swap_rb, + is_upload); + } else { + return glamor_get_tex_format_type_from_pictformat_gles2(pict_format, + format, type, + no_alpha, + revert, + swap_rb, + is_upload); + } } static void * |