[Intel-gfx] [PATCH] sna: Fix the reduction of xy reflection onto rotations.

Bob Paauwe bob.j.paauwe at intel.com
Thu Aug 13 16:51:37 PDT 2015


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>
---
 src/sna/sna_display.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 5b975c1..c8c2197 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1007,6 +1007,8 @@ static unsigned
 rotation_reduce(struct plane *p, unsigned rotation)
 {
 	unsigned unsupported_rotations = rotation & ~p->rotation.supported;
+	unsigned rr_mask = (RR_Rotate_0 | RR_Rotate_90 |
+			    RR_Rotate_180 | RR_Rotate_270);
 
 	if (unsupported_rotations == 0)
 		return rotation;
@@ -1016,7 +1018,8 @@ rotation_reduce(struct plane *p, unsigned rotation)
 	if ((unsupported_rotations & RR_Reflect_XY) == RR_Reflect_XY &&
 	    p->rotation.supported& RR_Rotate_180) {
 		rotation &= ~RR_Reflect_XY;
-		rotation ^= RR_Rotate_180;
+		rotation = ((rotation << 2 & rr_mask) |
+			    (((rotation << 2) & ~rr_mask) >> 4));
 	}
 
 	if ((unsupported_rotations & RR_Rotate_180) &&
-- 
2.1.0



More information about the Intel-gfx mailing list