sna/gen2+: Use the reduced operator from CompositeRectangles

Do not attempt to further reduce the operator locally in each backend as
the reduction is already performed in the upper layer.

References: https://bugs.freedesktop.org/show_bug.cgi?id=42606
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-03-08 11:04:05 +00:00
parent 2ae3cd36ae
commit f6474883d3
6 changed files with 82 additions and 123 deletions

View File

@ -2348,30 +2348,24 @@ gen2_render_fill_boxes_try_blt(struct sna *sna,
PixmapPtr dst, struct kgem_bo *dst_bo,
const BoxRec *box, int n)
{
uint8_t alu = GXcopy;
uint8_t alu;
uint32_t pixel;
if (!sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))
if (op > PictOpSrc)
return FALSE;
if (op == PictOpClear) {
alu = GXclear;
pixel = 0;
op = PictOpSrc;
}
if (op == PictOpOver) {
if ((pixel & 0xff000000) == 0xff000000)
op = PictOpSrc;
}
if (op != PictOpSrc)
} else if (!sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))
return FALSE;
else
alu = GXcopy;
return sna_blt_fill_boxes(sna, alu,
dst_bo, dst->drawable.bitsPerPixel,

View File

@ -4153,7 +4153,7 @@ gen3_render_fill_boxes_try_blt(struct sna *sna,
PixmapPtr dst, struct kgem_bo *dst_bo,
const BoxRec *box, int n)
{
uint8_t alu = GXcopy;
uint8_t alu;
uint32_t pixel;
if (dst_bo->tiling == I915_TILING_Y) {
@ -4162,36 +4162,21 @@ gen3_render_fill_boxes_try_blt(struct sna *sna,
return FALSE;
}
if (color->alpha >= 0xff00) {
if (op == PictOpOver)
op = PictOpSrc;
else if (op == PictOpOutReverse)
op = PictOpClear;
else if (op == PictOpAdd &&
(color->red & color->green & color->blue) >= 0xff00)
op = PictOpSrc;
}
if (op > PictOpSrc)
return FALSE;
pixel = 0;
if (op == PictOpClear) {
alu = GXclear;
} else if (op == PictOpSrc) {
if (color->alpha <= 0x00ff)
alu = GXclear;
else if (!sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format)) {
DBG(("%s: unknown format %x\n", __FUNCTION__,
(uint32_t)format));
return FALSE;
}
} else {
DBG(("%s: unhandle op %d\n", __FUNCTION__, alu));
pixel = 0;
} else if (!sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))
return FALSE;
}
else
alu = GXcopy;
return sna_blt_fill_boxes(sna, alu,
dst_bo, dst->drawable.bitsPerPixel,

View File

@ -2901,29 +2901,24 @@ gen4_render_fill_boxes(struct sna *sna,
return FALSE;
}
if (prefer_blt(sna) ||
too_large(dst->drawable.width, dst->drawable.height) ||
!gen4_check_dst_format(format)) {
if (op <= PictOpSrc &&
(prefer_blt(sna) ||
too_large(dst->drawable.width, dst->drawable.height) ||
!gen4_check_dst_format(format))) {
uint8_t alu = -1;
if (op == PictOpClear || (op == PictOpOutReverse && color->alpha >= 0xff00))
alu = GXclear;
if (op == PictOpSrc || (op == PictOpOver && color->alpha >= 0xff00)) {
alu = GXcopy;
if (color->alpha <= 0x00ff)
alu = GXclear;
}
pixel = 0;
if ((alu == GXclear ||
(alu == GXcopy &&
sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))) &&
if (op == PictOpClear)
alu = GXclear;
else if (sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))
alu = GXcopy;
if (alu != -1 &&
sna_blt_fill_boxes(sna, alu,
dst_bo, dst->drawable.bitsPerPixel,
pixel, box, n))

View File

@ -3241,29 +3241,24 @@ gen5_render_fill_boxes(struct sna *sna,
return FALSE;
}
if (prefer_blt_fill(sna) ||
too_large(dst->drawable.width, dst->drawable.height) ||
!gen5_check_dst_format(format)) {
if (op <= PictOpSrc &&
(prefer_blt_fill(sna) ||
too_large(dst->drawable.width, dst->drawable.height) ||
!gen5_check_dst_format(format))) {
uint8_t alu = -1;
if (op == PictOpClear || (op == PictOpOutReverse && color->alpha >= 0xff00))
alu = GXclear;
if (op == PictOpSrc || (op == PictOpOver && color->alpha >= 0xff00)) {
alu = GXcopy;
if (color->alpha <= 0x00ff)
alu = GXclear;
}
pixel = 0;
if ((alu == GXclear ||
(alu == GXcopy &&
sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))) &&
if (op == PictOpClear)
alu = GXclear;
else if (sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))
alu = GXcopy;
if (alu != -1 &&
sna_blt_fill_boxes(sna, alu,
dst_bo, dst->drawable.bitsPerPixel,
pixel, box, n))

View File

@ -3655,29 +3655,24 @@ gen6_render_fill_boxes(struct sna *sna,
return FALSE;
}
if (prefer_blt_fill(sna, dst_bo) ||
too_large(dst->drawable.width, dst->drawable.height) ||
!gen6_check_dst_format(format)) {
if (op <= PictOpSrc &&
(prefer_blt_fill(sna, dst_bo) ||
too_large(dst->drawable.width, dst->drawable.height) ||
!gen6_check_dst_format(format))) {
uint8_t alu = -1;
if (op == PictOpClear || (op == PictOpOutReverse && color->alpha >= 0xff00))
alu = GXclear;
if (op == PictOpSrc || (op == PictOpOver && color->alpha >= 0xff00)) {
alu = GXcopy;
if (color->alpha <= 0x00ff)
alu = GXclear;
}
pixel = 0;
if ((alu == GXclear ||
(alu == GXcopy &&
sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))) &&
if (op == PictOpClear)
alu = GXclear;
else if (sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))
alu = GXcopy;
if (alu != -1 &&
sna_blt_fill_boxes(sna, alu,
dst_bo, dst->drawable.bitsPerPixel,
pixel, box, n))

View File

@ -3738,29 +3738,24 @@ gen7_render_fill_boxes(struct sna *sna,
return FALSE;
}
if (prefer_blt_fill(sna, dst_bo) ||
too_large(dst->drawable.width, dst->drawable.height) ||
!gen7_check_dst_format(format)) {
if (op <= PictOpSrc &&
(prefer_blt_fill(sna, dst_bo) ||
too_large(dst->drawable.width, dst->drawable.height) ||
!gen7_check_dst_format(format))) {
uint8_t alu = -1;
if (op == PictOpClear || (op == PictOpOutReverse && color->alpha >= 0xff00))
alu = GXclear;
if (op == PictOpSrc || (op == PictOpOver && color->alpha >= 0xff00)) {
alu = GXcopy;
if (color->alpha <= 0x00ff)
alu = GXclear;
}
pixel = 0;
if ((alu == GXclear ||
(alu == GXcopy &&
sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))) &&
if (op == PictOpClear)
alu = GXclear;
else if (sna_get_pixel_from_rgba(&pixel,
color->red,
color->green,
color->blue,
color->alpha,
format))
alu = GXcopy;
if (alu != -1 &&
sna_blt_fill_boxes(sna, alu,
dst_bo, dst->drawable.bitsPerPixel,
pixel, box, n))