diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2006-01-23 10:10:48 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2006-01-23 10:10:48 +0000 |
commit | 39c492bb14d706ffa8bf04f78048c05de735492b (patch) | |
tree | f29a5df4f7dc8013fb38b7b92b48b5f24a9cb8d2 /src/mesa/drivers/dri/i915/intel_texmem.c | |
parent | acd1f16b356ee21d40c706eda14b7105a84c8001 (diff) |
Add Intel 945GM support
Add rotation support
(Tungsten Graphics)
Diffstat (limited to 'src/mesa/drivers/dri/i915/intel_texmem.c')
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_texmem.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_texmem.c b/src/mesa/drivers/dri/i915/intel_texmem.c new file mode 100644 index 0000000000..09beec95b8 --- /dev/null +++ b/src/mesa/drivers/dri/i915/intel_texmem.c @@ -0,0 +1,72 @@ +#include "texmem.h" +#include "simple_list.h" +#include "imports.h" +#include "macros.h" + +#include "intel_tex.h" + +static GLuint +driLog2( GLuint n ) +{ + GLuint log2; + + for ( log2 = 1 ; n > 1 ; log2++ ) { + n >>= 1; + } + + return log2; +} + +static void calculate_heap_size( driTexHeap * heap, unsigned size, + unsigned nr_regions, unsigned alignmentShift ) +{ + unsigned l; + + l = driLog2( (size - 1) / nr_regions ); + if ( l < alignmentShift ) + { + l = alignmentShift; + } + + heap->logGranularity = l; + heap->size = size & ~((1L << l) - 1); +} + + +GLboolean +intel_driReinitTextureHeap( driTexHeap *heap, + unsigned size ) +{ + driTextureObject *t, *tmp; + + /* Kick out everything: + */ + foreach_s ( t, tmp, & heap->texture_objects ) { + if ( t->tObj != NULL ) { + driSwapOutTextureObject( t ); + } + else { + driDestroyTextureObject( t ); + } + } + + /* Destroy the memory manager: + */ + mmDestroy( heap->memory_heap ); + + /* Recreate the memory manager: + */ + calculate_heap_size(heap, size, heap->nrRegions, heap->alignmentShift); + heap->memory_heap = mmInit( 0, heap->size ); + if ( heap->memory_heap == NULL ) { + fprintf(stderr, "driReinitTextureHeap: couldn't recreate memory heap\n"); + FREE( heap ); + return GL_FALSE; + } + + make_empty_list( & heap->texture_objects ); + + return GL_TRUE; +} + + |