summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-28 15:26:14 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-28 21:38:11 +0000
commit78425a15597079c0549de0fa1bbbdbebcf9eaf28 (patch)
tree5c035d6162103f0925eb96727dd8e5cdcdbbf5a8
parent9105b7e03ab7e3602c7200ebdc44e89f873afe1f (diff)
sna: Refactor common code for testing gpu busyness of a pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render_inline.h26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h
index 58eced01..06d1ba35 100644
--- a/src/sna/sna_render_inline.h
+++ b/src/sna/sna_render_inline.h
@@ -70,14 +70,14 @@ static inline Bool
is_gpu(DrawablePtr drawable)
{
struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable);
- return priv && priv->gpu_damage;
-}
-static inline Bool
-is_busy_cpu(DrawablePtr drawable)
-{
- struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable);
- return priv && priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo);
+ if (priv == NULL)
+ return false;
+
+ if (priv->gpu_damage)
+ return true;
+
+ return priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo);
}
static inline Bool
@@ -88,17 +88,9 @@ is_cpu(DrawablePtr drawable)
}
static inline Bool
-is_dirty_gpu(DrawablePtr drawable)
-{
- struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable);
- return priv && priv->gpu_bo && priv->gpu_damage;
-}
-
-static inline Bool
too_small(DrawablePtr drawable)
{
- return ((uint32_t)drawable->width * drawable->height * drawable->bitsPerPixel <= 8*4096) &&
- !(is_dirty_gpu(drawable) || is_busy_cpu(drawable));
+ return ((uint32_t)drawable->width * drawable->height * drawable->bitsPerPixel <= 8*4096) && !is_gpu(drawable);
}
static inline Bool
@@ -106,7 +98,7 @@ picture_is_gpu(PicturePtr picture)
{
if (!picture || !picture->pDrawable)
return FALSE;
- return is_gpu(picture->pDrawable) || is_busy_cpu(picture->pDrawable);
+ return is_gpu(picture->pDrawable);
}
static inline Bool sna_blt_compare_depth(DrawablePtr src, DrawablePtr dst)