radeonEmitState(&rmesa->radeon);
-#ifdef RADEON_DEBUG_BO
- rmesa->radeon.tcl.elt_dma_bo = radeon_bo_open(rmesa->radeon.radeonScreen->bom,
- 0, R200_ELT_BUF_SZ, 4,
- RADEON_GEM_DOMAIN_GTT, 0, "ELT");
-#else
rmesa->radeon.tcl.elt_dma_bo = radeon_bo_open(rmesa->radeon.radeonScreen->bom,
0, R200_ELT_BUF_SZ, 4,
RADEON_GEM_DOMAIN_GTT, 0);
-#endif
rmesa->radeon.tcl.elt_dma_offset = 0;
rmesa->tcl.elt_used = min_nr * 2;
struct radeon_bo * pbo;
uint32_t *out;
-shader_again_alloc:
-#ifdef RADEON_DEBUG_BO
- pbo = radeon_bo_open(radeonctx->radeonScreen->bom,
- 0,
- sizeinDWORD * 4,
- 256,
- RADEON_GEM_DOMAIN_GTT,
- 0,
- szShaderUsage);
-#else
+shader_again_alloc:
pbo = radeon_bo_open(radeonctx->radeonScreen->bom,
- 0,
- sizeinDWORD * 4,
- 256,
+ 0,
+ sizeinDWORD * 4,
+ 256,
RADEON_GEM_DOMAIN_GTT,
- 0);
-#endif /* RADEON_DEBUG_BO */
+ 0);
- if (!pbo)
- {
+ if (!pbo) {
rcommonFlushCmdBuf(radeonctx, __FUNCTION__);
goto shader_again_alloc;
}
#include <stdint.h>
//#include "radeon_track.h"
-#ifndef RADEON_DEBUG_BO
-#define RADEON_DEBUG_BO 0
-#endif
-
/* bo object */
#define RADEON_BO_FLAGS_MACRO_TILE 1
#define RADEON_BO_FLAGS_MICRO_TILE 2
/* bo functions */
struct radeon_bo_funcs {
-#ifdef RADEON_DEBUG_BO
- struct radeon_bo *(*bo_open)(struct radeon_bo_manager *bom,
- uint32_t handle,
- uint32_t size,
- uint32_t alignment,
- uint32_t domains,
- uint32_t flags,
- char * szBufUsage);
-#else
struct radeon_bo *(*bo_open)(struct radeon_bo_manager *bom,
uint32_t handle,
uint32_t size,
uint32_t alignment,
uint32_t domains,
uint32_t flags);
-#endif /* RADEON_DEBUG_BO */
void (*bo_ref)(struct radeon_bo *bo);
struct radeon_bo *(*bo_unref)(struct radeon_bo *bo);
int (*bo_map)(struct radeon_bo *bo, int write);
uint32_t alignment,
uint32_t domains,
uint32_t flags,
-#ifdef RADEON_DEBUG_BO
- char * szBufUsage,
-#endif /* RADEON_DEBUG_BO */
const char *file,
const char *func,
int line)
{
struct radeon_bo *bo;
-#ifdef RADEON_DEBUG_BO
- bo = bom->funcs->bo_open(bom, handle, size, alignment, domains, flags, szBufUsage);
-#else
bo = bom->funcs->bo_open(bom, handle, size, alignment, domains, flags);
-#endif /* RADEON_DEBUG_BO */
#ifdef RADEON_BO_TRACK
if (bo) {
return 0;
}
-#ifdef RADEON_DEBUG_BO
-#define radeon_bo_open(bom, h, s, a, d, f, u)\
- _radeon_bo_open(bom, h, s, a, d, f, u, __FILE__, __FUNCTION__, __LINE__)
-#else
#define radeon_bo_open(bom, h, s, a, d, f)\
_radeon_bo_open(bom, h, s, a, d, f, __FILE__, __FUNCTION__, __LINE__)
-#endif /* RADEON_DEBUG_BO */
#define radeon_bo_ref(bo)\
_radeon_bo_ref(bo, __FILE__, __FUNCTION__, __LINE__)
#define radeon_bo_unref(bo)\
void *ptr;
struct bo_legacy *next, *prev;
struct bo_legacy *pnext, *pprev;
-#ifdef RADEON_DEBUG_BO
- char szBufUsage[16];
-#endif /* RADEON_DEBUG_BO */
};
struct bo_manager_legacy {
uint32_t size,
uint32_t alignment,
uint32_t domains,
-#ifdef RADEON_DEBUG_BO
- uint32_t flags,
- char * szBufUsage)
-#else
uint32_t flags)
-#endif /* RADEON_DEBUG_BO */
{
struct bo_legacy *bo_legacy;
static int pgsize;
bo_legacy->next->prev = bo_legacy;
}
-#ifdef RADEON_DEBUG_BO
- sprintf(bo_legacy->szBufUsage, "%s", szBufUsage);
-#endif /* RADEON_DEBUG_BO */
-
return bo_legacy;
}
uint32_t size,
uint32_t alignment,
uint32_t domains,
-#ifdef RADEON_DEBUG_BO
- uint32_t flags,
- char * szBufUsage)
-#else
uint32_t flags)
-#endif /* RADEON_DEBUG_BO */
{
struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bom;
struct bo_legacy *bo_legacy;
}
return NULL;
}
-#ifdef RADEON_DEBUG_BO
- bo_legacy = bo_allocate(boml, size, alignment, domains, flags, szBufUsage);
-#else
bo_legacy = bo_allocate(boml, size, alignment, domains, flags);
-#endif /* RADEON_DEBUG_BO */
bo_legacy->static_bo = 0;
r = legacy_new_handle(boml, &bo_legacy->base.handle);
if (r) {
int retries = 0;
if (bo_legacy->map_count) {
-#ifdef RADEON_DEBUG_BO
- fprintf(stderr, "bo(%p, %d, %s) is mapped (%d) can't valide it.\n",
- bo, bo->size, bo_legacy->szBufUsage, bo_legacy->map_count);
-#else
fprintf(stderr, "bo(%p, %d) is mapped (%d) can't valide it.\n",
bo, bo->size, bo_legacy->map_count);
-#endif /* RADEON_DEBUG_BO */
-
return -EINVAL;
}
if (bo_legacy->static_bo || bo_legacy->validated) {
}
static struct bo_legacy *radeon_legacy_bo_alloc_static(struct bo_manager_legacy *bom,
- int size,
-#ifdef RADEON_DEBUG_BO
- uint32_t offset,
- char * szBufUsage)
-#else
- uint32_t offset)
-#endif /* RADEON_DEBUG_BO */
+ int size,
+ uint32_t offset)
{
struct bo_legacy *bo;
-#ifdef RADEON_DEBUG_BO
- bo = bo_allocate(bom, size, 0, RADEON_GEM_DOMAIN_VRAM, 0, szBufUsage);
-#else
bo = bo_allocate(bom, size, 0, RADEON_GEM_DOMAIN_VRAM, 0);
-#endif /* RADEON_DEBUG_BO */
+
if (bo == NULL)
return NULL;
bo->static_bo = 1;
size = 4096*4096*4;
/* allocate front */
-#ifdef RADEON_DEBUG_BO
- bo = radeon_legacy_bo_alloc_static(bom, size, bom->screen->frontOffset, "FRONT BUF");
-#else
bo = radeon_legacy_bo_alloc_static(bom, size, bom->screen->frontOffset);
-#endif /* RADEON_DEBUG_BO */
+
if (!bo) {
radeon_bo_manager_legacy_dtor((struct radeon_bo_manager*)bom);
return NULL;
}
/* allocate back */
-#ifdef RADEON_DEBUG_BO
- bo = radeon_legacy_bo_alloc_static(bom, size, bom->screen->backOffset, "BACK BUF");
-#else
bo = radeon_legacy_bo_alloc_static(bom, size, bom->screen->backOffset);
-#endif /* RADEON_DEBUG_BO */
+
if (!bo) {
radeon_bo_manager_legacy_dtor((struct radeon_bo_manager*)bom);
return NULL;
}
/* allocate depth */
-#ifdef RADEON_DEBUG_BO
- bo = radeon_legacy_bo_alloc_static(bom, size, bom->screen->depthOffset, "Z BUF");
-#else
bo = radeon_legacy_bo_alloc_static(bom, size, bom->screen->depthOffset);
-#endif /* RADEON_DEBUG_BO */
+
if (!bo) {
radeon_bo_manager_legacy_dtor((struct radeon_bo_manager*)bom);
return NULL;
struct bo_manager_legacy *boml = (struct bo_manager_legacy *)bom;
struct bo_legacy *bo;
-#ifdef RADEON_DEBUG_BO
- bo = bo_allocate(boml, size, 0, RADEON_GEM_DOMAIN_VRAM, 0, "fake bo");
-#else
bo = bo_allocate(boml, size, 0, RADEON_GEM_DOMAIN_VRAM, 0);
-#endif /* RADEON_DEBUG_BO */
+
if (bo == NULL)
return NULL;
bo->static_bo = 1;
}
if (size != 0) {
-#ifdef RADEON_DEBUG_BO
- radeon_obj->bo = radeon_bo_open(radeon->radeonScreen->bom,
- 0,
- size,
- 32,
- RADEON_GEM_DOMAIN_GTT,
- 0,
- "Radeon Named object");
-#else
radeon_obj->bo = radeon_bo_open(radeon->radeonScreen->bom,
0,
size,
32,
RADEON_GEM_DOMAIN_GTT,
0);
-#endif
+
if (data != NULL) {
radeon_bo_map(radeon_obj->bo, GL_TRUE);
if ((rb = (void *)draw->base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer)) {
if (!rb->bo) {
-#ifdef RADEON_DEBUG_BO
- rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- radeon->radeonScreen->frontOffset,
- 0,
- 0,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Front Buf");
-#else
rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
radeon->radeonScreen->frontOffset,
0,
0,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
}
rb->cpp = radeon->radeonScreen->cpp;
rb->pitch = radeon->radeonScreen->frontPitch * rb->cpp;
}
if ((rb = (void *)draw->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer)) {
if (!rb->bo) {
-#ifdef RADEON_DEBUG_BO
rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- radeon->radeonScreen->backOffset,
- 0,
- 0,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Back Buf");
-#else
- rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
radeon->radeonScreen->backOffset,
0,
0,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
}
rb->cpp = radeon->radeonScreen->cpp;
rb->pitch = radeon->radeonScreen->backPitch * rb->cpp;
}
if ((rb = (void *)draw->base.Attachment[BUFFER_DEPTH].Renderbuffer)) {
if (!rb->bo) {
-#ifdef RADEON_DEBUG_BO
- rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- radeon->radeonScreen->depthOffset,
- 0,
- 0,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Z Buf");
-#else
rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
radeon->radeonScreen->depthOffset,
0,
0,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
}
rb->cpp = radeon->radeonScreen->cpp;
rb->pitch = radeon->radeonScreen->depthPitch * rb->cpp;
}
if ((rb = (void *)draw->base.Attachment[BUFFER_STENCIL].Renderbuffer)) {
if (!rb->bo) {
-#ifdef RADEON_DEBUG_BO
- rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- radeon->radeonScreen->depthOffset,
- 0,
- 0,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Stencil Buf");
-#else
rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
radeon->radeonScreen->depthOffset,
0,
0,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
}
rb->cpp = radeon->radeonScreen->cpp;
rb->pitch = radeon->radeonScreen->depthPitch * rb->cpp;
if ((rb = (void *)draw->base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer)) {
if (!rb->bo) {
-#ifdef RADEON_DEBUG_BO
- rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- radeon->radeonScreen->frontOffset +
- radeon->radeonScreen->fbLocation,
- size,
- 4096,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Front Buf");
-#else
rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
radeon->radeonScreen->frontOffset +
radeon->radeonScreen->fbLocation,
4096,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
}
rb->cpp = radeon->radeonScreen->cpp;
rb->pitch = radeon->radeonScreen->frontPitch * rb->cpp;
}
if ((rb = (void *)draw->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer)) {
if (!rb->bo) {
-#ifdef RADEON_DEBUG_BO
- rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- radeon->radeonScreen->backOffset +
- radeon->radeonScreen->fbLocation,
- size,
- 4096,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Back Buf");
-#else
rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
radeon->radeonScreen->backOffset +
radeon->radeonScreen->fbLocation,
4096,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
}
rb->cpp = radeon->radeonScreen->cpp;
rb->pitch = radeon->radeonScreen->backPitch * rb->cpp;
}
if ((rb = (void *)draw->base.Attachment[BUFFER_DEPTH].Renderbuffer)) {
if (!rb->bo) {
-#ifdef RADEON_DEBUG_BO
rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- radeon->radeonScreen->depthOffset +
- radeon->radeonScreen->fbLocation,
- size,
- 4096,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Z Buf");
-#else
- rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
radeon->radeonScreen->depthOffset +
radeon->radeonScreen->fbLocation,
size,
4096,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
}
rb->cpp = radeon->radeonScreen->cpp;
rb->pitch = radeon->radeonScreen->depthPitch * rb->cpp;
}
if ((rb = (void *)draw->base.Attachment[BUFFER_STENCIL].Renderbuffer)) {
if (!rb->bo) {
-#ifdef RADEON_DEBUG_BO
rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- radeon->radeonScreen->depthOffset +
- radeon->radeonScreen->fbLocation,
- size,
- 4096,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Stencil Buf");
-#else
- rb->bo = radeon_bo_open(radeon->radeonScreen->bom,
radeon->radeonScreen->depthOffset +
radeon->radeonScreen->fbLocation,
size,
4096,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
}
rb->cpp = radeon->radeonScreen->cpp;
rb->pitch = radeon->radeonScreen->depthPitch * rb->cpp;
} else {
uint32_t tiling_flags = 0, pitch = 0;
int ret;
-#ifdef RADEON_DEBUG_BO
- bo = radeon_bo_open(radeon->radeonScreen->bom,
- buffers[i].name,
- 0,
- 0,
- RADEON_GEM_DOMAIN_VRAM,
- buffers[i].flags,
- regname);
-#else
+
bo = radeon_bo_open(radeon->radeonScreen->bom,
buffers[i].name,
0,
0,
RADEON_GEM_DOMAIN_VRAM,
buffers[i].flags);
-#endif /* RADEON_DEBUG_BO */
+
if (bo == NULL) {
fprintf(stderr, "failed to attach %s %d\n",
#define RADEON_DEBUG 0
#endif
-#ifndef HAVE_LIBDRM_RADEON
-#ifndef RADEON_DEBUG_BO
-#define RADEON_DEBUG_BO 0
-#endif
-#endif
-
#endif
}
again_alloc:
-#ifdef RADEON_DEBUG_BO
- rmesa->dma.current = radeon_bo_open(rmesa->radeonScreen->bom,
- 0, size, 4, RADEON_GEM_DOMAIN_GTT,
- 0, "dma.current");
-#else
rmesa->dma.current = radeon_bo_open(rmesa->radeonScreen->bom,
0, size, 4, RADEON_GEM_DOMAIN_GTT,
0);
-#endif /* RADEON_DEBUG_BO */
if (!rmesa->dma.current) {
rcommonFlushCmdBuf(rmesa, __FUNCTION__);
rrb->pitch = pitch * cpp;
rrb->cpp = cpp;
-#ifdef RADEON_DEBUG_BO
- rrb->bo = radeon_bo_open(radeon->radeonScreen->bom,
- 0,
- size,
- 0,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "Radeon RBO");
-#else
rrb->bo = radeon_bo_open(radeon->radeonScreen->bom,
0,
size,
0,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
rb->Width = width;
rb->Height = height;
return GL_TRUE;
else
calculate_miptree_layout_r100(rmesa, mt);
-#ifdef RADEON_DEBUG_BO
- mt->bo = radeon_bo_open(rmesa->radeonScreen->bom,
- 0, mt->totalsize, 1024,
- RADEON_GEM_DOMAIN_VRAM,
- 0,
- "MIPMAP TREE");
-#else
mt->bo = radeon_bo_open(rmesa->radeonScreen->bom,
0, mt->totalsize, 1024,
RADEON_GEM_DOMAIN_VRAM,
0);
-#endif /* RADEON_DEBUG_BO */
return mt;
}