[Intel-gfx] [PATCH] Use zero videoRam and aligned size limit in DRM mode

Wu Fengguang fengguang.wu at intel.com
Thu Apr 30 12:44:59 CEST 2009


Explictly set videoRam to 0 in drm mode, to indicate "no size limit".
And to use a large _aligned_ size limit in this case. Because
i830_allocate_aperture() does a testing
           
        if (mem->end <= scan->next->offset)
                break;

which can fail in a very tricky way when
        mem->end           = rounded up size limit
        scan->next->offset = untouched size limit

Reported-by: Magnus Kessler <Magnus.Kessler at gmx.net>
Tested-by: Magnus Kessler <Magnus.Kessler at gmx.net>
Signed-off-by: Wu Fengguang <fengguang.wu at intel.com>
---
 src/i830_driver.c |    2 +-
 src/i830_memory.c |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

--- xf86-video-intel.orig/src/i830_driver.c
+++ xf86-video-intel/src/i830_driver.c
@@ -2550,7 +2550,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr 
 
    if (pI830->use_drm_mode) {
        pI830->stolen_size = 0;
-       pScrn->videoRam = ~0UL / KB(1);
+       pScrn->videoRam = 0;
    } else {
        I830AdjustMemory(pScreen);
    }
--- xf86-video-intel.orig/src/i830_memory.c
+++ xf86-video-intel/src/i830_memory.c
@@ -394,6 +394,9 @@ i830_allocator_init(ScrnInfoPtr pScrn, u
 	return FALSE;
     }
 
+    if (size == 0) /* use_drm_mode: no size limit */
+	    size = ALIGN(ULONG_MAX >> 16, GTT_PAGE_SIZE);
+
     start->key = -1;
     start->offset = 0;
     start->end = start->offset;
@@ -425,7 +428,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, u
      * rather than after DRIFinishScreenInit.
      */
     if (pI830->directRenderingType == DRI_DRI2 && has_gem) {
-	int mmsize;
+	unsigned long mmsize;
 
 	/* Take over all of the graphics aperture minus enough to for
 	 * physical-address allocations of cursor/overlay registers.



More information about the Intel-gfx mailing list