diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index 9f8e6db9..c8d093b2 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -1238,7 +1238,8 @@ gen2_composite_set_target(struct sna *sna, static Bool try_blt(struct sna *sna, - PicturePtr source, + PicturePtr dst, + PicturePtr src, int width, int height) { uint32_t color; @@ -1254,14 +1255,27 @@ try_blt(struct sna *sna, return TRUE; } + if (too_large(dst->pDrawable->width, dst->pDrawable->height)) { + DBG(("%s: target too large for 3D pipe (%d, %d)\n", + __FUNCTION__, + dst->pDrawable->width, dst->pDrawable->height)); + return TRUE; + } + /* If it is a solid, try to use the BLT paths */ - if (sna_picture_is_solid(source, &color)) + if (sna_picture_is_solid(src, &color)) return TRUE; - if (!source->pDrawable) + if (!src->pDrawable) return FALSE; - return is_cpu(source->pDrawable); + if (too_large(src->pDrawable->width, src->pDrawable->height)) { + DBG(("%s: source too large for 3D pipe (%d, %d)\n", + __FUNCTION__, + src->pDrawable->width, src->pDrawable->height)); + return TRUE; + } + return is_cpu(src->pDrawable); } static bool @@ -1402,7 +1416,7 @@ gen2_render_composite(struct sna *sna, * 3D -> 2D context switch. */ 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/gen3_render.c b/src/sna/gen3_render.c index cd0044aa..96c0d9b1 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -2137,7 +2137,7 @@ gen3_composite_picture(struct sna *sna, } static inline Bool -picture_is_cpu(PicturePtr picture) +source_use_blt(struct sna *sna, PicturePtr picture) { if (!picture->pDrawable) return FALSE; @@ -2148,12 +2148,21 @@ picture_is_cpu(PicturePtr picture) picture->repeat) return FALSE; + if (too_large(picture->pDrawable->width, + picture->pDrawable->height)) + return TRUE; + + /* If we can sample directly from user-space, do so */ + if (sna->kgem.has_vmap) + return FALSE; + return is_cpu(picture->pDrawable); } static Bool try_blt(struct sna *sna, - PicturePtr source, + PicturePtr dst, + PicturePtr src, int width, int height) { if (sna->kgem.mode != KGEM_RENDER) { @@ -2167,12 +2176,15 @@ try_blt(struct sna *sna, return TRUE; } - /* If we can sample directly from user-space, do so */ - if (sna->kgem.has_vmap) - return FALSE; + if (too_large(dst->pDrawable->width, dst->pDrawable->height)) { + DBG(("%s: target too large for 3D pipe (%d, %d)\n", + __FUNCTION__, + dst->pDrawable->width, dst->pDrawable->height)); + return TRUE; + } /* is the source picture only in cpu memory e.g. a shm pixmap? */ - return picture_is_cpu(source); + return source_use_blt(sna, src); } static void @@ -2397,7 +2409,7 @@ gen3_render_composite(struct sna *sna, * 3D -> 2D context switch. */ 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,