diff options
author | Alan Hourihane <[email protected]> | 2003-12-07 23:47:56 +0000 |
---|---|---|
committer | Alan Hourihane <[email protected]> | 2003-12-07 23:47:56 +0000 |
commit | 273e52f86fa41564f573c8e84d013f995e01a8f0 (patch) | |
tree | 28bd792577342a0bb53dfa7bb3cebd21b370fe89 /src/mesa | |
parent | 297807d431aed30d7fff3749eea91bde84f60cfa (diff) |
sync some more of the r200 driver from the DRI trunk
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_context.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_ioctl.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_lock.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_pixel.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_screen.c | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_screen.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state_init.c | 33 |
9 files changed, 68 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index b0a3ca8c356..c08c411e22d 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -68,11 +68,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. int R200_DEBUG = (0); #endif + /* R200 configuration */ #include "xmlpool.h" - const char __driConfigOptions[] = DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE @@ -246,7 +246,7 @@ static const struct dri_debug_control debug_control[] = static int -get_ust_nop( uint64_t * ust ) +get_ust_nop( int64_t * ust ) { *ust = 1; return 0; @@ -264,7 +264,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, r200ContextPtr rmesa; GLcontext *ctx, *shareCtx; int i; - int tcl_mode, fthrottle_mode, preferred_bpt; + int tcl_mode, fthrottle_mode; assert(glVisual); assert(driContextPriv); @@ -299,6 +299,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, /* Parse configuration files */ driParseConfigFiles (&rmesa->optionCache, &screen->optionCache, screen->driScreen->myNum, "r200"); + rmesa->r200Screen = screen; rmesa->sarea = (RADEONSAREAPrivPtr)((GLubyte *)sPriv->pSAREA + screen->sarea_priv_offset); diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index ebb1b8c215f..0b2ce111f26 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -96,6 +96,7 @@ typedef void (*r200_point_func)( r200ContextPtr, struct r200_colorbuffer_state { GLuint clear; GLint drawOffset, drawPitch; + int roundEnable; }; diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index af7c3a0e629..fbfdd6374dd 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -319,7 +319,7 @@ static CARD32 r200GetLastFrame(r200ContextPtr rmesa) CARD32 frame; gp.param = RADEON_PARAM_LAST_FRAME; - gp.value = &frame; + gp.value = (int *)&frame; ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp) ); if ( ret ) { @@ -403,7 +403,7 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv ) r200ContextPtr rmesa; GLint nbox, i, ret; GLboolean missed_target; - uint64_t ust; + int64_t ust; assert(dPriv); assert(dPriv->driContextPriv); @@ -534,7 +534,8 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv ) } R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset; + rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset + + rmesa->r200Screen->fbLocation; rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch; } @@ -615,7 +616,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, int clear; gp.param = RADEON_PARAM_LAST_CLEAR; - gp.value = &clear; + gp.value = (int *)&clear; ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp) ); diff --git a/src/mesa/drivers/dri/r200/r200_lock.c b/src/mesa/drivers/dri/r200/r200_lock.c index 9d6cff50ae4..3c3356eecb8 100644 --- a/src/mesa/drivers/dri/r200/r200_lock.c +++ b/src/mesa/drivers/dri/r200/r200_lock.c @@ -64,7 +64,8 @@ r200UpdatePageFlipping( r200ContextPtr rmesa ) } R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset; + rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset + + rmesa->r200Screen->fbLocation; rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch; } diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c index 29eab6cd2fb..806484404d6 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.c +++ b/src/mesa/drivers/dri/r200/r200_pixel.c @@ -215,7 +215,8 @@ r200TryReadPixels( GLcontext *ctx, { __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; int nbox = dPriv->numClipRects; - int src_offset = rmesa->state.color.drawOffset; + int src_offset = rmesa->state.color.drawOffset + + rmesa->r200Screen->fbLocation; int src_pitch = rmesa->state.color.drawPitch * rmesa->r200Screen->cpp; int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels ); int dst_pitch = pitch * rmesa->r200Screen->cpp; @@ -288,7 +289,7 @@ static void do_draw_pix( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLint pitch, const void *pixels, - GLuint dest, GLuint planemask) + GLuint planemask) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; @@ -354,7 +355,7 @@ static void do_draw_pix( GLcontext *ctx, blit_format, src_pitch, src_offset, rmesa->state.color.drawPitch * rmesa->r200Screen->cpp, - rmesa->state.color.drawOffset, + rmesa->state.color.drawOffset + rmesa->r200Screen->fbLocation, bx - x, by - y, bx, by, bw, bh ); @@ -377,7 +378,7 @@ r200TryDrawPixels( GLcontext *ctx, { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLint pitch = unpack->RowLength ? unpack->RowLength : width; - GLuint dest, planemask; + GLuint planemask; GLuint cpp = rmesa->r200Screen->cpp; GLint size = width * pitch * cpp; @@ -388,8 +389,6 @@ r200TryDrawPixels( GLcontext *ctx, case GL_RGB: case GL_RGBA: case GL_BGRA: - dest = rmesa->state.color.drawOffset; - planemask = r200PackColor(cpp, ctx->Color.ColorMask[RCOMP], ctx->Color.ColorMask[GCOMP], @@ -428,8 +427,7 @@ r200TryDrawPixels( GLcontext *ctx, if ( r200IsGartMemory(rmesa, pixels, size) ) { - do_draw_pix( ctx, x, y, width, height, pitch, pixels, - dest, planemask ); + do_draw_pix( ctx, x, y, width, height, pitch, pixels, planemask ); return GL_TRUE; } else if (0) diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index 4216046d198..fe246686a01 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -76,6 +76,7 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) { r200ScreenPtr screen; RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv; + unsigned char *RADEONMMIO; if ( ! driCheckDriDdxDrmVersions( sPriv, "R200", 4, 0, 4, 0, 1, 5 ) ) return NULL; @@ -193,8 +194,9 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } + RADEONMMIO = screen->mmio.map; + if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) { - unsigned char *RADEONMMIO = screen->mmio.map; screen->gartTextures.handle = dri_priv->gartTexHandle; screen->gartTextures.size = dri_priv->gartTexMapSize; @@ -218,6 +220,18 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) screen->cpp = dri_priv->bpp / 8; screen->AGPMode = dri_priv->AGPMode; + screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16; + + if ( sPriv->drmMinor >= 10 ) { + drmRadeonSetParam sp; + + sp.param = RADEON_SETPARAM_FB_LOCATION; + sp.value = screen->fbLocation; + + drmCommandWrite( sPriv->fd, DRM_RADEON_SETPARAM, + &sp, sizeof( sp ) ); + } + screen->frontOffset = dri_priv->frontOffset; screen->frontPitch = dri_priv->frontPitch; screen->backOffset = dri_priv->backOffset; @@ -225,7 +239,8 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) screen->depthOffset = dri_priv->depthOffset; screen->depthPitch = dri_priv->depthPitch; - screen->texOffset[RADEON_CARD_HEAP] = dri_priv->textureOffset; + screen->texOffset[RADEON_CARD_HEAP] = dri_priv->textureOffset + + screen->fbLocation; screen->texSize[RADEON_CARD_HEAP] = dri_priv->textureSize; screen->logTexGranularity[RADEON_CARD_HEAP] = dri_priv->log2TexGran; diff --git a/src/mesa/drivers/dri/r200/r200_screen.h b/src/mesa/drivers/dri/r200/r200_screen.h index 3ed4f550282..6b12227ec54 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.h +++ b/src/mesa/drivers/dri/r200/r200_screen.h @@ -64,6 +64,7 @@ typedef struct { int AGPMode; unsigned int irq; /* IRQ number (0 means none) */ + unsigned int fbLocation; unsigned int frontOffset; unsigned int frontPitch; unsigned int backOffset; diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 27dc6fd1f2b..2a3df39be03 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -1623,8 +1623,9 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode ) _swrast_DrawBuffer(ctx, mode); R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = (rmesa->state.color.drawOffset & - R200_COLOROFFSET_MASK); + rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset + + rmesa->r200Screen->fbLocation) + & R200_COLOROFFSET_MASK); rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch; } @@ -1719,8 +1720,10 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) R200_STATECHANGE(rmesa, ctx ); if ( state ) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_ENABLE; + rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~rmesa->state.color.roundEnable; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_DITHER_ENABLE; + rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable; } break; diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 4c9a69f79d2..f7dfcff8b6c 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -52,6 +52,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_swtcl.h" #include "r200_vtxfmt.h" +#include "xmlpool.h" + /* ============================================================= * State initialization */ @@ -363,7 +365,7 @@ void r200InitState( r200ContextPtr rmesa ) R200_DST_BLEND_GL_ZERO ); rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHOFFSET] = - rmesa->r200Screen->depthOffset; + rmesa->r200Screen->depthOffset + rmesa->r200Screen->fbLocation; rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHPITCH] = ((rmesa->r200Screen->depthPitch & @@ -382,10 +384,28 @@ void r200InitState( r200ContextPtr rmesa ) | R200_TEX_BLEND_0_ENABLE); rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = color_fmt; - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_ENABLE; - - rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = (rmesa->state.color.drawOffset & - R200_COLOROFFSET_MASK); + switch ( driQueryOptioni( &rmesa->optionCache, "dither_mode" ) ) { + case DRI_CONF_DITHER_XERRORDIFFRESET: + rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_INIT; + break; + case DRI_CONF_DITHER_ORDERED: + rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_SCALE_DITHER_ENABLE; + break; + } + if ( driQueryOptioni( &rmesa->optionCache, "round_mode" ) == + DRI_CONF_ROUND_ROUND ) + rmesa->state.color.roundEnable = R200_ROUND_ENABLE; + else + rmesa->state.color.roundEnable = 0; + if ( driQueryOptioni (&rmesa->optionCache, "color_reduction" ) == + DRI_CONF_COLOR_REDUCTION_DITHER ) + rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_ENABLE; + else + rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable; + + rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset + + rmesa->r200Screen->fbLocation) + & R200_COLOROFFSET_MASK); rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = ((rmesa->state.color.drawPitch & R200_COLORPITCH_MASK) | @@ -470,7 +490,8 @@ void r200InitState( r200ContextPtr rmesa ) ((i << R200_TXFORMAT_ST_ROUTE_SHIFT) | /* <-- note i */ (2 << R200_TXFORMAT_WIDTH_SHIFT) | (2 << R200_TXFORMAT_HEIGHT_SHIFT)); - rmesa->hw.tex[i].cmd[TEX_PP_TXOFFSET] = 0; + rmesa->hw.tex[i].cmd[TEX_PP_TXOFFSET] = + rmesa->r200Screen->texOffset[RADEON_CARD_HEAP]; rmesa->hw.tex[i].cmd[TEX_PP_BORDER_COLOR] = 0; rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT_X] = (/* R200_TEXCOORD_PROJ | */ |