Go to the source code of this file.
Functions | |
boolean | brw_cached_batch_struct (struct brw_context *brw, const void *data, unsigned sz) |
static void | clear_batch_cache (struct brw_context *brw) |
void | brw_clear_batch_cache_flush (struct brw_context *brw) |
void | brw_destroy_batch_cache (struct brw_context *brw) |
boolean brw_cached_batch_struct | ( | struct brw_context * | brw, | |
const void * | data, | |||
unsigned | sz | |||
) |
Definition at line 40 of file brw_state_batch.c.
References assert, brw_batchbuffer_data(), brw_context::cached_batch_items, CALLOC_STRUCT, brw_context::emit_state_always, FALSE, FREE, brw_cached_batch_item::header, MALLOC, brw_cached_batch_item::next, header::opcode, brw_cached_batch_item::sz, TRUE, and brw_context::winsys.
00043 { 00044 struct brw_cached_batch_item *item = brw->cached_batch_items; 00045 struct header *newheader = (struct header *)data; 00046 00047 if (brw->emit_state_always) { 00048 brw_batchbuffer_data(brw->winsys, data, sz); 00049 return TRUE; 00050 } 00051 00052 while (item) { 00053 if (item->header->opcode == newheader->opcode) { 00054 if (item->sz == sz && memcmp(item->header, newheader, sz) == 0) 00055 return FALSE; 00056 if (item->sz != sz) { 00057 FREE(item->header); 00058 item->header = MALLOC(sz); 00059 item->sz = sz; 00060 } 00061 goto emit; 00062 } 00063 item = item->next; 00064 } 00065 00066 assert(!item); 00067 item = CALLOC_STRUCT(brw_cached_batch_item); 00068 item->header = MALLOC(sz); 00069 item->sz = sz; 00070 item->next = brw->cached_batch_items; 00071 brw->cached_batch_items = item; 00072 00073 emit: 00074 memcpy(item->header, newheader, sz); 00075 brw_batchbuffer_data(brw->winsys, data, sz); 00076 return TRUE; 00077 }
void brw_clear_batch_cache_flush | ( | struct brw_context * | brw | ) |
Definition at line 98 of file brw_state_batch.c.
References brw_state_flags::brw, brw_state_flags::cache, clear_batch_cache(), brw_context::dirty, and brw_context::state.
00099 { 00100 clear_batch_cache(brw); 00101 00102 /* brw_do_flush(brw, BRW_FLUSH_STATE_CACHE|BRW_FLUSH_READ_CACHE); */ 00103 00104 brw->state.dirty.brw |= ~0; 00105 brw->state.dirty.cache |= ~0; 00106 }
void brw_destroy_batch_cache | ( | struct brw_context * | brw | ) |
Definition at line 110 of file brw_state_batch.c.
References clear_batch_cache().
00111 { 00112 clear_batch_cache(brw); 00113 }
static void clear_batch_cache | ( | struct brw_context * | brw | ) | [static] |
Definition at line 79 of file brw_state_batch.c.
References brw_clear_all_caches(), brw_invalidate_pools(), brw_context::cached_batch_items, brw_cached_batch_item::header, and brw_cached_batch_item::next.
00080 { 00081 struct brw_cached_batch_item *item = brw->cached_batch_items; 00082 00083 while (item) { 00084 struct brw_cached_batch_item *next = item->next; 00085 free((void *)item->header); 00086 free(item); 00087 item = next; 00088 } 00089 00090 brw->cached_batch_items = NULL; 00091 00092 00093 brw_clear_all_caches(brw); 00094 00095 brw_invalidate_pools(brw); 00096 }