From b6e486906968d82c7b8a869d7ab51697a7cce80c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Jan 2009 06:28:43 +1000 Subject: radeon/r200: move state atom to common header --- src/mesa/drivers/dri/radeon/common_context.h | 39 ++++++++++++++++++++++++- src/mesa/drivers/dri/radeon/radeon_context.h | 33 --------------------- src/mesa/drivers/dri/radeon/radeon_ioctl.c | 6 ++-- src/mesa/drivers/dri/radeon/radeon_state_init.c | 10 +++---- 4 files changed, 46 insertions(+), 42 deletions(-) (limited to 'src/mesa/drivers/dri/radeon') diff --git a/src/mesa/drivers/dri/radeon/common_context.h b/src/mesa/drivers/dri/radeon/common_context.h index e9bf413786..d8539df6df 100644 --- a/src/mesa/drivers/dri/radeon/common_context.h +++ b/src/mesa/drivers/dri/radeon/common_context.h @@ -74,11 +74,12 @@ struct radeon_state_atom { struct radeon_state_atom *next, *prev; const char *name; /* for debug */ int cmd_size; /* size in bytes */ + GLuint idx; GLuint is_tcl; int *cmd; /* one or more cmd's */ int *lastcmd; /* one or more cmd's */ GLboolean dirty; /* dirty-mark in emit_state_list */ - GLboolean(*check) (GLcontext *); /* is this state active? */ + GLboolean(*check) (GLcontext *, int idx); /* is this state active? */ }; typedef struct radeon_tex_obj radeonTexObj, *radeonTexObjPtr; @@ -176,3 +177,39 @@ static INLINE GLuint radeonPackColor(GLuint cpp, return 0; } } + +struct radeon_dri_mirror { + __DRIcontextPrivate *context; /* DRI context */ + __DRIscreenPrivate *screen; /* DRI screen */ + + /** + * DRI drawable bound to this context for drawing. + */ + __DRIdrawablePrivate *drawable; + + /** + * DRI drawable bound to this context for reading. + */ + __DRIdrawablePrivate *readable; + + drm_context_t hwContext; + drm_hw_lock_t *hwLock; + int fd; + int drmMinor; +}; + +#define DEBUG_TEXTURE 0x001 +#define DEBUG_STATE 0x002 +#define DEBUG_IOCTL 0x004 +#define DEBUG_PRIMS 0x008 +#define DEBUG_VERTS 0x010 +#define DEBUG_FALLBACKS 0x020 +#define DEBUG_VFMT 0x040 +#define DEBUG_CODEGEN 0x080 +#define DEBUG_VERBOSE 0x100 +#define DEBUG_DRI 0x200 +#define DEBUG_DMA 0x400 +#define DEBUG_SANITY 0x800 +#define DEBUG_SYNC 0x1000 +#define DEBUG_PIXEL 0x2000 +#define DEBUG_MEMORY 0x4000 diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index 75ec2d15dd..bdd4a47609 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -351,25 +351,6 @@ struct radeon_state { (rvb)->address - rmesa->dma.buf0_address + \ (rvb)->start) -struct radeon_dri_mirror { - __DRIcontextPrivate *context; /* DRI context */ - __DRIscreenPrivate *screen; /* DRI screen */ - - /** - * DRI drawable bound to this context for drawing. - */ - __DRIdrawablePrivate *drawable; - - /** - * DRI drawable bound to this context for reading. - */ - __DRIdrawablePrivate *readable; - - drm_context_t hwContext; - drm_hw_lock_t *hwLock; - int fd; - int drmMinor; -}; #define RADEON_CMD_BUF_SZ (8*1024) @@ -585,18 +566,4 @@ extern int RADEON_DEBUG; #define RADEON_DEBUG 0 #endif -#define DEBUG_TEXTURE 0x0001 -#define DEBUG_STATE 0x0002 -#define DEBUG_IOCTL 0x0004 -#define DEBUG_PRIMS 0x0008 -#define DEBUG_VERTS 0x0010 -#define DEBUG_FALLBACKS 0x0020 -#define DEBUG_VFMT 0x0040 -#define DEBUG_CODEGEN 0x0080 -#define DEBUG_VERBOSE 0x0100 -#define DEBUG_DRI 0x0200 -#define DEBUG_DMA 0x0400 -#define DEBUG_SANITY 0x0800 -#define DEBUG_SYNC 0x1000 - #endif /* __RADEON_CONTEXT_H__ */ diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 09acf6b4f8..9858dacc13 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -85,7 +85,7 @@ static void radeonSaveHwState( radeonContextPtr rmesa ) rmesa->backup_store.cmd_used = 0; foreach( atom, &rmesa->hw.atomlist ) { - if ( atom->check( rmesa->glCtx ) ) { + if ( atom->check( rmesa->glCtx, 0 ) ) { int size = atom->cmd_size * 4; memcpy( dest, atom->cmd, size); dest += size; @@ -198,7 +198,7 @@ void radeonEmitState( radeonContextPtr rmesa ) if (RADEON_DEBUG & DEBUG_STATE) { foreach(atom, &rmesa->hw.atomlist) { if (atom->dirty || rmesa->hw.all_dirty) { - if (atom->check(rmesa->glCtx)) + if (atom->check(rmesa->glCtx, 0)) print_state_atom(atom); else fprintf(stderr, "skip state %s\n", atom->name); @@ -213,7 +213,7 @@ void radeonEmitState( radeonContextPtr rmesa ) atom->is_tcl) atom->dirty = GL_FALSE; if (atom->dirty) { - if (atom->check(rmesa->glCtx)) { + if (atom->check(rmesa->glCtx, 0)) { int size = atom->cmd_size * 4; memcpy(dest, atom->cmd, size); dest += size; diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index 57dc380050..5b1e79bad2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -96,14 +96,14 @@ static int cmdscl( int offset, int stride, int count ) return h.i; } -#define CHECK( NM, FLAG ) \ -static GLboolean check_##NM( GLcontext *ctx ) \ -{ \ - return FLAG; \ +#define CHECK( NM, FLAG ) \ +static GLboolean check_##NM( GLcontext *ctx, int idx ) \ +{ \ + return FLAG; \ } #define TCL_CHECK( NM, FLAG ) \ -static GLboolean check_##NM( GLcontext *ctx ) \ +static GLboolean check_##NM( GLcontext *ctx, int idx ) \ { \ radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \ return !rmesa->TclFallback && (FLAG); \ -- cgit v1.2.3