diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-18 01:41:03 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-18 01:47:27 +0000 |
commit | de530f89a36a80b652ed01001e6f0d4c8b1dc11a (patch) | |
tree | 47af0462e56795edc3d5baebc0e42251dcafe812 | |
parent | 7b88f87945f23b3f80ae44b2aa19f00dff1904c8 (diff) |
sna/gen5+: First try a blt composite if the source/dest are too large
If we will need to extract either the source or the destination, we
should see if we can do the entire operation on the BLT.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/gen5_render.c | 16 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 21 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 21 |
3 files changed, 51 insertions, 7 deletions
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 89b7bef0..42703c53 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -1899,11 +1899,17 @@ picture_is_cpu(PicturePtr picture) picture->repeat) return FALSE; + if (picture->pDrawable->width > 8192 || + picture->pDrawable->height > 8192) + return TRUE; + return is_cpu(picture->pDrawable); } static Bool -try_blt(struct sna *sna, PicturePtr source, int width, int height) +try_blt(struct sna *sna, + PicturePtr dst, PicturePtr src, + int width, int height) { if (sna->kgem.mode == KGEM_BLT) { DBG(("%s: already performing BLT\n", __FUNCTION__)); @@ -1916,8 +1922,12 @@ try_blt(struct sna *sna, PicturePtr source, int width, int height) return TRUE; } + if (dst->pDrawable->width > 8192 || + dst->pDrawable->height > 8192) + return TRUE; + /* is the source picture only in cpu memory e.g. a shm pixmap? */ - return picture_is_cpu(source); + return picture_is_cpu(src); } static bool @@ -2044,7 +2054,7 @@ gen5_render_composite(struct sna *sna, } if (mask == NULL && - try_blt(sna, src, width, height) && + try_blt(sna, dst, src, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 4ec0bd6f..aeb9dfeb 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -2077,7 +2077,9 @@ gen6_composite_set_target(struct sna *sna, } static Bool -try_blt(struct sna *sna, int width, int height) +try_blt(struct sna *sna, + PicturePtr dst, PicturePtr src, + int width, int height) { if (sna->kgem.ring == KGEM_BLT) { DBG(("%s: already performing BLT\n", __FUNCTION__)); @@ -2090,6 +2092,21 @@ try_blt(struct sna *sna, int width, int height) return TRUE; } + if (too_large(dst->pDrawable->width, dst->pDrawable->height)) { + DBG(("%s: dst too large for 3D pipe (%d, %d)\n", + __FUNCTION__, + dst->pDrawable->width, dst->pDrawable->height)); + return TRUE; + } + + if (src->pDrawable && + too_large(src->pDrawable->width, src->pDrawable->height)) { + DBG(("%s: src too large for 3D pipe (%d, %d)\n", + __FUNCTION__, + src->pDrawable->width, src->pDrawable->height)); + return TRUE; + } + return FALSE; } @@ -2226,7 +2243,7 @@ gen6_render_composite(struct sna *sna, width, height, sna->kgem.ring)); if (mask == NULL && - try_blt(sna, width, height) && + try_blt(sna, dst, src, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 121f137c..178b37ad 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -2190,7 +2190,9 @@ gen7_composite_set_target(struct sna_composite_op *op, PicturePtr dst) } static Bool -try_blt(struct sna *sna, int width, int height) +try_blt(struct sna *sna, + PicturePtr dst, PicturePtr src, + int width, int height) { if (sna->kgem.ring == KGEM_BLT) { DBG(("%s: already performing BLT\n", __FUNCTION__)); @@ -2203,6 +2205,21 @@ try_blt(struct sna *sna, int width, int height) return TRUE; } + if (too_large(dst->pDrawable->width, dst->pDrawable->height)) { + DBG(("%s: dst too large for 3D pipe (%d, %d)\n", + __FUNCTION__, + dst->pDrawable->width, dst->pDrawable->height)); + return TRUE; + } + + if (src->pDrawable && + too_large(src->pDrawable->width, src->pDrawable->height)) { + DBG(("%s: src too large for 3D pipe (%d, %d)\n", + __FUNCTION__, + src->pDrawable->width, src->pDrawable->height)); + return TRUE; + } + return FALSE; } @@ -2339,7 +2356,7 @@ gen7_render_composite(struct sna *sna, width, height, sna->kgem.ring)); if (mask == NULL && - try_blt(sna, width, height) && + try_blt(sna, dst, src, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, |