diff options
author | Wang Zhenyu <zhenyu.z.wang@intel.com> | 2006-11-29 15:47:19 +0800 |
---|---|---|
committer | Keith Packard <keithp@neko.keithp.com> | 2007-01-06 14:37:29 -0800 |
commit | 1329c86f2a4b3664920ded970a984a745a530da4 (patch) | |
tree | c20309d61567db3c41ff5973d33fb86002b67e25 | |
parent | f9c3ef40100acb85fca6e49c5c0e98f5c9ac97ca (diff) |
[PATCH] EXA state mem for G965
Not split offscreen mem for exa, but alloc a dedicated one
for G965 states.
Signed-off-by: Keith Packard <keithp@neko.keithp.com>
-rw-r--r-- | src/i830.h | 2 | ||||
-rw-r--r-- | src/i830_exa.c | 7 | ||||
-rw-r--r-- | src/i830_memory.c | 36 | ||||
-rw-r--r-- | src/i965_exa_render.c | 15 |
4 files changed, 42 insertions, 18 deletions
@@ -73,6 +73,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef I830_USE_EXA #include "exa.h" Bool I830EXAInit(ScreenPtr pScreen); +#define EXA_LINEAR_EXTRA (64*1024) #endif #ifdef I830_USE_XAA @@ -267,6 +268,7 @@ typedef struct _I830Rec { I830MemRange Scratch2; #ifdef I830_USE_EXA I830MemRange Offscreen; + I830MemRange EXAStateMem; /* specific exa state for G965 */ #endif /* Regions allocated either from the above pools, or from agpgart. */ I830MemRange *CursorMem; diff --git a/src/i830_exa.c b/src/i830_exa.c index c5b91b04..3e874c97 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -425,7 +425,6 @@ IntelEXADoneComposite(PixmapPtr pDst) #endif } -#define BRW_LINEAR_EXTRA (32*1024) /* * TODO: * - Dual head? @@ -448,11 +447,7 @@ I830EXAInit(ScreenPtr pScreen) pI830->EXADriverPtr->exa_minor = 0; pI830->EXADriverPtr->memoryBase = pI830->FbBase; pI830->EXADriverPtr->offScreenBase = pI830->Offscreen.Start; - if (IS_I965G(pI830)) - pI830->EXADriverPtr->memorySize = pI830->Offscreen.End - - BRW_LINEAR_EXTRA; /* BRW needs state buffer*/ - else - pI830->EXADriverPtr->memorySize = pI830->Offscreen.End; + pI830->EXADriverPtr->memorySize = pI830->Offscreen.End; DPRINTF(PFX, "EXA Mem: memoryBase 0x%x, end 0x%x, offscreen base 0x%x, memorySize 0x%x\n", pI830->EXADriverPtr->memoryBase, diff --git a/src/i830_memory.c b/src/i830_memory.c index 5bbf3e30..20e3afb6 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -841,6 +841,25 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags) pI830->Offscreen.Start, pI830->Offscreen.Size/1024); } } + if (IS_I965G(pI830)) { + memset(&(pI830->EXAStateMem), 0, sizeof(I830MemRange)); + pI830->EXAStateMem.Key = -1; + size = ROUND_TO_PAGE(EXA_LINEAR_EXTRA); + align = GTT_PAGE_SIZE; + alloced = I830AllocVidMem(pScrn, &(pI830->EXAStateMem), + &(pI830->StolenPool), size, align, + flags | FROM_ANYWHERE | ALLOCATE_AT_TOP); + if (alloced < size) { + if (!dryrun) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "G965: Failed to allocate exa state buffer space.\n"); + } + return FALSE; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity, + "%sAllocated %ld kB for the G965 exa state buffer at 0x%lx - 0x%lx.\n", s, + alloced / 1024, pI830->EXAStateMem.Start, pI830->EXAStateMem.End); + } #endif } else { long lineSize; @@ -1493,6 +1512,11 @@ I830FixupOffsets(ScrnInfoPtr pScrn) } } #endif +#ifdef I830_USE_EXA + I830FixOffset(pScrn, &(pI830->Offscreen)); + if (IS_I965G(pI830)) + I830FixOffset(pScrn, &(pI830->EXAStateMem)); +#endif return TRUE; } @@ -1894,6 +1918,12 @@ I830BindAGPMemory(ScrnInfoPtr pScrn) return FALSE; } #endif +#ifdef I830_USE_EXA + if (!BindMemRange(pScrn, &(pI830->Offscreen))) + return FALSE; + if (IS_I965G(pI830) && !BindMemRange(pScrn, &(pI830->EXAStateMem))) + return FALSE; +#endif pI830->GttBound = 1; } @@ -1979,6 +2009,12 @@ I830UnbindAGPMemory(ScrnInfoPtr pScrn) return FALSE; } #endif +#ifdef I830_USE_EXA + if (!UnbindMemRange(pScrn, &(pI830->Offscreen))) + return FALSE; + if (IS_I965G(pI830) && !UnbindMemRange(pScrn, &(pI830->EXAStateMem))) + return FALSE; +#endif if (!xf86ReleaseGART(pScrn->scrnIndex)) return FALSE; diff --git a/src/i965_exa_render.c b/src/i965_exa_render.c index 7fbf99c8..fe3007b0 100644 --- a/src/i965_exa_render.c +++ b/src/i965_exa_render.c @@ -490,21 +490,12 @@ ErrorF("i965 prepareComposite\n"); next_offset = binding_table_offset + (binding_table_entries * 4); total_state_size = next_offset; + assert(total_state_size < EXA_LINEAR_EXTRA); - /* - * XXX: Use the extra space allocated at the end of the exa offscreen buffer? - */ -#define BRW_LINEAR_EXTRA (32*1024) - - state_base_offset = (pI830->Offscreen.End - - BRW_LINEAR_EXTRA); - + state_base_offset = pI830->EXAStateMem.Start; state_base_offset = ALIGN(state_base_offset, 64); state_base = (char *)(pI830->FbBase + state_base_offset); - /* Set up our pointers to state structures in framebuffer. It would probably - * be a good idea to fill these structures out in system memory and then dump - * them there, instead. - */ + vs_state = (void *)(state_base + vs_offset); sf_state = (void *)(state_base + sf_offset); wm_state = (void *)(state_base + wm_offset); |