From: Oliver McFadden Date: Fri, 11 May 2007 21:08:56 +0000 (+0000) Subject: r300: Removed deprecated/disabled VBO code from r300_mem.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6a69bb586445da4c6bdfa00fa775a9286ead3c31;p=mesa.git r300: Removed deprecated/disabled VBO code from r300_mem.c Also removed a couple of unused fields from the r300_memory_manager structure. --- diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 00ff9812b89..9ea14ab4c78 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -447,15 +447,6 @@ static void r300FreeGartAllocations(r300ContextPtr r300) r300->rmm->u_list[i].pending = 0; r300->rmm->u_list[i].ptr = NULL; - if (r300->rmm->u_list[i].fb) { - LOCK_HARDWARE(&(r300->radeon)); - ret = mmFreeMem(r300->rmm->u_list[i].fb); - UNLOCK_HARDWARE(&(r300->radeon)); - if (ret) - fprintf(stderr, "failed to free!\n"); - r300->rmm->u_list[i].fb = NULL; - } - r300->rmm->u_list[i].ref_count = 0; } } r300->rmm->u_head = i; diff --git a/src/mesa/drivers/dri/r300/r300_mem.c b/src/mesa/drivers/dri/r300/r300_mem.c index 21c5d22d1b4..f8f9d4fcdf1 100644 --- a/src/mesa/drivers/dri/r300/r300_mem.c +++ b/src/mesa/drivers/dri/r300/r300_mem.c @@ -181,19 +181,6 @@ int r300_mem_alloc(r300ContextPtr rmesa, int alignment, int size) allocated -= rmesa->rmm->u_list[i].size; rmesa->rmm->u_list[i].pending = 0; rmesa->rmm->u_list[i].ptr = NULL; - - if (rmesa->rmm->u_list[i].fb) { - LOCK_HARDWARE(&(rmesa->radeon)); - ret = - mmFreeMem(rmesa->rmm->u_list[i].fb); - UNLOCK_HARDWARE(&(rmesa->radeon)); - - if (ret != 0) - fprintf(stderr, - "failed to free!\n"); - rmesa->rmm->u_list[i].fb = NULL; - } - rmesa->rmm->u_list[i].ref_count = 0; free = i; } } @@ -249,7 +236,6 @@ int r300_mem_alloc(r300ContextPtr rmesa, int alignment, int size) ((GLubyte *) rmesa->radeon.radeonScreen->gartTextures.map) + offset; rmesa->rmm->u_list[i].size = size; rmesa->rmm->u_list[i].age = 0; - rmesa->rmm->u_list[i].fb = NULL; //fprintf(stderr, "alloc %p at id %d\n", rmesa->rmm->u_list[i].ptr, i); #ifdef MM_DEBUG @@ -260,63 +246,6 @@ int r300_mem_alloc(r300ContextPtr rmesa, int alignment, int size) return i; } -#include "r300_emit.h" -static void emit_lin_cp(r300ContextPtr rmesa, unsigned long dst, - unsigned long src, unsigned long size) -{ - int cmd_reserved = 0; - int cmd_written = 0; - drm_radeon_cmd_header_t *cmd = NULL; - int cp_size; - - while (size > 0) { - cp_size = size; - if (cp_size > /*8190 */ 4096) - cp_size = /*8190 */ 4096; - - reg_start(0x146c, 1); - e32(0x52cc32fb); - - reg_start(0x15ac, 1); - e32(src); - e32(cp_size); - - reg_start(0x1704, 0); - e32(0x0); - - reg_start(0x1404, 1); - e32(dst); - e32(cp_size); - - reg_start(0x1700, 0); - e32(0x0); - - reg_start(0x1640, 3); - e32(0x00000000); - e32(0x00001fff); - e32(0x00000000); - e32(0x00001fff); - - start_packet3(RADEON_CP_PACKET3_UNK1B, 2); - e32(0 << 16 | 0); - e32(0 << 16 | 0); - e32(cp_size << 16 | 0x1); - - dst += cp_size; - src += cp_size; - size -= cp_size; - } - - reg_start(R300_RB3D_DSTCACHE_CTLSTAT, 0); - e32(R300_RB3D_DSTCACHE_UNKNOWN_0A); - - reg_start(0x342c, 0); - e32(0x00000005); - - reg_start(0x1720, 0); - e32(0x00010000); -} - void r300_mem_use(r300ContextPtr rmesa, int id) { uint64_t ull; @@ -331,47 +260,6 @@ void r300_mem_use(r300ContextPtr rmesa, int id) if (id == 0) return; -#if 0 /* FB VBOs. Needs further changes... */ - rmesa->rmm->u_list[id].ref_count++; - if (rmesa->rmm->u_list[id].ref_count > 100 - && rmesa->rmm->u_list[id].fb == NULL - && rmesa->rmm->u_list[id].size != - RADEON_BUFFER_SIZE * 16 /*&& rmesa->rmm->u_list[id].size > 40 */ ) { - driTexHeap *heap; - struct mem_block *mb; - - LOCK_HARDWARE(&(rmesa->radeon)); - - heap = rmesa->texture_heaps[0]; - - mb = mmAllocMem(heap->memory_heap, rmesa->rmm->u_list[id].size, - heap->alignmentShift, 0); - - UNLOCK_HARDWARE(&(rmesa->radeon)); - - if (mb) { - rmesa->rmm->u_list[id].fb = mb; - - emit_lin_cp(rmesa, - rmesa->radeon.radeonScreen->texOffset[0] + - rmesa->rmm->u_list[id].fb->ofs, - r300GartOffsetFromVirtual(rmesa, - rmesa->rmm-> - u_list[id].ptr), - rmesa->rmm->u_list[id].size); - } else { - WARN_ONCE("Upload to fb failed, %d, %d\n", - rmesa->rmm->u_list[id].size, id); - } - //fprintf(stderr, "Upload to fb! %d, %d\n", rmesa->rmm->u_list[id].ref_count, id); - } - /*if (rmesa->rmm->u_list[id].fb) { - emit_lin_cp(rmesa, rmesa->radeon.radeonScreen->texOffset[0] + rmesa->rmm->u_list[id].fb->ofs, - r300GartOffsetFromVirtual(rmesa, rmesa->rmm->u_list[id].ptr), - rmesa->rmm->u_list[id].size); - } */ -#endif - cmd = (drm_r300_cmd_header_t *) r300AllocCmdBuf(rmesa, 2 + sizeof(ull) / 4, @@ -399,29 +287,13 @@ unsigned long r300_mem_offset(r300ContextPtr rmesa, int id) assert(id <= rmesa->rmm->u_last); - if (rmesa->rmm->u_list[id].fb) { - offset = - rmesa->radeon.radeonScreen->texOffset[0] + - rmesa->rmm->u_list[id].fb->ofs; - } else { - offset = (char *)rmesa->rmm->u_list[id].ptr - - (char *)rmesa->radeon.radeonScreen->gartTextures.map; - offset += rmesa->radeon.radeonScreen->gart_texture_offset; - } + offset = (char *)rmesa->rmm->u_list[id].ptr - + (char *)rmesa->radeon.radeonScreen->gartTextures.map; + offset += rmesa->radeon.radeonScreen->gart_texture_offset; return offset; } -int r300_mem_on_card(r300ContextPtr rmesa, int id) -{ - assert(id <= rmesa->rmm->u_last); - - if (rmesa->rmm->u_list[id].fb) - return GL_TRUE; - - return GL_FALSE; -} - void *r300_mem_map(r300ContextPtr rmesa, int id, int access) { #ifdef MM_DEBUG @@ -433,21 +305,6 @@ void *r300_mem_map(r300ContextPtr rmesa, int id, int access) assert(id <= rmesa->rmm->u_last); - rmesa->rmm->u_list[id].ref_count = 0; - if (rmesa->rmm->u_list[id].fb) { - WARN_ONCE("Mapping fb!\n"); - /* Idle gart only and do upload on unmap */ - //rmesa->rmm->u_list[id].fb = NULL; - - if (rmesa->rmm->u_list[id].mapped == 1) - WARN_ONCE("buffer %d already mapped\n", id); - - rmesa->rmm->u_list[id].mapped = 1; - ptr = r300_mem_ptr(rmesa, id); - - return ptr; - } - if (access == R300_MEM_R) { if (rmesa->rmm->u_list[id].mapped == 1) @@ -499,15 +356,6 @@ void r300_mem_unmap(r300ContextPtr rmesa, int id) WARN_ONCE("buffer %d not mapped\n", id); rmesa->rmm->u_list[id].mapped = 0; - - if (rmesa->rmm->u_list[id].fb) - emit_lin_cp(rmesa, - rmesa->radeon.radeonScreen->texOffset[0] + - rmesa->rmm->u_list[id].fb->ofs, - r300GartOffsetFromVirtual(rmesa, - rmesa->rmm->u_list[id]. - ptr), - rmesa->rmm->u_list[id].size); } void r300_mem_free(r300ContextPtr rmesa, int id) diff --git a/src/mesa/drivers/dri/r300/r300_mem.h b/src/mesa/drivers/dri/r300/r300_mem.h index 1e99b176383..d2932380ec6 100644 --- a/src/mesa/drivers/dri/r300/r300_mem.h +++ b/src/mesa/drivers/dri/r300/r300_mem.h @@ -18,10 +18,8 @@ struct r300_memory_manager { uint32_t h_pending; int pending; int mapped; - int ref_count; - struct mem_block *fb; } *u_list; - int u_head, u_tail, u_size, u_last; + int u_head, u_size, u_last; }; @@ -32,7 +30,6 @@ extern int r300_mem_find(r300ContextPtr rmesa, void *ptr); extern int r300_mem_alloc(r300ContextPtr rmesa, int alignment, int size); extern void r300_mem_use(r300ContextPtr rmesa, int id); extern unsigned long r300_mem_offset(r300ContextPtr rmesa, int id); -extern int r300_mem_on_card(r300ContextPtr rmesa, int id); extern void *r300_mem_map(r300ContextPtr rmesa, int id, int access); extern void r300_mem_unmap(r300ContextPtr rmesa, int id); extern void r300_mem_free(r300ContextPtr rmesa, int id);