sna/gen6: Prefer the BLT ring, except for copies on behalf of DRI

As demonstrated by the all-important trap300, using the BLT is 2x faster
than the RENDER ring for the simple case of solid fills. (Though note
that performing the relocations costs 3x as much CPU for 2x GPU
performance.) One case that may regress from this change is copywinpix
which should benefit from the batching in the RENDER commands, and might
warrant revisiting in the future (with realistic and synthetic
benchmarks in hand!)

However, due to the forced stall when switching rings, we still want to
perform RENDER copies on behalf of DRI clients and before page-flips.

Checking against cairo-perf-trace indicated no major impact -- I had
worried that setting the BLT flag for some clears might have had a
knock-on effect causing too many operations that could be pipelined on
the RENDER ring to be sent to the BLT ring instead.

Reported-by: Michael Larabel <Michael@phoronix.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-08-31 23:21:54 +01:00
parent 5586dd729b
commit 32fc0c896e
2 changed files with 22 additions and 4 deletions

View File

@ -2307,7 +2307,8 @@ gen6_render_copy_boxes(struct sna *sna, uint8_t alu,
__FUNCTION__, src_dx, src_dy, dst_dx, dst_dy, n, alu,
src_bo == dst_bo));
if (sna->kgem.mode == KGEM_BLT &&
/* XXX benchmark me! */
if (sna->kgem.mode != KGEM_RENDER &&
sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
sna_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
@ -2464,7 +2465,8 @@ gen6_render_copy(struct sna *sna, uint8_t alu,
src->drawable.width, src->drawable.height,
dst->drawable.width, dst->drawable.height));
if (sna->kgem.mode == KGEM_BLT &&
/* XXX benchmark me! */
if (sna->kgem.mode != KGEM_RENDER &&
sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
sna_blt_copy(sna, alu,
src_bo, dst_bo,
@ -2577,7 +2579,7 @@ gen6_render_fill_boxes(struct sna *sna,
return FALSE;
}
if (sna->kgem.mode == KGEM_BLT ||
if (sna->kgem.mode != KGEM_RENDER ||
dst->drawable.width > 8192 ||
dst->drawable.height > 8192 ||
!gen6_check_dst_format(format)) {
@ -2734,7 +2736,7 @@ gen6_render_fill(struct sna *sna, uint8_t alu,
op);
#endif
if (sna->kgem.mode == KGEM_BLT &&
if (sna->kgem.mode != KGEM_RENDER &&
sna_blt_fill(sna, alu,
dst_bo, dst->drawable.bitsPerPixel,
color,

View File

@ -461,6 +461,22 @@ sna_dri_copy(struct sna *sna, DrawablePtr draw, RegionPtr region,
get_drawable_deltas(draw, dst, &dx, &dy);
}
if (sna->kgem.gen >= 60) {
/* Sandybridge introduced a separate ring which it uses to
* perform blits. Switching rendering between rings incurs
* a stall as we wait upon the old ring to finish and
* flush its render cache before we can proceed on with
* the operation on the new ring.
*
* As this buffer, we presume, has just been written to by
* the DRI client using the RENDER ring, we want to perform
* our operation on the same ring, and ideally on the same
* ring as we will flip from (which should be the RENDER ring
* as well).
*/
kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
if (region) {
boxes = REGION_RECTS(region);
n = REGION_NUM_RECTS(region);