xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 20 11:14:04 UTC 2023


 glamor/glamor.c      |   26 ++++++++++++++++++++------
 glamor/glamor_priv.h |    7 +++++++
 test/meson.build     |   10 +++-------
 3 files changed, 30 insertions(+), 13 deletions(-)

New commits:
commit d63d23bde812361b1ef76ded6c4f43cd2c07bf29
Author: Konstantin <ria.freelander at gmail.com>
Date:   Wed Sep 20 16:04:29 2023 +0300

    glamor: mark tests fixed by this PR
    
    This tests will pass after previous commit will be merged,
    so, mark this tests now as PASS.
    
    Signed-off-by: Konstantin <ria.freelander at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Acked-by: Martin Roukala <martin.roukala at mupuf.org>

diff --git a/test/meson.build b/test/meson.build
index 7032f3003..4d36f5778 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -54,23 +54,19 @@ rendercheck_blend = [
     ['blend/Src', '-t blend -o src'],
     ['blend/Over', '-t blend -o over'],
 ]
-#A8 test is fail on GLES 2.0 now
+#A8 test failing on GLES 2.0 llvmpipe before mesa 23.
 rendercheck_a8 = [
     ['ca composite/Some/a8', '-t cacomposite -f a8r8g8b8,a8' + some_ops],
 ]
 #Exclude 15bpp for now due to GLES limitation (see glamor.c:470)
 rendercheck_blend_gles2 = [
     ['blend/Clear', '-t blend -o clear' + gles2_working_formats],
-]
-#Test than should fail before !1158 merged
-rendercheck_tests_gles2_fail = [
     ['blend/Src', '-t blend -o src' + gles2_working_formats],
     ['blend/Over', '-t blend -o over' + gles2_working_formats],
-    ['ca composite/Some/a8', '-t cacomposite -f a8r8g8b8,a8' + some_ops],
 ]
 rendercheck_tests = rendercheck_blend + rendercheck_tests_noblend + rendercheck_a8
 rendercheck_tests_gles2_success = rendercheck_blend_gles2 + rendercheck_tests_noblend
-rendercheck_tests_gles3 = rendercheck_blend_gles2 + rendercheck_tests_noblend + rendercheck_tests_gles2_fail
+rendercheck_tests_gles3 = rendercheck_blend_gles2 + rendercheck_tests_noblend + rendercheck_a8
 rendercheck = find_program('rendercheck', required:false)
 
 if get_option('xvfb')
@@ -121,7 +117,7 @@ if get_option('xvfb')
         test_parameters = [
                 [rendercheck_tests, '', piglit_env, '', false], 
                 [rendercheck_tests_gles2_success, '_gles2', gles20_env, '-gles2', false], 
-                [rendercheck_tests_gles2_fail, '_gles2', gles20_env, '-gles2', true], 
+                [rendercheck_a8, '_gles2', gles20_env, '-gles2', true], 
                 [rendercheck_tests_gles3, '_gles2', piglit_env, '-gles3', false]
             ]
 
commit e573d4ca03756cd7ea37288a7ca7df003ad5c1f8
Author: Konstantin Pugin <ria.freelander at gmail.com>
Date:   Sun Jul 10 17:08:44 2022 +0300

    glamor: accelerate incomplete textures for GL ES
    
    If texture can be uploaded to GL using glTexImage2D normally, but
    cannot be read back using glReadPixels, we still can accelerate it,
    but we cannot create pixmap with FBO using this texture type. So,
    add a flag to avoid such creations.
    
    This allow us to accelerate 8-bit glyph masks on GL ES 2.0, because those
    masks are used only as textures, and in next stages are rendered on RGBA
    surfaces normally, so, we do not need to call glReadPixels on them.
    
    This is needed for correctly working fonts on GL ES 2.0, due to inability
    to use GL_RED and texture swizzle. We should use GL_ALPHA there, and
    with this format we cannot have a complete framebuffer. But completed
    framebuffer, according to testing, is not required for fonts anyway.
    Also it fixes all 8-bit formats for GLES2.
    
    Fixes #1362
    Fixes #1411
    
    Signed-off-by: Konstantin Pugin <ria.freelander at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Acked-by: Michel Dänzer <mdaenzer at redhat.com>
    Acked-by: Martin Roukala <martin.roukala at mupuf.org>

diff --git a/glamor/glamor.c b/glamor/glamor.c
index a2cee41a0..9bd2b90db 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -216,7 +216,9 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
              w <= glamor_priv->glyph_max_dim &&
              h <= glamor_priv->glyph_max_dim)
          || (w == 0 && h == 0)
-         || !glamor_priv->formats[depth].rendering_supported))
+         || !glamor_priv->formats[depth].rendering_supported
+         || (glamor_priv->formats[depth].texture_only &&
+              (usage != GLAMOR_CREATE_FBO_NO_FBO))))
         return fbCreatePixmap(screen, w, h, depth, usage);
     else
         pixmap = fbCreatePixmap(screen, 0, 0, depth, usage);
@@ -467,6 +469,7 @@ glamor_add_format(ScreenPtr screen, int depth, CARD32 render_format,
 {
     glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
     struct glamor_format *f = &glamor_priv->formats[depth];
+    Bool texture_only = FALSE;
 
     /* If we're trying to run on GLES, make sure that we get the read
      * formats that we're expecting, since glamor_transfer relies on
@@ -489,6 +492,13 @@ glamor_add_format(ScreenPtr screen, int depth, CARD32 render_format,
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
         glTexImage2D(GL_TEXTURE_2D, 0, internalformat, 1, 1, 0,
                      format, type, NULL);
+        if (glGetError() != GL_NO_ERROR)
+        {
+            ErrorF("glamor: Cannot upload texture for depth %d.  "
+                   "Falling back to software.\n", depth);
+            glDeleteTextures(1, &tex);
+            return;
+        }
 
         glGenFramebuffers(1, &fbo);
         glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -500,21 +510,23 @@ glamor_add_format(ScreenPtr screen, int depth, CARD32 render_format,
                    "Falling back to software.\n", depth);
             glDeleteTextures(1, &tex);
             glDeleteFramebuffers(1, &fbo);
-            return;
+            texture_only = TRUE;
         }
 
-        glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &read_format);
-        glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &read_type);
+        if (!texture_only) {
+            glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &read_format);
+            glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &read_type);
+        }
 
         glDeleteTextures(1, &tex);
         glDeleteFramebuffers(1, &fbo);
 
-        if (format != read_format || type != read_type) {
+        if (!texture_only && (format != read_format || type != read_type)) {
             ErrorF("glamor: Implementation returned 0x%x/0x%x read format/type "
                    "for depth %d, expected 0x%x/0x%x.  "
                    "Falling back to software.\n",
                    read_format, read_type, depth, format, type);
-            return;
+            texture_only = TRUE;
         }
     }
 
@@ -524,6 +536,7 @@ glamor_add_format(ScreenPtr screen, int depth, CARD32 render_format,
     f->format = format;
     f->type = type;
     f->rendering_supported = rendering_supported;
+    f->texture_only = texture_only;
 }
 
 /* Set up the GL format/types that glamor will use for the various depths
@@ -617,6 +630,7 @@ glamor_setup_formats(ScreenPtr screen)
     glamor_priv->cbcr_format.render_format = PICT_yuv2;
     glamor_priv->cbcr_format.type = GL_UNSIGNED_BYTE;
     glamor_priv->cbcr_format.rendering_supported = TRUE;
+    glamor_priv->cbcr_format.texture_only = FALSE;
 }
 
 /** Set up glamor for an already-configured GL context. */
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index d8da1a0c1..33072cb3b 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -194,6 +194,13 @@ struct glamor_format {
      * just before upload)
      */
     Bool rendering_supported;
+    /**
+     * Whether image with this depth is framebuffer-complete in GL.
+     * This flag is set on GL ES when rendering is supported without
+     * conversion, but reading from framebuffer can bring some caveats
+     * like different format combination or incomplete framebuffer.
+     */
+    Bool texture_only;
 };
 
 struct glamor_saved_procs {


More information about the xorg-commit mailing list