summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTilman Sauerbeck <tilman@code-monkey.de>2007-09-26 19:58:52 +0200
committerTilman Sauerbeck <tilman@code-monkey.de>2007-09-26 19:58:52 +0200
commit88d4290a88362df9f37890ff8863b93d3abf2866 (patch)
tree62d4b71dcbb3afad39f3d6cb52fa5c3e6b18229d /src
parenta4e4ecc9e04f8d6a4c338f5a0aa7e93143d3d94b (diff)
Bug #12575: Evaluate the x and y arguments to crtc_mode_set().
Diffstat (limited to 'src')
-rw-r--r--src/mga_g_crtc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mga_g_crtc.c b/src/mga_g_crtc.c
index e6ef324..d4dfe99 100644
--- a/src/mga_g_crtc.c
+++ b/src/mga_g_crtc.c
@@ -327,6 +327,7 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
MGAPtr pMga = MGAPTR(crtc->scrn);
MGAFBLayout *pLayout = &pMga->CurrentLayout;
vgaRegPtr vga = &VGAHWPTR(crtc->scrn)->ModeReg;
+ unsigned int startadd = (y * crtc->scrn->virtualX) + x;
BppShift = pMga->BppShifts[(pLayout->bitsPerPixel >> 3) - 1];
@@ -469,6 +470,7 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
switch (pLayout->bitsPerPixel) {
case 8:
state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_8bits;
+ startadd /= 8;
break;
case 16:
state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_16bits;
@@ -478,9 +480,11 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_15bits;
}
+ startadd /= 4;
break;
case 24:
state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_24bits;
+ startadd /= 8;
break;
case 32:
if (pLayout->Overlay8Plus24) {
@@ -490,11 +494,15 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
} else
state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_32_24bits;
+ startadd /= 2;
break;
default:
FatalError("MGA: unsupported depth\n");
}
+ /* we only have 20 bits to store the start address */
+ startadd &= 0xfffff;
+
/*
* This will initialize all of the generic VGA registers.
*/
@@ -537,6 +545,7 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
}
state->ExtVga[0] |= (wd & 0x300) >> 4;
+ state->ExtVga[0] |= (startadd >> 16) & 0x0f;
state->ExtVga[1] = (((ht - 4) & 0x100) >> 8) |
((hd & 0x100) >> 7) |
@@ -573,6 +582,9 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
vga->CRTC[9] = ((vd & 0x200) >> 4) |
((vd & 0x200) >> 3); /* linecomp */
+ vga->CRTC[12] = (startadd & 0xff00) >> 8;
+ vga->CRTC[13] = startadd & 0xff;
+
vga->CRTC[16] = vs & 0xFF;
vga->CRTC[17] = (ve & 0x0F) | 0x20;
vga->CRTC[18] = vd & 0xFF;