xf86-video-intel: Branch 'modesetting' - src/i830_dri.c src/i830_memory.c

Eric Anholt anholt at kemper.freedesktop.org
Tue Feb 27 01:05:06 EET 2007


 src/i830_dri.c    |    3 ++-
 src/i830_memory.c |    5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
diff-tree 732885c08daaf17034da8f4855d0b957ec3df9d7 (from 0bfaeaab2838184827236c5c0fcc17f06d9e1372)
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Feb 26 15:04:56 2007 -0800

    Bug #9604: Align the sizes of allocations to page increments as well.
    
    Without this, the 965 DRI driver fell over when pitch * height wasn't
    page-size aligned.  Since the allocator only allocates at page-aligned offsets
    anyway this shouldn't hurt us at all.

diff --git a/src/i830_dri.c b/src/i830_dri.c
index e14880f..f81251a 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1449,7 +1449,8 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, 
    /* Don't use front_buffer->size here as it includes the pixmap cache area
     * Instead, calculate the entire framebuffer.
     */
-   sarea->front_size = pScrn->displayWidth * pScrn->virtualY * pI830->cpp;
+   sarea->front_size = ROUND_TO_PAGE(pScrn->displayWidth * pScrn->virtualY *
+				     pI830->cpp);
 
    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
               "[drm] init sarea width,height = %d x %d (pitch %d)\n",
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 79c1b4d..b83078a 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -338,6 +338,8 @@ i830_allocate_aperture(ScrnInfoPtr pScrn
 	xfree(mem);
 	return NULL;
     }
+    /* Only allocate page-sized increments. */
+    size = ALIGN(size, GTT_PAGE_SIZE);
     mem->size = size;
 
     if (alignment < GTT_PAGE_SIZE)
@@ -466,6 +468,9 @@ i830_allocate_memory_tiled(ScrnInfoPtr p
     if (tile_format == TILING_NONE)
 	return i830_allocate_memory(pScrn, name, size, alignment, flags);
 
+    /* Only allocate page-sized increments. */
+    size = ALIGN(size, GTT_PAGE_SIZE);
+
     /* Check for maximum tiled region size */
     if (IS_I9XX(pI830)) {
 	if (size > MB(128))



More information about the xorg-commit mailing list