xserver: Branch 'master' - 3 commits

Keith Packard keithp at kemper.freedesktop.org
Wed May 7 11:32:30 PDT 2014


 glamor/glamor.h      |    3 +++
 glamor/glamor_priv.h |    5 -----
 glamor/glamor_text.c |   36 +++++++++++++++++++++++++-----------
 3 files changed, 28 insertions(+), 16 deletions(-)

New commits:
commit a5b9757142a2ab471ca26651dce9cc5f5e351f3d
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Apr 25 15:07:03 2014 -0700

    glamor: Publish change_window_attributes and copy_window
    
    Because uxa doesn't just use glamor directly, it keeps these two
    functions from being wrapped so that they get called
    automatically. Publishing these will allow uxa to call them directly.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/glamor/glamor.h b/glamor/glamor.h
index e63762b..b0f2212 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -321,6 +321,9 @@ extern _X_EXPORT int glamor_create_gc(GCPtr gc);
 extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes,
                                          DrawablePtr drawable);
 
+extern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
+extern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region);
+
 /* Glamor rendering/drawing functions with XXX_nf.
  * nf means no fallback within glamor internal if possible. If glamor
  * fail to accelerate the operation, glamor will return a false, and the
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index a2a21fc..96635be 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -626,10 +626,6 @@ void glamor_copy_n_to_n(DrawablePtr src, DrawablePtr dst, GCPtr gc,
                         BoxPtr box, int nbox, int dx, int dy, Bool reverse,
                         Bool upsidedown, Pixel bitplane, void *closure);
 
-/* glamor_copywindow.c */
-void glamor_copy_window(WindowPtr win, DDXPointRec old_origin,
-                        RegionPtr src_region);
-
 /* glamor_core.c */
 Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access);
 void glamor_finish_access(DrawablePtr drawable);
@@ -670,7 +666,6 @@ glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x,
 
 Bool glamor_set_alu(ScreenPtr screen, unsigned char alu);
 Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
-Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
 RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap);
 
 /* glamor_fill.c */
commit 4711182033ec579caff8c930d420f90ecdbe54cf
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Apr 25 20:25:56 2014 -0700

    glamor: Work around libXfont when it fails to use defaultChar
    
    GetGlyphs is supposed to always return the full list of characters
    when there is a default character available. However, if an
    application opens a 16-bit two dimensional font and then draws with
    8-bit requests, the bitmapGetGlyphs function in libXfont versions up
    through 1.4.7 will return zero glyphs if there is no 0th row.
    
    While this is a bug in libXfont and should be fixed there, it's easy
    to protect glamor from it by simply falling through to the case that
    handles GetGlyphs failures for fonts without a default character.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/glamor/glamor_text.c b/glamor/glamor_text.c
index fdee08e..6e02b9a 100644
--- a/glamor/glamor_text.c
+++ b/glamor/glamor_text.c
@@ -37,6 +37,7 @@ glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font,
     unsigned long nglyphs;
     FontEncoding encoding;
     int char_step;
+    int c;
 
     if (sixteen) {
         char_step = 2;
@@ -49,7 +50,7 @@ glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font,
         encoding = Linear8Bit;
     }
 
-    /* If the font has a default character, then we don't have to
+    /* If the font has a default character, then we shouldn't have to
      * worry about missing glyphs, so just get the whole string all at
      * once. Otherwise, we have to fetch chars one at a time to notice
      * missing ones.
@@ -57,15 +58,28 @@ glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font,
     if (glamor_font->default_char) {
         GetGlyphs(font, (unsigned long) count, (unsigned char *) chars,
                   encoding, &nglyphs, charinfo);
-    } else {
-        int c;
-        for (c = 0; c < count; c++) {
-            GetGlyphs(font, 1, (unsigned char *) chars,
-                      encoding, &nglyphs, &charinfo[c]);
-            if (!nglyphs)
-                charinfo[c] = NULL;
-            chars += char_step;
-        }
+
+        /* Make sure it worked. There's a bug in libXfont through
+         * version 1.4.7 which would cause it to fail when the font is
+         * a 2D font without a first row, and the application sends a
+         * 1-d request. In this case, libXfont would return zero
+         * glyphs, even when the font had a default character.
+         *
+         * It's easy enough for us to work around that bug here by
+         * simply checking the returned nglyphs and falling through to
+         * the one-at-a-time code below. Not doing this check would
+         * result in uninitialized memory accesses in the rendering code.
+         */
+        if (nglyphs == count)
+            return;
+    }
+
+    for (c = 0; c < count; c++) {
+        GetGlyphs(font, 1, (unsigned char *) chars,
+                  encoding, &nglyphs, &charinfo[c]);
+        if (!nglyphs)
+            charinfo[c] = NULL;
+        chars += char_step;
     }
 }
 
commit 91767a32874790f8a8c7340be0e81a0b719ca4f6
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Apr 25 23:38:35 2014 -0700

    glamor: Fix uxa-entry point for ImageText16
    
    Was interpreting the incoming chars as 8-bits instead of 16-bits,
    resulting in the wrong characters being drawn.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/glamor/glamor_text.c b/glamor/glamor_text.c
index 395116d..fdee08e 100644
--- a/glamor/glamor_text.c
+++ b/glamor/glamor_text.c
@@ -508,7 +508,7 @@ Bool
 glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
                        int x, int y, int count, unsigned short *chars)
 {
-    return glamor_image_text(drawable, gc, x, y, count, (char *) chars, FALSE);
+    return glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE);
 }
 
 void


More information about the xorg-commit mailing list