[PATCH 4/5] glamor: Handle compositing from large to small pixmaps

Keith Packard keithp at keithp.com
Tue Aug 19 13:00:12 PDT 2014


glamor_composite_largepixmap_region is given the job of dealing with
compositing between a mixture of large and small pixmaps. However, it
was assuming that the destination pixmap was large and fetching
members of the large structure even for small pixmaps.

This manifested with assertion failures when compositing from a large
pixmap to a small pixmap.

Fixed by using the pixmap size for the destination block size for
small pixmaps.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 glamor/glamor_largepixmap.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c
index ad6a090..ce38809 100644
--- a/glamor/glamor_largepixmap.c
+++ b/glamor/glamor_largepixmap.c
@@ -1041,6 +1041,7 @@ glamor_composite_largepixmap_region(CARD8 op,
     int is_normal_source_fbo = 0;
     int is_normal_mask_fbo = 0;
     int fixed_block_width, fixed_block_height;
+    int dest_block_width, dest_block_height;
     int null_source, null_mask;
     glamor_pixmap_private *need_free_source_pixmap_priv = NULL;
     glamor_pixmap_private *need_free_mask_pixmap_priv = NULL;
@@ -1057,8 +1058,16 @@ glamor_composite_largepixmap_region(CARD8 op,
     else
         mask_repeat_type = RepeatNone;
 
-    fixed_block_width = dest_pixmap_priv->large.block_w;
-    fixed_block_height = dest_pixmap_priv->large.block_h;
+    if (dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
+        dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
+    } else {
+        dest_block_width = dest_pixmap_priv->base.pixmap->drawable.width;
+        dest_block_height = dest_pixmap_priv->base.pixmap->drawable.height;
+    }
+    fixed_block_width = dest_block_width;
+    fixed_block_height = dest_block_height;
+
     /* 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). */
@@ -1124,8 +1133,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 < dest_pixmap_priv->large.block_w
-        || fixed_block_height < dest_pixmap_priv->large.block_h)
+    if (force_clip || fixed_block_width < dest_block_width
+        || fixed_block_height < dest_block_height)
         clipped_dest_regions =
             glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
                                                &n_dest_regions,
-- 
2.0.1



More information about the xorg-devel mailing list