diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-26 16:05:48 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-26 16:05:48 +0000 |
commit | adb1320bba15a3a3b4fa8e7d0fd0360fa696721d (patch) | |
tree | 81e4ff2dd49b158c7681f1ad34d1da89ce080860 | |
parent | b1f9415bf355e9fbd6fc3ce8fa1af59083ca2943 (diff) |
sna/gen2+: Include being unattached in the list of source fallbacks
If the source is not attached to a buffer (be it a GPU bo or a CPU bo),
a temporary upload buffer would be required and so it is not worth
forcing the target to the destination in that case (should the target
not be on the GPU already).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/gen2_render.c | 9 | ||||
-rw-r--r-- | src/sna/gen3_render.c | 12 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 13 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 9 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 13 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 13 | ||||
-rw-r--r-- | src/sna/sna_render_inline.h | 11 |
7 files changed, 74 insertions, 6 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index eb8d4efa..2a97cea7 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -1514,12 +1514,19 @@ has_alphamap(PicturePtr p) } static bool +need_upload(PicturePtr p) +{ + return p->pDrawable && unattached(p->pDrawable); +} + +static bool source_fallback(PicturePtr p) { return (has_alphamap(p) || is_unhandled_gradient(p) || !gen2_check_filter(p) || - !gen2_check_repeat(p)); + !gen2_check_repeat(p) || + need_upload(p)); } static bool diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index af83966d..931142d2 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -2426,9 +2426,19 @@ has_alphamap(PicturePtr p) } static bool +need_upload(PicturePtr p) +{ + return p->pDrawable && unattached(p->pDrawable); +} + +static bool source_fallback(PicturePtr p) { - return has_alphamap(p) || !gen3_check_xformat(p) || !gen3_check_filter(p) || !gen3_check_repeat(p); + return (has_alphamap(p) || + !gen3_check_xformat(p) || + !gen3_check_filter(p) || + !gen3_check_repeat(p) || + need_upload(p)); } static bool diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index c798ce50..91d5f49e 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -2015,9 +2015,20 @@ has_alphamap(PicturePtr p) } static bool +need_upload(PicturePtr p) +{ + return p->pDrawable && unattached(p->pDrawable); +} + +static bool source_fallback(PicturePtr p) { - return has_alphamap(p) || is_gradient(p) || !gen4_check_filter(p) || !gen4_check_repeat(p) || !gen4_check_format(p->format); + return (has_alphamap(p) || + is_gradient(p) || + !gen4_check_filter(p) || + !gen4_check_repeat(p) || + !gen4_check_format(p->format) || + need_upload(p)); } static bool diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 47c4e967..2c6d020b 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -2049,13 +2049,20 @@ has_alphamap(PicturePtr p) } static bool +need_upload(PicturePtr p) +{ + return p->pDrawable && unattached(p->pDrawable); +} + +static bool source_fallback(PicturePtr p) { return (has_alphamap(p) || is_gradient(p) || !gen5_check_filter(p) || !gen5_check_repeat(p) || - !gen5_check_format(p->format)); + !gen5_check_format(p->format) || + need_upload(p)); } static bool diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index c3bc2e77..d813d95a 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -2266,9 +2266,20 @@ has_alphamap(PicturePtr p) } static bool +need_upload(PicturePtr p) +{ + return p->pDrawable && unattached(p->pDrawable); +} + +static bool source_fallback(PicturePtr p) { - return has_alphamap(p) || is_gradient(p) || !gen6_check_filter(p) || !gen6_check_repeat(p) || !gen6_check_format(p->format); + return (has_alphamap(p) || + is_gradient(p) || + !gen6_check_filter(p) || + !gen6_check_repeat(p) || + !gen6_check_format(p->format) || + need_upload(p)); } static bool diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 21d8c99d..282b7249 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -2333,9 +2333,20 @@ has_alphamap(PicturePtr p) } static bool +need_upload(PicturePtr p) +{ + return p->pDrawable && unattached(p->pDrawable); +} + +static bool source_fallback(PicturePtr p) { - return has_alphamap(p) || is_gradient(p) || !gen7_check_filter(p) || !gen7_check_repeat(p) || !gen7_check_format(p->format); + return (has_alphamap(p) || + is_gradient(p) || + !gen7_check_filter(p) || + !gen7_check_repeat(p) || + !gen7_check_format(p->format) || + need_upload(p)); } static bool diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h index c9d2b5f0..489f2151 100644 --- a/src/sna/sna_render_inline.h +++ b/src/sna/sna_render_inline.h @@ -106,6 +106,17 @@ too_small(DrawablePtr drawable) } static inline Bool +unattached(DrawablePtr drawable) +{ + struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable); + + if (priv == NULL) + return true; + + return priv->gpu_bo == NULL && priv->cpu_bo == NULL; +} + +static inline Bool picture_is_gpu(PicturePtr picture) { if (!picture || !picture->pDrawable) |