summaryrefslogtreecommitdiff
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
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>
-rw-r--r--src/sna/sna.h1
-rw-r--r--src/sna/sna_accel.c1
-rw-r--r--src/sna/sna_render_inline.h13
3 files changed, 14 insertions, 1 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 76e32997..6f726981 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -145,6 +145,7 @@ struct sna_pixmap {
uint8_t pinned :1;
uint8_t mapped :1;
uint8_t flush :1;
+ uint8_t gpu :1;
uint8_t header :1;
};
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 2d6d1ee4..0c7ab575 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -690,6 +690,7 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
}
priv->stride = pad;
+ priv->gpu = true;
}
return pixmap;
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