From 432c707885a7efe1929d7a54f53afc5bb71230d5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 27 May 2010 23:08:02 +0200 Subject: Emit colour buffer address, raster op, colour format etc --- src/mesa/drivers/dri/glamo/glamo_regs.h | 5 +++++ src/mesa/drivers/dri/glamo/glamo_render.c | 9 +++++++-- src/mesa/drivers/dri/glamo/glamo_state.c | 16 ++++++++++++++++ src/mesa/drivers/dri/glamo/glamo_state.h | 2 ++ 4 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/glamo/glamo_regs.h b/src/mesa/drivers/dri/glamo/glamo_regs.h index 02b229449b..7465362121 100644 --- a/src/mesa/drivers/dri/glamo/glamo_regs.h +++ b/src/mesa/drivers/dri/glamo/glamo_regs.h @@ -160,6 +160,11 @@ enum glamo_register_3d G3D_STREAM_MODE_7 = REG_3D(0x1f48), G3D_STREAM_BASE_7 = REG_3D(0x1f4c), + /* Colour buffer */ + G3D_COLOUR_FROP = REG_3D(0x2120), + G3D_COLOUR_MASK = REG_3D(0x2124), + G3D_COLOUR_BASE = REG_3D(0x2128), + /* Modelview*projection matrix */ G3D_MATRIX_MVP = REG_3D(0x26a0), /* .. 0x27df */ diff --git a/src/mesa/drivers/dri/glamo/glamo_render.c b/src/mesa/drivers/dri/glamo/glamo_render.c index fd52418956..67959e88fb 100644 --- a/src/mesa/drivers/dri/glamo/glamo_render.c +++ b/src/mesa/drivers/dri/glamo/glamo_render.c @@ -87,13 +87,17 @@ #define HAVE_ELTS 0 -static void glamoFlushPrim(struct glamo_context *gCtx) +static void glamoFlushPrim(GLcontext *ctx) { + struct glamo_context *gCtx = GLAMO_CONTEXT(ctx); + printf("glamoFlushPrim: %i vertices, %i %i\n", gCtx->prim.count, gCtx->prim.start_offset, gCtx->prim.current_offset); if ( gCtx->prim.vb_bo == NULL ) return; + glamoEmitState(ctx); + /* Upload to hardware */ glamo_bo_subdata(gCtx->prim.vb_bo, 0, gCtx->prim.current_offset, gCtx->prim.vb); @@ -108,6 +112,7 @@ static void glamoFlushPrim(struct glamo_context *gCtx) gCtx->prim.vb_bo = NULL; /* Continue from new start */ + gCtx->prim.count = 0; gCtx->prim.start_offset = gCtx->prim.current_offset; } @@ -131,7 +136,7 @@ static inline GLuint glamoGetCurrentMax(struct glamo_context *gCtx) #define INIT(prim) -#define FLUSH() glamoFlushPrim(gCtx) +#define FLUSH() glamoFlushPrim(ctx) #define GET_SUBSEQUENT_VB_MAX_VERTS() glamoGetVBMax(gCtx) #define GET_CURRENT_VB_MAX_VERTS() glamoGetCurrentMax(gCtx) diff --git a/src/mesa/drivers/dri/glamo/glamo_state.c b/src/mesa/drivers/dri/glamo/glamo_state.c index 4046c24aaf..24f8d9cd3d 100644 --- a/src/mesa/drivers/dri/glamo/glamo_state.c +++ b/src/mesa/drivers/dri/glamo/glamo_state.c @@ -63,6 +63,22 @@ #include "glamo_regs.h" +/* State which must be done for every buffer of vertices */ +void glamoEmitState(GLcontext *ctx) +{ + struct glamo_renderbuffer *grb; + struct glamo_context *gCtx; + + gCtx = GLAMO_CONTEXT(ctx); + grb = glamo_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]); + + glamoDRMStartBurst(gCtx, G3D_COLOUR_FROP); + glamoDRMAddData(gCtx, 0x0f110000 | (grb->pitch & 0x3ff), 4); + glamoDRMAddData(gCtx, 0x00ff, 4); + glamoDRMAddBO(gCtx, grb->bo); /* Low bit must be 0 (kernel's job) */ +} + + static void glamoResizeBuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height) { diff --git a/src/mesa/drivers/dri/glamo/glamo_state.h b/src/mesa/drivers/dri/glamo/glamo_state.h index 98f0b97e48..2519e7ee52 100644 --- a/src/mesa/drivers/dri/glamo/glamo_state.h +++ b/src/mesa/drivers/dri/glamo/glamo_state.h @@ -28,6 +28,8 @@ #include "main/context.h" extern void glamoInitStateFuncs(GLcontext *ctx); +extern GLboolean glamoValidateState(GLcontext *ctx, GLuint new_state); +extern void glamoEmitState(GLcontext *ctx); #endif /* __GLAMO_STATE_H */ -- cgit v1.2.3