xserver: Branch 'server-1.17-branch' - 4 commits

Adam Jackson ajax at kemper.freedesktop.org
Mon Oct 26 08:34:33 PDT 2015


 glamor/glamor.c         |   26 ++++++++++++++------------
 glamor/glamor_font.c    |   37 +++++++++++++++++++++++++------------
 glamor/glamor_image.c   |    4 ++--
 glamor/glamor_prepare.c |    2 ++
 4 files changed, 43 insertions(+), 26 deletions(-)

New commits:
commit 92effabee1fe7225709acdca4adb2783b78392d4
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Jul 22 15:37:23 2015 +0900

    glamor: Make our EGL context current before calling into GL in glamor_init
    
    Without this, the context of another screen may be current, or no context
    at all if glamor_egl_init failed for another screen.
    
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 0a458a908ec071a4da5d22c760581e0c5ec885ce)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index a8cc810..21252bc 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -379,6 +379,20 @@ glamor_init(ScreenPtr screen, unsigned int flags)
         goto fail;
     }
 
+    glamor_priv->saved_procs.close_screen = screen->CloseScreen;
+    screen->CloseScreen = glamor_close_screen;
+
+    /* If we are using egl screen, call egl screen init to
+     * register correct close screen function. */
+    if (flags & GLAMOR_USE_EGL_SCREEN) {
+        glamor_egl_screen_init(screen, &glamor_priv->ctx);
+    } else {
+        if (!glamor_glx_screen_init(&glamor_priv->ctx))
+            goto fail;
+    }
+
+    glamor_make_current(glamor_priv);
+
     if (epoxy_is_desktop_gl())
         glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
     else
@@ -463,18 +477,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 
     glamor_set_debug_level(&glamor_debug_level);
 
-    glamor_priv->saved_procs.close_screen = screen->CloseScreen;
-    screen->CloseScreen = glamor_close_screen;
-
-    /* If we are using egl screen, call egl screen init to
-     * register correct close screen function. */
-    if (flags & GLAMOR_USE_EGL_SCREEN) {
-        glamor_egl_screen_init(screen, &glamor_priv->ctx);
-    } else {
-        if (!glamor_glx_screen_init(&glamor_priv->ctx))
-            goto fail;
-    }
-
     glamor_priv->saved_procs.create_screen_resources =
         screen->CreateScreenResources;
     screen->CreateScreenResources = glamor_create_screen_resources;
commit a420301a8bc9376a174315bc32d3cd7e89dacd7f
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jul 15 17:56:11 2015 +1000

    glamor: make current in prepare paths
    
    Lots of the accel paths only make current once they start
    doing someting, so a lot of them call the bail paths without
    make current, which means on PRIME systems for example
    we end up in the wrong context.
    
    Add a prepare pixmap in the prepare fallback path.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90667
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer at amd.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit db5337afb248edf81087cf8d74006fc496d70589)

diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c
index fb85d90..40b7b4f 100644
--- a/glamor/glamor_prepare.c
+++ b/glamor/glamor_prepare.c
@@ -45,6 +45,8 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
         return TRUE;
 
+    glamor_make_current(glamor_priv);
+
     RegionInit(&region, box, 1);
 
     /* See if it's already mapped */
commit fb17307b1bbb6842a2c76c0a934c4f50aaea69d1
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Jul 10 15:28:52 2015 +0900

    glamor: Use glamor_prepare_access_box() for PutImage/GetImage fallback
    
    Fixes slow text display in xdvi.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91260
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    (cherry picked from commit 1a18513a4eb3fa22459dd9f7d8f0e275aff679ec)

diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c
index b38b412..90fda40 100644
--- a/glamor/glamor_image.c
+++ b/glamor/glamor_image.c
@@ -88,7 +88,7 @@ static void
 glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
                       int w, int h, int leftPad, int format, char *bits)
 {
-    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW))
+    if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RW, x, y, w, h))
         fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
     glamor_finish_access(drawable);
 }
@@ -150,7 +150,7 @@ static void
 glamor_get_image_bail(DrawablePtr drawable, int x, int y, int w, int h,
                       unsigned int format, unsigned long plane_mask, char *d)
 {
-    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO))
+    if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RO, x, y, w, h))
         fbGetImage(drawable, x, y, w, h, format, plane_mask, d);
     glamor_finish_access(drawable);
 }
commit 8415eca0abc00ec96cb94cd656b58edbfa8f09a3
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Mon Jul 6 18:45:51 2015 -0700

    glamor: Use a single glTexImage2D call for core font atlas texture data v2
    
    Instead of one glTexSubImage2D call for each glyph.
    
    This significantly reduces the amount of time it takes for xterm to start
    up on a fresh X server with the radeonsi driver.
    
    v2: Use GLYPHWIDTHBYTESPADDED instead of hardcoding 4 bytes glyph
        alignment (Keith Packard)
    
    [ajax 1.17: fix up summary as suggested by Michel]
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 732e3b9c08532f40656010eac9d128601cc88c3f)

diff --git a/glamor/glamor_font.c b/glamor/glamor_font.c
index cc0fecf..6b3a16a 100644
--- a/glamor/glamor_font.c
+++ b/glamor/glamor_font.c
@@ -45,6 +45,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     unsigned char       c[2];
     CharInfoPtr         glyph;
     unsigned long       count;
+    char                *bits;
 
     if (glamor_priv->glsl_version < 130)
         return NULL;
@@ -62,8 +63,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     if (glamor_font->realized)
         return glamor_font;
 
-    glamor_font->realized = TRUE;
-
     /* Figure out how many glyphs are in the font */
     num_cols = font->info.lastCol - font->info.firstCol + 1;
     num_rows = font->info.lastRow - font->info.firstRow + 1;
@@ -81,6 +80,10 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     overall_width = glyph_width_bytes * num_cols;
     overall_height = glyph_height * num_rows;
 
+    bits = malloc(overall_width * overall_height);
+    if (!bits)
+        return NULL;
+
     /* Check whether the font has a default character */
     c[0] = font->info.lastRow + 1;
     c[1] = font->info.lastCol + 1;
@@ -100,12 +103,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 
-    /* Allocate storage */
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_R8UI, overall_width, overall_height,
-                 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL);
-
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
-
     /* Paint all of the glyphs */
     for (row = 0; row < num_rows; row++) {
         for (col = 0; col < num_cols; col++) {
@@ -114,13 +111,29 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
 
             (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph);
 
-            if (count)
-                glTexSubImage2D(GL_TEXTURE_2D, 0, col * glyph_width_bytes, row * glyph_height,
-                                GLYPHWIDTHBYTES(glyph), GLYPHHEIGHTPIXELS(glyph),
-                                GL_RED_INTEGER, GL_UNSIGNED_BYTE, glyph->bits);
+            if (count) {
+                char *dst = bits + row * glyph_height * overall_width +
+                    col * glyph_width_bytes;
+                char *src = glyph->bits;
+                unsigned y;
+
+                for (y = 0; y < GLYPHHEIGHTPIXELS(glyph); y++) {
+                    memcpy(dst, src, GLYPHWIDTHBYTES(glyph));
+                    dst += overall_width;
+                    src += GLYPHWIDTHBYTESPADDED(glyph);
+                }
+            }
         }
     }
 
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_R8UI, overall_width, overall_height,
+                 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, bits);
+
+    free(bits);
+
+    glamor_font->realized = TRUE;
+
     return glamor_font;
 }
 


More information about the xorg-commit mailing list