Go to the source code of this file.
Functions | |
boolean | brw_pool_alloc (struct brw_mem_pool *pool, unsigned size, unsigned alignment, unsigned *offset_return) |
static void | brw_invalidate_pool (struct brw_mem_pool *pool) |
static void | brw_init_pool (struct brw_context *brw, unsigned pool_id, unsigned size) |
static void | brw_destroy_pool (struct brw_context *brw, unsigned pool_id) |
void | brw_pool_check_wrap (struct brw_context *brw, struct brw_mem_pool *pool) |
void | brw_init_pools (struct brw_context *brw) |
void | brw_destroy_pools (struct brw_context *brw) |
void | brw_invalidate_pools (struct brw_context *brw) |
For the 965, we create two state pools for state cache entries. Objects will be allocated into the pools depending on which state base address their pointer is relative to in other 965 state.
The state pools are relatively simple: As objects are allocated, increment the offset to allocate space. When the pool is "full" (rather, close to full), we reset the pool and reset the state cache entries that point into the pool.
Definition in file brw_state_pool.c.
static void brw_destroy_pool | ( | struct brw_context * | brw, | |
unsigned | pool_id | |||
) | [static] |
Definition at line 101 of file brw_state_pool.c.
References brw_mem_pool::brw, brw_mem_pool::buffer, brw_context::pipe, pipe_buffer_reference(), brw_context::pool, and pipe_context::screen.
00103 { 00104 struct brw_mem_pool *pool = &brw->pool[pool_id]; 00105 00106 pipe_buffer_reference( pool->brw->pipe.screen, 00107 &pool->buffer, 00108 NULL ); 00109 }
void brw_destroy_pools | ( | struct brw_context * | brw | ) |
Definition at line 127 of file brw_state_pool.c.
References brw_destroy_pool(), BRW_GS_POOL, and BRW_SS_POOL.
00128 { 00129 brw_destroy_pool(brw, BRW_GS_POOL); 00130 brw_destroy_pool(brw, BRW_SS_POOL); 00131 }
static void brw_init_pool | ( | struct brw_context * | brw, | |
unsigned | pool_id, | |||
unsigned | size | |||
) | [static] |
Definition at line 86 of file brw_state_pool.c.
References brw_mem_pool::brw, brw_mem_pool::buffer, brw_context::pipe, pipe_buffer_create(), brw_context::pool, pipe_context::screen, and brw_mem_pool::size.
00089 { 00090 struct brw_mem_pool *pool = &brw->pool[pool_id]; 00091 00092 pool->size = size; 00093 pool->brw = brw; 00094 00095 pool->buffer = pipe_buffer_create(brw->pipe.screen, 00096 4096, 00097 0 /* DRM_BO_FLAG_MEM_TT */, 00098 size); 00099 }
void brw_init_pools | ( | struct brw_context * | brw | ) |
Definition at line 121 of file brw_state_pool.c.
References BRW_GS_POOL, brw_init_pool(), and BRW_SS_POOL.
00122 { 00123 brw_init_pool(brw, BRW_GS_POOL, 0x80000); 00124 brw_init_pool(brw, BRW_SS_POOL, 0x80000); 00125 }
static void brw_invalidate_pool | ( | struct brw_mem_pool * | pool | ) | [static] |
Definition at line 75 of file brw_state_pool.c.
References brw_mem_pool::brw, brw_clear_all_caches(), BRW_DEBUG, debug_printf(), DEBUG_STATE, and brw_mem_pool::offset.
00076 { 00077 if (BRW_DEBUG & DEBUG_STATE) 00078 debug_printf("\n\n\n %s \n\n\n", __FUNCTION__); 00079 00080 pool->offset = 0; 00081 00082 brw_clear_all_caches(pool->brw); 00083 }
void brw_invalidate_pools | ( | struct brw_context * | brw | ) |
Definition at line 134 of file brw_state_pool.c.
References BRW_GS_POOL, brw_invalidate_pool(), BRW_SS_POOL, and brw_context::pool.
00135 { 00136 brw_invalidate_pool(&brw->pool[BRW_GS_POOL]); 00137 brw_invalidate_pool(&brw->pool[BRW_SS_POOL]); 00138 }
boolean brw_pool_alloc | ( | struct brw_mem_pool * | pool, | |
unsigned | size, | |||
unsigned | alignment, | |||
unsigned * | offset_return | |||
) |
Definition at line 52 of file brw_state_pool.c.
References align(), assert, debug_printf(), brw_mem_pool::offset, brw_mem_pool::size, and TRUE.
00056 { 00057 unsigned fixup = align(pool->offset, alignment) - pool->offset; 00058 00059 size = align(size, 4); 00060 00061 if (pool->offset + fixup + size >= pool->size) { 00062 debug_printf("%s failed\n", __FUNCTION__); 00063 assert(0); 00064 exit(0); 00065 } 00066 00067 pool->offset += fixup; 00068 *offset_return = pool->offset; 00069 pool->offset += size; 00070 00071 return TRUE; 00072 }
void brw_pool_check_wrap | ( | struct brw_context * | brw, | |
struct brw_mem_pool * | pool | |||
) |
Definition at line 112 of file brw_state_pool.c.
References brw_state_flags::brw, BRW_NEW_SCENE, brw_context::dirty, brw_mem_pool::offset, brw_mem_pool::size, and brw_context::state.
00114 { 00115 if (pool->offset > (pool->size * 3) / 4) { 00116 brw->state.dirty.brw |= BRW_NEW_SCENE; 00117 } 00118 00119 }