[PATCH xserver] glamor: Cannot use copies when accessing outside of composite source

Keith Packard keithp at keithp.com
Sat May 28 05:52:06 UTC 2016


Michel Dänzer <michel at daenzer.net> writes:

> You know the details better than I do, but my understanding is that the
> region can only be clipped to the destination in general, because
> accessing source pictures outside of their boundaries is defined such
> that it can change the contents of the destination.

Yeah, I didn't remember that the composite operation is supposed to do
source clipping as there may be a transform involved. However, we need
to make sure the rendered region is inside the source composite clip so
that the simple copy will work correctly.

> Anyway, the fact is that this patch fixes a fair number of rendercheck
> tests.

Here's a patch which uses region operations to make sure we don't use
copy when the source doesn't contain all of the necessary bits. Note
that this just means we'll fall back to the existing (broken) code which
doesn't bother to clip against the source either, but at least that's
only one bug instead of two?

            || (op == PictOpOver
                && source->format == dest->format
                && !PICT_FORMAT_A(source->format)))) {
        int dx, dy;

        x_source += source->pDrawable->x;
        y_source += source->pDrawable->y;
        x_dest += dest->pDrawable->x;
        y_dest += dest->pDrawable->y;
        dx = x_source - x_dest;
        dy = y_source - y_dest;

        /* Align region with source */
        pixman_region_translate(region, dx, dy);
        box = RegionRects(region);
        nbox = RegionNumRects(region);

        for (i = 0; i < nbox; i++)
            if (pixman_region_contains_rectangle(source->pCompositeClip, &box[i]) != PIXMAN_REGION_IN)
                break;
        pixman_region_translate(region, -dx, -dy);
        if (i == nbox)
        {
            /* Re-align region with dest */
            glamor_copy(source->pDrawable, dest->pDrawable, NULL,
                        RegionRects(region), RegionNumRects(region),
                        dx, dy, FALSE, FALSE, 0, NULL);
            ok = TRUE;
            goto out;
        }


-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160527/3c206709/attachment.sig>


More information about the xorg-devel mailing list