summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Potyra <sistpoty@ubuntu.com>2011-10-20 14:44:44 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-10-20 14:50:10 -0700
commitf5a8080f149a2f2658b7773ae7db7c67c52c4199 (patch)
tree5739f9df36785d34a1a72ee4dceb9c06e78162f0 /src
parent9fcfd1aa760023e449cbb8c1eebd0bb570a6aacb (diff)
downloadxorg-driver-xf86-video-cirrus-f5a8080f149a2f2658b7773ae7db7c67c52c4199.tar.gz
Limit the maximul pitch of GD5436 and GD5446
Limit the maximum supported pitch of the GD5446 to 4088, since the internal pitch register is only 9 bit (and contains the pitch left shifted by 3). See https://bugs.freedesktop.org/show_bug.cgi?id=23775 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'src')
-rw-r--r--src/alp_driver.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/alp_driver.c b/src/alp_driver.c
index e773471..3153484 100644
--- a/src/alp_driver.c
+++ b/src/alp_driver.c
@@ -405,6 +405,8 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
{
int *linePitches = NULL;
int i, n = 0;
+ int max_pitch;
+
CirPtr pCir = CIRPTR(pScrn);
/* XXX ajv - 512, 576, and 1536 may not be supported
@@ -421,8 +423,21 @@ GetAccelPitchValues(ScrnInfoPtr pScrn)
1280, 1536, 1600, 1920, 2048, 0 };
#endif
+ switch (pCir->Chipset) {
+ case PCI_CHIP_GD5436:
+ 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];