summaryrefslogtreecommitdiff
path: root/src/sna/gen5_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-02-07 22:54:37 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-02-08 11:23:02 +0000
commitc69b4389abc324533a9a311c17a667bf8a1e1673 (patch)
treeed7897e81fdfff4cb7724baa6eb5d8465d00ac28 /src/sna/gen5_render.c
parentbec99de812ce6a1bbc2c8e4cfd05f4f74c560ea6 (diff)
sna/gen4: Split the have_render flag in separate prefer_gpu hints
The idea is to implement more fine-grained checks as we may want different heuristics for desktops with GT1s than for mobile GT2s, etc. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen5_render.c')
-rw-r--r--src/sna/gen5_render.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 35f70f83..6e119963 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1556,15 +1556,6 @@ gen5_composite_set_target(struct sna *sna,
return true;
}
-static inline bool
-picture_is_cpu(PicturePtr picture)
-{
- if (!picture->pDrawable)
- return false;
-
- return !is_gpu(picture->pDrawable);
-}
-
static bool
try_blt(struct sna *sna,
PicturePtr dst, PicturePtr src,
@@ -1589,7 +1580,7 @@ try_blt(struct sna *sna,
return true;
/* is the source picture only in cpu memory e.g. a shm pixmap? */
- return picture_is_cpu(src);
+ return picture_is_cpu(sna, src);
}
static bool
@@ -1614,9 +1605,10 @@ has_alphamap(PicturePtr p)
}
static bool
-need_upload(PicturePtr p)
+need_upload(struct sna *sna, PicturePtr p)
{
- return p->pDrawable && untransformed(p) && !is_gpu(p->pDrawable);
+ return p->pDrawable && untransformed(p) &&
+ !is_gpu(sna, p->pDrawable, PREFER_GPU_RENDER);
}
static bool
@@ -1639,7 +1631,7 @@ source_is_busy(PixmapPtr pixmap)
}
static bool
-source_fallback(PicturePtr p, PixmapPtr pixmap)
+source_fallback(struct sna *sna, PicturePtr p, PixmapPtr pixmap)
{
if (sna_picture_is_solid(p, NULL))
return false;
@@ -1652,7 +1644,7 @@ source_fallback(PicturePtr p, PixmapPtr pixmap)
if (pixmap && source_is_busy(pixmap))
return false;
- return has_alphamap(p) || !gen5_check_filter(p) || need_upload(p);
+ return has_alphamap(p) || !gen5_check_filter(p) || need_upload(sna, p);
}
static bool
@@ -1675,11 +1667,11 @@ gen5_composite_fallback(struct sna *sna,
dst_pixmap = get_drawable_pixmap(dst->pDrawable);
src_pixmap = src->pDrawable ? get_drawable_pixmap(src->pDrawable) : NULL;
- src_fallback = source_fallback(src, src_pixmap);
+ src_fallback = source_fallback(sna, src, src_pixmap);
if (mask) {
mask_pixmap = mask->pDrawable ? get_drawable_pixmap(mask->pDrawable) : NULL;
- mask_fallback = source_fallback(mask, mask_pixmap);
+ mask_fallback = source_fallback(sna, mask, mask_pixmap);
} else {
mask_pixmap = NULL;
mask_fallback = false;
@@ -2075,7 +2067,8 @@ gen5_check_composite_spans(struct sna *sna,
return false;
}
- if (need_tiling(sna, width, height) && !is_gpu(dst->pDrawable)) {
+ if (need_tiling(sna, width, height) &&
+ !is_gpu(sna, dst->pDrawable, PREFER_GPU_SPANS)) {
DBG(("%s: fallback, tiled operation not on GPU\n",
__FUNCTION__));
return false;
@@ -2088,13 +2081,14 @@ gen5_check_composite_spans(struct sna *sna,
if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo))
return true;
- if ((flags & COMPOSITE_SPANS_INPLACE_HINT) == 0 &&
- priv->gpu_bo && kgem_bo_is_busy(priv->gpu_bo))
- return true;
+ if (flags & COMPOSITE_SPANS_INPLACE_HINT)
+ return false;
- DBG(("%s: fallback, non-rectilinear spans to idle bo\n",
- __FUNCTION__));
- return false;
+ if ((sna->render.prefer_gpu & PREFER_GPU_SPANS) == 0 &&
+ dst->format == PICT_a8)
+ return false;
+
+ return priv->gpu_bo && kgem_bo_is_busy(priv->gpu_bo);
}
return true;
@@ -3272,10 +3266,13 @@ bool gen5_render_init(struct sna *sna)
#if !NO_COMPOSITE
sna->render.composite = gen5_render_composite;
+ sna->render.prefer_gpu |= PREFER_GPU_RENDER;
#endif
#if !NO_COMPOSITE_SPANS
sna->render.check_composite_spans = gen5_check_composite_spans;
sna->render.composite_spans = gen5_render_composite_spans;
+ if (DEVICE_ID(sna->PciInfo) == 0x0044)
+ sna->render.prefer_gpu |= PREFER_GPU_SPANS;
#endif
sna->render.video = gen5_render_video;