[PATCH xserver 02/12] glamor: Make sure that GLAMOR_MEMORY pixmaps don't retain an FBO.

2016-02-01 Thread Eric Anholt
glamor_composite_choose_shader() may upload our scratch pixmaps to get
a Render operation completed.  We don't want to hang onto GL memory
for our scratch pixmaps, since we'll just have to reallocate them at a
new w/h next time around, and the contents will be updated as well.

Signed-off-by: Eric Anholt 
---
 glamor/glamor_fbo.c |  1 +
 glamor/glamor_picture.c | 13 -
 glamor/glamor_render.c  | 11 +--
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
index 5bfffe5..0bfc1dd 100644
--- a/glamor/glamor_fbo.c
+++ b/glamor/glamor_fbo.c
@@ -510,6 +510,7 @@ glamor_pixmap_destroy_fbo(PixmapPtr pixmap)
 for (i = 0; i < priv->block_wcnt * priv->block_hcnt; i++)
 glamor_destroy_fbo(glamor_priv, priv->fbo_array[i]);
 free(priv->fbo_array);
+priv->fbo_array = NULL;
 }
 else {
 fbo = glamor_pixmap_detach_fbo(priv);
diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index e91461c..9bb2c74 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -797,9 +797,10 @@ glamor_put_bits(char *dst_bits, int dst_stride, char 
*src_bits,
 }
 }
 
-/* Upload picture to texture.  We may need to flip the y axis or
- * wire alpha to 1. So we may conditional create fbo for the picture.
- * */
+/**
+ * Uploads a picture based on a GLAMOR_MEMORY pixmap to a texture in a
+ * temporary FBO.
+ */
 Bool
 glamor_upload_picture_to_texture(PicturePtr picture)
 {
@@ -810,9 +811,12 @@ glamor_upload_picture_to_texture(PicturePtr picture)
 glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
 GLenum format, type;
 int no_alpha, revert, swap_rb;
-glamor_pixmap_private *pixmap_priv;
+glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
 Bool force_clip;
 
+assert(glamor_pixmap_is_memory(pixmap));
+assert(!pixmap_priv->fbo);
+
 if (glamor_get_tex_format_type_from_pixmap(pixmap,
picture->format,
,
@@ -825,7 +829,6 @@ glamor_upload_picture_to_texture(PicturePtr picture)
 if (glamor_pixmap_upload_prepare(pixmap, format, no_alpha, revert, 
swap_rb))
 return FALSE;
 
-pixmap_priv = glamor_get_pixmap_private(pixmap);
 force_clip = glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP;
 
 if (glamor_pixmap_priv_is_large(pixmap_priv) || force_clip) {
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index d47e7d7..65f7059 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -1125,7 +1125,7 @@ glamor_composite_with_shader(CARD8 op,
 , , _info,
 _source_format, ca_state)) {
 glamor_fallback("glamor_composite_choose_shader failed\n");
-return ret;
+goto fail;
 }
 if (ca_state == CA_TWO_PASS) {
 if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest,
@@ -1135,7 +1135,7 @@ glamor_composite_with_shader(CARD8 op,
 _ca, _ca, _info_ca,
 _source_format, ca_state)) {
 glamor_fallback("glamor_composite_choose_shader failed\n");
-return ret;
+goto fail;
 }
 }
 
@@ -1267,6 +1267,13 @@ glamor_composite_with_shader(CARD8 op,
 source->format = saved_source_format;
 
 ret = TRUE;
+
+fail:
+if (mask_pixmap && glamor_pixmap_is_memory(mask_pixmap))
+glamor_pixmap_destroy_fbo(mask_pixmap);
+if (source_pixmap && glamor_pixmap_is_memory(source_pixmap))
+glamor_pixmap_destroy_fbo(source_pixmap);
+
 return ret;
 }
 
-- 
2.7.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 05/12] glamor: Merge the two GL-type-from-pictformat paths.

2016-02-01 Thread Eric Anholt
It clarifies what the difference is between the two paths, and would
potentially encourage us to handle GLES extensions that expose
additional types.

Signed-off-by: Eric Anholt 
---
 glamor/glamor_picture.c | 322 ++--
 1 file changed, 121 insertions(+), 201 deletions(-)

diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index 34cf4a3..e11280f 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -40,275 +40,195 @@
  *
  * Return 0 if find a matched texture type. Otherwise return -1.
  **/
-static int
-glamor_get_tex_format_type_from_pictformat_gl(ScreenPtr pScreen,
-  PictFormatShort format,
-  GLenum *tex_format,
-  GLenum *tex_type,
-  int *no_alpha,
-  int *revert,
-  int *swap_rb)
+static Bool
+glamor_get_tex_format_type_from_pictformat(ScreenPtr pScreen,
+   PictFormatShort format,
+   GLenum *tex_format,
+   GLenum *tex_type,
+   int *no_alpha,
+   int *revert,
+   int *swap_rb)
 {
 glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen);
+Bool is_little_endian = IMAGE_BYTE_ORDER == LSBFirst;
+
 *no_alpha = 0;
 *revert = REVERT_NONE;
 *swap_rb = SWAP_NONE_UPLOADING;
+
 switch (format) {
 case PICT_a1:
 *tex_format = glamor_priv->one_channel_format;
 *tex_type = GL_UNSIGNED_BYTE;
 *revert = REVERT_UPLOADING_A1;
 break;
-case PICT_b8g8r8x8:
-*no_alpha = 1;
-case PICT_b8g8r8a8:
-*tex_format = GL_BGRA;
-*tex_type = GL_UNSIGNED_INT_8_8_8_8;
-break;
-
-case PICT_x8r8g8b8:
-*no_alpha = 1;
-case PICT_a8r8g8b8:
-*tex_format = GL_BGRA;
-*tex_type = GL_UNSIGNED_INT_8_8_8_8_REV;
-break;
-case PICT_x8b8g8r8:
-*no_alpha = 1;
-case PICT_a8b8g8r8:
-*tex_format = GL_RGBA;
-*tex_type = GL_UNSIGNED_INT_8_8_8_8_REV;
-break;
-case PICT_x2r10g10b10:
-*no_alpha = 1;
-case PICT_a2r10g10b10:
-*tex_format = GL_BGRA;
-*tex_type = GL_UNSIGNED_INT_2_10_10_10_REV;
-break;
-case PICT_x2b10g10r10:
-*no_alpha = 1;
-case PICT_a2b10g10r10:
-*tex_format = GL_RGBA;
-*tex_type = GL_UNSIGNED_INT_2_10_10_10_REV;
-break;
-
-case PICT_r5g6b5:
-*tex_format = GL_RGB;
-*tex_type = GL_UNSIGNED_SHORT_5_6_5;
-break;
-case PICT_b5g6r5:
-*tex_format = GL_RGB;
-*tex_type = GL_UNSIGNED_SHORT_5_6_5_REV;
-break;
-case PICT_x1b5g5r5:
-*no_alpha = 1;
-case PICT_a1b5g5r5:
-*tex_format = GL_RGBA;
-*tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
-break;
-
-case PICT_x1r5g5b5:
-*no_alpha = 1;
-case PICT_a1r5g5b5:
-*tex_format = GL_BGRA;
-*tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
-break;
-case PICT_a8:
-*tex_format = glamor_priv->one_channel_format;
-*tex_type = GL_UNSIGNED_BYTE;
-break;
-case PICT_x4r4g4b4:
-*no_alpha = 1;
-case PICT_a4r4g4b4:
-*tex_format = GL_BGRA;
-*tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
-break;
-
-case PICT_x4b4g4r4:
-*no_alpha = 1;
-case PICT_a4b4g4r4:
-*tex_format = GL_RGBA;
-*tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
-break;
-
-default:
-return -1;
-}
-return 0;
-}
-
-#define IS_LITTLE_ENDIAN  (IMAGE_BYTE_ORDER == LSBFirst)
-
-static int
-glamor_get_tex_format_type_from_pictformat_gles2(ScreenPtr pScreen,
- PictFormatShort format,
- GLenum *tex_format,
- GLenum *tex_type,
- int *no_alpha,
- int *revert,
- int *swap_rb)
-{
-glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen);
-int need_swap_rb = 0;
 
-*no_alpha = 0;
-*revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL;
-
-switch (format) {
 case PICT_b8g8r8x8:
 *no_alpha = 1;
 case PICT_b8g8r8a8:
-*tex_format = GL_RGBA;
-*tex_type = GL_UNSIGNED_BYTE;
-need_swap_rb = 1;
-*revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE;
+if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+

[PATCH xserver 04/12] glamor: Propagate that is_upload is always true.

2016-02-01 Thread Eric Anholt
Signed-off-by: Eric Anholt 
---
 glamor/glamor_core.c|  18 ++
 glamor/glamor_picture.c | 142 ++--
 glamor/glamor_utils.h   |   6 --
 3 files changed, 46 insertions(+), 120 deletions(-)

diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index b9948b5..a8768f4 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -164,8 +164,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
 "uniform int swap_rb;\n"
 "#define REVERT_NONE   0\n"
 "#define REVERT_NORMAL 1\n"
-"#define SWAP_NONE_DOWNLOADING 0\n"
-"#define SWAP_DOWNLOADING  1\n"
 "#define SWAP_UPLOADING2\n"
 "#define SWAP_NONE_UPLOADING   3\n";
 
@@ -175,18 +173,14 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
 "   vec4 color = texture2D(sampler, source_texture);\n"
 "   if (revert == REVERT_NONE) \n"
 "{ \n"
-" if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != 
SWAP_NONE_UPLOADING))   \n"
+" if ((swap_rb != SWAP_NONE_UPLOADING))   \n"
 "  gl_FragColor = color.bgra;\n"
 " else \n"
 "  gl_FragColor = color.rgba;\n"
 "} \n"
 "   else \n"
 "{ \n"
-" if (swap_rb == SWAP_DOWNLOADING)   \n"
-"  gl_FragColor = color.argb;\n"
-" else if (swap_rb == SWAP_NONE_DOWNLOADING)\n"
-"  gl_FragColor = color.abgr;\n"
-" else if (swap_rb == SWAP_UPLOADING)\n"
+" if (swap_rb == SWAP_UPLOADING)\n"
 "  gl_FragColor = color.gbar;\n"
 " else if (swap_rb == SWAP_NONE_UPLOADING)\n"
 "  gl_FragColor = color.abgr;\n"
@@ -199,18 +193,14 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
 "   vec4 color = texture2D(sampler, source_texture);\n"
 "   if (revert == REVERT_NONE) \n"
 "{ \n"
-" if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != 
SWAP_NONE_UPLOADING))   \n"
+" if (swap_rb != SWAP_NONE_UPLOADING)   \n"
 "  gl_FragColor = vec4(color.bgr, 1);\n"
 " else \n"
 "  gl_FragColor = vec4(color.rgb, 1);\n"
 "} \n"
 "   else \n"
 "{ \n"
-" if (swap_rb == SWAP_DOWNLOADING)   \n"
-"  gl_FragColor = vec4(1, color.rgb);\n"
-" else if (swap_rb == SWAP_NONE_DOWNLOADING)\n"
-"  gl_FragColor = vec4(1, color.bgr);\n"
-" else if (swap_rb == SWAP_UPLOADING)\n"
+" if (swap_rb == SWAP_UPLOADING)\n"
 "  gl_FragColor = vec4(color.gba, 1);\n"
 " else if (swap_rb == SWAP_NONE_UPLOADING)\n"
 "  gl_FragColor = vec4(color.abg, 1);\n"
diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index a032ed0..34cf4a3 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -47,17 +47,17 @@ glamor_get_tex_format_type_from_pictformat_gl(ScreenPtr 
pScreen,
   GLenum *tex_type,
   int *no_alpha,
   int *revert,
-  int *swap_rb, int is_upload)
+  int *swap_rb)
 {
 glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen);
 *no_alpha = 0;
 *revert = REVERT_NONE;
-*swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING;
+*swap_rb = SWAP_NONE_UPLOADING;
 switch (format) {
 case PICT_a1:
 *tex_format = glamor_priv->one_channel_format;
 *tex_type = GL_UNSIGNED_BYTE;
-*revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1;
+*revert = REVERT_UPLOADING_A1;
 break;
 case PICT_b8g8r8x8:
 *no_alpha = 1;
@@ -145,7 +145,7 @@ glamor_get_tex_format_type_from_pictformat_gles2(ScreenPtr 
pScreen,
  GLenum *tex_type,
  int *no_alpha,
  int *revert,
- int *swap_rb, int is_upload)
+ int *swap_rb)
 {
 glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen);
 int need_swap_rb = 0;
@@ -186,20 +186,10 @@ 
glamor_get_tex_format_type_from_pictformat_gles2(ScreenPtr pScreen,
  * we have to use GL_UNSIGNED_BYTE and do the conversion in
  * shader latter.*/
 *tex_type = GL_UNSIGNED_BYTE;
-if (is_upload == 1) {
-if (!IS_LITTLE_ENDIAN)
-*revert = 

[PATCH xserver 06/12] glamor: Drop the GLES2 REVERT_UPLOADING_2_10_10_10 paths.

2016-02-01 Thread Eric Anholt
These just smash your 2_10_10_10 data into , despite what the
comments said.  That's not valid rendering, so just ditch this path
and fall back to software.  One might also note in the code being
removed here that the REVERT_UPLOADING_10_10_10_2 path wasn't even
connected.

Signed-off-by: Eric Anholt 
---
 glamor/glamor_picture.c | 57 ++---
 glamor/glamor_utils.h   |  2 --
 2 files changed, 2 insertions(+), 57 deletions(-)

diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index e11280f..5c6a1a5 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -111,18 +111,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr 
pScreen,
 *tex_format = GL_BGRA;
 *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV;
 } else {
-/* glReadPixmap doesn't support
- * GL_UNSIGNED_INT_10_10_10_2.  We have to use
- * GL_UNSIGNED_BYTE and do the conversion in a shader
- * later.
- */
-*tex_format = GL_RGBA;
-*tex_type = GL_UNSIGNED_BYTE;
-if (!is_little_endian)
-*revert = REVERT_UPLOADING_10_10_10_2;
-else
-*revert = REVERT_UPLOADING_2_10_10_10;
-*swap_rb = SWAP_UPLOADING;
+return FALSE;
 }
 break;
 
@@ -133,13 +122,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr 
pScreen,
 *tex_format = GL_RGBA;
 *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV;
 } else {
-*tex_format = GL_RGBA;
-*tex_type = GL_UNSIGNED_BYTE;
-if (!is_little_endian)
-*revert = REVERT_UPLOADING_10_10_10_2;
-else
-*revert = REVERT_UPLOADING_2_10_10_10;
-break;
+return FALSE;
 }
 break;
 
@@ -300,37 +283,6 @@ _glamor_color_convert_a1_a8(void *src_bits, void 
*dst_bits, int w, int h,
(*dst) = ((a) << (a_shift)) | ((r) << (b_shift)) | ((g) 
<< (g_shift)) | ((b) << (r_shift)); \
} while (0)
 
-static void *
-_glamor_color_revert_x2b10g10r10(void *src_bits, void *dst_bits, int w, int h,
- int stride, int no_alpha,
- int swap_rb)
-{
-int x, y;
-unsigned int *words, *saved_words, *source_words;
-int swap = swap_rb != SWAP_NONE_UPLOADING;
-
-source_words = src_bits;
-words = dst_bits;
-saved_words = words;
-
-for (y = 0; y < h; y++) {
-DEBUGF("Line %d :  ", y);
-for (x = 0; x < w; x++) {
-unsigned int pixel = source_words[x];
-
-GLAMOR_DO_CONVERT(pixel, [x], no_alpha, swap,
-  30, 2, 20, 10, 10, 10, 0, 10,
-  24, 8, 16, 8, 8, 8, 0, 8);
-DEBUGF("%x:%x ", pixel, words[x]);
-}
-DEBUGF("\n");
-words += stride / sizeof(*words);
-source_words += stride / sizeof(*words);
-}
-DEBUGF("\n");
-return saved_words;
-
-}
 
 static void *
 _glamor_color_revert_x1b5g5r5(void *src_bits, void *dst_bits, int w, int h,
@@ -371,7 +323,6 @@ _glamor_color_revert_x1b5g5r5(void *src_bits, void 
*dst_bits, int w, int h,
  * If it is set, then we need to wire the alpha value to 1.
  * @revert:
REVERT_UPLOADING_A1 : convert an A1 buffer to an Alpha8 
buffer
-   REVERT_UPLOADING_2_10_10_10 : convert X2B10G10R10 to R10G10B10X2
REVERT_UPLOADING_1_5_5_5: convert X1R5G5B5 to B5G5R5X1
@swap_rb: if we have the swap_rb set, then we need to swap the R and B's 
position.
  *
@@ -384,10 +335,6 @@ glamor_color_convert_to_bits(void *src_bits, void 
*dst_bits, int w, int h,
 if (revert == REVERT_UPLOADING_A1) {
 return _glamor_color_convert_a1_a8(src_bits, dst_bits, w, h, stride);
 }
-else if (revert == REVERT_UPLOADING_2_10_10_10) {
-return _glamor_color_revert_x2b10g10r10(src_bits, dst_bits, w, h,
-stride, no_alpha, swap_rb);
-}
 else if (revert == REVERT_UPLOADING_1_5_5_5) {
 return _glamor_color_revert_x1b5g5r5(src_bits, dst_bits, w, h, stride,
  no_alpha, swap_rb);
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index e23de86..fc33995 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -768,9 +768,7 @@ format_for_pixmap(PixmapPtr pixmap)
 #define REVERT_NONE0
 #define REVERT_NORMAL  1
 #define REVERT_UPLOADING_A13
-#define REVERT_UPLOADING_2_10_10_105
 #define REVERT_UPLOADING_1_5_5_5   8
-#define REVERT_UPLOADING_10_10_10_210
 
 #define SWAP_UPLOADING 2
 #define SWAP_NONE_UPLOADING3
-- 
2.7.0

___
xorg-devel@lists.x.org: X.Org development
Archives: 

[PATCH xserver 03/12] glamor: Drop dead fbo handling from GLAMORY_MEMORY pict uploads.

2016-02-01 Thread Eric Anholt
The previous commit asserts that we don't have one.

Signed-off-by: Eric Anholt 
---
 glamor/glamor_picture.c | 25 ++---
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index 9bb2c74..a032ed0 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -734,27 +734,10 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum 
format, int no_alpha,
  int revert, int swap_rb)
 {
 int flag = 0;
-glamor_pixmap_private *pixmap_priv;
-glamor_screen_private *glamor_priv;
-glamor_pixmap_fbo *fbo;
+glamor_screen_private *glamor_priv =
+glamor_get_screen_private(pixmap->drawable.pScreen);
 GLenum iformat;
 
-pixmap_priv = glamor_get_pixmap_private(pixmap);
-glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
-
-if (pixmap_priv->gl_fbo != GLAMOR_FBO_UNATTACHED)
-return 0;
-
-if (pixmap_priv->fbo
-&& (pixmap_priv->fbo->width < pixmap->drawable.width
-|| pixmap_priv->fbo->height < pixmap->drawable.height)) {
-fbo = glamor_pixmap_detach_fbo(pixmap_priv);
-glamor_destroy_fbo(glamor_priv, fbo);
-}
-
-if (pixmap_priv->fbo && pixmap_priv->fbo->fb)
-return 0;
-
 if (!(no_alpha || (revert == REVERT_NORMAL)
   || (swap_rb != SWAP_NONE_UPLOADING))) {
 /* We don't need a fbo, a simple texture uploading should work. */
@@ -762,10 +745,6 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum 
format, int no_alpha,
 flag = GLAMOR_CREATE_FBO_NO_FBO;
 }
 
-if ((flag == GLAMOR_CREATE_FBO_NO_FBO
- && pixmap_priv->fbo && pixmap_priv->fbo->tex))
-return 0;
-
 if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
 iformat = gl_iformat_for_pixmap(pixmap);
 else
-- 
2.7.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 00/12] glamor_picture.c total rewrite

2016-02-01 Thread Eric Anholt
I started incrementally cleaning up glamor_picture.c after being
surprised by its behavior during the last series, and ended up with a
total rewrite.  There will be some small losses in acceleration paths
for GLES2, but since GLES2 hasn't worked in several releases (and a
bunch of glamor_picture.c on GLES2 started out broken), I don't think
that's a big deal.  We could get back to acceleration for those paths
using the converted_format output, if someone cared.

I tested this with a full xts-render run, the new rendercheck/shmblend
test I wrote, and I also forced the upload paths to use the GLES2
cases for a rendercheck/shmblend to make sure I had their swizzles
right (I didn't).

Eric Anholt (12):
  glamor: Simplify temporary picture uploading call stack.
  glamor: Make sure that GLAMOR_MEMORY pixmaps don't retain an FBO.
  glamor: Drop dead fbo handling from GLAMORY_MEMORY pict uploads.
  glamor: Propagate that is_upload is always true.
  glamor: Merge the two GL-type-from-pictformat paths.
  glamor: Drop the GLES2 REVERT_UPLOADING_2_10_10_10 paths.
  glamor: Drop the REVERT_UPLOADING_1_5_5_5 path.
  glamor: Generalize the a1-to-a8 conversion path.
  glamor: Drop unused PBO code in temporary picture uploading.
  glamor: Drop dead large-pixmap handling code in temp picture uploads.
  glamor: Replace "finish access" shader with texture swizzling.
  ephyr: Fix redisplay with glamor on GLES.

 glamor/glamor.c|9 +-
 glamor/glamor_core.c   |  168 --
 glamor/glamor_fbo.c|   12 +
 glamor/glamor_picture.c| 1003 
 glamor/glamor_priv.h   |   27 +-
 glamor/glamor_render.c |   38 +-
 glamor/glamor_utils.h  |   11 +-
 hw/kdrive/ephyr/ephyr_glamor_glx.c |4 +-
 8 files changed, 267 insertions(+), 1005 deletions(-)

-- 
2.7.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 10/12] glamor: Drop dead large-pixmap handling code in temp picture uploads.

2016-02-01 Thread Eric Anholt
The glamor_pixmap_ensure_fbo() in glamor_pixmap_upload_prepare() will
always fail on a large pixmap, so we can just be explicit about
bailing out here and then dump the rest of this garbage.

Signed-off-by: Eric Anholt 
---
 glamor/glamor_picture.c | 127 ++--
 glamor/glamor_priv.h|   1 -
 2 files changed, 16 insertions(+), 112 deletions(-)

diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index e0458a6..42fee1b 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -315,11 +315,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, 
GLenum format,
 /* Try fast path firstly, upload the pixmap to the texture attached
  * to the fbo directly. */
 if (no_alpha == 0
-&& revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING
-#ifdef WALKAROUND_LARGE_TEXTURE_MAP
-&& glamor_pixmap_priv_is_small(pixmap_priv)
-#endif
-) {
+&& revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING) {
 int fbo_x_off, fbo_y_off;
 
 assert(pixmap_priv->fbo->tex);
@@ -429,26 +425,6 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum 
format, int no_alpha,
 return 0;
 }
 
-/*
- * upload sub region to a large region.
- * */
-static void
-glamor_put_bits(char *dst_bits, int dst_stride, char *src_bits,
-int src_stride, int bpp, int x, int y, int w, int h)
-{
-int j;
-int byte_per_pixel;
-
-byte_per_pixel = bpp / 8;
-src_bits += y * src_stride + (x * byte_per_pixel);
-
-for (j = y; j < y + h; j++) {
-memcpy(dst_bits, src_bits, w * byte_per_pixel);
-src_bits += src_stride;
-dst_bits += dst_stride;
-}
-}
-
 /**
  * Uploads a picture based on a GLAMOR_MEMORY pixmap to a texture in a
  * temporary FBO.
@@ -464,11 +440,19 @@ glamor_upload_picture_to_texture(PicturePtr picture)
 GLenum format, type;
 int no_alpha, revert, swap_rb;
 glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
-Bool force_clip;
 
 assert(glamor_pixmap_is_memory(pixmap));
 assert(!pixmap_priv->fbo);
 
+/* No handling of large pixmap pictures here (would need to make
+ * an FBO array and split the uploads across it).
+ */
+if (!glamor_check_fbo_size(glamor_priv,
+   pixmap->drawable.width,
+   pixmap->drawable.height)) {
+return FALSE;
+}
+
 if (!glamor_get_tex_format_type_from_pictformat(screen,
 picture->format,
 ,
@@ -481,89 +465,10 @@ glamor_upload_picture_to_texture(PicturePtr picture)
 if (glamor_pixmap_upload_prepare(pixmap, format, no_alpha, revert, 
swap_rb))
 return FALSE;
 
-force_clip = glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP;
-
-if (glamor_pixmap_priv_is_large(pixmap_priv) || force_clip) {
-RegionRec region;
-BoxRec box;
-int n_region;
-glamor_pixmap_clipped_regions *clipped_regions;
-void *sub_bits;
-int i, j;
-
-sub_bits = xallocarray(pixmap->drawable.height, stride);
-if (sub_bits == NULL)
-return FALSE;
-box.x1 = 0;
-box.y1 = 0;
-box.x2 = pixmap->drawable.width;
-box.y2 = pixmap->drawable.height;
-RegionInitBoxes(, , 1);
-if (!force_clip)
-clipped_regions =
-glamor_compute_clipped_regions(pixmap, , _region,
-   0, 0, 0);
-else
-clipped_regions =
-glamor_compute_clipped_regions_ext(pixmap, ,
-   _region,
-   pixmap_priv->block_w,
-   pixmap_priv->block_h,
-   0,
-   0);
-DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap);
-for (i = 0; i < n_region; i++) {
-BoxPtr boxes;
-int nbox;
-int temp_stride;
-void *temp_bits;
-
-glamor_set_pixmap_fbo_current(pixmap_priv, 
clipped_regions[i].block_idx);
-
-boxes = RegionRects(clipped_regions[i].region);
-nbox = RegionNumRects(clipped_regions[i].region);
-DEBUGF("split to %d boxes\n", nbox);
-for (j = 0; j < nbox; j++) {
-temp_stride = PixmapBytePad(boxes[j].x2 - boxes[j].x1,
-pixmap->drawable.depth);
-
-if (boxes[j].x1 == 0 && temp_stride == stride) {
-temp_bits = (char *) bits + boxes[j].y1 * stride;
-}
-else {
-temp_bits = sub_bits;
-glamor_put_bits(temp_bits, 

[PATCH xserver 09/12] glamor: Drop unused PBO code in temporary picture uploading.

2016-02-01 Thread Eric Anholt
Signed-off-by: Eric Anholt 
---
 glamor/glamor_picture.c | 30 +++---
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index e0f5828..e0458a6 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -246,7 +246,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, 
unsigned int *tex,
   GLenum format,
   GLenum type,
   int x, int y, int w, int h,
-  void *bits, int pbo)
+  void *bits)
 {
 glamor_screen_private *glamor_priv =
 glamor_get_screen_private(pixmap->drawable.pScreen);
@@ -269,11 +269,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, 
unsigned int *tex,
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 
-assert(pbo || bits != 0);
-if (bits == NULL) {
-glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
-glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
-}
 glamor_priv->suppress_gl_out_of_memory_logging = true;
 if (non_sub)
 glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits);
@@ -288,9 +283,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, 
unsigned int *tex,
 return FALSE;
 }
 
-if (bits == NULL)
-glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
-
 return TRUE;
 }
 
@@ -298,7 +290,7 @@ static Bool
 _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
   GLenum type, int no_alpha, int revert,
   int swap_rb, int x, int y, int w, int h,
-  int stride, void *bits, int pbo)
+  int stride, void *bits)
 {
 ScreenPtr screen = pixmap->drawable.pScreen;
 glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
@@ -308,9 +300,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, 
GLenum format,
 GLuint tex = 0;
 pixman_image_t *converted_image = NULL;
 
-if (bits == NULL)
-goto ready_to_upload;
-
 if (revert == REVERT_UPLOADING_A1) {
 converted_image = glamor_get_converted_image(PICT_a8,
  PICT_a1,
@@ -323,8 +312,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, 
GLenum format,
 bits = pixman_image_get_data(converted_image);
 }
 
- ready_to_upload:
-
 /* Try fast path firstly, upload the pixmap to the texture attached
  * to the fbo directly. */
 if (no_alpha == 0
@@ -345,7 +332,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, 
GLenum format,
format, type,
x + fbo_x_off, y + fbo_y_off,
w, h,
-   bits, pbo)) {
+   bits)) {
 if (converted_image)
 pixman_image_unref(bits);
 return FALSE;
@@ -371,8 +358,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, 
GLenum format,
 glamor_make_current(glamor_priv);
 
 if (!__glamor_upload_pixmap_to_texture(pixmap, ,
-   format, type, 0, 0, w, h, bits,
-   pbo)) {
+   format, type, 0, 0, w, h, 
bits)) {
 if (converted_image)
 pixman_image_unref(bits);
 return FALSE;
@@ -556,11 +542,10 @@ glamor_upload_picture_to_texture(PicturePtr picture)
boxes[j].x1, boxes[j].y1,
boxes[j].x2 - boxes[j].x1,
boxes[j].y2 - boxes[j].y1, temp_stride);
-if (_glamor_upload_bits_to_pixmap_texture
+if (!_glamor_upload_bits_to_pixmap_texture
 (pixmap, format, type, no_alpha, revert, swap_rb,
  boxes[j].x1, boxes[j].y1, boxes[j].x2 - boxes[j].x1,
- boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits,
- 0) == FALSE) {
+ boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits)) {
 RegionUninit();
 free(sub_bits);
 assert(0);
@@ -580,6 +565,5 @@ glamor_upload_picture_to_texture(PicturePtr picture)
  0, 0,
  pixmap->drawable.width,
  pixmap->drawable.height,
- stride, bits,
- 0);
+ 

[PATCH xserver 07/12] glamor: Drop the REVERT_UPLOADING_1_5_5_5 path.

2016-02-01 Thread Eric Anholt
There was only a pretty special case that could have even worked --
you've got a GLES2 renderer, you've got a SHM pixmap, it's 1555 (not
the usual 565 for 16-bit), and you're little endian (BE was broken,
since GL's 5_5_5_1 picks the 1 bit from the lowest bit of the short,
and on BE we weren't doing the conversion path that swaps around the
channels).  This is just not worth the complexity.

Signed-off-by: Eric Anholt 
---
 glamor/glamor_picture.c | 123 ++--
 glamor/glamor_utils.h   |   1 -
 2 files changed, 5 insertions(+), 119 deletions(-)

diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index 5c6a1a5..63d4365 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -151,11 +151,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr 
pScreen,
 if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
 *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
 } else {
-*tex_type = GL_UNSIGNED_SHORT_5_5_5_1;
-if (is_little_endian)
-*revert = REVERT_UPLOADING_1_5_5_5;
-else
-*revert = REVERT_NONE;
+return FALSE;
 }
 break;
 
@@ -166,13 +162,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr 
pScreen,
 *tex_format = GL_BGRA;
 *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
 } else {
-*tex_format = GL_RGBA;
-*tex_type = GL_UNSIGNED_SHORT_5_5_5_1;
-if (is_little_endian)
-*revert = REVERT_UPLOADING_1_5_5_5;
-else
-*revert = REVERT_NONE;
-*swap_rb = SWAP_UPLOADING;
+return FALSE;
 }
 break;
 
@@ -215,8 +205,7 @@ glamor_get_tex_format_type_from_pictformat(ScreenPtr 
pScreen,
 }
 
 static void *
-_glamor_color_convert_a1_a8(void *src_bits, void *dst_bits, int w, int h,
-int stride)
+glamor_convert_a1_a8(void *src_bits, void *dst_bits, int w, int h, int stride)
 {
 PictFormatShort dst_format = PICT_a8, src_format = PICT_a1;
 pixman_image_t *dst_image;
@@ -244,107 +233,6 @@ _glamor_color_convert_a1_a8(void *src_bits, void 
*dst_bits, int w, int h,
 return dst_bits;
 }
 
-#define ADJUST_BITS(d, src_bits, dst_bits) (((dst_bits) == (src_bits)) ? 
(d) : \
-   (((dst_bits) > 
(src_bits)) ?\
- (((d) << ((dst_bits) 
- (src_bits)))   \
-  + (( 1 << 
((dst_bits) - (src_bits))) >> 1))  \
-   :  ((d) >> 
((src_bits) - (dst_bits)
-
-#define GLAMOR_DO_CONVERT(src, dst, no_alpha, swap,\
- a_shift_src, a_bits_src,  \
- b_shift_src, b_bits_src,  \
- g_shift_src, g_bits_src,  \
- r_shift_src, r_bits_src,  \
- a_shift, a_bits,  \
- b_shift, b_bits,  \
- g_shift, g_bits,  \
- r_shift, r_bits)  \
-   do {\
-   typeof(src) a,b,g,r;\
-   typeof(src) a_mask_src, b_mask_src, g_mask_src, r_mask_src;\
-   a_mask_src = (((1 << (a_bits_src)) - 1) << a_shift_src);\
-   b_mask_src = (((1 << (b_bits_src)) - 1) << b_shift_src);\
-   g_mask_src = (((1 << (g_bits_src)) - 1) << g_shift_src);\
-   r_mask_src = (((1 << (r_bits_src)) - 1) << r_shift_src);\
-   if (no_alpha)   \
-   a = (a_mask_src) >> (a_shift_src);  
\
-   else\
-   a = ((src) & (a_mask_src)) >> (a_shift_src);\
-   b = ((src) & (b_mask_src)) >> (b_shift_src);\
-   g = ((src) & (g_mask_src)) >> (g_shift_src);\
-   r = ((src) & (r_mask_src)) >> (r_shift_src);\
-   a = ADJUST_BITS(a, a_bits_src, a_bits); \
-   b = ADJUST_BITS(b, b_bits_src, b_bits); \
-   g = ADJUST_BITS(g, g_bits_src, g_bits); \
-   r = ADJUST_BITS(r, r_bits_src, r_bits); \
-   if (swap == 0)  \
-   (*dst) = ((a) << (a_shift)) | ((b) << (b_shift)) | ((g) 
<< (g_shift)) | ((r) << (r_shift)); \
-   

[PATCH xserver 12/12] ephyr: Fix redisplay with glamor on GLES.

2016-02-01 Thread Eric Anholt
glamor_transfer.c is still totally broken, though.

Signed-off-by: Eric Anholt 
---
 hw/kdrive/ephyr/ephyr_glamor_glx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/kdrive/ephyr/ephyr_glamor_glx.c 
b/hw/kdrive/ephyr/ephyr_glamor_glx.c
index 636150d..2f21914 100644
--- a/hw/kdrive/ephyr/ephyr_glamor_glx.c
+++ b/hw/kdrive/ephyr/ephyr_glamor_glx.c
@@ -225,8 +225,10 @@ ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
 if (glamor->vao) {
 glGetIntegerv(GL_VERTEX_ARRAY_BINDING, _vao);
 glBindVertexArray(glamor->vao);
-} else
+} else {
+glBindBuffer(GL_ARRAY_BUFFER, glamor->vbo);
 ephyr_glamor_set_vertices(glamor);
+}
 
 glBindFramebuffer(GL_FRAMEBUFFER, 0);
 glUseProgram(glamor->texture_shader);
-- 
2.7.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 01/12] glamor: Simplify temporary picture uploading call stack.

2016-02-01 Thread Eric Anholt
glamor_upload_sub_pixmap_to_texture() only had the one caller, so we
can merge it in, fix its silly return value, and propagate a bunch of
constants.

Signed-off-by: Eric Anholt 
---
 glamor/glamor_picture.c | 68 ++---
 glamor/glamor_priv.h| 18 +
 glamor/glamor_render.c  | 27 
 3 files changed, 37 insertions(+), 76 deletions(-)

diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index b069ce5..e91461c 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -797,11 +797,15 @@ glamor_put_bits(char *dst_bits, int dst_stride, char 
*src_bits,
 }
 }
 
-static Bool
-glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
-int h, int stride, void *bits, int pbo,
-PictFormatShort pict_format)
+/* Upload picture to texture.  We may need to flip the y axis or
+ * wire alpha to 1. So we may conditional create fbo for the picture.
+ * */
+Bool
+glamor_upload_picture_to_texture(PicturePtr picture)
 {
+PixmapPtr pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
+void *bits = pixmap->devPrivate.ptr;
+int stride = pixmap->devKind;
 ScreenPtr screen = pixmap->drawable.pScreen;
 glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
 GLenum format, type;
@@ -810,7 +814,7 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int 
x, int y, int w,
 Bool force_clip;
 
 if (glamor_get_tex_format_type_from_pixmap(pixmap,
-   pict_format,
+   picture->format,
,
,
_alpha,
@@ -822,8 +826,7 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int 
x, int y, int w,
 return FALSE;
 
 pixmap_priv = glamor_get_pixmap_private(pixmap);
-force_clip = glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
-&& !glamor_check_fbo_size(glamor_priv, w, h);
+force_clip = glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP;
 
 if (glamor_pixmap_priv_is_large(pixmap_priv) || force_clip) {
 RegionRec region;
@@ -833,13 +836,13 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int 
x, int y, int w,
 void *sub_bits;
 int i, j;
 
-sub_bits = xallocarray(h, stride);
+sub_bits = xallocarray(pixmap->drawable.height, stride);
 if (sub_bits == NULL)
 return FALSE;
-box.x1 = x;
-box.y1 = y;
-box.x2 = x + w;
-box.y2 = y + h;
+box.x1 = 0;
+box.y1 = 0;
+box.x2 = pixmap->drawable.width;
+box.y2 = pixmap->drawable.height;
 RegionInitBoxes(, , 1);
 if (!force_clip)
 clipped_regions =
@@ -860,8 +863,6 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int 
x, int y, int w,
 int temp_stride;
 void *temp_bits;
 
-assert(pbo == 0);
-
 glamor_set_pixmap_fbo_current(pixmap_priv, 
clipped_regions[i].block_idx);
 
 boxes = RegionRects(clipped_regions[i].region);
@@ -871,26 +872,26 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int 
x, int y, int w,
 temp_stride = PixmapBytePad(boxes[j].x2 - boxes[j].x1,
 pixmap->drawable.depth);
 
-if (boxes[j].x1 == x && temp_stride == stride) {
-temp_bits = (char *) bits + (boxes[j].y1 - y) * stride;
+if (boxes[j].x1 == 0 && temp_stride == stride) {
+temp_bits = (char *) bits + boxes[j].y1 * stride;
 }
 else {
 temp_bits = sub_bits;
 glamor_put_bits(temp_bits, temp_stride, bits, stride,
 pixmap->drawable.bitsPerPixel,
-boxes[j].x1 - x, boxes[j].y1 - y,
+boxes[j].x1, boxes[j].y1,
 boxes[j].x2 - boxes[j].x1,
 boxes[j].y2 - boxes[j].y1);
 }
 DEBUGF("upload x %d y %d w %d h %d temp stride %d \n",
-   boxes[j].x1 - x, boxes[j].y1 - y,
+   boxes[j].x1, boxes[j].y1,
boxes[j].x2 - boxes[j].x1,
boxes[j].y2 - boxes[j].y1, temp_stride);
 if (_glamor_upload_bits_to_pixmap_texture
 (pixmap, format, type, no_alpha, revert, swap_rb,
  boxes[j].x1, boxes[j].y1, boxes[j].x2 - boxes[j].x1,
  boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits,
- pbo) == FALSE) {
+ 0) == FALSE) {
 

[PATCH xserver 11/12] glamor: Replace "finish access" shader with texture swizzling.

2016-02-01 Thread Eric Anholt
For pictures without alpha, and for most other formats for GLES2, we
would make a temporary FBO, make another temporary texture, upload our
GLAMORY_MEMORY pixmap to the texture, then run the "finish access"
shader across it to swizzle its values around into the temporary FBO
(which we would use for a single Render operation and then throw
away).

We can simplify everything by using GL_ARB_texture_swizzle (or its
GLES3 counterpart).  It's just not worth the complexity to try to
improve the performance of this already low-performance path (SHM
pixmaps + Render) on GLES2.

Signed-off-by: Eric Anholt 
---
 glamor/glamor.c |   9 +-
 glamor/glamor_core.c| 158 
 glamor/glamor_fbo.c |  11 ++
 glamor/glamor_picture.c | 381 ++--
 glamor/glamor_priv.h|   8 +-
 5 files changed, 160 insertions(+), 407 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index e9c1d9e..efe5953 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -605,9 +605,15 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 glamor_priv->max_fbo_size = MAX_FBO_SIZE;
 #endif
 
+glamor_priv->has_texture_swizzle =
+(epoxy_has_gl_extension("GL_ARB_texture_swizzle") ||
+ (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP && gl_version >= 30));
+
 glamor_priv->one_channel_format = GL_ALPHA;
-if (epoxy_has_gl_extension("GL_ARB_texture_rg") && 
epoxy_has_gl_extension("GL_ARB_texture_swizzle"))
+if (epoxy_has_gl_extension("GL_ARB_texture_rg") &&
+glamor_priv->has_texture_swizzle) {
 glamor_priv->one_channel_format = GL_RED;
+}
 
 glamor_set_debug_level(_debug_level);
 
@@ -668,7 +674,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 
 glamor_init_vbo(screen);
 glamor_init_pixmap_fbo(screen);
-glamor_init_finish_access_shaders(screen);
 
 #ifdef GLAMOR_GRADIENT_SHADER
 glamor_init_gradient_shader(screen);
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index a8768f4..7b2b396 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -113,164 +113,6 @@ glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const 
char *format, ...)
 }
 }
 
-/*
- *  When downloading a unsupported color format to CPU memory,
-we need to shuffle the color elements and then use a supported
-color format to read it back to CPU memory.
-
-For an example, 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;
-*/
-
-void
-glamor_init_finish_access_shaders(ScreenPtr screen)
-{
-glamor_screen_private *glamor_priv;
-const char *vs_source =
-"attribute vec4 v_position;\n"
-"attribute vec4 v_texcoord0;\n"
-"varying vec2 source_texture;\n"
-"void main()\n"
-"{\n"
-"  gl_Position = v_position;\n"
-"  source_texture = v_texcoord0.xy;\n"
-"}\n";
-
-const char *common_source =
-GLAMOR_DEFAULT_PRECISION
-"varying vec2 source_texture;\n"
-"uniform sampler2D sampler;\n"
-"uniform int revert;\n"
-"uniform int swap_rb;\n"
-"#define REVERT_NONE   0\n"
-"#define REVERT_NORMAL 1\n"
-"#define SWAP_UPLOADING2\n"
-"#define SWAP_NONE_UPLOADING   3\n";
-
-const char *fs_source =
-"void main()\n"
-"{\n"
-"   vec4 color = texture2D(sampler, source_texture);\n"
-"   if (revert == REVERT_NONE) \n"
-"{ \n"
-" if ((swap_rb != SWAP_NONE_UPLOADING))   \n"
-"  gl_FragColor = color.bgra;\n"
-" else \n"
-"  gl_FragColor = color.rgba;\n"
-"} \n"
-"   else \n"
-"{ \n"
-" if (swap_rb == SWAP_UPLOADING)\n"
-"  gl_FragColor = color.gbar;\n"
-" else if (swap_rb == SWAP_NONE_UPLOADING)\n"
-"  gl_FragColor = color.abgr;\n"
-"} \n"
-"}\n";
-
-const char *set_alpha_source =
-"void main()\n"
-"{\n"
-"   vec4 color 

Re: [PATCH rendercheck 1/5] Start using stdbool.h instead of Xlib or custom bools.

2016-02-01 Thread Alex Deucher
On Mon, Feb 1, 2016 at 4:48 PM, Eric Anholt  wrote:
> I have a hard time typing anything else at this point.
>
> Signed-off-by: Eric Anholt 
> ---
>  main.c   | 21 ++
>  ops.c|  2 +-
>  rendercheck.h| 58 +++-
>  t_blend.c|  8 +++
>  t_bug7366.c  | 32 +--
>  t_composite.c| 12 +-
>  t_dstcoords.c|  6 ++---
>  t_fill.c |  6 ++---
>  t_gradient.c | 32 +--
>  t_gtk_argb_xbgr.c|  8 +++
>  t_libreoffice_xrgb.c | 10 -
>  t_repeat.c   | 22 +--
>  t_srccoords.c| 14 ++--
>  t_triangles.c| 24 ++--
>  t_tsrccoords.c   | 12 +-
>  t_tsrccoords2.c  | 14 ++--
>  tests.c  | 62 
> ++--
>  17 files changed, 171 insertions(+), 172 deletions(-)
>
> diff --git a/main.c b/main.c
> index a7035b9..b5d67cc 100644
> --- a/main.c
> +++ b/main.c
> @@ -27,7 +27,7 @@
>  #include 
>  #include 
>
> -Bool is_verbose = FALSE, minimalrendering = FALSE;
> +bool is_verbose = false, minimalrendering = false;
>  int enabled_tests = ~0;/* Enable all tests by default */
>
>  int format_whitelist_len = 0;
> @@ -163,7 +163,8 @@ int main(int argc, char **argv)
> Display *dpy;
> XEvent ev;
> int i, o, maj, min;
> -   static Bool is_sync = FALSE, print_version = FALSE;
> +   static int is_sync = false, print_version = false;

Did you mean bool here rather than int?

Alex
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH rendercheck 1/5] Start using stdbool.h instead of Xlib or custom bools.

2016-02-01 Thread Eric Anholt
Alex Deucher  writes:

> On Mon, Feb 1, 2016 at 4:48 PM, Eric Anholt  wrote:
>> I have a hard time typing anything else at this point.
>>
>> Signed-off-by: Eric Anholt 
>> ---
>>  main.c   | 21 ++
>>  ops.c|  2 +-
>>  rendercheck.h| 58 +++-
>>  t_blend.c|  8 +++
>>  t_bug7366.c  | 32 +--
>>  t_composite.c| 12 +-
>>  t_dstcoords.c|  6 ++---
>>  t_fill.c |  6 ++---
>>  t_gradient.c | 32 +--
>>  t_gtk_argb_xbgr.c|  8 +++
>>  t_libreoffice_xrgb.c | 10 -
>>  t_repeat.c   | 22 +--
>>  t_srccoords.c| 14 ++--
>>  t_triangles.c| 24 ++--
>>  t_tsrccoords.c   | 12 +-
>>  t_tsrccoords2.c  | 14 ++--
>>  tests.c  | 62 
>> ++--
>>  17 files changed, 171 insertions(+), 172 deletions(-)
>>
>> diff --git a/main.c b/main.c
>> index a7035b9..b5d67cc 100644
>> --- a/main.c
>> +++ b/main.c
>> @@ -27,7 +27,7 @@
>>  #include 
>>  #include 
>>
>> -Bool is_verbose = FALSE, minimalrendering = FALSE;
>> +bool is_verbose = false, minimalrendering = false;
>>  int enabled_tests = ~0;/* Enable all tests by default */
>>
>>  int format_whitelist_len = 0;
>> @@ -163,7 +163,8 @@ int main(int argc, char **argv)
>> Display *dpy;
>> XEvent ev;
>> int i, o, maj, min;
>> -   static Bool is_sync = FALSE, print_version = FALSE;
>> +   static int is_sync = false, print_version = false;
>
> Did you mean bool here rather than int?
>
> Alex

No, because it's an argument to getopt_long.


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH rendercheck 2/5] Save the list of active formats in a global for use by tests.

2016-02-01 Thread Eric Anholt
I'd like to move driving of tests out of tests.c and into t_*.c, and
part of that will be allowing tests to use the formats list.  While I'm
at it, save the name of the format in the array so it doesn't need to be
recomputed.

Signed-off-by: Eric Anholt 
---
 rendercheck.h |  8 
 tests.c   | 51 ++-
 2 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/rendercheck.h b/rendercheck.h
index 55ffcff..2195cb4 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -80,6 +80,14 @@ struct op_info {
 #define TEST_GTK_ARGB_XBGR 0x2000
 #define TEST_LIBREOFFICE_XRGB  0x4000
 
+struct render_format {
+   XRenderPictFormat *format;
+   char *name;
+};
+
+extern struct render_format *formats;
+extern int nformats;
+
 extern int pixmap_move_iter;
 extern int win_width, win_height;
 extern struct op_info ops[];
diff --git a/tests.c b/tests.c
index 62fa34b..456e778 100644
--- a/tests.c
+++ b/tests.c
@@ -27,8 +27,8 @@
 
 #include "rendercheck.h"
 
-static XRenderPictFormat **format_list;
-static int nformats;
+struct render_format *formats;
+int nformats;
 static int argb32index;
 
 /* Note: changing the order of these colors may disrupt tests that depend on
@@ -240,36 +240,35 @@ create_formats_list(Display *dpy)
 {
 int i;
 int nformats_allocated = 5;
-XRenderPictFormat templ;
+XRenderPictFormat templ, *format;
 
 memset(, 0, sizeof(templ));
 templ.type = PictTypeDirect;
 
-format_list = malloc(sizeof(XRenderPictFormat *) * nformats_allocated);
-if (format_list == NULL)
+formats = malloc(sizeof(*formats) * nformats_allocated);
+if (formats == NULL)
errx(1, "malloc error");
 nformats = 0;
 
 argb32index = -1;
 for (i = 0; ; i++) {
-   char *name;
int alphabits, redbits;
 
if (nformats + 1 == nformats_allocated) {
nformats_allocated *= 2;
-   format_list = realloc(format_list, sizeof(XRenderPictFormat *) *
-   nformats_allocated);
-   if (format_list == NULL)
+   formats = realloc(formats, sizeof(*formats) * nformats_allocated);
+   if (formats == NULL)
errx(1, "realloc error");
}
 
-   format_list[nformats] = XRenderFindFormat(dpy, PictFormatType, ,
-   i);
-   if (format_list[nformats] == NULL)
-   break;
+   format = XRenderFindFormat(dpy, PictFormatType, , i);
+   if (!format)
+   break;
 
-   alphabits = bit_count(format_list[nformats]->direct.alphaMask);
-   redbits = bit_count(format_list[nformats]->direct.redMask);
+   formats[nformats].format = format;
+
+   alphabits = bit_count(format->direct.alphaMask);
+   redbits = bit_count(format->direct.redMask);
 
/* Our testing code isn't all that hot, so don't bother trying at
 * the low depths yet.
@@ -280,31 +279,33 @@ create_formats_list(Display *dpy)
continue;
}
 
-   describe_format(, NULL, format_list[nformats]);
+   describe_format([nformats].name, NULL, format);
 
if (format_whitelist_len != 0) {
bool ok = false;
int j;
 
for (j = 0; j < format_whitelist_len; j++) {
-   if (strcmp(format_whitelist[j], name) == 0) {
+   if (strcmp(format_whitelist[j], formats[nformats].name) == 0) {
ok = true;
break;
}
}
if (!ok) {
-   printf("Ignoring server-supported format: %s\n", name);
+   printf("Ignoring server-supported format: %s\n",
+  formats[nformats].name);
+   free(formats[nformats].name);
+   formats[nformats].name = NULL;
continue;
}
}
 
-   if (format_list[nformats] == XRenderFindStandardFormat(dpy,
-   PictStandardARGB32))
+   if (format == XRenderFindStandardFormat(dpy, PictStandardARGB32))
{
argb32index = nformats;
}
 
-   printf("Found server-supported format: %s\n", name);
+   printf("Found server-supported format: %s\n", formats[nformats].name);
 
nformats++;
 }
@@ -336,7 +337,7 @@ do_tests(Display *dpy, picture_info *win)
errx(1, "malloc error");
 
for (i = 0; i < num_dests; i++) {
-   dests[i].format = format_list[i];
+   dests[i].format = formats[i].format;
dests[i].d = XCreatePixmap(dpy, DefaultRootWindow(dpy),
win_width, win_height, dests[i].format->depth);
dests[i].pict = XRenderCreatePicture(dpy, dests[i].d,
@@ -355,7 +356,7 @@ do_tests(Display *dpy, picture_info *win)
color4d *c = [i / nformats];
 
/* The standard PictFormat numbers go from 0 to 4 */
-   pictures_1x1[i].format = format_list[i % nformats];
+   pictures_1x1[i].format 

[PATCH rendercheck 4/5] shmblend: New test for XRenderComposite() from a pixmap in SHM.

2016-02-01 Thread Eric Anholt
There's a giant pile of code in glamor for uploading SHM pixmaps to
temporary GL memory for accelerating a Composite operation, and most of
its code is about how you convert formats.  Add a test that runs through
all the formats, to give us some coverage.

Signed-off-by: Eric Anholt 
---
 Makefile.am   |   1 +
 configure.ac  |   2 +-
 rendercheck.h |   3 +
 t_shmblend.c  | 245 ++
 tests.c   |   2 -
 5 files changed, 250 insertions(+), 3 deletions(-)
 create mode 100644 t_shmblend.c

diff --git a/Makefile.am b/Makefile.am
index 852d174..f77cb4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,6 +16,7 @@ rendercheck_SOURCES = \
t_gtk_argb_xbgr.c \
t_libreoffice_xrgb.c \
t_repeat.c \
+   t_shmblend.c \
t_srccoords.c \
t_tsrccoords.c \
t_tsrccoords2.c \
diff --git a/configure.ac b/configure.ac
index 655a1b6..8ad0b3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ XORG_TESTSET_CFLAG(CWARNFLAGS, [-Wno-shadow])
 AC_CHECK_HEADERS([err.h])
 
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(RC, [xrender x11 xproto >= 7.0.17])
+PKG_CHECK_MODULES(RC, [xrender xext x11 xproto >= 7.0.17])
 
 AC_CONFIG_FILES([Makefile
  man/Makefile])
diff --git a/rendercheck.h b/rendercheck.h
index f0fa7b7..1c392e8 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #if HAVE_ERR_H
 # include 
@@ -44,6 +45,7 @@ static inline void errx(int eval, const char *fmt, ...) {
 
 #define min(a, b) (a < b ? a : b)
 #define max(a, b) (a > b ? a : b)
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 typedef struct _color4d
 {
@@ -92,6 +94,7 @@ record_result(struct rendercheck_test_result *result, bool 
success)
 #define TEST_BUG7366   0x1000
 #define TEST_gtk_argb_xbgr 0x2000
 #define TEST_libreoffice_xrgb  0x4000
+#define TEST_shmblend  0x8000
 
 struct rendercheck_test {
int bit;
diff --git a/t_shmblend.c b/t_shmblend.c
new file mode 100644
index 000..752e17a
--- /dev/null
+++ b/t_shmblend.c
@@ -0,0 +1,245 @@
+/*
+ * Copyright © 2016 Broadcom
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include "rendercheck.h"
+#include 
+
+bool had_x_error;
+static int (*orig_x_error_handler)(Display *, XErrorEvent *);
+
+static int
+shmerrorhandler(Display *d, XErrorEvent *e)
+{
+   had_x_error = true;
+   if (e->error_code == BadAccess) {
+   fprintf(stderr,"failed to attach shared memory\n");
+   return 0;
+   } else {
+   return (*orig_x_error_handler)(d,e);
+   }
+}
+
+static XShmSegmentInfo *
+get_x_shm_info(Display *dpy, size_t size)
+{
+   XShmSegmentInfo *shm_info = calloc(1, sizeof(*shm_info));
+
+   if (!XShmQueryExtension(dpy))
+   return NULL;
+
+   shm_info->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777);
+   if (shm_info->shmid < 0) {
+   free(shm_info);
+   return NULL;
+   }
+
+   shm_info->shmaddr = shmat(shm_info->shmid, NULL, 0);
+   if (shm_info->shmaddr == (void *)-1) {
+   free(shm_info);
+   return NULL;
+   }
+
+   shm_info->readOnly = false;
+
+   XSync(dpy, true);
+   had_x_error = false;
+   orig_x_error_handler = XSetErrorHandler(shmerrorhandler);
+   XShmAttach(dpy, shm_info);
+   XSync(dpy, true);
+   XSetErrorHandler(orig_x_error_handler);
+
+   return shm_info;
+}
+
+static void
+fill_shm_with_formatted_color(Display *dpy, XShmSegmentInfo *shm_info,
+ XRenderPictFormat *format,
+ int w, int h, color4d *color)
+{
+   XImage *image;
+   XRenderDirectFormat *layout = >direct;
+   unsigned long r = layout->redMask * color->r;
+

[PATCH rendercheck 1/5] Start using stdbool.h instead of Xlib or custom bools.

2016-02-01 Thread Eric Anholt
I have a hard time typing anything else at this point.

Signed-off-by: Eric Anholt 
---
 main.c   | 21 ++
 ops.c|  2 +-
 rendercheck.h| 58 +++-
 t_blend.c|  8 +++
 t_bug7366.c  | 32 +--
 t_composite.c| 12 +-
 t_dstcoords.c|  6 ++---
 t_fill.c |  6 ++---
 t_gradient.c | 32 +--
 t_gtk_argb_xbgr.c|  8 +++
 t_libreoffice_xrgb.c | 10 -
 t_repeat.c   | 22 +--
 t_srccoords.c| 14 ++--
 t_triangles.c| 24 ++--
 t_tsrccoords.c   | 12 +-
 t_tsrccoords2.c  | 14 ++--
 tests.c  | 62 ++--
 17 files changed, 171 insertions(+), 172 deletions(-)

diff --git a/main.c b/main.c
index a7035b9..b5d67cc 100644
--- a/main.c
+++ b/main.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 
-Bool is_verbose = FALSE, minimalrendering = FALSE;
+bool is_verbose = false, minimalrendering = false;
 int enabled_tests = ~0;/* Enable all tests by default */
 
 int format_whitelist_len = 0;
@@ -163,7 +163,8 @@ int main(int argc, char **argv)
Display *dpy;
XEvent ev;
int i, o, maj, min;
-   static Bool is_sync = FALSE, print_version = FALSE;
+   static int is_sync = false, print_version = false;
+   static int longopt_minimalrendering = 0;
XWindowAttributes a;
XSetWindowAttributes as;
picture_info window;
@@ -177,10 +178,10 @@ int main(int argc, char **argv)
{ "tests",  required_argument,  NULL,   't' },
{ "ops",required_argument,  NULL,   'o' },
{ "verbose",no_argument,NULL,   'v' },
-   { "sync",   no_argument,_sync, TRUE},
-   { "minimalrendering", no_argument,  ,
-   TRUE},
-   { "version",no_argument,_version, TRUE },
+   { "sync",   no_argument,_sync, true},
+   { "minimalrendering", no_argument,
+ _minimalrendering, true},
+   { "version",no_argument,_version, true },
{ NULL, 0,  NULL,   0 }
};
 
@@ -194,7 +195,7 @@ int main(int argc, char **argv)
break;
case 'o':
for (i = 0; i < num_ops; i++)
-   ops[i].disabled = TRUE;
+   ops[i].disabled = true;
 
nextname = optarg;
while ((opname = strsep(, ",")) != NULL) {
@@ -202,7 +203,7 @@ int main(int argc, char **argv)
if (strcasecmp(ops[i].name, opname) !=
0)
continue;
-   ops[i].disabled = FALSE;
+   ops[i].disabled = false;
break;
}
if (i == num_ops)
@@ -252,7 +253,7 @@ int main(int argc, char **argv)
 
break;
case 'v':
-   is_verbose = TRUE;
+   is_verbose = true;
break;
case 0:
break;
@@ -262,6 +263,8 @@ int main(int argc, char **argv)
}
}
 
+   minimalrendering = longopt_minimalrendering;
+
/* Print the version string.  Bail out if --version was requested and
 * continue otherwise.
 */
diff --git a/ops.c b/ops.c
index 0e03550..b7803da 100644
--- a/ops.c
+++ b/ops.c
@@ -210,7 +210,7 @@ do_composite(int op,
 const color4d *mask,
 const color4d *dst,
 color4d *result,
-Bool componentAlpha)
+bool componentAlpha)
 {
color4d srcval, srcalpha;
 
diff --git a/rendercheck.h b/rendercheck.h
index 67efdbf..55ffcff 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #if HAVE_ERR_H
@@ -44,11 +45,6 @@ static inline void errx(int eval, const char *fmt, ...) {
 #define min(a, b) (a < b ? a : b)
 #define max(a, b) (a > b ? a : b)
 
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
 typedef struct _color4d
 {
double r, g, b, a;
@@ -65,7 +61,7 @@ typedef struct _picture_info {
 struct op_info {
int op;
const char *name;
-   Bool disabled;
+   bool disabled;
 };
 
 #define TEST_FILL  0x0001
@@ -87,7 +83,7 @@ struct op_info {
 extern int pixmap_move_iter;
 extern int win_width, win_height;
 extern struct op_info ops[];

[PATCH rendercheck 3/5] Use ELF sections to make test setup easier.

2016-02-01 Thread Eric Anholt
Managing the group logic was really error-prone (forget to edit
success_mask when copy and pasting?  Forget to printf a description of
the group?).  Most new tests being written can be described as a single
call that does a couple subtests.

This doesn't convert all of the tests.  Some of the remaining ones use
"win" for presenting results (which we may want to just put in a
global?), and the rest use the pre-created pictures, which would need
some much bigger refactoring if we want to move their test logic into
their test files.

Signed-off-by: Eric Anholt 
---
 main.c   | 47 ++-
 rendercheck.h| 51 ---
 t_gtk_argb_xbgr.c| 17 -
 t_libreoffice_xrgb.c | 18 --
 tests.c  | 37 ++---
 5 files changed, 120 insertions(+), 50 deletions(-)

diff --git a/main.c b/main.c
index b5d67cc..4cec99b 100644
--- a/main.c
+++ b/main.c
@@ -121,27 +121,38 @@ struct {
 {TEST_REPEAT, "repeat"},
 {TEST_TRIANGLES, "triangles"},
 {TEST_BUG7366, "bug7366"},
-{TEST_GTK_ARGB_XBGR, "gtk_argb_xbgr"},
-{TEST_LIBREOFFICE_XRGB, "libreoffice_xrgb"},
 {0, NULL}
 };
 
+static void
+print_test_separator(int i)
+{
+if (i % 5 == 0) {
+if(i != 0)
+putc('\n', stderr);
+putc('\t', stderr);
+} else {
+fprintf(stderr, ", ");
+}
+}
+
 void print_tests(FILE *file, int tests) {
 int i, j;
 
 for (i=0, j=0; available_tests[i].name; i++) {
 if (!(available_tests[i].flag & tests))
 continue;
-if (j % 5 == 0) {
-if(j != 0)
-putc('\n', stderr);
-putc('\t', stderr);
-} else {
-fprintf(stderr, ", ");
-}
+   print_test_separator(j++);
 fprintf(stderr, "%s", available_tests[i].name);
 j++;
 }
+for_each_test(test) {
+   if (!(test->bit & tests))
+   continue;
+   print_test_separator(j++);
+fprintf(stderr, "%s", test->arg_name);
+j++;
+}
 if (j)
 fprintf(file, "\n");
 }
@@ -169,7 +180,7 @@ int main(int argc, char **argv)
XSetWindowAttributes as;
picture_info window;
char *display = NULL;
-   char *test, *format, *opname, *nextname;
+   char *test_name, *format, *opname, *nextname;
 
static struct option longopts[] = {
{ "display",required_argument,  NULL,   'd' },
@@ -239,15 +250,25 @@ int main(int argc, char **argv)
/* disable all tests */
enabled_tests = 0;
 
-   while ((test = strsep(, ",")) != NULL) {
+   while ((test_name = strsep(, ",")) != NULL) {
int i;
+   bool found = false;
for(i=0; available_tests[i].name; i++) {
-   if(strcmp(test, 
available_tests[i].name) == 0) {
+   if(strcmp(test_name, 
available_tests[i].name) == 0) {
enabled_tests |= 
available_tests[i].flag;
+   found = true;
+   break;
+   }
+   }
+   for_each_test(test) {
+   if (strcmp(test_name,
+  test->arg_name) == 0) {
+   enabled_tests |= test->bit;
+   found = true;
break;
}
}
-   if(available_tests[i].name == NULL)
+   if (!found)
usage(argv[0]);
}
 
diff --git a/rendercheck.h b/rendercheck.h
index 2195cb4..f0fa7b7 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -64,6 +64,19 @@ struct op_info {
bool disabled;
 };
 
+struct rendercheck_test_result {
+   int tests;
+   int passed;
+};
+
+static inline void
+record_result(struct rendercheck_test_result *result, bool success)
+{
+   result->tests++;
+   if (success)
+   result->passed++;
+}
+
 #define TEST_FILL  0x0001
 #define TEST_DSTCOORDS 0x0002
 #define TEST_SRCCOORDS 0x0004
@@ -77,8 +90,27 @@ struct op_info {
 #define TEST_REPEAT0x0400
 #define TEST_TRIANGLES 0x0800
 #define TEST_BUG7366   0x1000
-#define TEST_GTK_ARGB_XBGR 0x2000
-#define TEST_LIBREOFFICE_XRGB  0x4000
+#define TEST_gtk_argb_xbgr 0x2000
+#define 

[PATCH rendercheck 5/5] autogen: Set a default prefix for patches if unset.

2016-02-01 Thread Eric Anholt
Signed-off-by: Eric Anholt 
---
 autogen.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/autogen.sh b/autogen.sh
index 1b15e18..c262d6b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -11,3 +11,6 @@ autoreconf -v --install || exit 1
 cd $ORIGDIR || exit $?
 
 $srcdir/configure --enable-maintainer-mode "$@"
+
+git config --local --get format.subjectPrefix ||
+git config --local format.subjectPrefix "PATCH rendercheck"
-- 
2.7.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel