xserver: Branch 'master' - 2 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Tue Aug 23 08:01:11 UTC 2016


 glamor/glamor_composite_glyphs.c |    3 +-
 glamor/glamor_copy.c             |   40 ++++++++++++++++++++++++++++++++-------
 2 files changed, 35 insertions(+), 8 deletions(-)

New commits:
commit be334f42a198a25e817e6dab43dd0e30aa1cd4f8
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Aug 18 09:40:34 2016 +0900

    glamor: Declare "pos" in the composite glyph GLSL 1.20 vertex shader
    
    Fixes shader compile failure:
    
     Failed to compile VS: 0:13(43): error: `pos' undeclared
    0:13(14): error: operands to arithmetic operators must be numeric
    0:13(13): error: operands to arithmetic operators must be numeric
    
     Program source:
    #define ATLAS_DIM_INV 0.000976562500000000
    attribute vec2 primitive;
    attribute vec2 source;
    varying vec2 glyph_pos;
    uniform vec2 fill_offset;
    uniform vec2 fill_size_inv;
    varying vec2 fill_pos;
    uniform vec4 v_matrix;
    void main() {
           gl_Position.xy = primitive.xy * v_matrix.xz + v_matrix.yw;
           gl_Position.zw = vec2(0.0,1.0);
           glyph_pos = source.xy * ATLAS_DIM_INV;
           fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;
    }
     (EE) Fatal server error:
     (EE) GLSL compile failure
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97300
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c
index cc0aa6f..b651274 100644
--- a/glamor/glamor_composite_glyphs.c
+++ b/glamor/glamor_composite_glyphs.c
@@ -199,7 +199,8 @@ static const glamor_facet glamor_facet_composite_glyphs_120 = {
     .vs_vars = ("attribute vec2 primitive;\n"
                 "attribute vec2 source;\n"
                 "varying vec2 glyph_pos;\n"),
-    .vs_exec = (GLAMOR_POS(gl_Position, primitive)
+    .vs_exec = ("       vec2 pos = vec2(0,0);\n"
+                GLAMOR_POS(gl_Position, primitive.xy)
                 "       glyph_pos = source.xy * ATLAS_DIM_INV;\n"),
     .fs_vars = ("varying vec2 glyph_pos;\n"),
     .fs_exec = ("       vec4 mask = texture2D(atlas, glyph_pos);\n"),
commit cba28d572ac799391beacd89d57e69d0d7ed70e7
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Jul 12 12:25:13 2016 +0900

    glamor: Handle bitplane in glamor_copy_fbo_cpu
    
    This can significantly speed up at least some CopyPlane cases, e.g.
    indirectly for stippled fills.
    
    v2:
    * Make temporary pixmap the same size as the destination pixmap
      (instead of the destination drawable size), and fix coordinate
      parameters passed to fbCopyXtoX and glamor_upload_boxes. Fixes
      incorrect rendering with x11perf -copyplane* and crashes with the
      xscreensaver phosphor hack.
    v3:
    * Make the change a bit more compact and hopefully more readable by
      re-using the existing src_* locals in the bitplane case as well.
    
    Reported-by: Keith Raghubar <keith.raghubar at amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Acked-by: Eric Anholt <eric at anholt.net>

diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index 3501a0d..5b5f0e6 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -220,11 +220,37 @@ glamor_copy_cpu_fbo(DrawablePtr src,
 
     glamor_get_drawable_deltas(dst, dst_pixmap, &dst_xoff, &dst_yoff);
 
-    fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
+    if (bitplane) {
+        PixmapPtr src_pix = fbCreatePixmap(screen, dst_pixmap->drawable.width,
+                                           dst_pixmap->drawable.height,
+                                           dst->depth, 0);
+
+        if (!src_pix) {
+            glamor_finish_access(src);
+            goto bail;
+        }
 
-    glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy,
-                        dst_xoff, dst_yoff,
-                        (uint8_t *) src_bits, src_stride * sizeof (FbBits));
+        fbGetDrawable(&src_pix->drawable, src_bits, src_stride, src_bpp, src_xoff,
+                      src_yoff);
+
+        if (src->bitsPerPixel > 1)
+            fbCopyNto1(src, &src_pix->drawable, gc, box, nbox,
+                       dst_xoff + dx, dst_yoff + dy, reverse, upsidedown,
+                       bitplane, closure);
+        else
+            fbCopy1toN(src, &src_pix->drawable, gc, box, nbox,
+                       dst_xoff + dx, dst_yoff + dy, reverse, upsidedown,
+                       bitplane, closure);
+
+        glamor_upload_boxes(dst_pixmap, box, nbox, 0, 0, 0, 0,
+                            (uint8_t *) src_bits, src_stride * sizeof(FbBits));
+        fbDestroyPixmap(src_pix);
+    } else {
+        fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
+        glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy,
+                            dst_xoff, dst_yoff,
+                            (uint8_t *) src_bits, src_stride * sizeof (FbBits));
+    }
     glamor_finish_access(src);
 
     return TRUE;
@@ -616,9 +642,9 @@ glamor_copy_gl(DrawablePtr src,
                 return glamor_copy_fbo_fbo_draw(src, dst, gc, box, nbox, dx, dy,
                                                 reverse, upsidedown, bitplane, closure);
         }
-        if (bitplane == 0)
-            return glamor_copy_cpu_fbo(src, dst, gc, box, nbox, dx, dy,
-                                       reverse, upsidedown, bitplane, closure);
+
+        return glamor_copy_cpu_fbo(src, dst, gc, box, nbox, dx, dy,
+                                   reverse, upsidedown, bitplane, closure);
     } else if (GLAMOR_PIXMAP_PRIV_HAS_FBO(src_priv) &&
                dst_priv->type != GLAMOR_DRM_ONLY &&
                bitplane == 0) {


More information about the xorg-commit mailing list