summaryrefslogtreecommitdiff
path: root/src/sna/sna_blt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sna/sna_blt.c')
-rw-r--r--src/sna/sna_blt.c73
1 files changed, 39 insertions, 34 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 7f3fc3e8..9fad2921 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -2253,8 +2253,8 @@ sna_blt_composite(struct sna *sna,
int16_t x, int16_t y,
int16_t dst_x, int16_t dst_y,
int16_t width, int16_t height,
- struct sna_composite_op *tmp,
- bool fallback)
+ unsigned flags,
+ struct sna_composite_op *tmp)
{
PictFormat src_format = src->format;
PixmapPtr src_pixmap;
@@ -2269,7 +2269,6 @@ sna_blt_composite(struct sna *sna,
#if DEBUG_NO_BLT || NO_BLT_COMPOSITE
return false;
#endif
-
DBG(("%s (%d, %d), (%d, %d), %dx%d\n",
__FUNCTION__, x, y, dst_x, dst_y, width, height));
@@ -2309,22 +2308,25 @@ clear:
hint = 0;
if (can_render(sna)) {
hint |= PREFER_GPU;
- if (dst->pCompositeClip->data == NULL && (width | height)) {
+ if (dst->pCompositeClip->data == NULL &&
+ (flags & COMPOSITE_PARTIAL) == 0) {
hint |= IGNORE_CPU;
- if (width == tmp->dst.pixmap->drawable.width &&
+ if (width == tmp->dst.pixmap->drawable.width &&
height == tmp->dst.pixmap->drawable.height)
hint |= REPLACES;
}
}
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
- if (tmp->dst.bo && !kgem_bo_can_blt(&sna->kgem, tmp->dst.bo)) {
- DBG(("%s: can not blit to dst, tiling? %d, pitch? %d\n",
- __FUNCTION__, tmp->dst.bo->tiling, tmp->dst.bo->pitch));
- return false;
- }
-
- if (!tmp->dst.bo) {
+ if (tmp->dst.bo) {
+ if (!kgem_bo_can_blt(&sna->kgem, tmp->dst.bo)) {
+ DBG(("%s: can not blit to dst, tiling? %d, pitch? %d\n",
+ __FUNCTION__, tmp->dst.bo->tiling, tmp->dst.bo->pitch));
+ return false;
+ }
+ if (hint & REPLACES)
+ kgem_bo_undo(&sna->kgem, tmp->dst.bo);
+ } else {
RegionRec region;
region.extents = dst_box;
@@ -2333,8 +2335,7 @@ clear:
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
MOVE_INPLACE_HINT | MOVE_WRITE))
return false;
- } else if (hint & REPLACES)
- kgem_bo_undo(&sna->kgem, tmp->dst.bo);
+ }
return prepare_blt_clear(sna, tmp);
}
@@ -2363,31 +2364,34 @@ fill:
hint = 0;
if (can_render(sna)) {
hint |= PREFER_GPU;
- if (dst->pCompositeClip->data == NULL && (width | height))
+ if (dst->pCompositeClip->data == NULL &&
+ (flags & COMPOSITE_PARTIAL) == 0) {
hint |= IGNORE_CPU;
- if (width == tmp->dst.pixmap->drawable.width &&
- height == tmp->dst.pixmap->drawable.height)
- hint |= REPLACES;
+ if (width == tmp->dst.pixmap->drawable.width &&
+ height == tmp->dst.pixmap->drawable.height)
+ hint |= REPLACES;
+ }
}
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
- if (tmp->dst.bo && !kgem_bo_can_blt(&sna->kgem, tmp->dst.bo)) {
- DBG(("%s: can not blit to dst, tiling? %d, pitch? %d\n",
- __FUNCTION__, tmp->dst.bo->tiling, tmp->dst.bo->pitch));
- return false;
- }
-
- if (!tmp->dst.bo) {
+ if (tmp->dst.bo) {
+ if (!kgem_bo_can_blt(&sna->kgem, tmp->dst.bo)) {
+ DBG(("%s: can not blit to dst, tiling? %d, pitch? %d\n",
+ __FUNCTION__, tmp->dst.bo->tiling, tmp->dst.bo->pitch));
+ return false;
+ }
+ if (hint & REPLACES)
+ kgem_bo_undo(&sna->kgem, tmp->dst.bo);
+ } else {
RegionRec region;
region.extents = dst_box;
region.data = NULL;
if (!sna_drawable_move_region_to_cpu(dst->pDrawable, &region,
- MOVE_INPLACE_HINT | MOVE_WRITE))
+ MOVE_INPLACE_HINT | MOVE_WRITE))
return false;
- } else if (hint & REPLACES)
- kgem_bo_undo(&sna->kgem, tmp->dst.bo);
+ }
return prepare_blt_fill(sna, tmp, color);
}
@@ -2505,7 +2509,7 @@ fill:
if (src_pixmap->drawable.width <= sna->render.max_3d_size &&
src_pixmap->drawable.height <= sna->render.max_3d_size &&
bo->pitch <= sna->render.max_3d_pitch &&
- !fallback)
+ (flags & COMPOSITE_FALLBACK) == 0)
{
return false;
}
@@ -2516,9 +2520,10 @@ fill:
hint = 0;
if (bo || can_render(sna)) {
hint |= PREFER_GPU;
- if (dst->pCompositeClip->data == NULL && (width | height)) {
+ if (dst->pCompositeClip->data == NULL &&
+ (flags & COMPOSITE_PARTIAL) == 0) {
hint |= IGNORE_CPU;
- if (width == tmp->dst.pixmap->drawable.width &&
+ if (width == tmp->dst.pixmap->drawable.width &&
height == tmp->dst.pixmap->drawable.height)
hint |= REPLACES;
}
@@ -2536,7 +2541,7 @@ fill:
if (!tmp->dst.bo) {
DBG(("%s: fallback -- unaccelerated read back\n",
__FUNCTION__));
- if (fallback || !kgem_bo_is_busy(bo))
+ if (flags & COMPOSITE_FALLBACK || !kgem_bo_is_busy(bo))
goto put;
} else if (bo->snoop && tmp->dst.bo->snoop) {
DBG(("%s: fallback -- can not copy between snooped bo\n",
@@ -2545,11 +2550,11 @@ fill:
} else if (!kgem_bo_can_blt(&sna->kgem, tmp->dst.bo)) {
DBG(("%s: fallback -- unaccelerated upload\n",
__FUNCTION__));
- if (fallback || !kgem_bo_is_busy(bo))
+ if (flags & COMPOSITE_FALLBACK || !kgem_bo_is_busy(bo))
goto put;
} else {
ret = prepare_blt_copy(sna, tmp, bo, alpha_fixup);
- if (fallback && !ret)
+ if (flags & COMPOSITE_FALLBACK && !ret)
goto put;
}
} else {