diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index 27b04e3..e50a09f 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -171,6 +171,14 @@ radeon_dri2_create_buffers(DrawablePtr drawable, int flags = 0; unsigned front_width; uint32_t tiling = 0; + unsigned aligned_width = drawable->width; + unsigned width_align; + unsigned aligned_height; + unsigned height_align; + unsigned base_align; + unsigned pitch_bytes; + unsigned size; + pixmap = pScreen->GetScreenPixmap(pScreen); front_width = pixmap->drawable.width; @@ -255,28 +263,23 @@ radeon_dri2_create_buffers(DrawablePtr drawable, if (flags & RADEON_CREATE_PIXMAP_TILING_MACRO) tiling |= RADEON_TILING_MACRO; + width_align = drmmode_get_pitch_align(pScrn, drawable->depth / 8, tiling); + height_align = drmmode_get_height_align(pScrn, tiling); + base_align = drmmode_get_base_align(pScrn, drawable->depth / 8, tiling); + if (aligned_width == front_width) - aligned_width = pScrn->virtualX; + aligned_width = pScrn->displayWidth; + aligned_width = RADEON_ALIGN(aligned_width, width_align); + pitch_bytes = aligned_width * (drawable->depth / 8); + aligned_height = RADEON_ALIGN(drawable->height, height_align); + size = pitch_bytes * aligned_height; + size = RADEON_ALIGN(size, base_align); if (need_enlarge) { /* evergreen uses separate allocations for depth and stencil * so we make an extra large depth buffer to cover stencil * as well. */ - unsigned width_align = drmmode_get_pitch_align(pScrn, drawable->depth / 8, tiling); - unsigned height_align = drmmode_get_height_align(pScrn, tiling); - unsigned base_align = drmmode_get_base_align(pScrn, drawable->depth / 8, tiling); - unsigned pitch_bytes; - unsigned size; - - if (aligned_width == front_width) - aligned_width = pScrn->virtualX; - aligned_width = RADEON_ALIGN(aligned_width, width_align); - pitch_bytes = aligned_width * (drawable->depth / 8); - aligned_height = RADEON_ALIGN(aligned_height, height_align); - size = pitch_bytes * aligned_height; - size = RADEON_ALIGN(size, base_align); - /* add additional size for stencil */ size += aligned_width * aligned_height; aligned_height = RADEON_ALIGN(size / pitch_bytes, height_align); } @@ -425,7 +428,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen, if (aligned_width == front_width) - aligned_width = pScrn->virtualX; + aligned_width = pScrn->displayWidth; pixmap = (*pScreen->CreatePixmap)(pScreen, aligned_width,