diff options
Diffstat (limited to 'src/mesa/drivers/dri/r300')
-rw-r--r-- | src/mesa/drivers/dri/r300/Makefile | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_ioctl.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_maos.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_mem.c (renamed from src/mesa/drivers/dri/r300/radeon_mm.c) | 38 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_mem.h | 40 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_texmem.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_mm.h | 40 |
9 files changed, 74 insertions, 74 deletions
diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index b0b47be4a24..9b4ba0d7380 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -27,7 +27,7 @@ DRIVER_SOURCES = \ radeon_lock.c \ radeon_span.c \ radeon_state.c \ - radeon_mm.c \ + r300_mem.c \ \ r300_context.c \ r300_ioctl.c \ diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 12308af45fd..4407f8c4b58 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -62,7 +62,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_maos.h" #ifdef USER_BUFFERS -#include "radeon_mm.h" +#include "r300_mem.h" #endif #include "vblank.h" @@ -212,7 +212,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, r300InitShaderFuncs(&functions); #ifdef USER_BUFFERS - radeon_mm_init(r300); + r300_mem_init(r300); #endif if (!radeonInitContext(&r300->radeon, &functions, @@ -529,7 +529,7 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv) /* the memory manager might be accessed when Mesa frees the shared * state, so don't destroy it earlier */ - radeon_mm_destroy(r300); + r300_mem_destroy(r300); #endif /* free the option cache */ diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 8dc8f981994..8c4ed51af50 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -865,7 +865,7 @@ struct r300_context { GLuint prefer_gart_client_texturing; #ifdef USER_BUFFERS - struct radeon_memory_manager *rmm; + struct r300_memory_manager *rmm; GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; #endif diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index c787b3fd56c..1bf19850b79 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -410,7 +410,7 @@ void r300Flush(GLcontext * ctx) } #ifdef USER_BUFFERS -#include "radeon_mm.h" +#include "r300_mem.h" static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa, int size) { @@ -434,14 +434,14 @@ static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa, int size) dmabuf->buf = (void *)1; /* hack */ dmabuf->refcount = 1; - dmabuf->id = radeon_mm_alloc(rmesa, 4, size); + dmabuf->id = r300_mem_alloc(rmesa, 4, size); if (dmabuf->id == 0) { LOCK_HARDWARE(&rmesa->radeon); /* no need to validate */ r300FlushCmdBufLocked(rmesa, __FUNCTION__); radeonWaitForIdleLocked(&rmesa->radeon); - dmabuf->id = radeon_mm_alloc(rmesa, 4, size); + dmabuf->id = r300_mem_alloc(rmesa, 4, size); UNLOCK_HARDWARE(&rmesa->radeon); @@ -453,7 +453,7 @@ static void r300RefillCurrentDmaRegion(r300ContextPtr rmesa, int size) } rmesa->dma.current.buf = dmabuf; - rmesa->dma.current.address = radeon_mm_ptr(rmesa, dmabuf->id); + rmesa->dma.current.address = r300_mem_ptr(rmesa, dmabuf->id); rmesa->dma.current.end = size; rmesa->dma.current.start = 0; rmesa->dma.current.ptr = 0; @@ -472,7 +472,7 @@ void r300ReleaseDmaRegion(r300ContextPtr rmesa, rmesa->dma.flush(rmesa); if (--region->buf->refcount == 0) { - radeon_mm_free(rmesa, region->buf->id); + r300_mem_free(rmesa, region->buf->id); FREE(region->buf); rmesa->dma.nr_released_bufs++; } diff --git a/src/mesa/drivers/dri/r300/r300_maos.c b/src/mesa/drivers/dri/r300/r300_maos.c index 3beeb7b1ab8..54557c8eda3 100644 --- a/src/mesa/drivers/dri/r300/r300_maos.c +++ b/src/mesa/drivers/dri/r300/r300_maos.c @@ -51,7 +51,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_ioctl.h" #ifdef USER_BUFFERS -#include "radeon_mm.h" +#include "r300_mem.h" #endif #if SWIZZLE_X != R300_INPUT_ROUTE_SELECT_X || \ @@ -643,11 +643,11 @@ void r300UseArrays(GLcontext * ctx) int i; if (rmesa->state.elt_dma.buf) - radeon_mm_use(rmesa, rmesa->state.elt_dma.buf->id); + r300_mem_use(rmesa, rmesa->state.elt_dma.buf->id); for (i = 0; i < rmesa->state.aos_count; i++) { if (rmesa->state.aos[i].buf) - radeon_mm_use(rmesa, rmesa->state.aos[i].buf->id); + r300_mem_use(rmesa, rmesa->state.aos[i].buf->id); } } #endif diff --git a/src/mesa/drivers/dri/r300/radeon_mm.c b/src/mesa/drivers/dri/r300/r300_mem.c index 1502dac8fc3..2c1deddb246 100644 --- a/src/mesa/drivers/dri/r300/radeon_mm.c +++ b/src/mesa/drivers/dri/r300/r300_mem.c @@ -34,7 +34,7 @@ #include "r300_context.h" #include "r300_cmdbuf.h" #include "r300_ioctl.h" -#include "radeon_mm.h" +#include "r300_mem.h" #include "radeon_ioctl.h" #ifdef USER_BUFFERS @@ -60,16 +60,16 @@ static void resize_u_list(r300ContextPtr rmesa) rmesa->rmm->u_size = nsize; } -void radeon_mm_init(r300ContextPtr rmesa) +void r300_mem_init(r300ContextPtr rmesa) { - rmesa->rmm = malloc(sizeof(struct radeon_memory_manager)); - memset(rmesa->rmm, 0, sizeof(struct radeon_memory_manager)); + rmesa->rmm = malloc(sizeof(struct r300_memory_manager)); + memset(rmesa->rmm, 0, sizeof(struct r300_memory_manager)); rmesa->rmm->u_size = 128; resize_u_list(rmesa); } -void radeon_mm_destroy(r300ContextPtr rmesa) +void r300_mem_destroy(r300ContextPtr rmesa) { _mesa_free(rmesa->rmm->u_list); rmesa->rmm->u_list = NULL; @@ -78,13 +78,13 @@ void radeon_mm_destroy(r300ContextPtr rmesa) rmesa->rmm = NULL; } -void *radeon_mm_ptr(r300ContextPtr rmesa, int id) +void *r300_mem_ptr(r300ContextPtr rmesa, int id) { assert(id <= rmesa->rmm->u_last); return rmesa->rmm->u_list[id].ptr; } -int radeon_mm_find(r300ContextPtr rmesa, void *ptr) +int r300_mem_find(r300ContextPtr rmesa, void *ptr) { int i; @@ -102,7 +102,7 @@ int radeon_mm_find(r300ContextPtr rmesa, void *ptr) } //#define MM_DEBUG -int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size) +int r300_mem_alloc(r300ContextPtr rmesa, int alignment, int size) { drm_radeon_mem_alloc_t alloc; int offset = 0, ret; @@ -293,7 +293,7 @@ static void emit_lin_cp(r300ContextPtr rmesa, unsigned long dst, unsigned long s e32(0x00010000); } -void radeon_mm_use(r300ContextPtr rmesa, int id) +void r300_mem_use(r300ContextPtr rmesa, int id) { uint64_t ull; #ifdef MM_DEBUG @@ -341,7 +341,7 @@ void radeon_mm_use(r300ContextPtr rmesa, int id) cmd = (drm_r300_cmd_header_t *)r300AllocCmdBuf(rmesa, 2 + sizeof(ull) / 4, __FUNCTION__); cmd[0].scratch.cmd_type = R300_CMD_SCRATCH; - cmd[0].scratch.reg = RADEON_MM_SCRATCH; + cmd[0].scratch.reg = R300_MEM_SCRATCH; cmd[0].scratch.n_bufs = 1; cmd[0].scratch.flags = 0; cmd ++; @@ -357,7 +357,7 @@ void radeon_mm_use(r300ContextPtr rmesa, int id) UNLOCK_HARDWARE(&rmesa->radeon); } -unsigned long radeon_mm_offset(r300ContextPtr rmesa, int id) +unsigned long r300_mem_offset(r300ContextPtr rmesa, int id) { unsigned long offset; @@ -374,7 +374,7 @@ unsigned long radeon_mm_offset(r300ContextPtr rmesa, int id) return offset; } -int radeon_mm_on_card(r300ContextPtr rmesa, int id) +int r300_mem_on_card(r300ContextPtr rmesa, int id) { assert(id <= rmesa->rmm->u_last); @@ -384,7 +384,7 @@ int radeon_mm_on_card(r300ContextPtr rmesa, int id) return GL_FALSE; } -void *radeon_mm_map(r300ContextPtr rmesa, int id, int access) +void *r300_mem_map(r300ContextPtr rmesa, int id, int access) { #ifdef MM_DEBUG fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa)); @@ -405,18 +405,18 @@ void *radeon_mm_map(r300ContextPtr rmesa, int id, int access) WARN_ONCE("buffer %d already mapped\n", id); rmesa->rmm->u_list[id].mapped = 1; - ptr = radeon_mm_ptr(rmesa, id); + ptr = r300_mem_ptr(rmesa, id); return ptr; } - if (access == RADEON_MM_R) { + if (access == R300_MEM_R) { if(rmesa->rmm->u_list[id].mapped == 1) WARN_ONCE("buffer %d already mapped\n", id); rmesa->rmm->u_list[id].mapped = 1; - ptr = radeon_mm_ptr(rmesa, id); + ptr = r300_mem_ptr(rmesa, id); return ptr; } @@ -442,12 +442,12 @@ void *radeon_mm_map(r300ContextPtr rmesa, int id, int access) WARN_ONCE("buffer %d already mapped\n", id); rmesa->rmm->u_list[id].mapped = 1; - ptr = radeon_mm_ptr(rmesa, id); + ptr = r300_mem_ptr(rmesa, id); return ptr; } -void radeon_mm_unmap(r300ContextPtr rmesa, int id) +void r300_mem_unmap(r300ContextPtr rmesa, int id) { #ifdef MM_DEBUG fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa)); @@ -466,7 +466,7 @@ void radeon_mm_unmap(r300ContextPtr rmesa, int id) rmesa->rmm->u_list[id].size); } -void radeon_mm_free(r300ContextPtr rmesa, int id) +void r300_mem_free(r300ContextPtr rmesa, int id) { #ifdef MM_DEBUG fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa)); diff --git a/src/mesa/drivers/dri/r300/r300_mem.h b/src/mesa/drivers/dri/r300/r300_mem.h new file mode 100644 index 00000000000..1e99b176383 --- /dev/null +++ b/src/mesa/drivers/dri/r300/r300_mem.h @@ -0,0 +1,40 @@ +#ifndef __R300_MEM_H__ +#define __R300_MEM_H__ + +//#define R300_MEM_PDL 0 +#define R300_MEM_UL 1 + +#define R300_MEM_R 1 +#define R300_MEM_W 2 +#define R300_MEM_RW (R300_MEM_R | R300_MEM_W) + +#define R300_MEM_SCRATCH 2 + +struct r300_memory_manager { + struct { + void *ptr; + uint32_t size; + uint32_t age; + 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; + +}; + +extern void r300_mem_init(r300ContextPtr rmesa); +extern void r300_mem_destroy(r300ContextPtr rmesa); +extern void *r300_mem_ptr(r300ContextPtr rmesa, int id); +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); + +#endif diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c index 2c8740bff76..4377b7cdc7b 100644 --- a/src/mesa/drivers/dri/r300/r300_texmem.c +++ b/src/mesa/drivers/dri/r300/r300_texmem.c @@ -56,7 +56,7 @@ SOFTWARE. #include <unistd.h> /* for usleep() */ #ifdef USER_BUFFERS -#include "radeon_mm.h" +#include "r300_mem.h" #endif /** @@ -285,7 +285,7 @@ static void r300UploadRectSubImage(r300ContextPtr rmesa, r300EmitWait(rmesa, R300_WAIT_2D); #ifdef USER_BUFFERS - radeon_mm_use(rmesa, region.buf->id); + r300_mem_use(rmesa, region.buf->id); #endif r300ReleaseDmaRegion(rmesa, ®ion, __FUNCTION__); diff --git a/src/mesa/drivers/dri/r300/radeon_mm.h b/src/mesa/drivers/dri/r300/radeon_mm.h deleted file mode 100644 index 81f89917e60..00000000000 --- a/src/mesa/drivers/dri/r300/radeon_mm.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __RADEON_MM_H__ -#define __RADEON_MM_H__ - -//#define RADEON_MM_PDL 0 -#define RADEON_MM_UL 1 - -#define RADEON_MM_R 1 -#define RADEON_MM_W 2 -#define RADEON_MM_RW (RADEON_MM_R | RADEON_MM_W) - -#define RADEON_MM_SCRATCH 2 - -struct radeon_memory_manager { - struct { - void *ptr; - uint32_t size; - uint32_t age; - 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; - -}; - -extern void radeon_mm_init(r300ContextPtr rmesa); -extern void radeon_mm_destroy(r300ContextPtr rmesa); -extern void *radeon_mm_ptr(r300ContextPtr rmesa, int id); -extern int radeon_mm_find(r300ContextPtr rmesa, void *ptr); -extern int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size); -extern void radeon_mm_use(r300ContextPtr rmesa, int id); -extern unsigned long radeon_mm_offset(r300ContextPtr rmesa, int id); -extern int radeon_mm_on_card(r300ContextPtr rmesa, int id); -extern void *radeon_mm_map(r300ContextPtr rmesa, int id, int access); -extern void radeon_mm_unmap(r300ContextPtr rmesa, int id); -extern void radeon_mm_free(r300ContextPtr rmesa, int id); - -#endif |