Message ID | 1439509897-12151-1-git-send-email-bob.j.paauwe@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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 <bob.j.paauwe@intel.com> 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
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) &&
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@intel.com> --- src/sna/sna_display.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)