[PATCH 03/20] glamor: Get testing code using small FBOs working again

Keith Packard keithp at keithp.com
Tue Mar 18 22:09:37 PDT 2014


Glamor has a mode where pixmaps will be constructed from numerous
small FBOs. This allows testing of the tiled pixmap code without
needing to create huge pixmaps.

However, the render glyph code assumed that it could create a pixmap
large enough for the glyph atlas. Instead of attempting to fix that
(which would be disruptive and not helpful), I've added a new pixmap
creation usage, GLAMOR_CREATE_NO_LARGE which forces allocation of a
single large FBO.

Now that we have pixmaps with varying FBO sizes, I then went around
and fixed the few places using the global FBO max size and replaced
that with the per-pixmap FBO tiling sizes, which were already present
in each large pixmap.

Xephyr has been changed to pass GLAMOR_CREATE_NO_LARGE when it creates
the screen pixmap as it doesn't want to deal with tiling either.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 glamor/glamor.c             |  4 +++-
 glamor/glamor.h             |  7 +++++++
 glamor/glamor_fbo.c         |  3 ---
 glamor/glamor_glyphs.c      |  2 +-
 glamor/glamor_largepixmap.c | 10 ++++------
 glamor/glamor_pixmap.c      | 14 ++++++--------
 glamor/glamor_priv.h        |  7 -------
 hw/kdrive/ephyr/hostx.c     |  4 +++-
 8 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 0f7d68b..aaa786a 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -178,7 +178,9 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
     pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
     screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
 
-    if (type == GLAMOR_MEMORY_MAP || glamor_check_fbo_size(glamor_priv, w, h)) {
+    if (type == GLAMOR_MEMORY_MAP || usage == GLAMOR_CREATE_NO_LARGE ||
+        glamor_check_fbo_size(glamor_priv, w, h))
+    {
         pixmap_priv->type = type;
         fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
     }
diff --git a/glamor/glamor.h b/glamor/glamor.h
index d05d2f4..11ec493 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -140,9 +140,16 @@ extern _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap,
                                              glamor_pixmap_type_t type);
 extern _X_EXPORT void glamor_destroy_textured_pixmap(PixmapPtr pixmap);
 extern _X_EXPORT void glamor_block_handler(ScreenPtr screen);
+
 extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
                                                 int depth, unsigned int usage);
 
+#define GLAMOR_CREATE_PIXMAP_CPU        0x100
+#define GLAMOR_CREATE_PIXMAP_FIXUP      0x101
+#define GLAMOR_CREATE_FBO_NO_FBO        0x103
+#define GLAMOR_CREATE_PIXMAP_MAP        0x104
+#define GLAMOR_CREATE_NO_LARGE          0x105
+
 /* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo).
  *
  * @front: front pixmap.
diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
index 640b6fd..4f6da67 100644
--- a/glamor/glamor_fbo.c
+++ b/glamor/glamor_fbo.c
@@ -361,9 +361,6 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
     GLint tex = 0;
     int cache_flag;
 
-    if (!glamor_check_fbo_size(glamor_priv, w, h))
-        return NULL;
-
     if (flag == GLAMOR_CREATE_FBO_NO_FBO)
         goto new_fbo;
 
diff --git a/glamor/glamor_glyphs.c b/glamor/glamor_glyphs.c
index 2b2c735..a04ae82 100644
--- a/glamor/glamor_glyphs.c
+++ b/glamor/glamor_glyphs.c
@@ -332,7 +332,7 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
         pixmap = pScreen->CreatePixmap(pScreen,
                                        CACHE_PICTURE_SIZE,
                                        CACHE_PICTURE_SIZE + MASK_CACHE_MAX_SIZE,
-                                       depth, 0);
+                                       depth, GLAMOR_CREATE_NO_LARGE);
         if (!pixmap)
             goto bail;
 
diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c
index b8c0640..b3a8d5d 100644
--- a/glamor/glamor_largepixmap.c
+++ b/glamor/glamor_largepixmap.c
@@ -1015,7 +1015,6 @@ glamor_composite_largepixmap_region(CARD8 op,
                                     INT16 x_dest, INT16 y_dest,
                                     CARD16 width, CARD16 height)
 {
-    glamor_screen_private *glamor_priv;
     glamor_pixmap_clipped_regions *clipped_dest_regions;
     glamor_pixmap_clipped_regions *clipped_source_regions;
     glamor_pixmap_clipped_regions *clipped_mask_regions;
@@ -1044,9 +1043,8 @@ glamor_composite_largepixmap_region(CARD8 op,
     else
         mask_repeat_type = RepeatNone;
 
-    glamor_priv = dest_pixmap_priv->base.glamor_priv;
-    fixed_block_width = glamor_priv->max_fbo_size;
-    fixed_block_height = glamor_priv->max_fbo_size;
+    fixed_block_width = dest_pixmap_priv->large.block_w;
+    fixed_block_height = dest_pixmap_priv->large.block_h;
     /* If we got an totally out-of-box region for a source or mask
      * region without repeat, we need to set it as null_source and
      * give it a solid color (0,0,0,0). */
@@ -1112,8 +1110,8 @@ glamor_composite_largepixmap_region(CARD8 op,
 
     /*compute the correct block width and height whose transformed source/mask
      *region can fit into one texture.*/
-    if (force_clip || fixed_block_width < glamor_priv->max_fbo_size
-        || fixed_block_height < glamor_priv->max_fbo_size)
+    if (force_clip || fixed_block_width < dest_pixmap_priv->large.block_w
+        || fixed_block_height < dest_pixmap_priv->large.block_h)
         clipped_dest_regions =
             glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
                                                &n_dest_regions,
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index 615faad..891ecdd 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -1013,10 +1013,9 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
             clipped_regions =
                 glamor_compute_clipped_regions_ext(pixmap_priv, &region,
                                                    &n_region,
-                                                   pixmap_priv->base.
-                                                   glamor_priv->max_fbo_size,
-                                                   pixmap_priv->base.
-                                                   glamor_priv->max_fbo_size, 0,
+                                                   pixmap_priv->large.block_w,
+                                                   pixmap_priv->large.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++) {
@@ -1374,10 +1373,9 @@ glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h,
             clipped_regions =
                 glamor_compute_clipped_regions_ext(pixmap_priv, &region,
                                                    &n_region,
-                                                   pixmap_priv->base.
-                                                   glamor_priv->max_fbo_size,
-                                                   pixmap_priv->base.
-                                                   glamor_priv->max_fbo_size, 0,
+                                                   pixmap_priv->large.block_w,
+                                                   pixmap_priv->large.block_h,
+                                                   0,
                                                    0);
 
         DEBUGF("start download large pixmap %p %dx%d \n", pixmap, w, h);
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index bc7d3f8..fe1591b 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -153,13 +153,6 @@ enum glamor_gl_flavor {
     GLAMOR_GL_ES2               // OPENGL ES2.0 API
 };
 
-#define GLAMOR_CREATE_PIXMAP_CPU  0x100
-#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
-#define GLAMOR_CREATE_FBO_NO_FBO   0x103
-#define GLAMOR_CREATE_PIXMAP_MAP 0x104
-
-#define GLAMOR_CREATE_TEXTURE_EXACT_SIZE 0x104
-
 #define GLAMOR_NUM_GLYPH_CACHE_FORMATS 2
 
 #define GLAMOR_COMPOSITE_VBO_VERT_CNT (64*1024)
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 3260d95..3054f5f 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1260,7 +1260,9 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
     screen_pixmap = pScreen->CreatePixmap(pScreen,
                                           pScreen->width,
                                           pScreen->height,
-                                          pScreen->rootDepth, 0);
+                                          pScreen->rootDepth,
+                                          GLAMOR_CREATE_NO_LARGE);
+
     pScreen->SetScreenPixmap(screen_pixmap);
 
     /* Tell the GLX code what to GL texture to read from. */
-- 
1.9.0



More information about the xorg-devel mailing list