diff options
author | Eric Anholt <eric@anholt.net> | 2010-06-06 23:41:23 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-06-07 11:15:28 -0700 |
commit | b5c9de10ba3a811f312e622b97ee5e601bd3b74f (patch) | |
tree | 075b6547ed465381ee5b19288d352eb7460b03b0 /src/drmmode_display.c | |
parent | e6acbc763229fd5b5b2cc1d65136404d02ac4655 (diff) |
Allocate a correctly sized framebuffer when tiling by using libdrm's support.
When I made libdrm stop overallocating so much memory for the purpose
of bo caching, things started scribbling on the bottom of my
frontbuffer (and vice versa, leading to GPU hangs). We had the usual
mistake of size = tiled_pitch * height instead of size = tiled_pitch *
tile_aligned_height.
Diffstat (limited to 'src/drmmode_display.c')
-rw-r--r-- | src/drmmode_display.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 3ea9b0fe..63ff9f38 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1257,28 +1257,22 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) ScreenPtr screen = screenInfo.screens[scrn->scrnIndex]; PixmapPtr pixmap; uint32_t old_fb_id; - int i, w, pitch, old_width, old_height, old_pitch; + int i, old_width, old_height, old_pitch; + unsigned long pitch; if (scrn->virtualX == width && scrn->virtualY == height) return TRUE; - w = i830_pad_drawable_width(width); - i830_tiled_width(intel, &w, intel->cpp); - pitch = w * intel->cpp; - xf86DrvMsg(scrn->scrnIndex, X_INFO, - "Allocate new frame buffer %dx%d stride %d\n", - width, height, pitch); - old_width = scrn->virtualX; old_height = scrn->virtualY; old_pitch = scrn->displayWidth; old_fb_id = drmmode->fb_id; old_front = intel->front_buffer; - scrn->virtualX = width; - scrn->virtualY = height; - scrn->displayWidth = w; - intel->front_buffer = i830_allocate_framebuffer(scrn); + intel->front_buffer = i830_allocate_framebuffer(scrn, + width, height, + intel->cpp, + &pitch); if (!intel->front_buffer) goto fail; @@ -1289,6 +1283,10 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) if (ret) goto fail; + scrn->virtualX = width; + scrn->virtualY = height; + scrn->displayWidth = pitch / intel->cpp; + pixmap = screen->GetScreenPixmap(screen); screen->ModifyPixmapHeader(pixmap, width, height, -1, -1, pitch, NULL); i830_set_pixmap_bo(pixmap, intel->front_buffer); |