diff options
Diffstat (limited to 'glamor/glamor_largepixmap.c')
-rw-r--r-- | glamor/glamor_largepixmap.c | 131 |
1 files changed, 70 insertions, 61 deletions
diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c index 9b2458453..2c91c27de 100644 --- a/glamor/glamor_largepixmap.c +++ b/glamor/glamor_largepixmap.c @@ -150,12 +150,13 @@ __glamor_compute_clipped_regions(int block_w, */ glamor_pixmap_clipped_regions * -glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv, +glamor_compute_clipped_regions_ext(PixmapPtr pixmap, RegionPtr region, int *n_region, int inner_block_w, int inner_block_h, int reverse, int upsidedown) { + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); glamor_pixmap_clipped_regions *clipped_regions, *inner_regions, *result_regions; int i, j, x, y, k, inner_n_regions; @@ -176,8 +177,8 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv, clipped_regions[0].block_idx = 0; RegionCopy(clipped_regions[0].region, region); *n_region = 1; - block_w = pixmap_priv->base.pixmap->drawable.width; - block_h = pixmap_priv->base.pixmap->drawable.height; + block_w = pixmap->drawable.width; + block_h = pixmap->drawable.height; box_array = &small_box; small_box.x1 = small_box.y1 = 0; small_box.x2 = block_w; @@ -190,10 +191,8 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv, priv->block_h, priv->block_wcnt, 0, 0, - priv->base.pixmap-> - drawable.width, - priv->base.pixmap-> - drawable.height, + pixmap->drawable.width, + pixmap->drawable.height, region, n_region, reverse, upsidedown); @@ -336,7 +335,8 @@ _glamor_largepixmap_reflect_fixup(short *xy1, short *xy2, int wh) * */ static glamor_pixmap_clipped_regions * -_glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv, +_glamor_compute_clipped_regions(PixmapPtr pixmap, + glamor_pixmap_private *pixmap_priv, RegionPtr region, int *n_region, int repeat_type, int is_transform, int reverse, int upsidedown) @@ -366,8 +366,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv, priv = __glamor_large(pixmap_priv); - pixmap_width = priv->base.pixmap->drawable.width; - pixmap_height = priv->base.pixmap->drawable.height; + pixmap_width = pixmap->drawable.width; + pixmap_height = pixmap->drawable.height; if (repeat_type == 0 || repeat_type == RepeatPad) { RegionPtr saved_region = NULL; @@ -385,10 +385,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv, priv->block_h, priv->block_wcnt, 0, 0, - priv->base.pixmap-> - drawable.width, - priv->base.pixmap-> - drawable.height, + pixmap->drawable.width, + pixmap->drawable.height, region, n_region, reverse, upsidedown); if (saved_region) @@ -670,11 +668,13 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv, } glamor_pixmap_clipped_regions * -glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region, +glamor_compute_clipped_regions(PixmapPtr pixmap, + RegionPtr region, int *n_region, int repeat_type, int reverse, int upsidedown) { - return _glamor_compute_clipped_regions(priv, region, n_region, repeat_type, + glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); + return _glamor_compute_clipped_regions(pixmap, priv, region, n_region, repeat_type, 0, reverse, upsidedown); } @@ -682,12 +682,13 @@ glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region, * by default. Or just use region32 for repeat cases? **/ glamor_pixmap_clipped_regions * -glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv, +glamor_compute_transform_clipped_regions(PixmapPtr pixmap, struct pixman_transform *transform, RegionPtr region, int *n_region, int dx, int dy, int repeat_type, int reverse, int upsidedown) { + glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); BoxPtr temp_extent; struct pixman_box32 temp_box; struct pixman_box16 short_box; @@ -714,8 +715,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv, temp_box.x1 = 0; if (temp_box.y1 < 0) temp_box.y1 = 0; - temp_box.x2 = MIN(temp_box.x2, priv->base.pixmap->drawable.width); - temp_box.y2 = MIN(temp_box.y2, priv->base.pixmap->drawable.height); + temp_box.x2 = MIN(temp_box.x2, pixmap->drawable.width); + temp_box.y2 = MIN(temp_box.y2, pixmap->drawable.height); } /* Now copy back the box32 to a box16 box. */ short_box.x1 = temp_box.x1; @@ -725,7 +726,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv, RegionInitBoxes(temp_region, &short_box, 1); DEBUGF("copy to temp source region \n"); DEBUGRegionPrint(temp_region); - ret = _glamor_compute_clipped_regions(priv, + ret = _glamor_compute_clipped_regions(pixmap, + priv, temp_region, n_region, repeat_type, 1, reverse, upsidedown); @@ -747,7 +749,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv, * if the clipped result cross the region boundary. */ static void -glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv, +glamor_merge_clipped_regions(PixmapPtr pixmap, + glamor_pixmap_private *pixmap_priv, int repeat_type, glamor_pixmap_clipped_regions *clipped_regions, int *n_regions, int *need_clean_fbo) @@ -763,8 +766,8 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv, glamor_pixmap_private_large_t *priv; priv = __glamor_large(pixmap_priv); - pixmap_width = priv->base.pixmap->drawable.width; - pixmap_height = priv->base.pixmap->drawable.height; + pixmap_width = pixmap->drawable.width; + pixmap_height =pixmap->drawable.height; temp_region = RegionCreate(NULL, 4); for (i = 0; i < *n_regions; i++) { @@ -784,10 +787,10 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv, DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2, temp_box.y2); temp_pixmap = - glamor_create_pixmap(priv->base.pixmap->drawable.pScreen, + glamor_create_pixmap(pixmap->drawable.pScreen, temp_box.x2 - temp_box.x1, temp_box.y2 - temp_box.y1, - priv->base.pixmap->drawable.depth, + pixmap->drawable.depth, GLAMOR_CREATE_PIXMAP_FIXUP); if (temp_pixmap == NULL) { assert(0); @@ -808,7 +811,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv, copy_box.y2 = temp_extent->y2 - temp_extent->y1; dx = temp_extent->x1; dy = temp_extent->y1; - glamor_copy(&priv->base.pixmap->drawable, + glamor_copy(&pixmap->drawable, &temp_pixmap->drawable, NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL); // glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width, @@ -840,7 +843,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv, copy_box.x1, copy_box.y1, copy_box.x2, copy_box.y2, dx, dy); - glamor_copy(&priv->base.pixmap->drawable, + glamor_copy(&pixmap->drawable, &temp_pixmap->drawable, NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL); @@ -966,7 +969,8 @@ glamor_get_transform_extent_from_box(struct pixman_box32 *box, } static void -_glamor_process_transformed_clipped_region(glamor_pixmap_private *priv, +_glamor_process_transformed_clipped_region(PixmapPtr pixmap, + glamor_pixmap_private *priv, int repeat_type, glamor_pixmap_clipped_regions * clipped_regions, int *n_regions, @@ -976,7 +980,7 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv, if (*n_regions != 1) { /* Merge all source regions into one region. */ - glamor_merge_clipped_regions(priv, repeat_type, + glamor_merge_clipped_regions(pixmap, priv, repeat_type, clipped_regions, n_regions, need_clean_fbo); } @@ -990,22 +994,22 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv, int rem; temp_box = RegionExtents(clipped_regions[0].region); - modulus(temp_box->x1, priv->base.pixmap->drawable.width, rem); - shift_x = (temp_box->x1 - rem) / priv->base.pixmap->drawable.width; - modulus(temp_box->y1, priv->base.pixmap->drawable.height, rem); - shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height; + modulus(temp_box->x1, pixmap->drawable.width, rem); + shift_x = (temp_box->x1 - rem) / pixmap->drawable.width; + modulus(temp_box->y1, pixmap->drawable.height, rem); + shift_y = (temp_box->y1 - rem) / pixmap->drawable.height; if (shift_x != 0) { __glamor_large(priv)->box.x1 += - shift_x * priv->base.pixmap->drawable.width; + shift_x * pixmap->drawable.width; __glamor_large(priv)->box.x2 += - shift_x * priv->base.pixmap->drawable.width; + shift_x * pixmap->drawable.width; } if (shift_y != 0) { __glamor_large(priv)->box.y1 += - shift_y * priv->base.pixmap->drawable.height; + shift_y * pixmap->drawable.height; __glamor_large(priv)->box.y2 += - shift_y * priv->base.pixmap->drawable.height; + shift_y * pixmap->drawable.height; } } } @@ -1016,9 +1020,9 @@ glamor_composite_largepixmap_region(CARD8 op, PicturePtr source, PicturePtr mask, PicturePtr dest, - glamor_pixmap_private *source_pixmap_priv, - glamor_pixmap_private *mask_pixmap_priv, - glamor_pixmap_private *dest_pixmap_priv, + PixmapPtr source_pixmap, + PixmapPtr mask_pixmap, + PixmapPtr dest_pixmap, RegionPtr region, Bool force_clip, INT16 x_source, INT16 y_source, @@ -1027,6 +1031,11 @@ glamor_composite_largepixmap_region(CARD8 op, INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height) { + ScreenPtr screen = dest_pixmap->drawable.pScreen; + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap); + glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap); + glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap); glamor_pixmap_clipped_regions *clipped_dest_regions; glamor_pixmap_clipped_regions *clipped_source_regions; glamor_pixmap_clipped_regions *clipped_mask_regions; @@ -1060,8 +1069,8 @@ glamor_composite_largepixmap_region(CARD8 op, 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; + dest_block_width = dest_pixmap->drawable.width; + dest_block_height = dest_pixmap->drawable.height; } fixed_block_width = dest_block_width; fixed_block_height = dest_block_height; @@ -1134,12 +1143,12 @@ glamor_composite_largepixmap_region(CARD8 op, 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, + glamor_compute_clipped_regions_ext(dest_pixmap, region, &n_dest_regions, fixed_block_width, fixed_block_height, 0, 0); else - clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap_priv, + clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap, region, &n_dest_regions, 0, 0, 0); @@ -1168,7 +1177,7 @@ glamor_composite_largepixmap_region(CARD8 op, RegionTranslate(clipped_dest_regions[i].region, x_source - x_dest, y_source - y_dest); clipped_source_regions = - glamor_compute_clipped_regions(source_pixmap_priv, + glamor_compute_clipped_regions(source_pixmap, clipped_dest_regions[i]. region, &n_source_regions, source_repeat_type, 0, 0); @@ -1176,7 +1185,7 @@ glamor_composite_largepixmap_region(CARD8 op, } else { clipped_source_regions = - glamor_compute_transform_clipped_regions(source_pixmap_priv, + glamor_compute_transform_clipped_regions(source_pixmap, source->transform, clipped_dest_regions [i].region, @@ -1193,7 +1202,7 @@ glamor_composite_largepixmap_region(CARD8 op, } else _glamor_process_transformed_clipped_region - (source_pixmap_priv, source_repeat_type, + (source_pixmap, source_pixmap_priv, source_repeat_type, clipped_source_regions, &n_source_regions, &need_clean_source_fbo); } @@ -1214,7 +1223,7 @@ glamor_composite_largepixmap_region(CARD8 op, RegionTranslate(clipped_source_regions[j].region, -x_source + x_mask, -y_source + y_mask); clipped_mask_regions = - glamor_compute_clipped_regions(mask_pixmap_priv, + glamor_compute_clipped_regions(mask_pixmap, clipped_source_regions [j].region, &n_mask_regions, @@ -1230,7 +1239,7 @@ glamor_composite_largepixmap_region(CARD8 op, RegionTranslate(clipped_dest_regions[i].region, -x_dest + x_mask, -y_dest + y_mask); clipped_mask_regions = - glamor_compute_clipped_regions(mask_pixmap_priv, + glamor_compute_clipped_regions(mask_pixmap, clipped_dest_regions [i].region, &n_mask_regions, @@ -1244,14 +1253,14 @@ glamor_composite_largepixmap_region(CARD8 op, if (!is_normal_source_fbo) clipped_mask_regions = glamor_compute_transform_clipped_regions - (mask_pixmap_priv, mask->transform, + (mask_pixmap, mask->transform, clipped_dest_regions[i].region, &n_mask_regions, x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0, 0); else clipped_mask_regions = glamor_compute_transform_clipped_regions - (mask_pixmap_priv, mask->transform, + (mask_pixmap, mask->transform, clipped_source_regions[j].region, &n_mask_regions, x_mask - x_source, y_mask - y_source, mask_repeat_type, 0, 0); @@ -1263,7 +1272,7 @@ glamor_composite_largepixmap_region(CARD8 op, } else _glamor_process_transformed_clipped_region - (mask_pixmap_priv, mask_repeat_type, + (mask_pixmap, mask_pixmap_priv, mask_repeat_type, clipped_mask_regions, &n_mask_regions, &need_clean_mask_fbo); } @@ -1273,9 +1282,9 @@ glamor_composite_largepixmap_region(CARD8 op, if (!glamor_composite_clipped_region(op, \ null_source ? NULL : source, \ null_mask ? NULL : mask, dest, \ - null_source ? NULL : source_pixmap_priv, \ - null_mask ? NULL : mask_pixmap_priv, \ - dest_pixmap_priv, region, \ + null_source ? NULL : source_pixmap, \ + null_mask ? NULL : mask_pixmap, \ + dest_pixmap, region, \ x_source, y_source, x_mask, y_mask, \ x_dest, y_dest)) { \ assert(0); \ @@ -1326,7 +1335,7 @@ glamor_composite_largepixmap_region(CARD8 op, null_mask = 0; if (need_clean_mask_fbo) { assert(is_normal_mask_fbo == 0); - glamor_destroy_fbo(mask_pixmap_priv->base.fbo); + glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->base.fbo); mask_pixmap_priv->base.fbo = NULL; need_clean_mask_fbo = 0; } @@ -1355,7 +1364,7 @@ glamor_composite_largepixmap_region(CARD8 op, null_source = 0; if (need_clean_source_fbo) { assert(is_normal_source_fbo == 0); - glamor_destroy_fbo(source_pixmap_priv->base.fbo); + glamor_destroy_fbo(glamor_priv, source_pixmap_priv->base.fbo); source_pixmap_priv->base.fbo = NULL; need_clean_source_fbo = 0; } @@ -1367,7 +1376,7 @@ glamor_composite_largepixmap_region(CARD8 op, RegionTranslate(clipped_dest_regions[i].region, x_mask - x_dest, y_mask - y_dest); clipped_mask_regions = - glamor_compute_clipped_regions(mask_pixmap_priv, + glamor_compute_clipped_regions(mask_pixmap, clipped_dest_regions[i]. region, &n_mask_regions, mask_repeat_type, 0, 0); @@ -1376,7 +1385,7 @@ glamor_composite_largepixmap_region(CARD8 op, else { clipped_mask_regions = glamor_compute_transform_clipped_regions - (mask_pixmap_priv, mask->transform, + (mask_pixmap, mask->transform, clipped_dest_regions[i].region, &n_mask_regions, x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0, 0); @@ -1388,7 +1397,7 @@ glamor_composite_largepixmap_region(CARD8 op, } else _glamor_process_transformed_clipped_region - (mask_pixmap_priv, mask_repeat_type, + (mask_pixmap, mask_pixmap_priv, mask_repeat_type, clipped_mask_regions, &n_mask_regions, &need_clean_mask_fbo); } @@ -1417,7 +1426,7 @@ glamor_composite_largepixmap_region(CARD8 op, if (null_mask) null_mask = 0; if (need_clean_mask_fbo) { - glamor_destroy_fbo(mask_pixmap_priv->base.fbo); + glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->base.fbo); mask_pixmap_priv->base.fbo = NULL; need_clean_mask_fbo = 0; } |