xf86-video-intel: 2 commits - configure.ac libobj/getline.c src/sna/sna_display.c src/sna/sna.h

Chris Wilson ickle at kemper.freedesktop.org
Fri Jul 11 04:07:07 PDT 2014


 configure.ac          |    3 ++
 libobj/getline.c      |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/sna/sna.h         |    5 ++++
 src/sna/sna_display.c |   39 ++++++++++++++++++++++++++++++++++----
 4 files changed, 94 insertions(+), 4 deletions(-)

New commits:
commit e0523ade28fa0da00d0bd70d8b22d53ed4e49f73
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 9 12:10:15 2014 +0100

    sna: Reduce reflections onto rotations
    
    In order to support a wider range of rotation/reflections, perform a
    simple reduction of the requested rotation first.
    
    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 8bd0d0e..ba1a483 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -826,6 +826,33 @@ sna_crtc_force_outputs_off(xf86CrtcPtr crtc)
 	to_sna_crtc(crtc)->dpms_mode = DPMSModeOff;
 }
 
+static unsigned
+rotation_reduce(struct plane *p, 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)
+
+	if ((unsupported_rotations & RR_Reflect_XY) == RR_Reflect_XY &&
+	    p->rotation.supported& RR_Rotate_180) {
+		rotation &= ~RR_Reflect_XY;
+		rotation ^= RR_Rotate_180;
+	}
+
+	if ((unsupported_rotations & RR_Rotate_180) &&
+	    (p->rotation.supported& RR_Reflect_XY) == RR_Reflect_XY) {
+		rotation ^= RR_Reflect_XY;
+		rotation &= ~RR_Rotate_180;
+	}
+
+#undef RR_Reflect_XY
+
+	return rotation;
+}
+
 static bool
 rotation_set(struct sna *sna, struct plane *p, uint32_t desired)
 {
@@ -881,7 +908,7 @@ bool sna_crtc_set_sprite_rotation(xf86CrtcPtr crtc, uint32_t rotation)
 
 	return rotation_set(to_sna(crtc->scrn),
 			    &to_sna_crtc(crtc)->sprite,
-			    rotation);
+			    rotation_reduce(&to_sna_crtc(crtc)->sprite, rotation));
 }
 
 static bool
@@ -1607,10 +1634,11 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc)
 			       &f_crtc_to_fb,
 			       &f_fb_to_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 & crtc->rotation)
+		if (to_sna_crtc(crtc)->primary.rotation.supported & rotation)
 			needs_transform = RRTransformCompute(crtc->x, crtc->y,
 							     crtc->mode.HDisplay, crtc->mode.VDisplay,
 							     RR_Rotate_0, transform,
@@ -1728,6 +1756,8 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc)
 		sna_crtc->transform = true;
 		return bo;
 	} else {
+		unsigned rotation;
+
 		DBG(("%s: attaching to framebuffer\n", __FUNCTION__));
 		bo = sna_pixmap_pin(sna->front, PIN_SCANOUT);
 		if (bo == NULL)
@@ -1775,8 +1805,9 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc)
 		} else
 			sna_crtc_disable_shadow(sna, sna_crtc);
 
-		assert(sna_crtc->primary.rotation.supported & crtc->rotation);
-		sna_crtc->rotation = crtc->rotation;
+		rotation = rotation_reduce(&sna_crtc->primary, crtc->rotation);
+		assert(sna_crtc->primary.rotation.supported & rotation);
+		sna_crtc->rotation = rotation;
 		return kgem_bo_reference(bo);
 	}
 }
commit 251bcc32eed37ee10eb14ce2278ecbdcc40a7cde
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jul 10 21:01:57 2014 +0100

    configure: Provide a poor man's replacement for getline()
    
    uClibc is one such library that doesn't implement getline()
    
    Reported-by: Ben Widawsky <benjamin.widawsky at intel.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index 8e4d833..eec9f89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -818,6 +818,9 @@ if test "x$debug_msg" = "x"; then
 	debug_msg=" none"
 fi
 
+AC_CONFIG_LIBOBJ_DIR(libobj)
+AC_REPLACE_FUNCS(getline)
+
 DRIVER_NAME="intel"
 AC_SUBST([DRIVER_NAME])
 AC_SUBST([moduledir])
diff --git a/libobj/getline.c b/libobj/getline.c
new file mode 100644
index 0000000..5acdf8d
--- /dev/null
+++ b/libobj/getline.c
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+extern int getline(char **line, size_t *len, FILE *file);
+
+int getline(char **line, size_t *len, FILE *file)
+{
+	char *ptr, *end;
+	int c;
+
+	if (*line == NULL) {
+		errno = EINVAL;
+		if (*len == 0)
+			*line = malloc(4096);
+		if (*line == NULL)
+			return -1;
+
+		*len = 4096;
+	}
+
+	ptr = *line;
+	end = *line + *len;
+
+	while ((c = fgetc(file)) != EOF) {
+		if (ptr + 1 >= end) {
+			char *newline;
+			int offset;
+
+			newline = realloc(*line, *len + 4096);
+			if (newline == NULL)
+				return -1;
+
+			offset = ptr - *line;
+
+			*line = newline;
+			*len += 4096;
+
+			ptr = *line + offset;
+			end = *line + *len;
+		}
+
+		*ptr++ = c;
+		if (c == '\n') {
+			*ptr = '\0';
+			return ptr - *line;
+		}
+	}
+	*ptr = '\0';
+	return -1;
+}
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 431fe97..6e70c56 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -1222,4 +1222,9 @@ static inline void sigtrap_put(void)
 #define RR_Rotate_All (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270)
 #define RR_Reflect_All (RR_Reflect_X | RR_Reflect_Y)
 
+#ifndef HAVE_GETLINE
+#include <stdio.h>
+extern int getline(char **line, size_t *len, FILE *file);
+#endif
+
 #endif /* _SNA_H */


More information about the xorg-commit mailing list