i810: adjust the pitch for DRI rendering

Current code forgot to adjust the pitch of the frontbuffer.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=16729
This commit is contained in:
Daniel Vetter 2010-04-16 22:24:01 +02:00
parent c374c94e41
commit 9494f4e91f
1 changed files with 22 additions and 19 deletions

View File

@ -305,6 +305,28 @@ I810DRIScreenInit(ScreenPtr pScreen)
return FALSE;
}
/* adjust width first */
#define Elements(x) sizeof(x)/sizeof(*x)
for (pitch_idx = 0; pitch_idx < Elements(i810_pitches); pitch_idx++)
if (width <= i810_pitches[pitch_idx])
break;
if (pitch_idx == Elements(i810_pitches)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[dri] Couldn't find depth/back buffer pitch");
DRICloseScreen(pScreen);
return FALSE;
} else {
/* for tiled memory to work, the buffer needs to have the
* number of lines as a multiple of 16 (the tile size),
* - airlied */
int lines = (pScrn->virtualY + 15) / 16 * 16;
back_size = i810_pitches[pitch_idx] * lines;
back_size = ((back_size + 4096 - 1) / 4096) * 4096;
}
pScrn->displayWidth = i810_pitches[pitch_idx] / pI810->cpp;
/* Check the DRI version */
{
int major, minor, patch;
@ -521,25 +543,6 @@ I810DRIScreenInit(ScreenPtr pScreen)
xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : 0x%x\n",
(int)dcacheHandle);
#define Elements(x) sizeof(x)/sizeof(*x)
for (pitch_idx = 0; pitch_idx < Elements(i810_pitches); pitch_idx++)
if (width <= i810_pitches[pitch_idx])
break;
if (pitch_idx == Elements(i810_pitches)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[dri] Couldn't find depth/back buffer pitch");
DRICloseScreen(pScreen);
return FALSE;
} else {
/* for tiled memory to work, the buffer needs to have the
* number of lines as a multiple of 16 (the tile size),
* - airlied */
int lines = (pScrn->virtualY + 15) / 16 * 16;
back_size = i810_pitches[pitch_idx] * lines;
back_size = ((back_size + 4096 - 1) / 4096) * 4096;
}
sysmem_size = pScrn->videoRam * 1024;
if (dcacheHandle != DRM_AGP_NO_HANDLE) {
if (back_size > 4 * 1024 * 1024) {