specific.
radeon_lock.c \
radeon_span.c \
radeon_state.c \
- radeon_mm.c \
+ r300_mem.c \
\
r300_context.c \
r300_ioctl.c \
#include "r300_maos.h"
#ifdef USER_BUFFERS
-#include "radeon_mm.h"
+#include "r300_mem.h"
#endif
#include "vblank.h"
r300InitShaderFuncs(&functions);
#ifdef USER_BUFFERS
- radeon_mm_init(r300);
+ r300_mem_init(r300);
#endif
if (!radeonInitContext(&r300->radeon, &functions,
/* 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 */
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
}
#ifdef USER_BUFFERS
-#include "radeon_mm.h"
+#include "r300_mem.h"
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);
}
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;
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++;
}
#include "r300_ioctl.h"
#ifdef USER_BUFFERS
-#include "radeon_mm.h"
+#include "r300_mem.h"
#endif
#if SWIZZLE_X != R300_INPUT_ROUTE_SELECT_X || \
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
#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
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;
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;
}
//#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;
e32(0x00010000);
}
-void radeon_mm_use(r300ContextPtr rmesa, int id)
+void r300_mem_use(r300ContextPtr rmesa, int id)
{
uint64_t ull;
#ifdef MM_DEBUG
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 ++;
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;
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);
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));
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;
}
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));
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));
--- /dev/null
+#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
#include <unistd.h> /* for usleep() */
#ifdef USER_BUFFERS
-#include "radeon_mm.h"
+#include "r300_mem.h"
#endif
/**
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__);
+++ /dev/null
-#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