diff options
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_context.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_state.c | 41 |
3 files changed, 42 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/glamo/glamo_context.c b/src/mesa/drivers/dri/glamo/glamo_context.c index 6e86faf32e..77ae4349d9 100644 --- a/src/mesa/drivers/dri/glamo/glamo_context.c +++ b/src/mesa/drivers/dri/glamo/glamo_context.c @@ -178,8 +178,8 @@ void glamoDestroyContext(__DRIcontext *driContextPriv) } -static void glamo_update_renderbuffers(__DRIcontext *context, - __DRIdrawable *drawable) +void glamo_update_renderbuffers(__DRIcontext *context, + __DRIdrawable *drawable) { unsigned int attachments[10]; __DRIbuffer *buffers; diff --git a/src/mesa/drivers/dri/glamo/glamo_context.h b/src/mesa/drivers/dri/glamo/glamo_context.h index 624cfde239..ed4f525a8a 100644 --- a/src/mesa/drivers/dri/glamo/glamo_context.h +++ b/src/mesa/drivers/dri/glamo/glamo_context.h @@ -77,5 +77,7 @@ extern GLboolean glamoMakeCurrent(__DRIcontext *driContextPriv, __DRIdrawable *driDrawPriv, __DRIdrawable *driReadPriv); extern GLboolean glamoUnbindContext(__DRIcontext *driContextPriv); +extern void glamo_update_renderbuffers(__DRIcontext *context, + __DRIdrawable *drawable); #endif /* __GLAMO_CONTEXT_H */ diff --git a/src/mesa/drivers/dri/glamo/glamo_state.c b/src/mesa/drivers/dri/glamo/glamo_state.c index 795d62b058..d7bbf1c3fd 100644 --- a/src/mesa/drivers/dri/glamo/glamo_state.c +++ b/src/mesa/drivers/dri/glamo/glamo_state.c @@ -107,11 +107,11 @@ static void glamoClear(GLcontext *ctx, GLbitfield mask) glamoDRMAddCommandBO(gCtx, GLAMO_REG_2D_DST_ADDRL, grb->bo); glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_PITCH, - grb->width & 0x7ff); + grb->pitch & 0x7ff); glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_HEIGHT, grb->height); glamoDRMAddCommand(gCtx, GLAMO_REG_2D_PAT_FG, 0xabcd); - glamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND2, 0xff); /* set */ + glamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND2, 0xf0 << 8); glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_X, fb->_Xmin); glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_Y, fb->_Ymin); glamoDRMAddCommand(gCtx, GLAMO_REG_2D_RECT_WIDTH, @@ -120,7 +120,18 @@ static void glamoClear(GLcontext *ctx, GLbitfield mask) fb->_Ymax-fb->_Ymin); glamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND3, 0); + glamoDRMAddCommand(gCtx, GLAMO_REG_2D_PAT_FG, 0x1234); + glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_X, fb->_Xmin+1); + glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_Y, fb->_Ymin+1); + glamoDRMAddCommand(gCtx, GLAMO_REG_2D_RECT_WIDTH, + fb->_Xmax-fb->_Xmin-2); + glamoDRMAddCommand(gCtx, GLAMO_REG_2D_RECT_HEIGHT, + fb->_Ymax-fb->_Ymin-2); + glamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND3, 0); + } + + glamoDRMDispatch(gCtx); } @@ -140,7 +151,31 @@ static void glamoShadeModel(GLcontext *ctx, GLenum mode) static void glamoViewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { - printf("glamoViewport\n"); fflush(stdout); + struct glamo_context *gCtx = GLAMO_CONTEXT(ctx); + __DRIcontext *driContext = gCtx->driContext; + void (*old_viewport)(GLcontext *ctx, GLint x, GLint y, + GLsizei w, GLsizei h); + + if ( !driContext->driScreenPriv->dri2.enabled ) return; + + /* TODO: Flush before fiddling with fake front buffer */ + + if ( ctx->DrawBuffer->Name == 0 ) { + + glamo_update_renderbuffers(driContext, + driContext->driDrawablePriv); + if ( driContext->driDrawablePriv + != driContext->driReadablePriv ) { + glamo_update_renderbuffers(driContext, + driContext->driReadablePriv); + } + + } + + old_viewport = ctx->Driver.Viewport; + ctx->Driver.Viewport = NULL; + gCtx->driDrawable = driContext->driDrawablePriv; + ctx->Driver.Viewport = old_viewport; } |