xf86-video-intel: src/sna/sna_trapezoids.c

Chris Wilson ickle at kemper.freedesktop.org
Thu May 24 08:51:59 PDT 2012


 src/sna/sna_trapezoids.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit ae2be7e25bda46551381c19a673b321b4382e1f9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 24 16:33:27 2012 +0100

    sna/trapezoids: Correct rounding for downsampling onto sample grid
    
    Reported-by: S. Christian Collins <s_chriscollins at hotmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49446
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index c0565fa..e604720 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -3150,7 +3150,7 @@ composite_unaligned_boxes(struct sna *sna,
 
 static inline int pixman_fixed_to_grid (pixman_fixed_t v)
 {
-	return (v + FAST_SAMPLES_mask/2) >> (16 - FAST_SAMPLES_shift);
+	return (v + ((1<<(16-FAST_SAMPLES_shift))-1)/2) >> (16 - FAST_SAMPLES_shift);
 }
 
 static inline bool
@@ -3158,6 +3158,12 @@ project_trapezoid_onto_grid(const xTrapezoid *in,
 			    int dx, int dy,
 			    xTrapezoid *out)
 {
+	__DBG(("%s: in: L:(%d, %d), (%d, %d); R:(%d, %d), (%d, %d), [%d, %d]\n",
+	       __FUNCTION__,
+	       in->left.p1.x, in->left.p1.y, in->left.p2.x, in->left.p2.y,
+	       in->right.p1.x, in->right.p1.y, in->right.p2.x, in->right.p2.y,
+	       in->top, in->bottom));
+
 	out->left.p1.x = dx + pixman_fixed_to_grid(in->left.p1.x);
 	out->left.p1.y = dy + pixman_fixed_to_grid(in->left.p1.y);
 	out->left.p2.x = dx + pixman_fixed_to_grid(in->left.p2.x);
@@ -3171,6 +3177,12 @@ project_trapezoid_onto_grid(const xTrapezoid *in,
 	out->top = dy + pixman_fixed_to_grid(in->top);
 	out->bottom = dy + pixman_fixed_to_grid(in->bottom);
 
+	__DBG(("%s: out: L:(%d, %d), (%d, %d); R:(%d, %d), (%d, %d), [%d, %d]\n",
+	       __FUNCTION__,
+	       out->left.p1.x, out->left.p1.y, out->left.p2.x, out->left.p2.y,
+	       out->right.p1.x, out->right.p1.y, out->right.p2.x, out->right.p2.y,
+	       out->top, out->bottom));
+
 	return xTrapezoidValid(out);
 }
 


More information about the xorg-commit mailing list