xf86-video-intel: 2 commits - src/sna/gen7_render.c src/sna/sna_composite.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Aug 12 02:35:17 PDT 2013
src/sna/gen7_render.c | 14 ++--
src/sna/sna_composite.c | 144 ++++++++++++++++++++++++------------------------
2 files changed, 81 insertions(+), 77 deletions(-)
New commits:
commit e8dfc5b3f4ffeec93e52a5319b5a3118edf0e94e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Aug 12 10:33:41 2013 +0100
sna: Fix destination offset along memcpy composite fallback fastback
The application of dst_x|y was incorrect, and so the drawing could end
up in the wrong location for a window.
References: https://bugs.freedesktop.org/show_bug.cgi?id=66990
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index 58dd356..000e27e 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -504,79 +504,83 @@ sna_composite_fb(CARD8 op,
return;
}
- if (mask && mask->pDrawable) {
- DBG(("%s: fallback -- move mask to cpu\n", __FUNCTION__));
- if (!sna_drawable_move_to_cpu(mask->pDrawable,
- MOVE_READ))
- return;
-
- if (mask->alphaMap &&
- !sna_drawable_move_to_cpu(mask->alphaMap->pDrawable,
- MOVE_READ))
- return;
- }
-
validate_source(src);
- if (mask)
- validate_source(mask);
- if (mask == NULL &&
- src->pDrawable &&
- dst->pDrawable->bitsPerPixel >= 8 &&
- src->filter != PictFilterConvolution &&
- (op == PictOpSrc || (op == PictOpOver && !PICT_FORMAT_A(src->format))) &&
- (dst->format == src->format || dst->format == alphaless(src->format)) &&
- sna_transform_is_integer_translation(src->transform, &tx, &ty)) {
- PixmapPtr dst_pixmap = get_drawable_pixmap(dst->pDrawable);
- PixmapPtr src_pixmap = get_drawable_pixmap(src->pDrawable);
- int16_t sx = src_x + tx - (dst->pDrawable->x - dst_x);
- int16_t sy = src_y + ty - (dst->pDrawable->y - dst_y);
- if (region->extents.x1 + sx >= 0 &&
- region->extents.y1 + sy >= 0 &&
- region->extents.x2 + sx <= src->pDrawable->width &&
- region->extents.y2 + sy <= src->pDrawable->height) {
- BoxPtr box = RegionRects(region);
- int nbox = RegionNumRects(region);
-
- sx += src->pDrawable->x;
- sy += src->pDrawable->y;
- if (get_drawable_deltas(src->pDrawable, src_pixmap, &tx, &ty))
- sx += tx, sy += ty;
-
- assert(region->extents.x1 + sx >= 0);
- assert(region->extents.x2 + sx <= src_pixmap->drawable.width);
- assert(region->extents.y1 + sy >= 0);
- assert(region->extents.y2 + sy <= src_pixmap->drawable.height);
-
- if (get_drawable_deltas(dst->pDrawable, dst_pixmap, &tx, &ty))
- dst_x += tx, dst_y += ty;
-
- assert(nbox);
- do {
- assert(box->x1 + sx >= 0);
- assert(box->x2 + sx <= src_pixmap->drawable.width);
- assert(box->y1 + sy >= 0);
- assert(box->y2 + sy <= src_pixmap->drawable.height);
-
- assert(box->x1 + dst_x >= 0);
- assert(box->x2 + dst_x <= dst_pixmap->drawable.width);
- assert(box->y1 + dst_y >= 0);
- assert(box->y2 + dst_y <= dst_pixmap->drawable.height);
-
- assert(box->x2 > box->x1 && box->y2 > box->y1);
-
- memcpy_blt(src_pixmap->devPrivate.ptr,
- dst_pixmap->devPrivate.ptr,
- dst_pixmap->drawable.bitsPerPixel,
- src_pixmap->devKind,
- dst_pixmap->devKind,
- box->x1 + sx, box->y1 + sy,
- box->x1 + dst_x, box->y1 + dst_y,
- box->x2 - box->x1, box->y2 - box->y1);
- box++;
- } while (--nbox);
+ if (mask) {
+ if (mask->pDrawable) {
+ DBG(("%s: fallback -- move mask to cpu\n", __FUNCTION__));
+ if (!sna_drawable_move_to_cpu(mask->pDrawable,
+ MOVE_READ))
+ return;
+
+ if (mask->alphaMap &&
+ !sna_drawable_move_to_cpu(mask->alphaMap->pDrawable,
+ MOVE_READ))
+ return;
+ }
- return;
+ validate_source(mask);
+ } else {
+ if (src->pDrawable &&
+ dst->pDrawable->bitsPerPixel >= 8 &&
+ src->filter != PictFilterConvolution &&
+ (op == PictOpSrc || (op == PictOpOver && !PICT_FORMAT_A(src->format))) &&
+ (dst->format == src->format || dst->format == alphaless(src->format)) &&
+ sna_transform_is_integer_translation(src->transform, &tx, &ty)) {
+ PixmapPtr dst_pixmap = get_drawable_pixmap(dst->pDrawable);
+ PixmapPtr src_pixmap = get_drawable_pixmap(src->pDrawable);
+ int16_t sx = src_x + tx - (dst->pDrawable->x + dst_x);
+ int16_t sy = src_y + ty - (dst->pDrawable->y + dst_y);
+
+ assert(src->pDrawable->bitsPerPixel == dst->pDrawable->bitsPerPixel);
+ assert(src_pixmap->drawable.bitsPerPixel == dst_pixmap->drawable.bitsPerPixel);
+
+ if (region->extents.x1 + sx >= 0 &&
+ region->extents.y1 + sy >= 0 &&
+ region->extents.x2 + sx <= src->pDrawable->width &&
+ region->extents.y2 + sy <= src->pDrawable->height) {
+ BoxPtr box = RegionRects(region);
+ int nbox = RegionNumRects(region);
+
+ sx += src->pDrawable->x;
+ sy += src->pDrawable->y;
+ if (get_drawable_deltas(src->pDrawable, src_pixmap, &tx, &ty))
+ sx += tx, sy += ty;
+
+ assert(region->extents.x1 + sx >= 0);
+ assert(region->extents.x2 + sx <= src_pixmap->drawable.width);
+ assert(region->extents.y1 + sy >= 0);
+ assert(region->extents.y2 + sy <= src_pixmap->drawable.height);
+
+ get_drawable_deltas(dst->pDrawable, dst_pixmap, &tx, &ty);
+
+ assert(nbox);
+ do {
+ assert(box->x1 + sx >= 0);
+ assert(box->x2 + sx <= src_pixmap->drawable.width);
+ assert(box->y1 + sy >= 0);
+ assert(box->y2 + sy <= src_pixmap->drawable.height);
+
+ assert(box->x1 + dst_x >= 0);
+ assert(box->x2 + dst_x <= dst_pixmap->drawable.width);
+ assert(box->y1 + dst_y >= 0);
+ assert(box->y2 + dst_y <= dst_pixmap->drawable.height);
+
+ assert(box->x2 > box->x1 && box->y2 > box->y1);
+
+ memcpy_blt(src_pixmap->devPrivate.ptr,
+ dst_pixmap->devPrivate.ptr,
+ dst_pixmap->drawable.bitsPerPixel,
+ src_pixmap->devKind,
+ dst_pixmap->devKind,
+ box->x1 + sx, box->y1 + sy,
+ box->x1 + tx, box->y1 + ty,
+ box->x2 - box->x1, box->y2 - box->y1);
+ box++;
+ } while (--nbox);
+
+ return;
+ }
}
}
commit 8d48a43ed956ff21d779aff1a11a0f7bf6b65bcb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Aug 11 11:49:04 2013 +0100
sna/gen7: Refine ring selection
Don't force us to select BLT too early if we allow ring switching. As
the RENDER ring benefits from more cacheing over time (e.g. HSW:GT3e) it
becomes much more preferable to use it over the BLT. Since we already
have the logic to decide if ring switching is possible/preferred, relax
the initial checks on where the current activity is to allow switching
between batches.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index f056632..5888a04 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2375,7 +2375,7 @@ reuse_source(struct sna *sna,
static bool
prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp)
{
- if (sna->kgem.ring == KGEM_BLT)
+ if (sna->kgem.mode == KGEM_BLT)
return true;
if (untiled_tlb_miss(tmp->dst.bo) ||
@@ -2403,8 +2403,8 @@ gen7_render_composite(struct sna *sna,
if (op >= ARRAY_SIZE(gen7_blend_op))
return false;
- DBG(("%s: %dx%d, current mode=%d\n", __FUNCTION__,
- width, height, sna->kgem.ring));
+ DBG(("%s: %dx%d, current mode=%d/%d\n", __FUNCTION__,
+ width, height, sna->kgem.mode, sna->kgem.ring));
if (mask == NULL &&
try_blt(sna, dst, src, width, height) &&
@@ -2691,8 +2691,8 @@ gen7_render_composite_spans(struct sna *sna,
unsigned flags,
struct sna_composite_spans_op *tmp)
{
- DBG(("%s: %dx%d with flags=%x, current mode=%d\n", __FUNCTION__,
- width, height, flags, sna->kgem.ring));
+ DBG(("%s: %dx%d with flags=%x, current mode=%d/%d\n", __FUNCTION__,
+ width, height, flags, sna->kgem.mode, sna->kgem.ring));
assert(gen7_check_composite_spans(sna, op, src, dst, width, height, flags));
@@ -2807,7 +2807,7 @@ static inline bool prefer_blt_copy(struct sna *sna,
struct kgem_bo *dst_bo,
unsigned flags)
{
- if (sna->kgem.ring == KGEM_BLT)
+ if (sna->kgem.mode == KGEM_BLT)
return true;
assert((flags & COPY_SYNC) == 0);
@@ -3630,7 +3630,7 @@ gen7_render_clear(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo)
dst->drawable.height));
/* Prefer to use the BLT if already engaged */
- if (sna->kgem.ring == KGEM_BLT &&
+ if (sna->kgem.mode == KGEM_BLT &&
gen7_render_clear_try_blt(sna, dst, bo))
return true;
More information about the xorg-commit
mailing list