summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-09-09 12:09:05 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-09-09 12:40:15 +0100
commit1a77ca74bc829e019a06fe9ad559f013054c27ff (patch)
tree255a4067c219d3d0e5c49106c335e384da72f8d0
parentce10b5b6fca086eb4af45c1db28352e06ee4ce0b (diff)
i915: Restore nearest sampling
My recent commit [94fc93] to use the pixel centre for sampling with the i830 broke the i915. This restores the previous sampling coordinates for the i915 whilst preserving the correct coordinates for i830. Fixes: gnome characters disappear http://bugs.freedesktop.org/show_bug.cgi?id=23803 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/i830.h1
-rw-r--r--src/i830_render.c14
-rw-r--r--src/i915_render.c8
3 files changed, 13 insertions, 10 deletions
diff --git a/src/i830.h b/src/i830.h
index c8002b48..c3b0d022 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -467,6 +467,7 @@ typedef struct _I830Rec {
float scale_units[2][2];
/** Transform pointers for src/mask, or NULL if identity */
PictTransform *transform[2];
+ float dst_coord_adjust;
float src_coord_adjust;
float mask_coord_adjust;
diff --git a/src/i830_render.c b/src/i830_render.c
index af6fb6ed..dbee4465 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -414,7 +414,9 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
if (!i830_get_dest_format(pDstPicture, &pI830->render_dst_format))
return FALSE;
+ pI830->dst_coord_adjust = 0;
pI830->src_coord_adjust = 0;
+ pI830->mask_coord_adjust = 0;
if (pSrcPicture->filter == PictFilterNearest)
pI830->src_coord_adjust = 0.375;
if (pMask != NULL) {
@@ -707,8 +709,8 @@ i830_emit_composite_primitive(PixmapPtr pDst,
BEGIN_BATCH(1 + num_floats);
OUT_BATCH(PRIM3D_INLINE | PRIM3D_RECTLIST | (num_floats-1));
- OUT_BATCH_F(dstX + w);
- OUT_BATCH_F(dstY + h);
+ OUT_BATCH_F(pI830->dst_coord_adjust + dstX + w);
+ OUT_BATCH_F(pI830->dst_coord_adjust + dstY + h);
OUT_BATCH_F(src_x[2] / pI830->scale_units[0][0]);
OUT_BATCH_F(src_y[2] / pI830->scale_units[0][1]);
if (!is_affine_src) {
@@ -724,8 +726,8 @@ i830_emit_composite_primitive(PixmapPtr pDst,
}
}
- OUT_BATCH_F(dstX);
- OUT_BATCH_F(dstY + h);
+ OUT_BATCH_F(pI830->dst_coord_adjust + dstX);
+ OUT_BATCH_F(pI830->dst_coord_adjust + dstY + h);
OUT_BATCH_F(src_x[1] / pI830->scale_units[0][0]);
OUT_BATCH_F(src_y[1] / pI830->scale_units[0][1]);
if (!is_affine_src) {
@@ -741,8 +743,8 @@ i830_emit_composite_primitive(PixmapPtr pDst,
}
}
- OUT_BATCH_F(dstX);
- OUT_BATCH_F(dstY);
+ OUT_BATCH_F(pI830->dst_coord_adjust + dstX);
+ OUT_BATCH_F(pI830->dst_coord_adjust + dstY);
OUT_BATCH_F(src_x[0] / pI830->scale_units[0][0]);
OUT_BATCH_F(src_y[0] / pI830->scale_units[0][1]);
if (!is_affine_src) {
diff --git a/src/i915_render.c b/src/i915_render.c
index c7858aec..ed0b615d 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -166,7 +166,6 @@ static Bool i915_get_dest_format(PicturePtr pDstPicture, uint32_t *dst_format)
(int)pDstPicture->format);
}
}
- *dst_format |= DSTORG_HORT_BIAS (0x8) | DSTORG_VERT_BIAS (0x8);
return TRUE;
}
@@ -347,16 +346,17 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
if (!i915_texture_setup(pSrcPicture, pSrc, 0))
I830FALLBACK("fail to setup src texture\n");
+ pI830->dst_coord_adjust = 0;
pI830->src_coord_adjust = 0;
+ pI830->mask_coord_adjust = 0;
if (pSrcPicture->filter == PictFilterNearest)
- pI830->src_coord_adjust = 0.375;
+ pI830->dst_coord_adjust = -0.125;
if (pMask != NULL) {
if (!i915_texture_setup(pMaskPicture, pMask, 1))
I830FALLBACK("fail to setup mask texture\n");
- pI830->mask_coord_adjust = 0;
if (pMaskPicture->filter == PictFilterNearest)
- pI830->mask_coord_adjust = 0.375;
+ pI830->dst_coord_adjust = -0.125;
} else {
pI830->transform[1] = NULL;
pI830->scale_units[1][0] = -1;