sna/gen6+: Discourage use of the BLT with Y-tiling

Somewhere, somehow the first glyph character upload into the Y-tiled
glyph cache is corrupt since

commit 75d8776247
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Apr 17 10:29:28 2015 +0100

    sna: Enable blitting with Y-tiled surfaces

I have not spotted whether it is a missing magic bit or a bad GTT path,
but ideally we don't want to switch to BLT along that path anyway (since
we are in the middle of rendering with the other engine).

Reported-by: Andy Furniss <adf.lists@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=90138
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-04-22 14:08:17 +01:00
parent 83b8528773
commit 4fdd3a714d
6 changed files with 144 additions and 67 deletions

View File

@ -52,6 +52,9 @@ inline static bool can_switch_to_blt(struct sna *sna,
if (bo && RQ_IS_BLT(bo->rq))
return true;
if (bo && bo->tiling == I915_TILING_Y)
return false;
if (sna->render_state.gt < 2)
return true;

View File

@ -1965,54 +1965,77 @@ gen6_composite_set_target(struct sna *sna,
static bool
try_blt(struct sna *sna,
PicturePtr dst, PicturePtr src,
int width, int height)
uint8_t op,
PicturePtr src,
PicturePtr mask,
PicturePtr dst,
int16_t src_x, int16_t src_y,
int16_t msk_x, int16_t msk_y,
int16_t dst_x, int16_t dst_y,
int16_t width, int16_t height,
unsigned flags,
struct sna_composite_op *tmp)
{
struct kgem_bo *bo;
if (sna->kgem.mode == KGEM_BLT) {
DBG(("%s: already performing BLT\n", __FUNCTION__));
return true;
goto execute;
}
if (too_large(width, height)) {
DBG(("%s: operation too large for 3D pipe (%d, %d)\n",
__FUNCTION__, width, height));
return true;
goto execute;
}
bo = __sna_drawable_peek_bo(dst->pDrawable);
if (bo == NULL)
return true;
goto execute;
if (untiled_tlb_miss(bo))
return true;
goto execute;
if (bo->rq)
return RQ_IS_BLT(bo->rq);
if (bo->rq) {
if (RQ_IS_BLT(bo->rq))
goto execute;
return false;
}
if (bo->tiling == I915_TILING_Y)
goto upload;
if (src->pDrawable == dst->pDrawable &&
can_switch_to_blt(sna, bo, 0))
return true;
goto execute;
if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, bo, 0))
return true;
goto execute;
if (src->pDrawable) {
struct kgem_bo *s = __sna_drawable_peek_bo(src->pDrawable);
if (s == NULL)
return true;
goto execute;
if (prefer_blt_bo(sna, s, bo))
return true;
goto execute;
}
if (sna->kgem.ring == KGEM_BLT) {
DBG(("%s: already performing BLT\n", __FUNCTION__));
return true;
goto execute;
}
return false;
upload:
flags |= COMPOSITE_UPLOAD;
execute:
return sna_blt_composite(sna, op,
src, dst,
src_x, src_y,
dst_x, dst_y,
width, height,
flags, tmp);
}
static bool
@ -2242,13 +2265,13 @@ gen6_render_composite(struct sna *sna,
width, height, sna->kgem.ring));
if (mask == NULL &&
try_blt(sna, dst, src, width, height) &&
sna_blt_composite(sna, op,
src, dst,
src_x, src_y,
dst_x, dst_y,
width, height,
flags, tmp))
try_blt(sna, op,
src, mask, dst,
src_x, src_y,
msk_x, msk_y,
dst_x, dst_y,
width, height,
flags, tmp))
return true;
if (gen6_composite_fallback(sna, src, mask, dst))

View File

@ -2184,55 +2184,78 @@ gen7_composite_set_target(struct sna *sna,
static bool
try_blt(struct sna *sna,
PicturePtr dst, PicturePtr src,
int width, int height)
uint8_t op,
PicturePtr src,
PicturePtr mask,
PicturePtr dst,
int16_t src_x, int16_t src_y,
int16_t msk_x, int16_t msk_y,
int16_t dst_x, int16_t dst_y,
int16_t width, int16_t height,
unsigned flags,
struct sna_composite_op *tmp)
{
struct kgem_bo *bo;
if (sna->kgem.mode == KGEM_BLT) {
DBG(("%s: already performing BLT\n", __FUNCTION__));
return true;
goto execute;
}
if (too_large(width, height)) {
DBG(("%s: operation too large for 3D pipe (%d, %d)\n",
__FUNCTION__, width, height));
return true;
goto execute;
}
bo = __sna_drawable_peek_bo(dst->pDrawable);
if (bo == NULL)
return true;
goto execute;
if (untiled_tlb_miss(bo))
return true;
goto execute;
if (bo->rq)
return RQ_IS_BLT(bo->rq);
if (bo->rq) {
if (RQ_IS_BLT(bo->rq))
goto execute;
return false;
}
if (bo->tiling == I915_TILING_Y)
goto upload;
if (src->pDrawable == dst->pDrawable &&
(sna->render_state.gt < 3 || width*height < 1024) &&
can_switch_to_blt(sna, bo, 0))
return true;
goto execute;
if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, bo, 0))
return true;
goto execute;
if (src->pDrawable) {
struct kgem_bo *s = __sna_drawable_peek_bo(src->pDrawable);
if (s == NULL)
return true;
goto upload;
if (prefer_blt_bo(sna, s, bo))
return true;
goto execute;
}
if (sna->kgem.ring == KGEM_BLT) {
DBG(("%s: already performing BLT\n", __FUNCTION__));
return true;
goto execute;
}
return false;
upload:
flags |= COMPOSITE_UPLOAD;
execute:
return sna_blt_composite(sna, op,
src, dst,
src_x, src_y,
dst_x, dst_y,
width, height,
flags, tmp);
}
static bool
@ -2462,13 +2485,13 @@ gen7_render_composite(struct sna *sna,
width, height, sna->kgem.mode, sna->kgem.ring));
if (mask == NULL &&
try_blt(sna, dst, src, width, height) &&
sna_blt_composite(sna, op,
src, dst,
src_x, src_y,
dst_x, dst_y,
width, height,
flags, tmp))
try_blt(sna, op,
src, mask, dst,
src_x, src_y,
msk_x, msk_y,
dst_x, dst_y,
width, height,
flags, tmp))
return true;
if (gen7_composite_fallback(sna, src, mask, dst))

View File

@ -2029,55 +2029,78 @@ gen8_composite_set_target(struct sna *sna,
static bool
try_blt(struct sna *sna,
PicturePtr dst, PicturePtr src,
int width, int height)
uint8_t op,
PicturePtr src,
PicturePtr mask,
PicturePtr dst,
int16_t src_x, int16_t src_y,
int16_t msk_x, int16_t msk_y,
int16_t dst_x, int16_t dst_y,
int16_t width, int16_t height,
unsigned flags,
struct sna_composite_op *tmp)
{
struct kgem_bo *bo;
if (sna->kgem.mode == KGEM_BLT) {
DBG(("%s: already performing BLT\n", __FUNCTION__));
return true;
goto execute;
}
if (too_large(width, height)) {
DBG(("%s: operation too large for 3D pipe (%d, %d)\n",
__FUNCTION__, width, height));
return true;
goto execute;
}
bo = __sna_drawable_peek_bo(dst->pDrawable);
if (bo == NULL)
return true;
goto execute;
if (untiled_tlb_miss(bo))
return true;
goto execute;
if (bo->rq)
return RQ_IS_BLT(bo->rq);
if (bo->rq) {
if (RQ_IS_BLT(bo->rq))
goto execute;
return false;
}
if (bo->tiling == I915_TILING_Y)
goto upload;
if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, bo, 0))
return true;
goto execute;
if (src->pDrawable == dst->pDrawable &&
(sna->render_state.gt < 3 || width*height < 1024) &&
can_switch_to_blt(sna, bo, 0))
return true;
goto execute;
if (src->pDrawable) {
struct kgem_bo *s = __sna_drawable_peek_bo(src->pDrawable);
if (s == NULL)
return true;
goto upload;
if (prefer_blt_bo(sna, s, bo))
return true;
goto execute;
}
if (sna->kgem.ring == KGEM_BLT) {
DBG(("%s: already performing BLT\n", __FUNCTION__));
return true;
goto execute;
}
return false;
upload:
flags |= COMPOSITE_UPLOAD;
execute:
return sna_blt_composite(sna, op,
src, dst,
src_x, src_y,
dst_x, dst_y,
width, height,
flags, tmp);
}
static bool
@ -2307,13 +2330,13 @@ gen8_render_composite(struct sna *sna,
width, height, sna->kgem.mode, sna->kgem.ring));
if (mask == NULL &&
try_blt(sna, dst, src, width, height) &&
sna_blt_composite(sna, op,
src, dst,
src_x, src_y,
dst_x, dst_y,
width, height,
flags, tmp))
try_blt(sna, op,
src, mask, dst,
src_x, src_y,
msk_x, msk_y,
dst_x, dst_y,
width, height,
flags, tmp))
return true;
if (gen8_composite_fallback(sna, src, mask, dst))

View File

@ -2606,6 +2606,8 @@ clear:
}
if (hint & REPLACES)
kgem_bo_undo(&sna->kgem, tmp->dst.bo);
if (flags & COMPOSITE_UPLOAD)
return false;
} else {
RegionRec region;
@ -2692,6 +2694,8 @@ fill:
}
if (hint & REPLACES)
kgem_bo_undo(&sna->kgem, tmp->dst.bo);
if (flags & COMPOSITE_UPLOAD)
return false;
} else {
RegionRec region;
@ -2830,7 +2834,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 &&
(flags & COMPOSITE_FALLBACK) == 0)
(flags & (COMPOSITE_UPLOAD | COMPOSITE_FALLBACK)) == 0)
{
return false;
}
@ -2881,7 +2885,7 @@ fallback:
DBG(("%s: fallback -- unaccelerated upload\n",
__FUNCTION__));
goto fallback;
} else {
} else if ((flags & COMPOSITE_UPLOAD) == 0) {
ret = prepare_blt_copy(sna, tmp, bo, alpha_fixup);
if (!ret)
goto fallback;

View File

@ -238,8 +238,9 @@ struct sna_render {
int16_t w, int16_t h,
unsigned flags,
struct sna_composite_op *tmp);
#define COMPOSITE_PARTIAL 0x1
#define COMPOSITE_FALLBACK 0x80000000
#define COMPOSITE_PARTIAL 0x1
#define COMPOSITE_UPLOAD 0x40000000
#define COMPOSITE_FALLBACK 0x80000000
bool (*check_composite_spans)(struct sna *sna, uint8_t op,
PicturePtr dst, PicturePtr src,