Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:fmherschel
fhxorg
newdrm.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File newdrm.diff of Package fhxorg
diff -u -r -N -p xf86-video-intel.modesetting/configure.ac xf86-video-intel.modesetting.orig/configure.ac --- xf86-video-intel.modesetting/configure.ac 2006-11-19 14:01:37.000000000 +0100 +++ xf86-video-intel.modesetting.orig/configure.ac 2006-11-19 14:00:52.000000000 +0100 @@ -120,7 +120,7 @@ fi AM_CONDITIONAL(DRI, test x$DRI = xyes) if test "$DRI" = yes; then - PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto]) + PKG_CHECK_MODULES(DRI, [libdrm >= 2.2 xf86driproto]) AC_DEFINE(XF86DRI,1,[Enable DRI driver support]) AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support]) fi diff -u -r -N -p xf86-video-intel.modesetting/man/i810.man xf86-video-intel.modesetting.orig/man/i810.man --- xf86-video-intel.modesetting/man/i810.man 2006-11-19 14:01:37.000000000 +0100 +++ xf86-video-intel.modesetting.orig/man/i810.man 2006-11-19 14:00:52.000000000 +0100 @@ -183,6 +183,30 @@ Allows more memory for the offscreen all situations where HDTV movies are required to play but not enough offscreen memory is usually available. Set this to 8160 for upto 1920x1080 HDTV support. Default 0KB (off). +.TP +.BI "Option \*qLegacy3D\*q \*q" boolean \*q +Enable support for the legacy i915_dri.so 3D driver. +This will, among other things, make the 2D driver tell libGL to +load the 3D driver i915_dri.so instead of the newer i915tex_dri.so. +This option is only used for chipsets in the range i830-i945. +Default for i830-i945 series: Enabled for i915 drm versions < 1.7.0. Otherwise +disabled. +Default for i810: The option is not used. +Default for i965: The option is always true. +.TP +.BI "Option \*qAperTexSize\*q \*q" integer \*q +Give the size in kiB of the AGP aperture area that is reserved for the +DRM memory manager present in i915 drm from version 1.7.0 and upwards, +and that is used with the 3D driver in Mesa from version 6.5.2 and +upwards. If the size is set too high to make room for pre-allocated +VideoRam, the driver will try to reduce it automatically. If you use only +older Mesa or DRM versions, you may set this value to zero, and +atctivate the legacy texture pool (see +.B "Option \*qLegacy3D\*q" +). If you run 3D programs with large texture memory requirements, you might +gain some performance by increasing this value. +Default: 32768. + .SH "SEE ALSO" __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__) diff -u -r -N -p xf86-video-intel.modesetting/src/i810_driver.c xf86-video-intel.modesetting.orig/src/i810_driver.c --- xf86-video-intel.modesetting/src/i810_driver.c 2006-11-19 14:01:37.000000000 +0100 +++ xf86-video-intel.modesetting.orig/src/i810_driver.c 2006-11-19 14:00:52.000000000 +0100 @@ -313,6 +313,12 @@ const char *I810drmSymbols[] = { "drmGetLibVersion", "drmGetVersion", "drmRmMap", +#ifdef XSERVER_LIBDRM_MM + "drmMMInit", + "drmMMTakedown", + "drmMMLock", + "drmMMUnlock", +#endif NULL }; diff -u -r -N -p xf86-video-intel.modesetting/src/i830.h xf86-video-intel.modesetting.orig/src/i830.h --- xf86-video-intel.modesetting/src/i830.h 2006-11-19 14:01:37.000000000 +0100 +++ xf86-video-intel.modesetting.orig/src/i830.h 2006-11-19 14:00:52.000000000 +0100 @@ -86,6 +86,13 @@ typedef struct _I830OutputRec I830Output * Paulo César Pereira de Andrade <pcpa@conectiva.com.br>. */ +#ifdef XF86DRI +#define I830_MM_MINPAGES 512 +#define I830_MM_MAXSIZE (32*1024) +#define I830_KERNEL_MM (1 << 0) /* Initialize the kernel memory manager*/ +#define I830_KERNEL_TEX (1 << 1) /* Allocate texture memory pool */ +#endif + typedef struct _I830Rec *I830Ptr; typedef void (*I830WriteIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr, @@ -367,6 +374,8 @@ typedef struct _I830Rec { int TexGranularity; int drmMinor; Bool have3DWindows; + int mmModeFlags; + int mmSize; unsigned int front_tiled; unsigned int back_tiled; @@ -730,4 +739,10 @@ void i830_tv_init(ScrnInfoPtr pScrn); #define M_T_DRIVER 0x40 #endif +/* + * Xserver MM compatibility. Remove code guarded by this when the + * XServer contains the libdrm mm code + */ +#undef XSERVER_LIBDRM_MM + #endif /* _I830_H_ */ diff -u -r -N -p xf86-video-intel.modesetting/src/i830_dri.c xf86-video-intel.modesetting.orig/src/i830_dri.c --- xf86-video-intel.modesetting/src/i830_dri.c 2006-11-19 14:01:37.000000000 +0100 +++ xf86-video-intel.modesetting.orig/src/i830_dri.c 2006-11-19 14:00:52.000000000 +0100 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c,v 1.15 2003/06/18 13:14:17 dawes Exp $ */ +/* $xfree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.c,v 1.15 2003/06/18 13:14:17 dawes Exp $ */ /************************************************************************** Copyright 2001 VA Linux Systems Inc., Fremont, California. @@ -84,8 +84,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dristruct.h" static char I830KernelDriverName[] = "i915"; -static char I830ClientDriverName[] = "i915"; +static char I830ClientDriverName[] = "i915tex"; static char I965ClientDriverName[] = "i965"; +static char I830LegacyClientDriverName[] = "i915"; static Bool I830InitVisualConfigs(ScreenPtr pScreen); static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual, @@ -644,10 +645,31 @@ I830DRIScreenInit(ScreenPtr pScreen) return FALSE; } pI830->drmMinor = version->version_minor; + if (!(pI830->mmModeFlags & I830_KERNEL_TEX)) { + if ((version->version_major > 1) || + ((version->version_minor >= 7) && + (version->version_major == 1))) { + pI830->mmModeFlags |= I830_KERNEL_MM; + } else { + pI830->mmModeFlags |= I830_KERNEL_TEX; + } + } else { + xf86DrvMsg(pScreen->myNum, X_INFO, + "Not enabling the DRM memory manager.\n"); + } drmFreeVersion(version); } } + /* + * Backwards compatibility + */ + + if ((pDRIInfo->clientDriverName == I830ClientDriverName) && + (pI830->mmModeFlags & I830_KERNEL_TEX)) { + pDRIInfo->clientDriverName = I830LegacyClientDriverName; + } + return TRUE; } @@ -707,18 +729,20 @@ I830DRIMapScreenRegions(ScrnInfoPtr pScr xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Depth Buffer = 0x%08x\n", (int)sarea->depth_handle); - if (drmAddMap(pI830->drmSubFD, - (drm_handle_t)sarea->tex_offset + pI830->LinearAddr, - sarea->tex_size, DRM_AGP, 0, - (drmAddress) &sarea->tex_handle) < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] drmAddMap(tex_handle) failed. Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] textures = 0x%08x\n", - (int)sarea->tex_handle); + if (pI830->mmModeFlags & I830_KERNEL_TEX) { + if (drmAddMap(pI830->drmSubFD, + (drm_handle_t)sarea->tex_offset + pI830->LinearAddr, + sarea->tex_size, DRM_AGP, 0, + (drmAddress) &sarea->tex_handle) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] drmAddMap(tex_handle) failed. Disabling DRI\n"); + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] textures = 0x%08x\n", + (int)sarea->tex_handle); + } return TRUE; } @@ -1475,7 +1499,7 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, success = I830DRIMapScreenRegions(pScrn, sarea); - if (success) + if (success && (pI830->mmModeFlags & I830_KERNEL_TEX)) I830InitTextureHeap(pScrn, sarea); return success; diff -u -r -N -p xf86-video-intel.modesetting/src/i830_driver.c xf86-video-intel.modesetting.orig/src/i830_driver.c --- xf86-video-intel.modesetting/src/i830_driver.c 2006-11-19 14:05:21.000000000 +0100 +++ xf86-video-intel.modesetting.orig/src/i830_driver.c 2006-11-19 14:00:52.000000000 +0100 @@ -197,6 +197,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef XF86DRI #include "dri.h" +#include <sys/ioctl.h> +#include <errno.h> #endif #define BIT(x) (1 << (x)) @@ -262,7 +264,9 @@ typedef enum { OPTION_CHECKDEVICES, OPTION_FIXEDPIPE, OPTION_ROTATE, - OPTION_LINEARALLOC + OPTION_LINEARALLOC, + OPTION_INTELTEXPOOL, + OPTION_INTELMMSIZE } I830Opts; static OptionInfoRec I830Options[] = { @@ -281,6 +285,8 @@ static OptionInfoRec I830Options[] = { {OPTION_FIXEDPIPE, "FixedPipe", OPTV_ANYSTR, {0}, FALSE}, {OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE}, {OPTION_LINEARALLOC, "LinearAlloc", OPTV_INTEGER, {0}, FALSE}, + {OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_INTELMMSIZE, "AperTexSize", OPTV_INTEGER, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; /* *INDENT-ON* */ @@ -771,6 +777,27 @@ i830SetHotkeyControl(ScrnInfoPtr pScrn, pI830->writeControl(pI830, GRX, 0x18, gr18); } +#ifdef XF86DRI +static void +I830ReduceMMSize(ScrnInfoPtr pScrn, unsigned long newSize, + const char *reason) +{ + I830Ptr pI830 = I830PTR(pScrn); + + newSize = ROUND_DOWN_TO(newSize, GTT_PAGE_SIZE); + if (newSize / GTT_PAGE_SIZE > I830_MM_MINPAGES) { + pI830->mmSize = newSize / 1024; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "DRM memory manager aperture size is reduced to %d kiB\n" + "\t%s\n", pI830->mmSize, reason); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "DRM memory manager will be disabled\n\t%s\n", reason); + pI830->mmSize = 0; + } +} +#endif + static Bool I830PreInit(ScrnInfoPtr pScrn, int flags) { @@ -788,6 +815,9 @@ I830PreInit(ScrnInfoPtr pScrn, int flags Bool enable; const char *chipname; int mem_skip; +#ifdef XF86DRI + unsigned long savedMMSize; +#endif if (pScrn->numEntities != 1) return FALSE; @@ -1164,7 +1194,46 @@ I830PreInit(ScrnInfoPtr pScrn, int flags "runs only at depths 16 and 24.\n"); pI830->directRenderingDisabled = TRUE; } - } + + pI830->mmModeFlags = 0; + + if (!pI830->directRenderingDisabled) { + Bool tmp = FALSE; + + if (IS_I965G(pI830)) + pI830->mmModeFlags |= I830_KERNEL_TEX; + + from = X_PROBED; + if (xf86GetOptValBool(pI830->Options, + OPTION_INTELTEXPOOL, &tmp)) { + from = X_CONFIG; + if (tmp) { + pI830->mmModeFlags |= I830_KERNEL_TEX; + } else { + pI830->mmModeFlags &= ~I830_KERNEL_TEX; + } + } + if (from == X_CONFIG || + (pI830->mmModeFlags & I830_KERNEL_TEX)) { + xf86DrvMsg(pScrn->scrnIndex, from, + "Will %stry to allocate texture pool " + "for old Mesa 3D driver.\n", + (pI830->mmModeFlags & I830_KERNEL_TEX) ? + "" : "not "); + } + pI830->mmSize = I830_MM_MAXSIZE; + from = X_INFO; + if (xf86GetOptValInteger(pI830->Options, OPTION_INTELMMSIZE, + &(pI830->mmSize))) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, + "Will try to reserve %d kiB of AGP aperture space\n" + "\tfor the DRM memory manager.\n", + pI830->mmSize); + } + } + #endif pI830->LinearAlloc = 0; @@ -1713,9 +1782,15 @@ I830PreInit(ScrnInfoPtr pScrn, int flags * If DRI is potentially usable, check if there is enough memory available * for it, and if there's also enough to allow tiling to be enabled. */ + #if defined(XF86DRI) - if (!I830CheckDRIAvailable(pScrn)) + if (!I830CheckDRIAvailable(pScrn)) { pI830->directRenderingDisabled = TRUE; + pI830->mmSize = 0; + } else if (pScrn->videoRam > pI830->FbMapSize / 1024 - pI830->mmSize) { + I830ReduceMMSize(pScrn, pI830->FbMapSize - KB(pScrn->videoRam), + "to make room for video memory"); + } if (I830IsPrimary(pScrn) && !pI830->directRenderingDisabled) { int savedDisplayWidth = pScrn->displayWidth; @@ -1757,7 +1832,9 @@ I830PreInit(ScrnInfoPtr pScrn, int flags * If the displayWidth is a tilable pitch, test if there's enough * memory available to enable tiling. */ + savedMMSize = pI830->mmSize; if (pScrn->displayWidth == pitches[i]) { + retry_dryrun: I830ResetAllocations(pScrn, 0); if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) && I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN)) { @@ -1769,7 +1846,13 @@ I830PreInit(ScrnInfoPtr pScrn, int flags "required to\n\tenable tiling mode for DRI.\n", (memNeeded + 1023) / 1024); } - if (pI830->MemoryAperture.Size < 0) { + if (pI830->MemoryAperture.Size < 0) { + if (KB(pI830->mmSize) > I830_MM_MINPAGES * GTT_PAGE_SIZE) { + I830ReduceMMSize(pScrn, I830_MM_MINPAGES * GTT_PAGE_SIZE, + "to make room in AGP aperture for tiling."); + goto retry_dryrun; + } + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Allocation with DRI tiling enabled would " "exceed the\n" @@ -1797,7 +1880,9 @@ I830PreInit(ScrnInfoPtr pScrn, int flags * Tiling can't be enabled. Check if there's enough memory for DRI * without tiling. */ + pI830->mmSize = savedMMSize; pI830->disableTiling = TRUE; + retry_dryrun2: I830ResetAllocations(pScrn, 0); if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) && I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_NO_TILING)) { @@ -1810,6 +1895,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags (memNeeded + 1023) / 1024); } if (pI830->MemoryAperture.Size < 0) { + if (KB(pI830->mmSize) > I830_MM_MINPAGES * GTT_PAGE_SIZE) { + I830ReduceMMSize(pScrn, I830_MM_MINPAGES * GTT_PAGE_SIZE, + "to save AGP aperture space for video memory."); + goto retry_dryrun2; + } xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Allocation with DRI enabled would " "exceed the\n" @@ -1818,6 +1908,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags pI830->FbMapSize / 1024, -pI830->MemoryAperture.Size / 1024); } + pI830->mmSize = 0; pI830->directRenderingDisabled = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); } @@ -2753,6 +2844,87 @@ IntelEmitInvarientState(ScrnInfoPtr pScr } } +#ifdef XF86DRI +#ifndef DRM_BO_MEM_TT +#error "Wrong drm.h file included. You need to compile and install a recent libdrm." +#endif + +#ifndef XSERVER_LIBDRM_MM + +static int +I830DrmMMInit(int drmFD, unsigned long pageOffs, unsigned long pageSize, + unsigned memType) +{ + + drm_mm_init_arg_t arg; + int ret; + + memset(&arg, 0, sizeof(arg)); + arg.req.op = mm_init; + arg.req.p_offset = pageOffs; + arg.req.p_size = pageSize; + arg.req.mem_type = memType; + + ret = ioctl(drmFD, DRM_IOCTL_MM_INIT, &arg); + + if (ret) + return -errno; + + return 0; + +} + +static int +I830DrmMMTakedown(int drmFD, unsigned memType) +{ + drm_mm_init_arg_t arg; + int ret = 0; + + memset(&arg, 0, sizeof(arg)); + arg.req.op = mm_takedown; + arg.req.mem_type = memType; + if (ioctl(drmFD, DRM_IOCTL_MM_INIT, &arg)) { + ret = -errno; + } + + return ret; +} + +static int I830DrmMMLock(int fd, unsigned memType) +{ + drm_mm_init_arg_t arg; + int ret; + + memset(&arg, 0, sizeof(arg)); + arg.req.op = mm_lock; + arg.req.mem_type = memType; + + do{ + ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg); + } while (ret && errno == EAGAIN); + + return ret; +} + +static int I830DrmMMUnlock(int fd, unsigned memType) +{ + drm_mm_init_arg_t arg; + int ret; + + memset(&arg, 0, sizeof(arg)); + arg.req.op = mm_unlock; + arg.req.mem_type = memType; + + do{ + ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg); + } while (ret && errno == EAGAIN); + + return ret; +} + +#endif +#endif + static Bool I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { @@ -3199,6 +3371,48 @@ I830ScreenInit(int scrnIndex, ScreenPtr break; } + +#ifdef XF86DRI + if (pI830->directRenderingEnabled && (pI830->mmModeFlags & I830_KERNEL_MM)) { + unsigned long aperEnd = ROUND_DOWN_TO(pI830->FbMapSize, GTT_PAGE_SIZE) + / GTT_PAGE_SIZE; + unsigned long aperStart = ROUND_TO(pI830->FbMapSize - KB(pI830->mmSize), GTT_PAGE_SIZE) + / GTT_PAGE_SIZE; + + if (aperEnd < aperStart || aperEnd - aperStart < I830_MM_MINPAGES) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Too little AGP aperture space for DRM memory manager.\n" + "\tPlease increase AGP aperture size from BIOS configuration screen\n" + "\tor decrease the amount of video RAM using option \"VideoRam\".\n" + "\tDisabling DRI.\n"); + pI830->directRenderingOpen = FALSE; + I830DRICloseScreen(pScreen); + pI830->directRenderingEnabled = FALSE; + } else { +#ifndef XSERVER_LIBDRM_MM + if (I830DrmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart, + DRM_BO_MEM_TT)) { +#else + if (drmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart, + DRM_BO_MEM_TT)) { +#endif + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not initialize the DRM memory manager.\n"); + + pI830->directRenderingOpen = FALSE; + I830DRICloseScreen(pScreen); + pI830->directRenderingEnabled = FALSE; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Initialized DRM memory manager, %ld AGP pages\n" + "\tat AGP offset 0x%lx\n", + aperEnd - aperStart, + aperStart); + } + } + } +#endif + return TRUE; } @@ -3268,7 +3482,13 @@ I830LeaveVT(int scrnIndex, int flags) #ifdef XF86DRI if (pI830->directRenderingOpen) { DRILock(screenInfo.screens[pScrn->scrnIndex], 0); - + if (pI830->mmModeFlags & I830_KERNEL_MM) { +#ifndef XSERVER_LIBDRM_MM + I830DrmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT); +#else + drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT); +#endif + } I830DRISetVBlankInterrupt (pScrn, FALSE); drmCtlUninstHandler(pI830->drmSubFD); @@ -3383,6 +3603,14 @@ I830EnterVT(int scrnIndex, int flags) for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++) sarea->texList[i].age = sarea->texAge; + if (pI830->mmModeFlags & I830_KERNEL_MM) { +#ifndef XSERVER_LIBDRM_MM + I830DrmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT); +#else + drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT); +#endif + } + DPRINTF(PFX, "calling dri unlock\n"); DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); } @@ -3583,6 +3811,13 @@ I830CloseScreen(int scrnIndex, ScreenPtr pI830->closing = TRUE; #ifdef XF86DRI if (pI830->directRenderingOpen) { + if (pI830->mmModeFlags & I830_KERNEL_MM) { +#ifndef XSERVER_LIBDRM_MM + I830DrmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT); +#else + drmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT); +#endif + } pI830->directRenderingOpen = FALSE; I830DRICloseScreen(pScreen); } diff -u -r -N -p xf86-video-intel.modesetting/src/i830_memory.c xf86-video-intel.modesetting.orig/src/i830_memory.c --- xf86-video-intel.modesetting/src/i830_memory.c 2006-11-19 14:01:37.000000000 +0100 +++ xf86-video-intel.modesetting.orig/src/i830_memory.c 2006-11-19 14:00:52.000000000 +0100 @@ -1099,6 +1099,12 @@ I830ResetAllocations(ScrnInfoPtr pScrn, pI830->MemoryAperture.Start = pI830->StolenMemory.End; pI830->MemoryAperture.End = pI830->FbMapSize; pI830->MemoryAperture.Size = pI830->FbMapSize - pI830->StolenMemory.Size; +#ifdef XF86DRI + if (!pI830->directRenderingDisabled) { + pI830->MemoryAperture.End -= KB(pI830->mmSize); + pI830->MemoryAperture.Size -= KB(pI830->mmSize); + } +#endif pI830->StolenPool.Fixed = pI830->StolenMemory; pI830->StolenPool.Total = pI830->StolenMemory; pI830->StolenPool.Free = pI830->StolenPool.Total; @@ -1271,37 +1277,41 @@ I830AllocateTextureMemory(ScrnInfoPtr pS /* Allocate the remaining space for textures. */ memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem)); pI830->TexMem.Key = -1; - size = GetFreeSpace(pScrn); - if (dryrun && (size < MB(1))) - size = MB(1); - i = myLog2(size / I830_NR_TEX_REGIONS); - if (i < I830_LOG_MIN_TEX_REGION_SIZE) - i = I830_LOG_MIN_TEX_REGION_SIZE; - pI830->TexGranularity = i; - /* Truncate size */ - size >>= i; - size <<= i; - if (size < KB(512)) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Less than 512 kBytes for texture space (real %ld kBytes).\n", - size / 1024); + + if (pI830->mmModeFlags & I830_KERNEL_TEX) { + + size = GetFreeSpace(pScrn); + if (dryrun && (size < MB(1))) + size = MB(1); + i = myLog2(size / I830_NR_TEX_REGIONS); + if (i < I830_LOG_MIN_TEX_REGION_SIZE) + i = I830_LOG_MIN_TEX_REGION_SIZE; + pI830->TexGranularity = i; + /* Truncate size */ + size >>= i; + size <<= i; + if (size < KB(512)) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Less than 512 kBytes for texture space (real %ld kBytes).\n", + size / 1024); + } + return FALSE; } - return FALSE; - } - alloced = I830AllocVidMem(pScrn, &(pI830->TexMem), - &(pI830->StolenPool), size, GTT_PAGE_SIZE, - flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); - if (alloced < size) { - if (!dryrun) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to allocate texture space.\n"); + alloced = I830AllocVidMem(pScrn, &(pI830->TexMem), + &(pI830->StolenPool), size, GTT_PAGE_SIZE, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate texture space.\n"); + } + return FALSE; } - return FALSE; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %ld kB for textures at 0x%lx\n", s, + alloced / 1024, pI830->TexMem.Start); } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, - "%sAllocated %ld kB for textures at 0x%lx\n", s, - alloced / 1024, pI830->TexMem.Start); return TRUE; } @@ -1499,7 +1509,9 @@ I830FixupOffsets(ScrnInfoPtr pScrn) I830FixOffset(pScrn, &(pI830->ContextMem)); I830FixOffset(pScrn, &(pI830->BackBuffer)); I830FixOffset(pScrn, &(pI830->DepthBuffer)); - I830FixOffset(pScrn, &(pI830->TexMem)); + if (pI830->mmModeFlags & I830_KERNEL_TEX) { + I830FixOffset(pScrn, &(pI830->TexMem)); + } } #endif return TRUE; @@ -1898,7 +1910,8 @@ I830BindAGPMemory(ScrnInfoPtr pScrn) return FALSE; if (!BindMemRange(pScrn, &(pI830->DepthBuffer))) return FALSE; - if (!BindMemRange(pScrn, &(pI830->TexMem))) + if ((pI830->mmModeFlags & I830_KERNEL_TEX) && + !BindMemRange(pScrn, &(pI830->TexMem))) return FALSE; } #endif @@ -1982,7 +1995,8 @@ I830UnbindAGPMemory(ScrnInfoPtr pScrn) return FALSE; if (!UnbindMemRange(pScrn, &(pI830->DepthBuffer))) return FALSE; - if (!UnbindMemRange(pScrn, &(pI830->TexMem))) + if ((pI830->mmModeFlags & I830_KERNEL_TEX) && + !UnbindMemRange(pScrn, &(pI830->TexMem))) return FALSE; } #endif diff -u -r -N -p xf86-video-intel.modesetting/src/i830_rotate.c xf86-video-intel.modesetting.orig/src/i830_rotate.c --- xf86-video-intel.modesetting/src/i830_rotate.c 2006-11-19 14:01:37.000000000 +0100 +++ xf86-video-intel.modesetting.orig/src/i830_rotate.c 2006-11-19 14:00:52.000000000 +0100 @@ -778,7 +778,7 @@ I830Rotate(ScrnInfoPtr pScrn, DisplayMod /* Do heap teardown here */ - { + if (pI8301->mmModeFlags & I830_KERNEL_TEX) { drmI830MemDestroyHeap destroy; destroy.region = I830_MEM_REGION_AGP; @@ -790,10 +790,11 @@ I830Rotate(ScrnInfoPtr pScrn, DisplayMod } } - - if (pI8301->TexMem.Key != -1) - xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key); - I830FreeVidMem(pScrn1, &(pI8301->TexMem)); + if (pI8301->mmModeFlags & I830_KERNEL_TEX) { + if (pI8301->TexMem.Key != -1) + xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key); + I830FreeVidMem(pScrn1, &(pI8301->TexMem)); + } if (pI8301->StolenPool.Allocated.Key != -1) { xf86UnbindGARTMemory(pScrn1->scrnIndex, pI8301->StolenPool.Allocated.Key); xf86DeallocateGARTMemory(pScrn1->scrnIndex, pI8301->StolenPool.Allocated.Key); @@ -943,9 +944,11 @@ I830Rotate(ScrnInfoPtr pScrn, DisplayMod pI8301->disableTiling ? ALLOC_NO_TILING : 0)) goto BAIL3; - if (!I830AllocateTextureMemory(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - goto BAIL4; + if (pI8301->mmModeFlags & I830_KERNEL_TEX) { + if (!I830AllocateTextureMemory(pScrn1, + pI8301->disableTiling ? ALLOC_NO_TILING : 0)) + goto BAIL4; + } I830DoPoolAllocation(pScrn1, &(pI8301->StolenPool)); @@ -958,8 +961,10 @@ I830Rotate(ScrnInfoPtr pScrn, DisplayMod xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->DepthBuffer.Key, pI8301->DepthBuffer.Offset); if (pI8301->StolenPool.Allocated.Key != -1) xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->StolenPool.Allocated.Key, pI8301->StolenPool.Allocated.Offset); - if (pI8301->TexMem.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key, pI8301->TexMem.Offset); + if (pI8301->mmModeFlags & I830_KERNEL_TEX) { + if (pI8301->TexMem.Key != -1) + xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key, pI8301->TexMem.Offset); + } I830SetupMemoryTiling(pScrn1); /* update fence registers */ for (i = 0; i < 8; i++) @@ -1031,7 +1036,6 @@ I830Rotate(ScrnInfoPtr pScrn, DisplayMod pI830->AccelInfoRec->maxOffPixWidth = 1; pI830->AccelInfoRec->maxOffPixHeight = 1; } - return TRUE; BAIL4: @@ -1175,11 +1179,12 @@ BAIL0: pI8301->disableTiling ? ALLOC_NO_TILING : 0)) xf86DrvMsg(pScrn1->scrnIndex, X_INFO, "Oh dear, the depth buffer failed - badness\n"); - - if (!I830AllocateTextureMemory(pScrn1, - pI8301->disableTiling ? ALLOC_NO_TILING : 0)) - xf86DrvMsg(pScrn1->scrnIndex, X_INFO, - "Oh dear, the texture cache failed - badness\n"); + if (pI8301->mmModeFlags & I830_KERNEL_TEX) { + if (!I830AllocateTextureMemory(pScrn1, + pI8301->disableTiling ? ALLOC_NO_TILING : 0)) + xf86DrvMsg(pScrn1->scrnIndex, X_INFO, + "Oh dear, the texture cache failed - badness\n"); + } I830DoPoolAllocation(pScrn1, &(pI8301->StolenPool)); @@ -1192,8 +1197,10 @@ BAIL0: xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->DepthBuffer.Key, pI8301->DepthBuffer.Offset); if (pI8301->StolenPool.Allocated.Key != -1) xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->StolenPool.Allocated.Key, pI8301->StolenPool.Allocated.Offset); - if (pI8301->TexMem.Key != -1) - xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key, pI8301->TexMem.Offset); + if (pI8301->mmModeFlags & I830_KERNEL_TEX) { + if (pI8301->TexMem.Key != -1) + xf86BindGARTMemory(pScrn1->scrnIndex, pI8301->TexMem.Key, pI8301->TexMem.Offset); + } I830SetupMemoryTiling(pScrn1); /* update fence registers */ for (i = 0; i < 8; i++)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor