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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2009-11-10 11:17:23 +00:00
parent e581ceb738
commit 14109abf28
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}
}