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

Chris Wilson ickle at kemper.freedesktop.org
Fri Aug 14 01:16:37 PDT 2015


 src/sna/sna_display.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

New commits:
commit f75a5689c38ee1f41f98ac520d0b3dd1ee92755d
Author: Bob Paauwe <bob.j.paauwe at intel.com>
Date:   Thu Aug 13 16:51:37 2015 -0700

    sna: Fix the reduction of xy reflection onto rotations.
    
    When reducing a xy reflection to a 180 degree rotation, make sure
    only one rotation bit is set.  Also by rotating the bit left, we
    can support cases where xy reflection happens with 90/270 degree
    rotation.
    
    Signed-off-by: Bob Paauwe <bob.j.paauwe at intel.com>
    [ickle: Interleave comments]
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 5b975c1..d1792df 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1014,17 +1014,33 @@ rotation_reduce(struct plane *p, unsigned rotation)
 #define RR_Reflect_XY (RR_Reflect_X | RR_Reflect_Y)
 
 	if ((unsupported_rotations & RR_Reflect_XY) == RR_Reflect_XY &&
-	    p->rotation.supported& RR_Rotate_180) {
-		rotation &= ~RR_Reflect_XY;
-		rotation ^= RR_Rotate_180;
+	    p->rotation.supported & RR_Rotate_180) {
+		unsigned other_bits;
+
+		/* paranoia for future extensions */
+		other_bits = rotation & ~(RR_Rotate_All | RR_Reflect_XY);
+
+		/* Reflect the screen by rotating the rotation bit,
+		 * which has to have at least RR_Rotate_0 set. This allows
+		 * us to reflect any of the rotation bits, not just 0.
+		 */
+		rotation &= RR_Rotate_All;
+		assert(rotation);
+		rotation <<= 2; /* RR_Rotate_0 -> RR_Rotate_180 etc */
+		rotation |= rotation >> 4; /* RR_Rotate_270' to RR_Rotate_90 */
+
+		rotation |= other_bits;
 	}
 
 	if ((unsupported_rotations & RR_Rotate_180) &&
-	    (p->rotation.supported& RR_Reflect_XY) == RR_Reflect_XY) {
+	    (p->rotation.supported & RR_Reflect_XY) == RR_Reflect_XY) {
 		rotation ^= RR_Reflect_XY;
 		rotation &= ~RR_Rotate_180;
 	}
 
+	/* Only one rotation bit should be set */
+	assert(is_power_of_two(rotation & RR_Rotate_All));
+
 #undef RR_Reflect_XY
 
 	return rotation;


More information about the xorg-commit mailing list