diff options
author | Dave Airlie <airlied@redhat.com> | 2009-01-31 02:00:12 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-01-31 02:00:12 +1000 |
commit | f68a61d88398fe8eb3eb41b929dcb4483354a81e (patch) | |
tree | 43b89b00f9c1a59e80585207f2d2a6f44e6f439c /src/mesa/drivers/dri/radeon | |
parent | e45213d89bf26c68c9f4c9074eaec9ab3311de7d (diff) |
r200/r300: swtcl fixups to use old dma buffers on top of BOs
Diffstat (limited to 'src/mesa/drivers/dri/radeon')
-rw-r--r-- | src/mesa/drivers/dri/radeon/common_context.h | 38 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/common_misc.c | 68 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_cs_legacy.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 1 |
4 files changed, 61 insertions, 49 deletions
diff --git a/src/mesa/drivers/dri/radeon/common_context.h b/src/mesa/drivers/dri/radeon/common_context.h index 1ed33e2aec..90abca0bc1 100644 --- a/src/mesa/drivers/dri/radeon/common_context.h +++ b/src/mesa/drivers/dri/radeon/common_context.h @@ -11,6 +11,7 @@ #include "radeon_screen.h" #include "radeon_drm.h" #include "dri_util.h" +#include "tnl/t_vertex.h" /* This union is used to avoid warnings/miscompilation with float to uint32_t casts due to strict-aliasing */ @@ -250,13 +251,19 @@ struct radeon_dma { /* radeon_swtcl.c */ struct radeon_swtcl_info { - struct radeon_bo *bo; - /* Fallback rasterization functions - */ - GLuint hw_primitive; - GLenum render_primitive; - GLuint numverts; + GLuint RenderIndex; + GLuint vertex_size; + GLubyte *verts; + + /* Fallback rasterization functions + */ + GLuint hw_primitive; + GLenum render_primitive; + GLuint numverts; + + struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX]; + GLuint vertex_attr_count; }; @@ -416,7 +423,7 @@ struct radeon_context { /* Derived state - for r300 only */ struct radeon_state state; - struct radeon_swtcl swtcl; + struct radeon_swtcl_info swtcl; /* Configuration cache */ driOptionCache optionCache; @@ -424,14 +431,15 @@ struct radeon_context { struct radeon_cmdbuf cmdbuf; struct { - void (*get_lock)(radeonContextPtr radeon); - void (*update_viewport_offset)(GLcontext *ctx); - void (*flush)(GLcontext *ctx); - void (*set_all_dirty)(GLcontext *ctx); - void (*update_draw_buffer)(GLcontext *ctx); - void (*emit_cs_header)(struct radeon_cs *cs, radeonContextPtr rmesa); - void (*emit_state)(radeonContextPtr rmesa); - void (*flush_vertices)(radeonContextPtr rmesa); + void (*get_lock)(radeonContextPtr radeon); + void (*update_viewport_offset)(GLcontext *ctx); + void (*flush)(GLcontext *ctx); + void (*set_all_dirty)(GLcontext *ctx); + void (*update_draw_buffer)(GLcontext *ctx); + void (*emit_cs_header)(struct radeon_cs *cs, radeonContextPtr rmesa); + void (*emit_state)(radeonContextPtr rmesa); + void (*flush_vertices)(radeonContextPtr rmesa); + void (*swtcl_flush)(GLcontext *ctx, uint32_t offset); } vtbl; }; diff --git a/src/mesa/drivers/dri/radeon/common_misc.c b/src/mesa/drivers/dri/radeon/common_misc.c index 1adcefb19a..9044967ac0 100644 --- a/src/mesa/drivers/dri/radeon/common_misc.c +++ b/src/mesa/drivers/dri/radeon/common_misc.c @@ -2420,46 +2420,46 @@ void radeonAllocDmaRegion(radeonContextPtr rmesa, void radeonReleaseDmaRegion(radeonContextPtr rmesa) { - rmesa->dma.nr_released_bufs++; - radeon_bo_unref(rmesa->dma.current); + if (rmesa->dma.current) { + rmesa->dma.nr_released_bufs++; + radeon_bo_unref(rmesa->dma.current); + } rmesa->dma.current = NULL; } -void rcommonEmitVertexAOS(radeonContextPtr rmesa, GLuint vertex_size, struct radeon_bo *bo, GLuint offset) + +/* Flush vertices in the current dma region. + */ +void rcommon_flush_last_swtcl_prim( GLcontext *ctx ) { - BATCH_LOCALS(rmesa); + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + struct radeon_dma *dma = &rmesa->dma; + - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s: vertex_size %d, offset 0x%x \n", - __FUNCTION__, vertex_size, offset); + if (RADEON_DEBUG & DEBUG_IOCTL) + fprintf(stderr, "%s\n", __FUNCTION__); + dma->flush = NULL; - BEGIN_BATCH(5); - OUT_BATCH_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR, 2); - OUT_BATCH(1); - OUT_BATCH(vertex_size | (vertex_size << 8)); - OUT_BATCH_RELOC(offset, bo, offset, RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); -} + if (dma->current) { + GLuint current_offset = dma->current_used; -void rcommonEmitVbufPrim(radeonContextPtr rmesa, GLuint primitive, GLuint vertex_nr) -{ - BATCH_LOCALS(rmesa); - int type, num_verts; + assert (dma->current_used + + rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 == + dma->current_vertexptr); - type = r300PrimitiveType(rmesa, primitive); - num_verts = r300NumVerts(rmesa, vertex_nr, primitive); + radeon_bo_unmap(dma->current); + if (dma->current_used != dma->current_vertexptr) { + dma->current_used = dma->current_vertexptr; - BEGIN_BATCH(3); - OUT_BATCH_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2, 0); - OUT_BATCH(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (num_verts << 16) | type); - END_BATCH(); + rmesa->vtbl.swtcl_flush(ctx, current_offset); + } + radeonReleaseDmaRegion(rmesa); + rmesa->swtcl.numverts = 0; + } } - - - /* Alloc space in the current dma region. */ -static void * +void * rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize ) { GLuint bytes = vsize * nverts; @@ -2471,19 +2471,19 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize ) if (!rmesa->dma.flush) { rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; - rmesa->dma.flush = flush_last_swtcl_prim; + rmesa->dma.flush = rcommon_flush_last_swtcl_prim; } ASSERT( vsize == rmesa->swtcl.vertex_size * 4 ); - ASSERT( rmesa->radeon.dma.flush == flush_last_swtcl_prim ); - ASSERT( rmesa->radeon.dma.current_used + + ASSERT( rmesa->dma.flush == rcommon_flush_last_swtcl_prim ); + ASSERT( rmesa->dma.current_used + rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 == - rmesa->radeon.dma.current_vertexptr ); + rmesa->dma.current_vertexptr ); // fprintf(stderr,"current %p %x\n", rmesa->radeon.dma.current->ptr, // rmesa->radeon.dma.current_vertexptr); - head = (rmesa->radeon.dma.current->ptr + rmesa->radeon.dma.current_vertexptr); - rmesa->radeon.dma.current_vertexptr += bytes; + head = (rmesa->dma.current->ptr + rmesa->dma.current_vertexptr); + rmesa->dma.current_vertexptr += bytes; rmesa->swtcl.numverts += nverts; return head; } diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c index 171818db37..5c6d93f573 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c @@ -44,6 +44,8 @@ struct cs_manager_legacy { /* hack for scratch stuff */ uint32_t pending_age; uint32_t pending_count; + + }; struct cs_reloc_legacy { @@ -507,3 +509,4 @@ void radeon_cs_manager_legacy_dtor(struct radeon_cs_manager *csm) { free(csm); } + diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 320bf9244b..4ff4267348 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1015,6 +1015,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) free(screen); return NULL; } + return screen; } |