xf86-video-intel: 2 commits - src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Aug 14 02:48:36 PDT 2015
src/sna/sna_display.c | 60 +++++++++++++++++++++++---------------------------
1 file changed, 28 insertions(+), 32 deletions(-)
New commits:
commit 2c035991668b15304614f97b94a0bf58442d8b58
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Aug 14 10:40:17 2015 +0100
sna: Fixup conversion of rotation into reflection
Similarly to the fix for reflection into rotation, make sure we only set
one Rotation bit afterwards.
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 c252ab1..c670215 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1004,44 +1004,41 @@ sna_crtc_force_outputs_off(xf86CrtcPtr crtc)
}
static unsigned
-rotation_reduce(struct plane *p, unsigned rotation)
+rotation_reflect(unsigned rotation)
{
- unsigned unsupported_rotations = rotation & ~p->rotation.supported;
-
- if (unsupported_rotations == 0)
- return rotation;
-
-#define RR_Reflect_XY (RR_Reflect_X | RR_Reflect_Y)
+ unsigned other_bits;
- if ((unsupported_rotations & RR_Reflect_XY) == RR_Reflect_XY) {
- unsigned other_bits;
+ /* paranoia for future extensions */
+ other_bits = rotation & ~RR_Rotate_All;
- /* paranoia for future extensions */
- other_bits = rotation & ~(RR_Rotate_All | RR_Reflect_XY);
+ /* flip the reflection to compensate for reflecting the rotation */
+ other_bits ^= RR_Reflect_X | RR_Reflect_Y;
- /* 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 */
+ /* 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;
- }
+ return rotation | other_bits;
+}
- if ((unsupported_rotations & RR_Rotate_180) &&
- (p->rotation.supported & RR_Reflect_XY) == RR_Reflect_XY) {
- rotation ^= RR_Reflect_XY;
- rotation &= ~RR_Rotate_180;
+static unsigned
+rotation_reduce(struct plane *p, unsigned rotation)
+{
+ /* If unsupported try exchanging rotation for a reflection */
+ if (rotation & ~p->rotation.supported) {
+ unsigned new_rotation = rotation_reflect(rotation);
+ if ((new_rotation & p->rotation.supported) == new_rotation)
+ rotation = new_rotation;
}
/* Only one rotation bit should be set */
assert(is_power_of_two(rotation & RR_Rotate_All));
-#undef RR_Reflect_XY
-
return rotation;
}
commit eea91b8e234083b4526a969a5edc0284e3fb482b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Aug 14 10:29:56 2015 +0100
sna: Only handle a rotation natively if all bits are supported
Since we can combine Reflections and Rotations, we have to check all
bits.
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 d1792df..c252ab1 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1013,8 +1013,7 @@ 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) {
+ if ((unsupported_rotations & RR_Reflect_XY) == RR_Reflect_XY) {
unsigned other_bits;
/* paranoia for future extensions */
@@ -1061,7 +1060,7 @@ rotation_set(struct sna *sna, struct plane *p, uint32_t desired)
if (desired == p->rotation.current)
return true;
- if ((desired & p->rotation.supported) == 0) {
+ if ((desired & p->rotation.supported) != desired) {
errno = EINVAL;
return false;
}
@@ -1987,9 +1986,9 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc)
bool needs_transform = true;
unsigned rotation = rotation_reduce(&to_sna_crtc(crtc)->primary, crtc->rotation);
DBG(("%s: natively supported rotation? rotation=%x & supported=%x == %d\n",
- __FUNCTION__, crtc->rotation, to_sna_crtc(crtc)->primary.rotation.supported,
- !!(crtc->rotation & to_sna_crtc(crtc)->primary.rotation.supported)));
- if (to_sna_crtc(crtc)->primary.rotation.supported & rotation)
+ __FUNCTION__, rotation, to_sna_crtc(crtc)->primary.rotation.supported,
+ rotation == (rotation & to_sna_crtc(crtc)->primary.rotation.supported)));
+ if ((to_sna_crtc(crtc)->primary.rotation.supported & rotation) == rotation)
needs_transform = RRTransformCompute(crtc->x, crtc->y,
crtc->mode.HDisplay, crtc->mode.VDisplay,
RR_Rotate_0, transform,
More information about the xorg-commit
mailing list