From 14109abf285866ad4cd99d0cd16b0954a0a73a62 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 10 Nov 2009 11:17:23 +0000 Subject: [PATCH] i915: Fix texture sampling coordinates. RENDER specifies that texels should sampled from the pixel centre. This corrects a number of failures in the cairo test suite and a few off-by-one bug reports. Grey border around images https://bugs.freedesktop.org/show_bug.cgi?id=21523 Note that the earlier attempt to fix this was subverted by the buggy use of 1x1R textures for solid sources -- which caused the majority of text to disappear. Signed-off-by: Chris Wilson --- src/i915_render.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/i915_render.c b/src/i915_render.c index db0daf02..f64e0316 100644 --- a/src/i915_render.c +++ b/src/i915_render.c @@ -135,6 +135,9 @@ static uint32_t i915_get_blend_cntl(int op, PicturePtr mask, (dblend << S6_CBUF_DST_BLEND_FACT_SHIFT); } +#define DSTORG_HORT_BIAS(x) ((x)<<20) +#define DSTORG_VERT_BIAS(x) ((x)<<16) + static Bool i915_get_dest_format(PicturePtr dest_picture, uint32_t * dst_format) { ScrnInfoPtr scrn; @@ -165,6 +168,7 @@ static Bool i915_get_dest_format(PicturePtr dest_picture, uint32_t * dst_format) (int)dest_picture->format); return FALSE; } + *dst_format |= DSTORG_HORT_BIAS(0x8) | DSTORG_VERT_BIAS(0x8); return TRUE; } @@ -416,7 +420,7 @@ i915_prepare_composite(int op, PicturePtr source_picture, } if (source_picture->filter == PictFilterNearest) - intel->dst_coord_adjust = -0.125; + intel->src_coord_adjust = 0.375; } if (mask != NULL) { @@ -428,7 +432,7 @@ i915_prepare_composite(int op, PicturePtr source_picture, } if (mask_picture->filter == PictFilterNearest) - intel->dst_coord_adjust = -0.125; + intel->mask_coord_adjust = 0.375; } }