Skip to contentSkip to conversation

sna: Fix the reduction of xy reflection onto rotations.

PATCH In review Bob Paauwe 2 participants 2 messages Aug 13, 2015 – Aug 14, 2015

lore
Share & tools
lore

Bob Paauwe

author
#0 lore raw

PATCH 1/1 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.

---
 src/sna/sna_display.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/sna/sna_display.c +4 -1
index 5b975c1..c8c2197 100644
@@ -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) &&
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 6 lines · Bob Paauwe

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.

Nice. Took me a few moments to verify the shifting works as expected, so I left a couple of comments there for my future self.

Thanks, pushed
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx