From 4a53f7bc74fbbd84a3d0a28fc3316cdf5e826121 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 16 Jan 2004 13:41:18 +0000 Subject: Respect the 'in_use' field in the global LRU as a marker for kernel-reserved memory regions. --- src/mesa/drivers/dri/common/texmem.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index 4ed05219db..53e87b9593 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -246,7 +246,6 @@ void driUpdateTextureLRU( driTextureObject * t ) for (i = start ; i <= end ; i++) { - list[i].in_use = 1; list[i].age = heap->local_age; /* remove_from_list(i) @@ -374,7 +373,7 @@ void driDestroyTextureObject( driTextureObject * t ) * \param heap Heap whose state is to be updated * \param offset Byte offset in the heap that has been stolen * \param size Size, in bytes, of the stolen block - * \param in_use Non-zero if the block is in-use by another context + * \param in_use Non-zero if the block is pinned/reserved by the kernel */ static void driTexturesGone( driTexHeap * heap, int offset, int size, @@ -396,19 +395,13 @@ static void driTexturesGone( driTexHeap * heap, int offset, int size, driSwapOutTextureObject( t ); } else { - if ( in_use && - offset == t->memBlock->ofs && size == t->memBlock->size ) { - /* Matching placeholder already exists */ - return; - } else { - driDestroyTextureObject( t ); - } + driDestroyTextureObject( t ); } } } - if ( in_use ) { + { t = (driTextureObject *) CALLOC( heap->texture_object_size ); if ( t == NULL ) return; @@ -420,6 +413,8 @@ static void driTexturesGone( driTexHeap * heap, int offset, int size, return; } t->heap = heap; + if (in_use) + t->bound = 99; insert_at_head( & heap->texture_objects, t ); } } @@ -673,7 +668,7 @@ driCreateTextureHeap( unsigned heap_id, void * context, unsigned size, heap->destroy_texture_object = destroy_tex_obj; /* Force global heap init */ - if (heap->global_age == 0) + if (heap->global_age[0] == 0) heap->local_age = ~0; else heap->local_age = 0; -- cgit v1.2.3