diff options
Diffstat (limited to 'src/mesa/drivers/dri/glamo/glamo_state.c')
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_state.c | 41 |
1 files changed, 38 insertions, 3 deletions
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; } |