From d8694cd3f69dfc40509544293aa35f297571e878 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 29 May 2009 15:37:04 -0400 Subject: [PATCH] get rid of chip_object struct --- src/mesa/drivers/dri/r600/r600_context.c | 6 +---- src/mesa/drivers/dri/r600/r600_context.h | 30 ++++++++++++---------- src/mesa/drivers/dri/r600/r700_assembler.c | 1 - src/mesa/drivers/dri/r600/r700_chip.c | 26 +------------------ src/mesa/drivers/dri/r600/r700_chip.h | 12 --------- src/mesa/drivers/dri/r600/r700_clear.c | 1 - src/mesa/drivers/dri/r600/r700_fragprog.c | 3 +-- src/mesa/drivers/dri/r600/r700_ioctl.c | 1 - src/mesa/drivers/dri/r600/r700_oglprog.c | 1 - src/mesa/drivers/dri/r600/r700_render.c | 7 +++-- src/mesa/drivers/dri/r600/r700_shader.c | 1 - src/mesa/drivers/dri/r600/r700_state.c | 20 +++++---------- src/mesa/drivers/dri/r600/r700_tex.c | 1 - src/mesa/drivers/dri/r600/r700_vertprog.c | 3 +-- 14 files changed, 30 insertions(+), 83 deletions(-) diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index c54dae0c538..526d02ed571 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -63,7 +63,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r600_emit.h" #include "radeon_bocs_wrapper.h" -#include "r700_chip.h" #include "r700_state.h" #include "r700_ioctl.h" @@ -369,9 +368,6 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } - r600->disable_lowimpact_fallback = - driQueryOptionb(&r600->radeon.optionCache, - "disable_lowimpact_fallback"); radeon_fbo_init(&r600->radeon); radeonInitSpanFuncs( ctx ); @@ -410,7 +406,7 @@ r600DestroyContext (__DRIcontextPrivate * driContextPriv) context_t *context = ctx ? R700_CONTEXT(ctx) : NULL; if (context) - (context->chipobj.DestroyChipObj)(context->chipobj.pvChipObj); + FREE(context->hw.pStateList); } diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index 321b05d9306..52512aacc04 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -48,6 +48,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/mtypes.h" #include "main/colormac.h" +#include "r700_chip.h" + struct r600_context; typedef struct r600_context context_t; @@ -127,32 +129,20 @@ typedef struct offset_modifiers GLuint mask; } offset_modifiers; -typedef struct chip_object -{ - void *pvChipObj; - - /* ------------ OUT ------------------- */ - GLboolean (*DestroyChipObj)(GLcontext * ctx); - -} chip_object; - /** * \brief R600 context structure. */ struct r600_context { struct radeon_context radeon; /* parent class, must be first */ - /* ------ */ - chip_object chipobj; + /* ------ */ + R700_CHIP_CONTEXT hw; /* Vertex buffers */ GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; - GLboolean disable_lowimpact_fallback; - - GLboolean vap_flush_needed; }; #define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) @@ -163,6 +153,18 @@ extern GLboolean r600CreateContext(const __GLcontextModes * glVisual, __DRIcontextPrivate * driContextPriv, void *sharedContextPrivate); +#define R700_CONTEXT_STATES(context) ((R700_CHIP_CONTEXT *)(&context->hw)) + +extern GLboolean r700InitChipObject(context_t *context); +extern GLboolean r700SendContextStates(context_t *context); +extern int r700SetupStreams(GLcontext * ctx); +extern void r700SetupVTXConstants(GLcontext * ctx, + unsigned int nStreamID, + void * pAos, + unsigned int size, /* number of elements in vector */ + unsigned int stride, + unsigned int Count); /* number of vectors in stream */ + #define RADEON_D_CAPTURE 0 #define RADEON_D_PLAYBACK 1 #define RADEON_D_PLAYBACK_RAW 2 diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 1610020ee86..a564d6f099b 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -34,7 +34,6 @@ #include "main/imports.h" #include "r600_context.h" -#include "r700_chip.h" #include "r700_debug.h" #include "r700_assembler.h" diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 9b302492317..5ae70c99c74 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -31,7 +31,6 @@ #include "r600_context.h" #include "r600_cmdbuf.h" -#include "r700_chip.h" #include "r700_state.h" #include "r700_tex.h" #include "r700_oglprog.h" @@ -39,25 +38,6 @@ #include "r700_vertprog.h" #include "r700_ioctl.h" -static GLboolean r700DestroyChipObj(GLcontext * ctx) -{ - context_t * context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700; - - if(NULL == context->chipobj.pvChipObj) - { - return GL_TRUE; - } - - r700 = (R700_CHIP_CONTEXT *)(context->chipobj.pvChipObj); - - FREE(r700->pStateList); - - FREE(r700); - - return GL_TRUE; -} - #define LINK_STATES(reg) \ do \ { \ @@ -71,11 +51,7 @@ GLboolean r700InitChipObject(context_t *context) { ContextState * pStateListWork; - R700_CHIP_CONTEXT *r700 = CALLOC( sizeof(R700_CHIP_CONTEXT) ); - - context->chipobj.pvChipObj = (void*)r700; - - context->chipobj.DestroyChipObj = r700DestroyChipObj; + R700_CHIP_CONTEXT *r700 = &context->hw; /* init state list */ r700->pStateList = (ContextState*) MALLOC (sizeof(ContextState)*sizeof(R700_CHIP_CONTEXT)/sizeof(unsigned int)); diff --git a/src/mesa/drivers/dri/r600/r700_chip.h b/src/mesa/drivers/dri/r600/r700_chip.h index 88b50754799..918cb222d40 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.h +++ b/src/mesa/drivers/dri/r600/r700_chip.h @@ -451,17 +451,5 @@ typedef struct _R700_CHIP_CONTEXT } R700_CHIP_CONTEXT; -#define R700_CONTEXT_STATES(context) ((R700_CHIP_CONTEXT *)(context->chipobj.pvChipObj)) - -extern GLboolean r700InitChipObject(context_t *context); -extern GLboolean r700SendContextStates(context_t *context); -extern int r700SetupStreams(GLcontext * ctx); -extern void r700SetupVTXConstants(GLcontext * ctx, - unsigned int nStreamID, - void * pAos, - unsigned int size, /* number of elements in vector */ - unsigned int stride, - unsigned int Count); /* number of vectors in stream */ - #endif /* _R700_CHIP_H_ */ diff --git a/src/mesa/drivers/dri/r600/r700_clear.c b/src/mesa/drivers/dri/r600/r700_clear.c index e610514e01d..e1164a09d7c 100644 --- a/src/mesa/drivers/dri/r600/r700_clear.c +++ b/src/mesa/drivers/dri/r600/r700_clear.c @@ -33,7 +33,6 @@ #include "main/enums.h" #include "r600_context.h" -#include "r700_chip.h" #include "r700_shaderinst.h" #include "r600_emit.h" diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index c46094dcd7e..cebb82d8532 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -38,7 +38,6 @@ #include "r600_context.h" #include "r600_cmdbuf.h" -#include "r700_chip.h" #include "r700_fragprog.h" #include "r700_debug.h" @@ -259,7 +258,7 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) context_t *context = R700_CONTEXT(ctx); BATCH_LOCALS(&context->radeon); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); struct r700_fragment_program *fp = (struct r700_fragment_program *) (ctx->FragmentProgram._Current); diff --git a/src/mesa/drivers/dri/r600/r700_ioctl.c b/src/mesa/drivers/dri/r600/r700_ioctl.c index f8c3359a47d..c4795320012 100644 --- a/src/mesa/drivers/dri/r600/r700_ioctl.c +++ b/src/mesa/drivers/dri/r600/r700_ioctl.c @@ -37,7 +37,6 @@ #include "radeon_lock.h" #include "r600_context.h" -#include "r700_chip.h" #include "r700_ioctl.h" #include "r700_clear.h" diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c index ba49367dc4f..36de143b1a7 100644 --- a/src/mesa/drivers/dri/r600/r700_oglprog.c +++ b/src/mesa/drivers/dri/r600/r700_oglprog.c @@ -34,7 +34,6 @@ #include "r600_context.h" -#include "r700_chip.h" #include "r700_oglprog.h" #include "r700_fragprog.h" #include "r700_vertprog.h" diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index ded5f51a6a1..cc90e8dfb7c 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -47,7 +47,6 @@ #include "r600_context.h" #include "r600_cmdbuf.h" -#include "r700_chip.h" #include "r700_tex.h" #include "r700_vertprog.h" @@ -109,7 +108,7 @@ static GLboolean r700SetupShaders(GLcontext * ctx) { context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); GLuint exportCount; @@ -133,7 +132,7 @@ GLboolean r700SendTextureState(context_t *context) { unsigned int i; - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); #if 0 /* to be enabled */ for(i=0; ichipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); #if 1 BATCH_LOCALS(&context->radeon); diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c index 446f9f959bc..b4fd51c1370 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ b/src/mesa/drivers/dri/r600/r700_shader.c @@ -35,7 +35,6 @@ #include "main/glheader.h" #include "r600_context.h" -#include "r700_chip.h" #include "r700_debug.h" #include "r700_shader.h" diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index e3e78df16c2..768e1846235 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -49,7 +49,6 @@ #include "r600_context.h" -#include "r700_chip.h" #include "r700_state.h" #include "r700_fragprog.h" @@ -190,7 +189,7 @@ static void r700InvalidateState(GLcontext * ctx, GLuint new_state) //----------- { context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); _swrast_InvalidateState(ctx, new_state); _swsetup_InvalidateState(ctx, new_state); @@ -239,7 +238,7 @@ static void r700SetDepthState(GLcontext * ctx) { context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); if (ctx->Depth.Test) { @@ -322,7 +321,7 @@ static void r700BlendFuncSeparate(GLcontext * ctx, static void r700UpdateCulling(GLcontext * ctx) { - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(R700_CONTEXT(ctx)->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, CULL_FRONT_bit); @@ -490,7 +489,7 @@ static void r700Viewport(GLcontext * ctx, { context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); __DRIdrawablePrivate *dPriv = context->radeon.dri.drawable; @@ -524,12 +523,7 @@ static void r700Viewport(GLcontext * ctx, tz = v[MAT_TZ] * scale; /* TODO : Need DMA flush as well. */ -#if 0 /* to be enabled */ - if(context->cmdbuf.count_used > 0) - { - (context->chipobj.FlushCmdBuffer)(context); - } -#endif /* to be enabled */ + r700->PA_CL_VPORT_XSCALE.u32All = *((unsigned int*)(&sx)); r700->PA_CL_VPORT_XOFFSET.u32All = *((unsigned int*)(&tx)); @@ -591,7 +585,7 @@ static void r700Scissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h) void r700SetRenderTarget(context_t *context) { - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); struct radeon_renderbuffer *rrb; unsigned int nPitchInPixel; @@ -774,7 +768,7 @@ void r700InitState(GLcontext * ctx) //------------------- { context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); /* Turn off vgt reuse */ r700->VGT_REUSE_OFF.u32All = 0; diff --git a/src/mesa/drivers/dri/r600/r700_tex.c b/src/mesa/drivers/dri/r600/r700_tex.c index e2de8faf772..21c93797290 100644 --- a/src/mesa/drivers/dri/r600/r700_tex.c +++ b/src/mesa/drivers/dri/r600/r700_tex.c @@ -40,7 +40,6 @@ #include "radeon_common.h" #include "r600_context.h" -#include "r700_chip.h" #include "r700_state.h" diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 2861918c423..a827de197be 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -41,7 +41,6 @@ #include "r600_context.h" #include "r600_cmdbuf.h" -#include "r700_chip.h" #include "r700_debug.h" #include "r700_vertprog.h" @@ -339,7 +338,7 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) BATCH_LOCALS(&context->radeon); - R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(context->chipobj.pvChipObj); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); struct r700_vertex_program *vp = (struct r700_vertex_program *)ctx->VertexProgram._Current; -- 2.30.2