sna/gen[23]: Try BLT if the source/target do no fit in the 3D pipeline

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-12-18 10:23:11 +00:00
parent eeb9741981
commit 90a432431c
2 changed files with 38 additions and 12 deletions

View File

@ -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,

View File

@ -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,