diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2010-04-16 22:24:01 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2010-04-16 22:24:01 +0200 |
commit | 9494f4e91f8c8c7a0f8d61c6883c9bfceb2cec46 (patch) | |
tree | bcda71a5cd9f897cfd5647f543a5623ea8ff8a10 | |
parent | c374c94e41d6e7d677334171e3255778d77cbe18 (diff) |
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
-rw-r--r-- | src/i810_dri.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/i810_dri.c b/src/i810_dri.c index e566acf6..f6f9f5e1 100644 --- a/src/i810_dri.c +++ b/src/i810_dri.c @@ -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) { |