xserver-xorg-video-cirrus (1:1.3.2-2+squeeze1) 20-faumachine-maxpitch.diff

Summary

 src/alp_driver.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

    
download this patch

Patch contents

Fix max pitch issues in FAUmachine.

Patch by Stefan Potyra <sistpoty@ubuntu.com>, stolen from bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=23775

--- a/src/alp_driver.c
+++ b/src/alp_driver.c
@@ -407,6 +407,8 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
 {
 	int *linePitches = NULL;
 	int i, n = 0;
+	int max_pitch = 2048;
+
 	CirPtr pCir = CIRPTR(pScrn);
 
 	/* XXX ajv - 512, 576, and 1536 may not be supported
@@ -423,8 +425,20 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
 							1280, 1536, 1600, 1920, 2048, 0 };
 #endif
 
+	switch (pCir->Chipset) {
+	case PCI_CHIP_GD5446:
+		max_pitch = 0x1ff << 3;
+		break;
+
+	default:
+		/* FIXME max_pitch for other chipsets? */
+		max_pitch = (pScrn->bitsPerPixel / 8) * 2048;
+		break;
+	}
+
 	for (i = 0; accelWidths[i] != 0; i++) {
-		if (accelWidths[i] % pCir->Rounding == 0) {
+		if ((accelWidths[i] % pCir->Rounding == 0)
+		 && ((accelWidths[i] * pScrn->bitsPerPixel / 8) <= max_pitch)) {
 			n++;
 			linePitches = xnfrealloc(linePitches, n * sizeof(int));
 			linePitches[n - 1] = accelWidths[i];