sna/gen2+: Consider precision in render operation placement

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66297
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-06-28 10:59:23 +01:00
parent 541f816815
commit e979d32bb7
6 changed files with 64 additions and 33 deletions

View File

@ -1632,7 +1632,7 @@ gen2_composite_set_target(struct sna *sna,
}
static bool
is_unhandled_gradient(PicturePtr picture)
is_unhandled_gradient(PicturePtr picture, bool precise)
{
if (picture->pDrawable)
return false;
@ -1642,7 +1642,7 @@ is_unhandled_gradient(PicturePtr picture)
case SourcePictTypeLinear:
return false;
default:
return true;
return precise;
}
}
@ -1678,12 +1678,12 @@ source_is_busy(PixmapPtr pixmap)
}
static bool
source_fallback(PicturePtr p, PixmapPtr pixmap)
source_fallback(PicturePtr p, PixmapPtr pixmap, bool precise)
{
if (sna_picture_is_solid(p, NULL))
return false;
if (is_unhandled_gradient(p) || !gen2_check_repeat(p))
if (is_unhandled_gradient(p, precise) || !gen2_check_repeat(p))
return true;
if (pixmap && source_is_busy(pixmap))
@ -1712,11 +1712,13 @@ gen2_composite_fallback(struct sna *sna,
dst_pixmap = get_drawable_pixmap(dst->pDrawable);
src_pixmap = src->pDrawable ? get_drawable_pixmap(src->pDrawable) : NULL;
src_fallback = source_fallback(src, src_pixmap);
src_fallback = source_fallback(src, src_pixmap,
dst->polyMode == PolyModePrecise);
if (mask) {
mask_pixmap = mask->pDrawable ? get_drawable_pixmap(mask->pDrawable) : NULL;
mask_fallback = source_fallback(mask, mask_pixmap);
mask_fallback = source_fallback(mask, mask_pixmap,
dst->polyMode == PolyModePrecise);
} else {
mask_pixmap = NULL;
mask_fallback = NULL;

View File

@ -3307,11 +3307,30 @@ source_is_busy(PixmapPtr pixmap)
}
static bool
source_fallback(PicturePtr p, PixmapPtr pixmap)
is_unhandled_gradient(PicturePtr picture, bool precise)
{
if (picture->pDrawable)
return false;
switch (picture->pSourcePict->type) {
case SourcePictTypeSolidFill:
case SourcePictTypeLinear:
case SourcePictTypeRadial:
return false;
default:
return precise;
}
}
static bool
source_fallback(PicturePtr p, PixmapPtr pixmap, bool precise)
{
if (sna_picture_is_solid(p, NULL))
return false;
if (is_unhandled_gradient(p, precise))
return true;
if (!gen3_check_xformat(p) || !gen3_check_repeat(p))
return true;
@ -3342,11 +3361,13 @@ gen3_composite_fallback(struct sna *sna,
dst_pixmap = get_drawable_pixmap(dst->pDrawable);
src_pixmap = src->pDrawable ? get_drawable_pixmap(src->pDrawable) : NULL;
src_fallback = source_fallback(src, src_pixmap);
src_fallback = source_fallback(src, src_pixmap,
dst->polyMode == PolyModePrecise);
if (mask) {
mask_pixmap = mask->pDrawable ? get_drawable_pixmap(mask->pDrawable) : NULL;
mask_fallback = source_fallback(mask, mask_pixmap);
mask_fallback = source_fallback(mask, mask_pixmap,
dst->polyMode == PolyModePrecise);
} else {
mask_pixmap = NULL;
mask_fallback = false;

View File

@ -1635,14 +1635,14 @@ try_blt(struct sna *sna,
}
static bool
check_gradient(PicturePtr picture)
check_gradient(PicturePtr picture, bool precise)
{
switch (picture->pSourcePict->type) {
case SourcePictTypeSolidFill:
case SourcePictTypeLinear:
return false;
default:
return true;
return precise;
}
}
@ -1679,13 +1679,13 @@ source_is_busy(PixmapPtr pixmap)
}
static bool
source_fallback(struct sna *sna, PicturePtr p, PixmapPtr pixmap)
source_fallback(struct sna *sna, PicturePtr p, PixmapPtr pixmap, bool precise)
{
if (sna_picture_is_solid(p, NULL))
return false;
if (p->pSourcePict)
return check_gradient(p);
return check_gradient(p, precise);
if (!gen4_check_repeat(p) || !gen4_check_format(p->format))
return true;
@ -1717,11 +1717,13 @@ gen4_composite_fallback(struct sna *sna,
dst_pixmap = get_drawable_pixmap(dst->pDrawable);
src_pixmap = src->pDrawable ? get_drawable_pixmap(src->pDrawable) : NULL;
src_fallback = source_fallback(sna, src, src_pixmap);
src_fallback = source_fallback(sna, src, src_pixmap,
dst->polyMode == PolyModePrecise);
if (mask) {
mask_pixmap = mask->pDrawable ? get_drawable_pixmap(mask->pDrawable) : NULL;
mask_fallback = source_fallback(sna, mask, mask_pixmap);
mask_fallback = source_fallback(sna, mask, mask_pixmap,
dst->polyMode == PolyModePrecise);
} else {
mask_pixmap = NULL;
mask_fallback = false;

View File

@ -1611,7 +1611,7 @@ try_blt(struct sna *sna,
}
static bool
is_gradient(PicturePtr picture)
is_gradient(PicturePtr picture, bool precise)
{
if (picture->pDrawable)
return false;
@ -1621,7 +1621,7 @@ is_gradient(PicturePtr picture)
case SourcePictTypeLinear:
return false;
default:
return true;
return precise;
}
}
@ -1658,12 +1658,12 @@ source_is_busy(PixmapPtr pixmap)
}
static bool
source_fallback(struct sna *sna, PicturePtr p, PixmapPtr pixmap)
source_fallback(struct sna *sna, PicturePtr p, PixmapPtr pixmap, bool precise)
{
if (sna_picture_is_solid(p, NULL))
return false;
if (is_gradient(p) ||
if (is_gradient(p, precise) ||
!gen5_check_repeat(p) ||
!gen5_check_format(p->format))
return true;
@ -1694,11 +1694,13 @@ gen5_composite_fallback(struct sna *sna,
dst_pixmap = get_drawable_pixmap(dst->pDrawable);
src_pixmap = src->pDrawable ? get_drawable_pixmap(src->pDrawable) : NULL;
src_fallback = source_fallback(sna, src, src_pixmap);
src_fallback = source_fallback(sna, src, src_pixmap,
dst->polyMode == PolyModePrecise);
if (mask) {
mask_pixmap = mask->pDrawable ? get_drawable_pixmap(mask->pDrawable) : NULL;
mask_fallback = source_fallback(sna, mask, mask_pixmap);
mask_fallback = source_fallback(sna, mask, mask_pixmap,
dst->polyMode == PolyModePrecise);
} else {
mask_pixmap = NULL;
mask_fallback = false;

View File

@ -1931,7 +1931,7 @@ try_blt(struct sna *sna,
}
static bool
check_gradient(PicturePtr picture)
check_gradient(PicturePtr picture, bool precise)
{
if (picture->pDrawable)
return false;
@ -1941,7 +1941,7 @@ check_gradient(PicturePtr picture)
case SourcePictTypeLinear:
return false;
default:
return true;
return precise;
}
}
@ -1974,13 +1974,13 @@ source_is_busy(PixmapPtr pixmap)
}
static bool
source_fallback(PicturePtr p, PixmapPtr pixmap)
source_fallback(PicturePtr p, PixmapPtr pixmap, bool precise)
{
if (sna_picture_is_solid(p, NULL))
return false;
if (p->pSourcePict)
return check_gradient(p);
return check_gradient(p, precise);
if (!gen6_check_repeat(p) || !gen6_check_format(p->format))
return true;
@ -2011,11 +2011,13 @@ gen6_composite_fallback(struct sna *sna,
dst_pixmap = get_drawable_pixmap(dst->pDrawable);
src_pixmap = src->pDrawable ? get_drawable_pixmap(src->pDrawable) : NULL;
src_fallback = source_fallback(src, src_pixmap);
src_fallback = source_fallback(src, src_pixmap,
dst->polyMode == PolyModePrecise);
if (mask) {
mask_pixmap = mask->pDrawable ? get_drawable_pixmap(mask->pDrawable) : NULL;
mask_fallback = source_fallback(mask, mask_pixmap);
mask_fallback = source_fallback(mask, mask_pixmap,
dst->polyMode == PolyModePrecise);
} else {
mask_pixmap = NULL;
mask_fallback = false;

View File

@ -2138,7 +2138,7 @@ try_blt(struct sna *sna,
}
static bool
check_gradient(PicturePtr picture)
check_gradient(PicturePtr picture, bool precise)
{
if (picture->pDrawable)
return false;
@ -2148,7 +2148,7 @@ check_gradient(PicturePtr picture)
case SourcePictTypeLinear:
return false;
default:
return true;
return precise;
}
}
@ -2181,13 +2181,13 @@ source_is_busy(PixmapPtr pixmap)
}
static bool
source_fallback(PicturePtr p, PixmapPtr pixmap)
source_fallback(PicturePtr p, PixmapPtr pixmap, bool precise)
{
if (sna_picture_is_solid(p, NULL))
return false;
if (p->pSourcePict)
return check_gradient(p);
return check_gradient(p, precise);
if (!gen7_check_repeat(p) || !gen7_check_format(p->format))
return true;
@ -2218,11 +2218,13 @@ gen7_composite_fallback(struct sna *sna,
dst_pixmap = get_drawable_pixmap(dst->pDrawable);
src_pixmap = src->pDrawable ? get_drawable_pixmap(src->pDrawable) : NULL;
src_fallback = source_fallback(src, src_pixmap);
src_fallback = source_fallback(src, src_pixmap,
dst->polyMode == PolyModePrecise);
if (mask) {
mask_pixmap = mask->pDrawable ? get_drawable_pixmap(mask->pDrawable) : NULL;
mask_fallback = source_fallback(mask, mask_pixmap);
mask_fallback = source_fallback(mask, mask_pixmap,
dst->polyMode == PolyModePrecise);
} else {
mask_pixmap = NULL;
mask_fallback = false;