summaryrefslogtreecommitdiff
path: root/src/sna/sna_render_inline.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-13 14:21:13 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-14 18:13:47 +0000
commitc81dba18e6a308d716a11b90da6e53ca7f5f8a02 (patch)
treec844cef11a4a62707be8f8cbde2984c39b2975da /src/sna/sna_render_inline.h
parent2bd942d55314426d7f429d7ccc0b62a622a79009 (diff)
sna: Hint whether we prefer to use the GPU for a pixmap
This includes the condition where the pixmap is too large, as well as being too small, to be allocatable on the GPU. It is only a hint set during creation, and may be overridden if required. This fixes the regression in ocitysmap which decided to render glyphs into a GPU mask for a destination that does not fit into the aperture. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_render_inline.h')
-rw-r--r--src/sna/sna_render_inline.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h
index ca8e8391..ee55db7d 100644
--- a/src/sna/sna_render_inline.h
+++ b/src/sna/sna_render_inline.h
@@ -90,7 +90,18 @@ is_cpu(DrawablePtr drawable)
static inline Bool
too_small(DrawablePtr drawable)
{
- return ((uint32_t)drawable->width * drawable->height * drawable->bitsPerPixel <= 8*4096) && !is_gpu(drawable);
+ struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable);
+
+ if (priv == NULL)
+ return true;
+
+ if (priv->gpu_damage)
+ return false;
+
+ if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo))
+ return false;
+
+ return !priv->gpu;
}
static inline Bool