xserver: Branch 'master' - 4 commits

Eric Anholt anholt at kemper.freedesktop.org
Thu Sep 29 17:19:44 UTC 2016


 glamor/glamor.c         |   19 +
 glamor/glamor_program.c |    3 
 glamor/glamor_render.c  |   27 --
 glamor/glamor_utils.h   |  550 ------------------------------------------------
 4 files changed, 23 insertions(+), 576 deletions(-)

New commits:
commit 2aca2dadda4cc9c378049457885d33a4eede9768
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Sep 24 14:42:28 2016 -0700

    glamor: Fix link failure on GLES2.
    
    Current Mesa requires that the precision qualifier on uniforms matches
    between stages, even if (as in this case) the uniform isn't used in
    one of the stages.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c
index dec116c..23c102b 100644
--- a/glamor/glamor_program.c
+++ b/glamor/glamor_program.c
@@ -122,8 +122,7 @@ static glamor_location_var location_vars[] = {
         .vs_vars = ("uniform vec2 fill_offset;\n"
                     "uniform vec2 fill_size_inv;\n"
                     "varying vec2 fill_pos;\n"),
-        .fs_vars = ("uniform vec2 fill_size_inv;\n"
-                    "varying vec2 fill_pos;\n")
+        .fs_vars = ("varying vec2 fill_pos;\n")
     },
     {
         .location = glamor_program_location_font,
commit 20fcdfcf39497fe44d2a3200338523effb8e2bc6
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Sep 24 14:30:27 2016 -0700

    glamor: Remove #if 0-ed picture dumping code.
    
    I don't think anybody has run this code since it was pulled into the
    server.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 9aca750..e04dd21 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -1334,11 +1334,6 @@ glamor_convert_gradient_picture(ScreenPtr screen,
         }
 
         if (dst) {
-#if 0                           /* Debug to compare it to pixman, Enable it if needed. */
-            glamor_compare_pictures(screen, source,
-                                    dst, x_source, y_source, width, height,
-                                    0, 3);
-#endif
             return dst;
         }
     }
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index e639869..6b88527 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -721,385 +721,6 @@ glamor_is_large_pixmap(PixmapPtr pixmap)
 }
 
 static inline void
-_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    int i, j;
-    unsigned char *p = (pixmap)->devPrivate.ptr;
-    int stride = (pixmap)->devKind;
-
-    p = p + y * stride + x;
-
-    for (i = 0; i < h; i++) {
-        ErrorF("line %3d: ", i);
-        for (j = 0; j < w; j++)
-            ErrorF("%2d ", (p[j / 8] & (1 << (j % 8))) >> (j % 8));
-        p += stride;
-        ErrorF("\n");
-    }
-}
-
-static inline void
-_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    int i, j;
-    unsigned char *p = (pixmap)->devPrivate.ptr;
-    int stride = (pixmap)->devKind;
-
-    p = p + y * stride + x;
-
-    for (i = 0; i < h; i++) {
-        ErrorF("line %3d: ", i);
-        for (j = 0; j < w; j++)
-            ErrorF("%2x ", p[j]);
-        p += stride;
-        ErrorF("\n");
-    }
-}
-
-static inline void
-_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    int i, j;
-    unsigned short *p = (pixmap)->devPrivate.ptr;
-    int stride = (pixmap)->devKind / 2;
-
-    p = p + y * stride + x;
-
-    for (i = 0; i < h; i++) {
-        ErrorF("line %3d: ", i);
-        for (j = 0; j < w; j++)
-            ErrorF("%2x ", p[j]);
-        p += stride;
-        ErrorF("\n");
-    }
-}
-
-static inline void
-_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    int i, j;
-    unsigned int *p = (pixmap)->devPrivate.ptr;
-    int stride = (pixmap)->devKind / 4;
-
-    p = p + y * stride + x;
-
-    for (i = 0; i < h; i++) {
-        ErrorF("line %3d: ", i);
-        for (j = 0; j < w; j++)
-            ErrorF("%2x ", p[j]);
-        p += stride;
-        ErrorF("\n");
-    }
-}
-
-static inline void
-glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    w = ((x + w) > (pixmap)->drawable.width) ? ((pixmap)->drawable.width - x) : w;
-    h = ((y + h) > (pixmap)->drawable.height) ? ((pixmap)->drawable.height - y) : h;
-
-    glamor_prepare_access(&(pixmap)->drawable, GLAMOR_ACCESS_RO);
-    switch ((pixmap)->drawable.depth) {
-    case 8:
-        _glamor_dump_pixmap_byte(pixmap, x, y, w, h);
-        break;
-    case 15:
-    case 16:
-        _glamor_dump_pixmap_sword(pixmap, x, y, w, h);
-        break;
-
-    case 24:
-    case 32:
-        _glamor_dump_pixmap_word(pixmap, x, y, w, h);
-        break;
-    case 1:
-        _glamor_dump_pixmap_bits(pixmap, x, y, w, h);
-        break;
-    default:
-        ErrorF("dump depth %d, not implemented.\n", (pixmap)->drawable.depth);
-    }
-    glamor_finish_access(&(pixmap)->drawable);
-}
-
-static inline void
-_glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
-                        int x, int y, int w, int h,
-                        PictFormatShort short_format, int all, int diffs)
-{
-    int i, j;
-    unsigned char *p1 = pixmap1->devPrivate.ptr;
-    unsigned char *p2 = pixmap2->devPrivate.ptr;
-    int line_need_printed = 0;
-    int test_code = 0xAABBCCDD;
-    int little_endian = 0;
-    unsigned char *p_test;
-    int bpp = pixmap1->drawable.depth == 8 ? 1 : 4;
-    int stride = pixmap1->devKind;
-
-    assert(pixmap1->devKind == pixmap2->devKind);
-
-    ErrorF("stride:%d, width:%d, height:%d\n", stride, w, h);
-
-    p1 = p1 + y * stride + x;
-    p2 = p2 + y * stride + x;
-
-    if (all) {
-        for (i = 0; i < h; i++) {
-            ErrorF("line %3d: ", i);
-
-            for (j = 0; j < stride; j++) {
-                if (j % bpp == 0)
-                    ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]);
-                else
-                    ErrorF("%2x:%2x ", p1[j], p2[j]);
-            }
-
-            p1 += stride;
-            p2 += stride;
-            ErrorF("\n");
-        }
-    }
-    else {
-        if (short_format == PICT_a8r8g8b8) {
-            p_test = (unsigned char *) &test_code;
-            little_endian = (*p_test == 0xDD);
-            bpp = 4;
-
-            for (i = 0; i < h; i++) {
-                line_need_printed = 0;
-
-                for (j = 0; j < stride; j++) {
-                    if (p1[j] != p2[j] &&
-                        (p1[j] - p2[j] > diffs || p2[j] - p1[j] > diffs)) {
-                        if (line_need_printed) {
-                            if (little_endian) {
-                                switch (j % 4) {
-                                case 2:
-                                    ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 1:
-                                    ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 0:
-                                    ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 3:
-                                    ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                }
-                            }
-                            else {
-                                switch (j % 4) {
-                                case 1:
-                                    ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 2:
-                                    ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 3:
-                                    ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 0:
-                                    ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                }
-                            }
-                        }
-                        else {
-                            line_need_printed = 1;
-                            j = -1;
-                            ErrorF("line %3d: ", i);
-                            continue;
-                        }
-                    }
-                }
-
-                p1 += stride;
-                p2 += stride;
-                ErrorF("\n");
-            }
-        }                       //more format can be added here.
-        else {                  // the default format, just print.
-            for (i = 0; i < h; i++) {
-                line_need_printed = 0;
-
-                for (j = 0; j < stride; j++) {
-                    if (p1[j] != p2[j]) {
-                        if (line_need_printed) {
-                            ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]);
-                        }
-                        else {
-                            line_need_printed = 1;
-                            j = -1;
-                            ErrorF("line %3d: ", i);
-                            continue;
-                        }
-                    }
-                }
-
-                p1 += stride;
-                p2 += stride;
-                ErrorF("\n");
-            }
-        }
-    }
-}
-
-static inline void
-glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
-                       int x, int y, int w, int h, int all, int diffs)
-{
-    assert(pixmap1->drawable.depth == pixmap2->drawable.depth);
-
-    if (glamor_prepare_access(&pixmap1->drawable, GLAMOR_ACCESS_RO) &&
-        glamor_prepare_access(&pixmap2->drawable, GLAMOR_ACCESS_RO)) {
-        _glamor_compare_pixmaps(pixmap1, pixmap2, x, y, w, h, -1, all, diffs);
-    }
-    glamor_finish_access(&pixmap1->drawable);
-    glamor_finish_access(&pixmap2->drawable);
-}
-
-/* This function is used to compare two pictures.
-   If the picture has no drawable, we use fb functions to generate it. */
-static inline void
-glamor_compare_pictures(ScreenPtr screen,
-                        PicturePtr fst_picture,
-                        PicturePtr snd_picture,
-                        int x_source, int y_source,
-                        int width, int height, int all, int diffs)
-{
-    PixmapPtr fst_pixmap;
-    PixmapPtr snd_pixmap;
-    int fst_generated, snd_generated;
-    int error;
-    int fst_type = -1;
-    int snd_type = -1;          // -1 represent has drawable.
-
-    if (fst_picture->format != snd_picture->format) {
-        ErrorF("Different picture format can not compare!\n");
-        return;
-    }
-
-    if (!fst_picture->pDrawable) {
-        fst_type = fst_picture->pSourcePict->type;
-    }
-
-    if (!snd_picture->pDrawable) {
-        snd_type = snd_picture->pSourcePict->type;
-    }
-
-    if ((fst_type != -1) && (snd_type != -1) && (fst_type != snd_type)) {
-        ErrorF("Different picture type will never be same!\n");
-        return;
-    }
-
-    fst_generated = snd_generated = 0;
-
-    if (!fst_picture->pDrawable) {
-        PicturePtr pixman_pic;
-        PixmapPtr pixmap = NULL;
-        PictFormatShort format;
-
-        format = fst_picture->format;
-
-        pixmap = glamor_create_pixmap(screen,
-                                      width, height,
-                                      PIXMAN_FORMAT_DEPTH(format),
-                                      GLAMOR_CREATE_PIXMAP_CPU);
-
-        pixman_pic = CreatePicture(0,
-                                   &(pixmap)->drawable,
-                                   PictureMatchFormat(screen,
-                                                      PIXMAN_FORMAT_DEPTH
-                                                      (format), format), 0, 0,
-                                   serverClient, &error);
-
-        fbComposite(PictOpSrc, fst_picture, NULL, pixman_pic,
-                    x_source, y_source, 0, 0, 0, 0, width, height);
-
-        glamor_destroy_pixmap(pixmap);
-
-        fst_picture = pixman_pic;
-        fst_generated = 1;
-    }
-
-    if (!snd_picture->pDrawable) {
-        PicturePtr pixman_pic;
-        PixmapPtr pixmap = NULL;
-        PictFormatShort format;
-
-        format = snd_picture->format;
-
-        pixmap = glamor_create_pixmap(screen,
-                                      width, height,
-                                      PIXMAN_FORMAT_DEPTH(format),
-                                      GLAMOR_CREATE_PIXMAP_CPU);
-
-        pixman_pic = CreatePicture(0,
-                                   &(pixmap)->drawable,
-                                   PictureMatchFormat(screen,
-                                                      PIXMAN_FORMAT_DEPTH
-                                                      (format), format), 0, 0,
-                                   serverClient, &error);
-
-        fbComposite(PictOpSrc, snd_picture, NULL, pixman_pic,
-                    x_source, y_source, 0, 0, 0, 0, width, height);
-
-        glamor_destroy_pixmap(pixmap);
-
-        snd_picture = pixman_pic;
-        snd_generated = 1;
-    }
-
-    fst_pixmap = glamor_get_drawable_pixmap(fst_picture->pDrawable);
-    snd_pixmap = glamor_get_drawable_pixmap(snd_picture->pDrawable);
-
-    if (fst_pixmap->drawable.depth != snd_pixmap->drawable.depth) {
-        if (fst_generated)
-            miDestroyPicture(fst_picture);
-        if (snd_generated)
-            miDestroyPicture(snd_picture);
-
-        ErrorF("Different pixmap depth can not compare!\n");
-        return;
-    }
-
-    if ((fst_type == SourcePictTypeLinear) ||
-        (fst_type == SourcePictTypeRadial) ||
-        (fst_type == SourcePictTypeConical) ||
-        (snd_type == SourcePictTypeLinear) ||
-        (snd_type == SourcePictTypeRadial) ||
-        (snd_type == SourcePictTypeConical)) {
-        x_source = y_source = 0;
-    }
-
-    if (glamor_prepare_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO) &&
-        glamor_prepare_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO)) {
-        _glamor_compare_pixmaps(fst_pixmap, snd_pixmap,
-                                x_source, y_source,
-                                width, height, fst_picture->format,
-                                all, diffs);
-    }
-    glamor_finish_access(&fst_pixmap->drawable);
-    glamor_finish_access(&snd_pixmap->drawable);
-
-    if (fst_generated)
-        miDestroyPicture(fst_picture);
-    if (snd_generated)
-        miDestroyPicture(snd_picture);
-
-    return;
-}
-
-static inline void
 glamor_make_current(glamor_screen_private *glamor_priv)
 {
     if (lastGLContext != &glamor_priv->ctx) {
commit 4b5326aeba539249fcded91bf7806a708eeca651
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Sep 24 14:04:14 2016 -0700

    glamor: Remove many unused glamor util functions.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index 5617611..e639869 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -334,21 +334,6 @@
     DEBUGF("normalized tx %f ty %f \n", (texcoord)[0], (texcoord)[1]);	\
   } while(0)
 
-#define glamor_set_transformed_normalize_tri_tcoords(priv,		\
-						     matrix,		\
-						     xscale,		\
-						     yscale,		\
-						     vtx,		\
-						     texcoords)		\
-    do {								\
-	glamor_set_transformed_point(priv, matrix, xscale, yscale,	\
-				     texcoords, (vtx)[0], (vtx)[1]);    \
-	glamor_set_transformed_point(priv, matrix, xscale, yscale,	\
-				     texcoords+2, (vtx)[2], (vtx)[3]);  \
-	glamor_set_transformed_point(priv, matrix, xscale, yscale,	\
-				     texcoords+4, (vtx)[4], (vtx)[5]);  \
-    } while (0)
-
 #define glamor_set_transformed_normalize_tcoords_ext( priv,		\
 						  matrix,		\
 						  xscale,		\
@@ -367,38 +352,6 @@
 				 texcoords + 3 * stride, tx1, ty2);     \
   } while (0)
 
-#define glamor_set_transformed_normalize_tcoords( priv,			\
-						  matrix,		\
-						  xscale,		\
-						  yscale,		\
-                                                  tx1, ty1, tx2, ty2,   \
-                                                  texcoords)            \
-  do {									\
-	glamor_set_transformed_normalize_tcoords_ext( priv,		\
-						  matrix,		\
-						  xscale,		\
-						  yscale,		\
-                                                  tx1, ty1, tx2, ty2,   \
-                                                  texcoords,		\
-						  2);			\
-  } while (0)
-
-#define glamor_set_normalize_tri_tcoords(xscale,		\
-					 yscale,		\
-					 vtx,			\
-					 texcoords)		\
-    do {							\
-	_glamor_set_normalize_tpoint(xscale, yscale,		\
-				(vtx)[0], (vtx)[1],		\
-				texcoords);			\
-	_glamor_set_normalize_tpoint(xscale, yscale,		\
-				(vtx)[2], (vtx)[3],		\
-				texcoords+2);			\
-	_glamor_set_normalize_tpoint(xscale, yscale,		\
-				(vtx)[4], (vtx)[5],		\
-				texcoords+4);			\
-    } while (0)
-
 #define glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, \
 							 repeat_type,	\
 							 matrix,	\
@@ -508,15 +461,6 @@
                                       x2, y2, vertices, stride);        \
  } while(0)
 
-#define glamor_set_normalize_tcoords(priv, xscale, yscale,		\
-				     x1, y1, x2, y2,			\
-                                     vertices)		\
-  do {									\
-	glamor_set_normalize_tcoords_ext(priv, xscale, yscale,		\
-				     x1, y1, x2, y2,			\
-                                     vertices, 2);			\
- } while(0)
-
 #define glamor_set_repeat_normalize_tcoords_ext(pixmap, priv, repeat_type, \
 					    xscale, yscale,		\
 					    _x1_, _y1_, _x2_, _y2_,	\
@@ -543,17 +487,6 @@
 				   stride);				\
  } while(0)
 
-#define glamor_set_repeat_normalize_tcoords(priv, repeat_type,		\
-					    xscale, yscale,		\
-					    _x1_, _y1_, _x2_, _y2_,	\
-	                                    vertices)                   \
-  do {									\
-	glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type,	\
-					    xscale, yscale,		\
-					    _x1_, _y1_, _x2_, _y2_,	\
-	                                    vertices, 2);		\
- } while(0)
-
 #define glamor_set_normalize_tcoords_tri_stripe(xscale, yscale,		\
 						x1, y1, x2, y2,		\
 						vertices)               \
@@ -568,51 +501,6 @@
 	(vertices)[5] = (vertices)[7];					\
     } while(0)
 
-#define glamor_set_tcoords(x1, y1, x2, y2, vertices)            \
-    do {							\
-	(vertices)[0] = (x1);					\
-	(vertices)[2] = (x2);					\
-	(vertices)[4] = (vertices)[2];				\
-	(vertices)[6] = (vertices)[0];				\
-        (vertices)[1] = (y1);                                   \
-        (vertices)[5] = (y2);                                   \
-	(vertices)[3] = (vertices)[1];				\
-	(vertices)[7] = (vertices)[5];				\
-    } while(0)
-
-#define glamor_set_tcoords_ext(x1, y1, x2, y2, vertices, stride)        \
-    do {							\
-	(vertices)[0] = (x1);					\
-	(vertices)[1*stride] = (x2);				\
-	(vertices)[2*stride] = (vertices)[1*stride];		\
-	(vertices)[3*stride] = (vertices)[0];			\
-        (vertices)[1] = (y1);                                   \
-        (vertices)[2*stride + 1] = (y2);			\
-	(vertices)[1*stride + 1] = (vertices)[1];		\
-	(vertices)[3*stride + 1] = (vertices)[2*stride + 1];	\
-    } while(0)
-
-#define glamor_set_normalize_one_vcoord(xscale, yscale, x, y,		\
-					vertices)                       \
-    do {								\
-	(vertices)[0] = v_from_x_coord_x(xscale, x);			\
-        (vertices)[1] = v_from_x_coord_y(yscale, y);                    \
-    } while(0)
-
-#define glamor_set_normalize_tri_vcoords(xscale, yscale, vtx,		\
-					 vertices)                      \
-    do {								\
-	glamor_set_normalize_one_vcoord(xscale, yscale,			\
-					(vtx)[0], (vtx)[1],		\
-					vertices);                      \
-	glamor_set_normalize_one_vcoord(xscale, yscale,			\
-					(vtx)[2], (vtx)[3],		\
-					vertices+2);                    \
-	glamor_set_normalize_one_vcoord(xscale, yscale,			\
-					(vtx)[4], (vtx)[5],		\
-					vertices+4);                    \
-    } while(0)
-
 #define glamor_set_tcoords_tri_strip(x1, y1, x2, y2, vertices)          \
     do {								\
 	(vertices)[0] = (x1);						\
@@ -646,25 +534,6 @@
     (vertices)[3 * stride + 1] = _t5_;					\
   } while(0)
 
-#define glamor_set_normalize_vcoords(priv, xscale, yscale,		\
-				     x1, y1, x2, y2,			\
-                                     vertices)				\
-  do {									\
-	glamor_set_normalize_vcoords_ext(priv, xscale, yscale,		\
-				     x1, y1, x2, y2,			\
-                                     vertices, 2);			\
-  } while(0)
-
-#define glamor_set_const_ext(params, nparam, vertices, nverts, stride)	\
-    do {								\
-	int _i_ = 0, _j_ = 0;						\
-	for(; _i_ < nverts; _i_++) {					\
-	    for(_j_ = 0; _j_ < nparam; _j_++) {				\
-		vertices[stride*_i_ + _j_] = params[_j_];		\
-	    }								\
-	}								\
-    } while(0)
-
 #define glamor_set_normalize_vcoords_tri_strip(xscale, yscale,		\
 					       x1, y1, x2, y2,		\
 					       vertices)		\
@@ -1230,46 +1099,6 @@ glamor_compare_pictures(ScreenPtr screen,
     return;
 }
 
-#ifdef __i386__
-static inline unsigned long
-__fls(unsigned long x)
-{
- asm("bsr %1,%0":"=r"(x)
- :     "rm"(x));
-    return x;
-}
-#else
-static inline unsigned long
-__fls(unsigned long x)
-{
-    int n;
-
-    if (x == 0)
-        return (0);
-    n = 0;
-    if (x <= 0x0000FFFF) {
-        n = n + 16;
-        x = x << 16;
-    }
-    if (x <= 0x00FFFFFF) {
-        n = n + 8;
-        x = x << 8;
-    }
-    if (x <= 0x0FFFFFFF) {
-        n = n + 4;
-        x = x << 4;
-    }
-    if (x <= 0x3FFFFFFF) {
-        n = n + 2;
-        x = x << 2;
-    }
-    if (x <= 0x7FFFFFFF) {
-        n = n + 1;
-    }
-    return 31 - n;
-}
-#endif
-
 static inline void
 glamor_make_current(glamor_screen_private *glamor_priv)
 {
commit 117d614d1ba324bdb02c50a430c2e0d22a384f03
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Sep 24 22:26:17 2016 +0300

    glamor: Require GL_OES_texture_border_clamp for GLES2.
    
    The extension came out in 2000, and all Mesa-supported hardware that
    can do glamor supports it.  We were already relying on the ARB version
    being present on desktop.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 7b39536..b771832 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -515,6 +515,10 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 
     gl_version = epoxy_gl_version();
 
+    /* assume a core profile if we are GL 3.1 and don't have ARB_compatibility */
+    glamor_priv->is_core_profile =
+        gl_version >= 31 && !epoxy_has_gl_extension("GL_ARB_compatibility");
+
     shading_version_string = (char *) glGetString(GL_SHADING_LANGUAGE_VERSION);
 
     if (!shading_version_string) {
@@ -569,6 +573,12 @@ glamor_init(ScreenPtr screen, unsigned int flags)
             goto fail;
         }
 
+        if (!glamor_priv->is_core_profile &&
+            !epoxy_has_gl_extension("GL_ARB_texture_border_clamp")) {
+            ErrorF("GL_ARB_texture_border_clamp required\n");
+            goto fail;
+        }
+
         if (!glamor_check_instruction_count(gl_version))
             goto fail;
     } else {
@@ -581,6 +591,11 @@ glamor_init(ScreenPtr screen, unsigned int flags)
             ErrorF("GL_EXT_texture_format_BGRA8888 required\n");
             goto fail;
         }
+
+        if (!epoxy_has_gl_extension("GL_OES_texture_border_clamp")) {
+            ErrorF("GL_OES_texture_border_clamp required\n");
+            goto fail;
+        }
     }
 
     glamor_priv->has_rw_pbo = FALSE;
@@ -612,10 +627,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
     glamor_priv->has_dual_blend =
         epoxy_has_gl_extension("GL_ARB_blend_func_extended");
 
-    /* assume a core profile if we are GL 3.1 and don't have ARB_compatibility */
-    glamor_priv->is_core_profile =
-        gl_version >= 31 && !epoxy_has_gl_extension("GL_ARB_compatibility");
-
     glamor_priv->can_copyplane = (gl_version >= 30);
 
     glamor_setup_debug_output(screen);
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index f5651eb..9aca750 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -533,16 +533,8 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
     repeat_type = picture->repeatType;
     switch (picture->repeatType) {
     case RepeatNone:
-        if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) {
-            /* XXX  GLES2 doesn't support GL_CLAMP_TO_BORDER. */
-            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
-                            GL_CLAMP_TO_BORDER);
-            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
-                            GL_CLAMP_TO_BORDER);
-        } else {
-            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-        }
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
         break;
     case RepeatNormal:
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -573,12 +565,12 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
         break;
     }
 
-    /*
-     *  GLES2 doesn't support RepeatNone. We need to fix it anyway.
-     *
-     **/
+    /* Handle RepeatNone in the shader when the source is missing the
+     * alpha channel, as GL will return an alpha for 1 if the texture
+     * is RGB (no alpha), which we use for 16bpp textures.
+     */
     if (glamor_pixmap_priv_is_large(pixmap_priv) ||
-        ((!PICT_FORMAT_A(picture->format) || glamor_priv->gl_flavor == GLAMOR_GL_ES2) &&
+        (!PICT_FORMAT_A(picture->format) &&
          repeat_type == RepeatNone && picture->transform)) {
         glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, pixmap_priv);
         glUniform4fv(wh_location, 1, wh);


More information about the xorg-commit mailing list