diff options
author | Wang Zhenyu <zhenyu.z.wang@intel.com> | 2006-11-29 15:47:19 +0800 |
---|---|---|
committer | Wang Zhenyu <zhenyu.z.wang@intel.com> | 2006-11-29 15:47:19 +0800 |
commit | a06beb5f80f097fac3b718e742742bb32f1c1194 (patch) | |
tree | 04bdcebd4ecde32e4e83d22a3735a7fb797041a8 | |
parent | 4198f1216eb13b30d1e92d4395e98861f4324c38 (diff) |
EXA state mem for G965
Not split offscreen mem for exa, but alloc a dedicated one
for G965 states.
-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 @@ -243,6 +244,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 9b2e6b26..8b07ecb0 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -424,7 +424,6 @@ IntelEXADoneComposite(PixmapPtr pDst) #endif } -#define BRW_LINEAR_EXTRA (32*1024) /* * TODO: * - Dual head? @@ -447,11 +446,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 e3307d6f..4a8d480a 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -905,6 +905,25 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags) "offscreen memory at 0x%lx, size %ld KB\n", 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; @@ -1545,6 +1564,11 @@ I830FixupOffsets(ScrnInfoPtr pScrn) I830FixOffset(pScrn, &(pI830->TexMem)); } #endif +#ifdef I830_USE_EXA + I830FixOffset(pScrn, &(pI830->Offscreen)); + if (IS_I965G(pI830)) + I830FixOffset(pScrn, &(pI830->EXAStateMem)); +#endif return TRUE; } @@ -1945,6 +1969,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; } @@ -2029,6 +2059,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); |