void r100_swtcl_flush(struct gl_context *ctx, uint32_t current_offset) { r100ContextPtr rmesa = R100_CONTEXT(ctx); radeonEmitState(&rmesa->radeon); radeonEmitVertexAOS( rmesa, rmesa->radeon.swtcl.vertex_size, rmesa->radeon.swtcl.bo, current_offset); radeonEmitVbufPrim( rmesa, rmesa->swtcl.vertex_format, rmesa->radeon.swtcl.hw_primitive, rmesa->radeon.swtcl.numverts); if ( rmesa->radeon.swtcl.emit_prediction < rmesa->radeon.cmdbuf.cs->cdw ) WARN_ONCE("Rendering was %d commands larger than predicted size." " We might overflow command buffer.\n", rmesa->radeon.cmdbuf.cs->cdw - rmesa->radeon.swtcl.emit_prediction ); rmesa->radeon.swtcl.emit_prediction = 0; }
/* TODO: Try to extend existing primitive if both are identical, * discrete and there are no intervening state changes. (Somewhat * duplicates changes to DrawArrays code) */ static void radeonEmitPrim( struct gl_context *ctx, GLenum prim, GLuint hwprim, GLuint start, GLuint count) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); radeonTclPrimitive( ctx, prim, hwprim ); radeonEmitAOS( rmesa, rmesa->radeon.tcl.aos_count, start ); /* Why couldn't this packet have taken an offset param? */ radeonEmitVbufPrim( rmesa, rmesa->tcl.vertex_format, rmesa->tcl.hw_primitive, count - start ); }
/* Flush vertices in the current dma region. */ static void flush_last_swtcl_prim( radeonContextPtr rmesa ) { if (RADEON_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s\n", __FUNCTION__); rmesa->dma.flush = NULL; if (rmesa->dma.current.buf) { struct radeon_dma_region *current = &rmesa->dma.current; GLuint current_offset = (rmesa->radeonScreen->gart_buffer_offset + current->buf->buf->idx * RADEON_BUFFER_SIZE + current->start); assert (!(rmesa->swtcl.hw_primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND)); assert (current->start + rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 == current->ptr); if (rmesa->dma.current.start != rmesa->dma.current.ptr) { radeonEnsureCmdBufSpace( rmesa, VERT_AOS_BUFSZ + rmesa->hw.max_state_size + VBUF_BUFSZ ); radeonEmitVertexAOS( rmesa, rmesa->swtcl.vertex_size, current_offset); radeonEmitVbufPrim( rmesa, rmesa->swtcl.vertex_format, rmesa->swtcl.hw_primitive, rmesa->swtcl.numverts); } rmesa->swtcl.numverts = 0; current->start = current->ptr; } }
/* TODO: Try to extend existing primitive if both are identical, * discrete and there are no intervening state changes. (Somewhat * duplicates changes to DrawArrays code) */ static void radeonEmitPrim( GLcontext *ctx, GLenum prim, GLuint hwprim, GLuint start, GLuint count) { radeonContextPtr rmesa = RADEON_CONTEXT( ctx ); radeonTclPrimitive( ctx, prim, hwprim ); radeonEnsureCmdBufSpace( rmesa, AOS_BUFSZ(rmesa->tcl.nr_aos_components) + rmesa->hw.max_state_size + VBUF_BUFSZ ); radeonEmitAOS( rmesa, rmesa->tcl.aos_components, rmesa->tcl.nr_aos_components, start ); /* Why couldn't this packet have taken an offset param? */ radeonEmitVbufPrim( rmesa, rmesa->tcl.vertex_format, rmesa->tcl.hw_primitive, count - start ); }