[Glamor] [PATCH 1/2] Do not reduce a composite to a copy if we need to sample outside of the source
Zhigang Gong
zhigang.gong at linux.intel.com
Sun Jan 29 01:09:20 PST 2012
> -----Original Message-----
> From:
> glamor-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.org
> [mailto:glamor-bounces+zhigang.gong=linux.intel.com at lists.freedesktop.o
> rg] On Behalf Of Chris Wilson
> Sent: Friday, January 27, 2012 9:22 PM
> To: glamor at lists.freedesktop.org
> Cc: Chris Wilson
> Subject: [Glamor] [PATCH 1/2] Do not reduce a composite to a copy if we
> need to sample outside of the source
>
> In order to maintain Render semantics, samples outside of the source
> should return CLEAR. The copy routines instead are based on the core
> protocol and expects the source rectangle to be wholly contained within
> the drawable and so does no fixup.
>
> Fixes the rendering of GTK icons.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> src/glamor_render.c | 31 ++++++++++++++++++++++---------
> 1 files changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/src/glamor_render.c b/src/glamor_render.c index
> b0630b1..b70ace2 100644
> --- a/src/glamor_render.c
> +++ b/src/glamor_render.c
> @@ -602,7 +602,7 @@ glamor_composite_with_copy(CARD8 op,
> INT16 y_dest, CARD16 width, CARD16 height) {
> RegionRec region;
> - int ret;
> + int ret = FALSE;
>
> if (!source->pDrawable)
> return FALSE;
> @@ -622,14 +622,27 @@ glamor_composite_with_copy(CARD8 op,
> x_source, y_source,
> 0, 0, x_dest, y_dest, width, height))
> return TRUE;
> - ret = TRUE;
> - if (!glamor_copy_n_to_n_nf(source->pDrawable,
> - dest->pDrawable, NULL,
> - REGION_RECTS(®ion),
> - REGION_NUM_RECTS(®ion),
> - x_source - x_dest, y_source - y_dest,
> - FALSE, FALSE, 0, NULL))
> - ret = FALSE;
> + /* Fallback if we sample outside the source so that we swizzle the
> + * clear color appropriately. If the source has an alpha channel,
> + * we could rely on CLAMP_TO_BORDER working as required...
> + */
> + if (region.extents.x1 + x_source - x_dest < 0)
> + goto cleanup_region;
> + if (region.extents.x2 + x_source - x_dest >
> source->pDrawable->width)
> + goto cleanup_region;
> +
> + if (region.extents.y1 + y_source - y_dest < 0)
> + goto cleanup_region;
> + if (region.extents.y2 + y_source - y_dest >
> source->pDrawable->height)
> + goto cleanup_region;
> +
> + ret = glamor_copy_n_to_n_nf(source->pDrawable,
> + dest->pDrawable, NULL,
> + REGION_RECTS(®ion),
> + REGION_NUM_RECTS(®ion),
> + x_source - x_dest, y_source - y_dest,
> + FALSE, FALSE, 0, NULL);
> +cleanup_region:
> REGION_UNINIT(dest->pDrawable->pScreen, ®ion);
> return ret;
> }
> --
> 1.7.8.3
>
Reviewed-by: Zhigang Gong <zhigang.gong at linux.intel.com>
Applied, thanks.
> _______________________________________________
> Glamor mailing list
> Glamor at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/glamor
More information about the Glamor
mailing list