From 1b26c2bbaefe3608b96d9351c0f2eac80274891c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 19:40:38 -0700 Subject: r300-gallium, radeon: BO handling fixes, some useful asserts. --- src/gallium/drivers/r300/r300_emit.c | 4 ++-- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index ab17af799b..38b1682415 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -459,7 +459,7 @@ void r300_emit_dirty_state(struct r300_context* r300) /* Color buffers... */ for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) { tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]; - //assert(tex && tex->buffer && "cbuf is marked, but NULL!"); + assert(tex && tex->buffer && "cbuf is marked, but NULL!"); if (!tex->buffer) return; r300->winsys->add_buffer(r300->winsys, tex->buffer, 0, RADEON_GEM_DOMAIN_VRAM); @@ -467,7 +467,7 @@ void r300_emit_dirty_state(struct r300_context* r300) /* ...depth buffer... */ if (r300->framebuffer_state.zsbuf) { tex = (struct r300_texture*)r300->framebuffer_state.zsbuf; - //assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); + assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); if (!tex->buffer) return; r300->winsys->add_buffer(r300->winsys, tex->buffer, 0, RADEON_GEM_DOMAIN_VRAM); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 556f1d9b87..cbe1652302 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -37,6 +37,8 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys, * find a slot for it otherwise. */ for (i = 0; i < RADEON_MAX_BOS; i++) { if (sc[i].bo == bo) { + sc[i].read_domains |= rd; + sc[i].write_domain |= wd; return; } else if (sc[i].bo == NULL) { sc[i].bo = bo; @@ -52,11 +54,15 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys, static boolean radeon_r300_validate(struct r300_winsys* winsys) { - int retval; + int retval, i; struct radeon_winsys_priv* priv = (struct radeon_winsys_priv*)winsys->radeon_winsys; struct radeon_cs_space_check* sc = priv->sc; + debug_printf("Validation count: %d\n", priv->bo_count); + for (i = 0; i < priv->bo_count; i++) { + debug_printf("BO %d: %p rd: %d wd: %d\n", i, sc[i].bo, sc[i].read_domains, sc[i].write_domain); + } retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count); if (retval == RADEON_CS_SPACE_OP_TO_BIG) { -- cgit v1.2.3