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

2015-08-14 Thread Chris Wilson
On Thu, Aug 13, 2015 at 04:51:37PM -0700, Bob Paauwe wrote:
> 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 

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

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

2015-08-13 Thread 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.

Signed-off-by: Bob Paauwe 
---
 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

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx