diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 360ba72..7c4dabc 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -181,7 +181,6 @@ static void r200_emit_query_finish(radeonContextPtr radeon) static void r200_init_vtbl(radeonContextPtr radeon) { radeon->vtbl.get_lock = r200_get_lock; - radeon->vtbl.update_viewport_offset = r200UpdateViewportOffset; radeon->vtbl.emit_cs_header = r200_vtbl_emit_cs_header; radeon->vtbl.swtcl_flush = r200_swtcl_flush; radeon->vtbl.fallback = r200Fallback; diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 1c33517..b75ff5c 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -1544,11 +1544,10 @@ r200StencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail, void r200UpdateWindow( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); GLfloat xoffset = 0; - GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0; + GLfloat yoffset = ctx->DrawBuffer->Height; const GLfloat *v = ctx->Viewport._WindowMap.m; - const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0); + const GLboolean render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat y_scale, y_bias; @@ -1575,6 +1574,36 @@ void r200UpdateWindow( struct gl_context *ctx ) rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = ty.ui32; rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = sz.ui32; rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = tz.ui32; + + if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 || + rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 ) + { + /* Note: this should also modify whatever data the context reset + * code uses... + */ + + /* update polygon stipple x/y screen offset */ + GLuint stx, sty; + GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC]; + + m &= ~(R200_STIPPLE_X_OFFSET_MASK | + R200_STIPPLE_Y_OFFSET_MASK); + + /* add magic offsets, then invert */ + stx = 31 - ((-1) & R200_STIPPLE_COORD_MASK); + sty = 31 - ((yoffset - 1) + & R200_STIPPLE_COORD_MASK); + + m |= ((stx << R200_STIPPLE_X_OFFSET_SHIFT) | + (sty << R200_STIPPLE_Y_OFFSET_SHIFT)); + + if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) { + R200_STATECHANGE( rmesa, msc ); + rmesa->hw.msc.cmd[MSC_RE_MISC] = m; + } + } + + radeonUpdateScissor( ctx ); } void r200_vtbl_update_scissor( struct gl_context *ctx ) @@ -1621,57 +1650,6 @@ static void r200DepthRange( struct gl_context *ctx, GLclampd nearval, r200UpdateWindow( ctx ); } -void r200UpdateViewportOffset( struct gl_context *ctx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); - GLfloat xoffset = (GLfloat)0; - GLfloat yoffset = (GLfloat)dPriv->h; - const GLfloat *v = ctx->Viewport._WindowMap.m; - - float_ui32_type tx; - float_ui32_type ty; - - tx.f = v[MAT_TX] + xoffset; - ty.f = (- v[MAT_TY]) + yoffset; - - if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 || - rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 ) - { - /* Note: this should also modify whatever data the context reset - * code uses... - */ - R200_STATECHANGE( rmesa, vpt ); - rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = tx.ui32; - rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = ty.ui32; - - /* update polygon stipple x/y screen offset */ - { - GLuint stx, sty; - GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC]; - - m &= ~(R200_STIPPLE_X_OFFSET_MASK | - R200_STIPPLE_Y_OFFSET_MASK); - - /* add magic offsets, then invert */ - stx = 31 - ((-1) & R200_STIPPLE_COORD_MASK); - sty = 31 - ((dPriv->h - 1) - & R200_STIPPLE_COORD_MASK); - - m |= ((stx << R200_STIPPLE_X_OFFSET_SHIFT) | - (sty << R200_STIPPLE_Y_OFFSET_SHIFT)); - - if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) { - R200_STATECHANGE( rmesa, msc ); - rmesa->hw.msc.cmd[MSC_RE_MISC] = m; - } - } - } - - radeonUpdateScissor( ctx ); -} - - /* ============================================================= * Miscellaneous diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h index 4679516..2bb1450 100644 --- a/src/mesa/drivers/dri/r200/r200_state.h +++ b/src/mesa/drivers/dri/r200/r200_state.h @@ -43,7 +43,6 @@ extern void r200InitTnlFuncs( struct gl_context *ctx ); extern void r200UpdateMaterial( struct gl_context *ctx ); -extern void r200UpdateViewportOffset( struct gl_context *ctx ); extern void r200UpdateWindow( struct gl_context *ctx ); extern void r200UpdateDrawBuffer(struct gl_context *ctx); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 8437f34..96bcc41 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -465,7 +465,6 @@ struct radeon_context { struct { void (*get_lock)(radeonContextPtr radeon); - void (*update_viewport_offset)(struct gl_context *ctx); void (*emit_cs_header)(struct radeon_cs *cs, radeonContextPtr rmesa); void (*swtcl_flush)(struct gl_context *ctx, uint32_t offset); void (*pre_emit_atoms)(radeonContextPtr rmesa); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 1e0da0b..3eb5096 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -146,7 +146,6 @@ static void r100_emit_query_finish(radeonContextPtr radeon) static void r100_init_vtbl(radeonContextPtr radeon) { radeon->vtbl.get_lock = r100_get_lock; - radeon->vtbl.update_viewport_offset = radeonUpdateViewportOffset; radeon->vtbl.emit_cs_header = r100_vtbl_emit_cs_header; radeon->vtbl.swtcl_flush = r100_swtcl_flush; radeon->vtbl.pre_emit_state = r100_vtbl_pre_emit_state; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 7f12f9c..a71ffe8 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -1351,11 +1351,10 @@ static void radeonStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum void radeonUpdateWindow( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); GLfloat xoffset = 0.0; - GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0; + GLfloat yoffset = ctx->DrawBuffer->Height; const GLfloat *v = ctx->Viewport._WindowMap.m; - const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0); + const GLboolean render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat y_scale, y_bias; @@ -1382,6 +1381,36 @@ void radeonUpdateWindow( struct gl_context *ctx ) rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = ty.ui32; rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = sz.ui32; rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = tz.ui32; + + if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 || + rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 ) + { + /* Note: this should also modify whatever data the context reset + * code uses... + */ + + /* update polygon stipple x/y screen offset */ + GLuint stx, sty; + GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC]; + + m &= ~(RADEON_STIPPLE_X_OFFSET_MASK | + RADEON_STIPPLE_Y_OFFSET_MASK); + + /* add magic offsets, then invert */ + stx = 31 - ((-1) & RADEON_STIPPLE_COORD_MASK); + sty = 31 - ((yoffset - 1) + & RADEON_STIPPLE_COORD_MASK); + + m |= ((stx << RADEON_STIPPLE_X_OFFSET_SHIFT) | + (sty << RADEON_STIPPLE_Y_OFFSET_SHIFT)); + + if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) { + RADEON_STATECHANGE( rmesa, msc ); + rmesa->hw.msc.cmd[MSC_RE_MISC] = m; + } + } + + radeonUpdateScissor( ctx ); } @@ -1403,57 +1432,6 @@ static void radeonDepthRange( struct gl_context *ctx, GLclampd nearval, radeonUpdateWindow( ctx ); } -void radeonUpdateViewportOffset( struct gl_context *ctx ) -{ - r100ContextPtr rmesa = R100_CONTEXT(ctx); - __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); - GLfloat xoffset = 0.0; - GLfloat yoffset = (GLfloat)dPriv->h; - const GLfloat *v = ctx->Viewport._WindowMap.m; - - float_ui32_type tx; - float_ui32_type ty; - - tx.f = v[MAT_TX] + xoffset + SUBPIXEL_X; - ty.f = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y; - - if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 || - rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 ) - { - /* Note: this should also modify whatever data the context reset - * code uses... - */ - RADEON_STATECHANGE( rmesa, vpt ); - rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = tx.ui32; - rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = ty.ui32; - - /* update polygon stipple x/y screen offset */ - { - GLuint stx, sty; - GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC]; - - m &= ~(RADEON_STIPPLE_X_OFFSET_MASK | - RADEON_STIPPLE_Y_OFFSET_MASK); - - /* add magic offsets, then invert */ - stx = 31 - ((-1) & RADEON_STIPPLE_COORD_MASK); - sty = 31 - ((dPriv->h - 1) - & RADEON_STIPPLE_COORD_MASK); - - m |= ((stx << RADEON_STIPPLE_X_OFFSET_SHIFT) | - (sty << RADEON_STIPPLE_Y_OFFSET_SHIFT)); - - if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) { - RADEON_STATECHANGE( rmesa, msc ); - rmesa->hw.msc.cmd[MSC_RE_MISC] = m; - } - } - } - - radeonUpdateScissor( ctx ); -} - - /* ============================================================= * Miscellaneous diff --git a/src/mesa/drivers/dri/radeon/radeon_state.h b/src/mesa/drivers/dri/radeon/radeon_state.h index cb98969..c225808 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.h +++ b/src/mesa/drivers/dri/radeon/radeon_state.h @@ -44,7 +44,6 @@ extern void radeonInitStateFuncs( struct gl_context *ctx ); extern void radeonUpdateMaterial( struct gl_context *ctx ); -extern void radeonUpdateViewportOffset( struct gl_context *ctx ); extern void radeonUpdateWindow( struct gl_context *ctx ); extern void radeonUpdateDrawBuffer( struct gl_context *ctx ); extern void radeonUploadTexMatrix( r100ContextPtr rmesa,