radeon/r200: make radeon_context subclass of gl_context
authorBrian Paul <brianp@vmware.com>
Sat, 29 Sep 2012 14:47:55 +0000 (08:47 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 5 Oct 2012 23:13:03 +0000 (17:13 -0600)
radeon_context now contains a gl_context, rather than a pointer to one.
This will allow some minor core Mesa clean-up.

27 files changed:
src/mesa/drivers/dri/r200/r200_blit.c
src/mesa/drivers/dri/r200/r200_cmdbuf.c
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r200/r200_ioctl.h
src/mesa/drivers/dri/r200/r200_state.h
src/mesa/drivers/dri/r200/r200_state_init.c
src/mesa/drivers/dri/r200/r200_tcl.c
src/mesa/drivers/dri/r200/r200_tex.c
src/mesa/drivers/dri/r200/r200_texstate.c
src/mesa/drivers/dri/radeon/radeon_cmdbuf.h
src/mesa/drivers/dri/radeon/radeon_common.c
src/mesa/drivers/dri/radeon/radeon_common_context.c
src/mesa/drivers/dri/radeon/radeon_common_context.h
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/drivers/dri/radeon/radeon_dma.c
src/mesa/drivers/dri/radeon/radeon_fbo.c
src/mesa/drivers/dri/radeon/radeon_ioctl.c
src/mesa/drivers/dri/radeon/radeon_ioctl.h
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
src/mesa/drivers/dri/radeon/radeon_queryobj.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_state.c
src/mesa/drivers/dri/radeon/radeon_state.h
src/mesa/drivers/dri/radeon/radeon_state_init.c
src/mesa/drivers/dri/radeon/radeon_tcl.c
src/mesa/drivers/dri/radeon/radeon_tex.c
src/mesa/drivers/dri/radeon/radeon_texstate.c

index e3124b312f457dd9b4221e5755a7698a64b6a4b2..a6a1a3fa65c2fdb6d9d51182d955472d59b77a0a 100644 (file)
@@ -525,7 +525,7 @@ unsigned r200_blit(struct gl_context *ctx,
     }
 
     /* Flush is needed to make sure that source buffer has correct data */
-    radeonFlush(r200->radeon.glCtx);
+    radeonFlush(&r200->radeon.glCtx);
 
     rcommonEnsureCmdBufSpace(&r200->radeon, 102, __FUNCTION__);
 
index d911b45efb4de9180092c68959810e2e9e26d9be..aa058b39029f0313f4a4f3e53c8baa4bf2e63d1d 100644 (file)
@@ -56,7 +56,7 @@ void r200SetUpAtomList( r200ContextPtr rmesa )
 {
    int i, mtu;
 
-   mtu = rmesa->radeon.glCtx->Const.MaxTextureUnits;
+   mtu = rmesa->radeon.glCtx.Const.MaxTextureUnits;
 
    make_empty_list(&rmesa->radeon.hw.atomlist);
    rmesa->radeon.hw.atomlist.name = "atom-list";
@@ -201,7 +201,7 @@ GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
    retval = rmesa->radeon.tcl.elt_dma_bo->ptr + rmesa->radeon.tcl.elt_dma_offset;
    
    assert(!rmesa->radeon.dma.flush);
-   rmesa->radeon.glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
+   rmesa->radeon.glCtx.Driver.NeedFlush |= FLUSH_STORED_VERTICES;
    rmesa->radeon.dma.flush = r200FlushElts;
 
    return retval;
index 57bca064ea9467c7d7178bc6bb063416e37ed195..42f38a7b6c587f6c61a16e60772ef8ff92eaabb0 100644 (file)
@@ -295,7 +295,7 @@ GLboolean r200CreateContext( gl_api api,
     * setting allow larger textures.
     */
 
-   ctx = rmesa->radeon.glCtx;
+   ctx = &rmesa->radeon.glCtx;
    ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
                                                 "texture_units");
    ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
@@ -406,7 +406,7 @@ GLboolean r200CreateContext( gl_api api,
        others get the bit ordering right but don't actually do YUV-RGB conversion */
       ctx->Extensions.MESA_ycbcr_texture = true;
    }
-   if (rmesa->radeon.glCtx->Mesa_DXTn) {
+   if (rmesa->radeon.glCtx.Mesa_DXTn) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
       ctx->Extensions.S3_s3tc = true;
    }
@@ -458,7 +458,7 @@ GLboolean r200CreateContext( gl_api api,
         rmesa->radeon.radeonScreen->chip_flags &= ~RADEON_CHIPSET_TCL;
         fprintf(stderr, "Disabling HW TCL support\n");
       }
-      TCL_FALLBACK(rmesa->radeon.glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1);
+      TCL_FALLBACK(&rmesa->radeon.glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1);
    }
 
    _mesa_compute_version(ctx);
index 9aa00deb4e1af9f3ba3d763d52f44ef7be25d29d..f9b07a4b5a3f0a1d130187176bca2b6f3132acab 100644 (file)
@@ -76,7 +76,7 @@ void r200SetUpAtomList( r200ContextPtr rmesa );
 #define R200_NEWPRIM( rmesa )                  \
 do {                                           \
    if ( rmesa->radeon.dma.flush )                      \
-      rmesa->radeon.dma.flush( rmesa->radeon.glCtx );  \
+      rmesa->radeon.dma.flush( &rmesa->radeon.glCtx ); \
 } while (0)
 
 /* Can accomodate several state changes and primitive changes without
index 340bd8234ace693646f94e61759ae06d7f6126f6..4679516c05715153665222b6831943f6b94a3bd9 100644 (file)
@@ -55,7 +55,7 @@ extern void r200Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
 #define FALLBACK( rmesa, bit, mode ) do {                              \
    if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n",               \
                     __FUNCTION__, bit, mode );                         \
-   r200Fallback( rmesa->radeon.glCtx, bit, mode );                             \
+   r200Fallback( &rmesa->radeon.glCtx, bit, mode );                            \
 } while (0)
 
 extern void r200LightingSpaceChange( struct gl_context *ctx );
index 06e82429d7627428ef6ea883f0e829af4504c2eb..bde163295005d59261332971a0ef67b29ba624e5 100644 (file)
@@ -617,7 +617,7 @@ static void cube_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom)
  */
 void r200InitState( r200ContextPtr rmesa )
 {
-   struct gl_context *ctx = rmesa->radeon.glCtx;
+   struct gl_context *ctx = &rmesa->radeon.glCtx;
    GLuint i;
 
    rmesa->radeon.Fallback = 0;
index a667bd3530d925ac4ae154e073bef7d3fbd34b95..80963274526822a5aeccc5532d7dcf754d79ed7c 100644 (file)
@@ -153,7 +153,7 @@ static GLushort *r200AllocElts( r200ContextPtr rmesa, GLuint nr )
    }
    else {
       if (rmesa->radeon.dma.flush)
-        rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
+        rmesa->radeon.dma.flush( &rmesa->radeon.glCtx );
 
       r200EmitAOS( rmesa,
                   rmesa->radeon.tcl.aos_count, 0 );
@@ -312,7 +312,7 @@ static GLuint r200EnsureEmitSize( struct gl_context * ctx , GLubyte* vimap_rev )
     state_size = radeonCountStateEmitSize( &rmesa->radeon );
     /* vtx may be changed in r200EmitArrays so account for it if not dirty */
     if (!rmesa->hw.vtx.dirty)
-      state_size += rmesa->hw.vtx.check(rmesa->radeon.glCtx, &rmesa->hw.vtx);
+      state_size += rmesa->hw.vtx.check(&rmesa->radeon.glCtx, &rmesa->hw.vtx);
     /* predict size for elements */
     for (i = 0; i < VB->PrimitiveCount; ++i)
     {
@@ -546,7 +546,7 @@ static void transition_to_hwtnl( struct gl_context *ctx )
    tnl->Driver.NotifyMaterialChange = r200UpdateMaterial;
 
    if ( rmesa->radeon.dma.flush )                      
-      rmesa->radeon.dma.flush( rmesa->radeon.glCtx );  
+      rmesa->radeon.dma.flush( &rmesa->radeon.glCtx ); 
 
    rmesa->radeon.dma.flush = NULL;
    
@@ -613,7 +613,7 @@ void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
                if (oldfallback == 0) {
                        /* We have to flush before transition */
                        if ( rmesa->radeon.dma.flush )
-                               rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
+                               rmesa->radeon.dma.flush( &rmesa->radeon.glCtx );
 
                        if (R200_DEBUG & RADEON_FALLBACKS)
                                fprintf(stderr, "R200 begin tcl fallback %s\n",
@@ -626,7 +626,7 @@ void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
                if (oldfallback == bit) {
                        /* We have to flush before transition */
                        if ( rmesa->radeon.dma.flush )
-                               rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
+                               rmesa->radeon.dma.flush( &rmesa->radeon.glCtx );
 
                        if (R200_DEBUG & RADEON_FALLBACKS)
                                fprintf(stderr, "R200 end tcl fallback %s\n",
index 9d52095e24796d985858929501ef2e9a39aab097..a4347c606d73e4873add942a275d20eb8f0d7e85 100644 (file)
@@ -422,7 +422,7 @@ static void r200DeleteTexture(struct gl_context * ctx, struct gl_texture_object
    if (rmesa) {
       int i;
       radeon_firevertices(&rmesa->radeon);
-      for ( i = 0 ; i < rmesa->radeon.glCtx->Const.MaxTextureUnits ; i++ ) {
+      for ( i = 0 ; i < rmesa->radeon.glCtx.Const.MaxTextureUnits ; i++ ) {
         if ( t == rmesa->state.texture.unit[i].texobj ) {
            rmesa->state.texture.unit[i].texobj = NULL;
            rmesa->hw.tex[i].dirty = GL_FALSE;
index b25c611396006a97af10277ca10b8047196bc705..b20bd510a13098d44c5c1d400de8226fc6651334 100644 (file)
@@ -742,9 +742,9 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format
        radeon = pDRICtx->driverPrivate;
 
        rfb = dPriv->driverPrivate;
-        texUnit = &radeon->glCtx->Texture.Unit[radeon->glCtx->Texture.CurrentUnit];
-       texObj = _mesa_select_tex_object(radeon->glCtx, texUnit, target);
-        texImage = _mesa_get_tex_image(radeon->glCtx, texObj, target, 0);
+        texUnit = &radeon->glCtx.Texture.Unit[radeon->glCtx.Texture.CurrentUnit];
+       texObj = _mesa_select_tex_object(&radeon->glCtx, texUnit, target);
+        texImage = _mesa_get_tex_image(&radeon->glCtx, texObj, target, 0);
 
        rImage = get_radeon_texture_image(texImage);
        t = radeon_tex_obj(texObj);
@@ -759,7 +759,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format
                return;
        }
 
-       _mesa_lock_texture(radeon->glCtx, texObj);
+       _mesa_lock_texture(&radeon->glCtx, texObj);
        if (t->bo) {
                radeon_bo_unref(t->bo);
                t->bo = NULL;
@@ -806,7 +806,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format
                break;
        }
 
-       _mesa_init_teximage_fields(radeon->glCtx, texImage,
+       _mesa_init_teximage_fields(&radeon->glCtx, texImage,
                                   rb->base.Base.Width, rb->base.Base.Height,
                                   1, 0,
                                   rb->cpp, texFormat);
@@ -831,7 +831,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format
        }
 
        t->validated = GL_TRUE;
-       _mesa_unlock_texture(radeon->glCtx, texObj);
+       _mesa_unlock_texture(&radeon->glCtx, texObj);
        return;
 }
 
@@ -1046,7 +1046,7 @@ static void disable_tex_obj_state( r200ContextPtr rmesa,
    R200_STATECHANGE( rmesa, ctx );
    rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~(R200_TEX_0_ENABLE << unit);
    if (rmesa->radeon.TclFallback & (R200_TCL_FALLBACK_TEXGEN_0<<unit)) {
-      TCL_FALLBACK( rmesa->radeon.glCtx, (R200_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
+      TCL_FALLBACK( &rmesa->radeon.glCtx, (R200_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
    }
 
    /* Actually want to keep all units less than max active texture
index 9f8d6cc49de1ae79e9fb9cb52a9f4d84e8e435a4..efccc81bde756fcde3eadf4d63d7a01b970b0a9c 100644 (file)
@@ -107,7 +107,7 @@ void rcommonBeginBatch(radeonContextPtr rmesa,
 static INLINE void radeon_firevertices(radeonContextPtr radeon)
 {
    if (radeon->cmdbuf.cs->cdw || radeon->dma.flush )
-      radeon->glCtx->Driver.Flush(radeon->glCtx); /* +r6/r7 */
+      radeon->glCtx.Driver.Flush(&radeon->glCtx); /* +r6/r7 */
 }
 
 #endif
index c9f9b2078115c0b75d8fde87bac3c5a0ebc17de2..0cf656b6527ace0b6e157ca5403c79cf0191137e 100644 (file)
@@ -83,7 +83,7 @@ void radeonSetCliprects(radeonContextPtr radeon)
 
        if ((draw_rfb->base.Width != drawable->w) ||
            (draw_rfb->base.Height != drawable->h)) {
-               _mesa_resize_framebuffer(radeon->glCtx, &draw_rfb->base,
+               _mesa_resize_framebuffer(&radeon->glCtx, &draw_rfb->base,
                                         drawable->w, drawable->h);
                draw_rfb->base.Initialized = GL_TRUE;
        }
@@ -91,14 +91,14 @@ void radeonSetCliprects(radeonContextPtr radeon)
        if (drawable != readable) {
                if ((read_rfb->base.Width != readable->w) ||
                    (read_rfb->base.Height != readable->h)) {
-                       _mesa_resize_framebuffer(radeon->glCtx, &read_rfb->base,
+                       _mesa_resize_framebuffer(&radeon->glCtx, &read_rfb->base,
                                                 readable->w, readable->h);
                        read_rfb->base.Initialized = GL_TRUE;
                }
        }
 
        if (radeon->state.scissor.enabled)
-               radeonUpdateScissor(radeon->glCtx);
+               radeonUpdateScissor(&radeon->glCtx);
 
 }
 
@@ -428,7 +428,7 @@ void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GL
        old_viewport = ctx->Driver.Viewport;
        ctx->Driver.Viewport = NULL;
        radeon_window_moved(radeon);
-       radeon_draw_buffer(ctx, radeon->glCtx->DrawBuffer);
+       radeon_draw_buffer(ctx, radeon->glCtx.DrawBuffer);
        ctx->Driver.Viewport = old_viewport;
 }
 
@@ -440,7 +440,7 @@ static void radeon_print_state_atom(radeonContextPtr radeon, struct radeon_state
        if (!radeon_is_debug_enabled(RADEON_STATE, RADEON_VERBOSE) )
                return;
 
-       dwords = (*state->check) (radeon->glCtx, state);
+       dwords = (*state->check) (&radeon->glCtx, state);
 
        fprintf(stderr, "  emit %s %d/%d\n", state->name, dwords, state->cmd_size);
 
@@ -478,7 +478,7 @@ GLuint radeonCountStateEmitSize(radeonContextPtr radeon)
                        goto out;
                foreach(atom, &radeon->hw.atomlist) {
                        if (atom->dirty) {
-                               const GLuint atom_size = atom->check(radeon->glCtx, atom);
+                               const GLuint atom_size = atom->check(&radeon->glCtx, atom);
                                dwords += atom_size;
                                if (RADEON_CMDBUF && atom_size) {
                                        radeon_print_state_atom(radeon, atom);
@@ -487,7 +487,7 @@ GLuint radeonCountStateEmitSize(radeonContextPtr radeon)
                }
        } else {
                foreach(atom, &radeon->hw.atomlist) {
-                       const GLuint atom_size = atom->check(radeon->glCtx, atom);
+                       const GLuint atom_size = atom->check(&radeon->glCtx, atom);
                        dwords += atom_size;
                        if (RADEON_CMDBUF && atom_size) {
                                radeon_print_state_atom(radeon, atom);
@@ -505,13 +505,13 @@ static INLINE void radeon_emit_atom(radeonContextPtr radeon, struct radeon_state
        BATCH_LOCALS(radeon);
        int dwords;
 
-       dwords = (*atom->check) (radeon->glCtx, atom);
+       dwords = (*atom->check) (&radeon->glCtx, atom);
        if (dwords) {
 
                radeon_print_state_atom(radeon, atom);
 
                if (atom->emit) {
-                       (*atom->emit)(radeon->glCtx, atom);
+                       (*atom->emit)(&radeon->glCtx, atom);
                } else {
                        BEGIN_BATCH_NO_AUTOSTATE(dwords);
                        OUT_BATCH_TABLE(atom->cmd, dwords);
@@ -666,7 +666,7 @@ int rcommonFlushCmdBufLocked(radeonContextPtr rmesa, const char *caller)
                fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
        }
 
-       radeonEmitQueryEnd(rmesa->glCtx);
+       radeonEmitQueryEnd(&rmesa->glCtx);
 
        if (rmesa->cmdbuf.cs->cdw) {
                ret = radeon_cs_emit(rmesa->cmdbuf.cs);
@@ -675,7 +675,7 @@ int rcommonFlushCmdBufLocked(radeonContextPtr rmesa, const char *caller)
        radeon_cs_erase(rmesa->cmdbuf.cs);
        rmesa->cmdbuf.flushing = 0;
 
-       if (radeon_revalidate_bos(rmesa->glCtx) == GL_FALSE) {
+       if (radeon_revalidate_bos(&rmesa->glCtx) == GL_FALSE) {
                fprintf(stderr,"failed to revalidate buffers\n");
        }
 
@@ -751,7 +751,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa)
        rmesa->cmdbuf.size = size;
 
        radeon_cs_space_set_flush(rmesa->cmdbuf.cs,
-                                 (void (*)(void *))rmesa->glCtx->Driver.Flush, rmesa->glCtx);
+                                 (void (*)(void *))rmesa->glCtx.Driver.Flush, &rmesa->glCtx);
 
 
        if (!drmCommandWriteRead(rmesa->dri.fd, DRM_RADEON_GEM_INFO,
index 67f588c00e6c92321a59c099f1dfc5e7b5154677..a56d72a6d1d7cff62ecbba557279e6d6e3f5ee24 100644 (file)
@@ -143,15 +143,16 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
        radeon->radeonScreen = screen;
        /* Allocate and initialize the Mesa context */
        if (sharedContextPrivate)
-               shareCtx = ((radeonContextPtr)sharedContextPrivate)->glCtx;
+               shareCtx = &((radeonContextPtr)sharedContextPrivate)->glCtx;
        else
                shareCtx = NULL;
-       radeon->glCtx = _mesa_create_context(API_OPENGL, glVisual, shareCtx,
-                                           functions, (void *)radeon);
-       if (!radeon->glCtx)
+
+       if (!_mesa_initialize_context(&radeon->glCtx, API_OPENGL,
+                                     glVisual, shareCtx,
+                                     functions, (void *)radeon))
                return GL_FALSE;
 
-       ctx = radeon->glCtx;
+       ctx = &radeon->glCtx;
        driContextPriv->driverPrivate = radeon;
 
        _mesa_meta_init(ctx);
@@ -223,7 +224,7 @@ void radeonDestroyContext(__DRIcontext *driContextPriv )
 
        assert(radeon);
 
-       _mesa_meta_free(radeon->glCtx);
+       _mesa_meta_free(&radeon->glCtx);
 
        if (radeon == current) {
                _mesa_make_current(NULL, NULL, NULL);
@@ -235,17 +236,17 @@ void radeonDestroyContext(__DRIcontext *driContextPriv )
        }
 
        radeonFreeDmaRegions(radeon);
-       radeonReleaseArrays(radeon->glCtx, ~0);
+       radeonReleaseArrays(&radeon->glCtx, ~0);
        if (radeon->vtbl.free_context)
-               radeon->vtbl.free_context(radeon->glCtx);
-       _swsetup_DestroyContext( radeon->glCtx );
-       _tnl_DestroyContext( radeon->glCtx );
-       _vbo_DestroyContext( radeon->glCtx );
-       _swrast_DestroyContext( radeon->glCtx );
+               radeon->vtbl.free_context(&radeon->glCtx);
+       _swsetup_DestroyContext( &radeon->glCtx );
+       _tnl_DestroyContext( &radeon->glCtx );
+       _vbo_DestroyContext( &radeon->glCtx );
+       _swrast_DestroyContext( &radeon->glCtx );
 
        /* free atom list */
-       /* free the Mesa context */
-       _mesa_destroy_context(radeon->glCtx);
+       /* free the Mesa context data */
+       _mesa_free_context_data(&radeon->glCtx);
 
        /* _mesa_destroy_context() might result in calls to functions that
         * depend on the DriverCtx, so don't set it to NULL before.
@@ -277,7 +278,7 @@ GLboolean radeonUnbindContext(__DRIcontext * driContextPriv)
 
        if (RADEON_DEBUG & RADEON_DRI)
                fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
-                       radeon->glCtx);
+                       &radeon->glCtx);
 
        /* Unset current context and dispath table */
        _mesa_make_current(NULL, NULL, NULL);
@@ -316,7 +317,7 @@ void radeon_prepare_render(radeonContextPtr radeon)
            radeon_update_renderbuffers(driContext, drawable, GL_FALSE);
 
        /* Intel driver does the equivalent of this, no clue if it is needed:*/
-       radeon_draw_buffer(radeon->glCtx, radeon->glCtx->DrawBuffer);
+       radeon_draw_buffer(&radeon->glCtx, radeon->glCtx.DrawBuffer);
 
        driContext->dri2.draw_stamp = drawable->dri2.stamp;
     }
@@ -549,7 +550,7 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
                }
        }
 
-       driUpdateFramebufferSize(radeon->glCtx, drawable);
+       driUpdateFramebufferSize(&radeon->glCtx, drawable);
 }
 
 /* Force the context `c' to be the current context and associate with it
@@ -584,7 +585,7 @@ GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
        }
 
        if(driDrawPriv == NULL && driReadPriv == NULL) {
-               drfb = _mesa_create_framebuffer(&radeon->glCtx->Visual);
+               drfb = _mesa_create_framebuffer(&radeon->glCtx.Visual);
                readfb = drfb;
        }
        else {
@@ -602,25 +603,25 @@ GLboolean radeonMakeCurrent(__DRIcontext * driContextPriv,
                &(radeon_get_renderbuffer(drfb, BUFFER_DEPTH)->base.Base));
 
        if (RADEON_DEBUG & RADEON_DRI)
-            fprintf(stderr, "%s ctx %p dfb %p rfb %p\n", __FUNCTION__, radeon->glCtx, drfb, readfb);
+            fprintf(stderr, "%s ctx %p dfb %p rfb %p\n", __FUNCTION__, &radeon->glCtx, drfb, readfb);
 
        if(driDrawPriv)
-               driUpdateFramebufferSize(radeon->glCtx, driDrawPriv);
+               driUpdateFramebufferSize(&radeon->glCtx, driDrawPriv);
        if (driReadPriv != driDrawPriv)
-               driUpdateFramebufferSize(radeon->glCtx, driReadPriv);
+               driUpdateFramebufferSize(&radeon->glCtx, driReadPriv);
 
-       _mesa_make_current(radeon->glCtx, drfb, readfb);
+       _mesa_make_current(&radeon->glCtx, drfb, readfb);
        if (driDrawPriv == NULL && driReadPriv == NULL)
                _mesa_reference_framebuffer(&drfb, NULL);
 
-       _mesa_update_state(radeon->glCtx);
+       _mesa_update_state(&radeon->glCtx);
 
-       if (radeon->glCtx->DrawBuffer == drfb) {
+       if (radeon->glCtx.DrawBuffer == drfb) {
                if(driDrawPriv != NULL) {
                        radeon_window_moved(radeon);
                }
 
-               radeon_draw_buffer(radeon->glCtx, drfb);
+               radeon_draw_buffer(&radeon->glCtx, drfb);
        }
 
 
index 5c2389208f1ca031474cff01c2e73f1fd1707a08..6149fcc48fb45d84f8adb3962da756cf7723d820 100644 (file)
@@ -384,7 +384,7 @@ struct radeon_cmdbuf {
 };
 
 struct radeon_context {
-   struct gl_context *glCtx;
+   struct gl_context glCtx;             /**< base class, must be first */
    radeonScreenPtr radeonScreen;       /* Screen private DRI data */
 
    /* Texture object bookkeeping
index 0ee0aeedfa1987168ee38d347fbb2de5fd8db2ea..962f08ac69853a523689663ac5d20f4d7a223f1f 100644 (file)
@@ -257,7 +257,7 @@ r100CreateContext( gl_api api,
     * setting allow larger textures.
     */
 
-   ctx = rmesa->radeon.glCtx;
+   ctx = &rmesa->radeon.glCtx;
    ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
                                                 "texture_units");
    ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
@@ -357,7 +357,7 @@ r100CreateContext( gl_api api,
    ctx->Extensions.EXT_framebuffer_object = true;
    ctx->Extensions.ARB_texture_cube_map = true;
 
-   if (rmesa->radeon.glCtx->Mesa_DXTn) {
+   if (rmesa->radeon.glCtx.Mesa_DXTn) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
       ctx->Extensions.S3_s3tc = true;
    }
@@ -403,7 +403,7 @@ r100CreateContext( gl_api api,
         rmesa->radeon.radeonScreen->chip_flags &= ~RADEON_CHIPSET_TCL;
         fprintf(stderr, "Disabling HW TCL support\n");
       }
-      TCL_FALLBACK(rmesa->radeon.glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
+      TCL_FALLBACK(&rmesa->radeon.glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
    }
 
    if (rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL) {
index 9193d13e83bed6d7587787fa368df13b03a75e50..3497d481d4b71dc73ffd214d9cc028c9cfcd43e2 100644 (file)
@@ -270,7 +270,7 @@ void radeonAllocDmaRegion(radeonContextPtr rmesa,
                fprintf(stderr, "%s %d\n", __FUNCTION__, bytes);
 
        if (rmesa->dma.flush)
-               rmesa->dma.flush(rmesa->glCtx);
+               rmesa->dma.flush(&rmesa->glCtx);
 
        assert(rmesa->dma.current_used == rmesa->dma.current_vertexptr);
 
@@ -459,7 +459,7 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize )
        if(is_empty_list(&rmesa->dma.reserved)
              ||rmesa->dma.current_vertexptr + bytes > first_elem(&rmesa->dma.reserved)->bo->size) {
                if (rmesa->dma.flush) {
-                       rmesa->dma.flush(rmesa->glCtx);
+                       rmesa->dma.flush(&rmesa->glCtx);
                }
 
                 radeonRefillCurrentDmaRegion(rmesa, bytes);
@@ -469,7 +469,7 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize )
 
         if (!rmesa->dma.flush) {
                /* if cmdbuf flushed DMA restart */
-                rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
+                rmesa->glCtx.Driver.NeedFlush |= FLUSH_STORED_VERTICES;
                 rmesa->dma.flush = rcommon_flush_last_swtcl_prim;
         }
 
@@ -499,7 +499,7 @@ void radeonReleaseArrays( struct gl_context *ctx, GLuint newinputs )
                fprintf(stderr, "%s\n", __FUNCTION__);
 
    if (radeon->dma.flush) {
-       radeon->dma.flush(radeon->glCtx);
+       radeon->dma.flush(&radeon->glCtx);
    }
    for (i = 0; i < radeon->tcl.aos_count; i++) {
       if (radeon->tcl.aos[i].bo) {
index 481eb5a49c18cc194c737a01066facc9bd854b56..291f2b781884a9d6525a9b1089ace169000d6d6b 100644 (file)
@@ -596,7 +596,7 @@ radeon_image_target_renderbuffer_storage(struct gl_context *ctx,
    rb->Width = image->width;
    rb->Height = image->height;
    rb->Format = image->format;
-   rb->_BaseFormat = _mesa_base_fbo_format(radeon->glCtx,
+   rb->_BaseFormat = _mesa_base_fbo_format(&radeon->glCtx,
                                            image->internal_format);
 }
 
@@ -944,18 +944,18 @@ radeon_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
 
 void radeon_fbo_init(struct radeon_context *radeon)
 {
-  radeon->glCtx->Driver.NewFramebuffer = radeon_new_framebuffer;
-  radeon->glCtx->Driver.NewRenderbuffer = radeon_new_renderbuffer;
-  radeon->glCtx->Driver.MapRenderbuffer = radeon_map_renderbuffer;
-  radeon->glCtx->Driver.UnmapRenderbuffer = radeon_unmap_renderbuffer;
-  radeon->glCtx->Driver.BindFramebuffer = radeon_bind_framebuffer;
-  radeon->glCtx->Driver.FramebufferRenderbuffer = radeon_framebuffer_renderbuffer;
-  radeon->glCtx->Driver.RenderTexture = radeon_render_texture;
-  radeon->glCtx->Driver.FinishRenderTexture = radeon_finish_render_texture;
-  radeon->glCtx->Driver.ResizeBuffers = radeon_resize_buffers;
-  radeon->glCtx->Driver.ValidateFramebuffer = radeon_validate_framebuffer;
-  radeon->glCtx->Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer;
-  radeon->glCtx->Driver.EGLImageTargetRenderbufferStorage =
+  radeon->glCtx.Driver.NewFramebuffer = radeon_new_framebuffer;
+  radeon->glCtx.Driver.NewRenderbuffer = radeon_new_renderbuffer;
+  radeon->glCtx.Driver.MapRenderbuffer = radeon_map_renderbuffer;
+  radeon->glCtx.Driver.UnmapRenderbuffer = radeon_unmap_renderbuffer;
+  radeon->glCtx.Driver.BindFramebuffer = radeon_bind_framebuffer;
+  radeon->glCtx.Driver.FramebufferRenderbuffer = radeon_framebuffer_renderbuffer;
+  radeon->glCtx.Driver.RenderTexture = radeon_render_texture;
+  radeon->glCtx.Driver.FinishRenderTexture = radeon_finish_render_texture;
+  radeon->glCtx.Driver.ResizeBuffers = radeon_resize_buffers;
+  radeon->glCtx.Driver.ValidateFramebuffer = radeon_validate_framebuffer;
+  radeon->glCtx.Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer;
+  radeon->glCtx.Driver.EGLImageTargetRenderbufferStorage =
          radeon_image_target_renderbuffer_storage;
 }
 
index c6c8b05435177c0eee3ec9ec40ed06496b1cc5f3..4167820765bb1d5036fa64291904a2bc312ce6e1 100644 (file)
@@ -64,7 +64,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 void radeonSetUpAtomList( r100ContextPtr rmesa )
 {
-   int i, mtu = rmesa->radeon.glCtx->Const.MaxTextureUnits;
+   int i, mtu = rmesa->radeon.glCtx.Const.MaxTextureUnits;
 
    make_empty_list(&rmesa->radeon.hw.atomlist);
    rmesa->radeon.hw.atomlist.name = "atom-list";
@@ -208,7 +208,7 @@ void radeonFlushElts( struct gl_context *ctx )
 
    if (RADEON_DEBUG & RADEON_SYNC) {
       fprintf(stderr, "%s: Syncing\n", __FUNCTION__);
-      radeonFinish( rmesa->radeon.glCtx );
+      radeonFinish( &rmesa->radeon.glCtx );
    }
 
 }
@@ -267,7 +267,7 @@ GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa,
              __FUNCTION__, primitive);
 
    assert(!rmesa->radeon.dma.flush);
-   rmesa->radeon.glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
+   rmesa->radeon.glCtx.Driver.NeedFlush |= FLUSH_STORED_VERTICES;
    rmesa->radeon.dma.flush = radeonFlushElts;
 
    return retval;
index 3297b5cd841a9a0cc1da53f9baa6d000c88c75a1..1659682f02ccb5a2c656702fb7842be4979d4481 100644 (file)
@@ -92,7 +92,7 @@ extern void radeonSetUpAtomList( r100ContextPtr rmesa );
 #define RADEON_NEWPRIM( rmesa )                        \
 do {                                           \
    if ( rmesa->radeon.dma.flush )                      \
-      rmesa->radeon.dma.flush( rmesa->radeon.glCtx );  \
+      rmesa->radeon.dma.flush( &rmesa->radeon.glCtx ); \
 } while (0)
 
 /* Can accomodate several state changes and primitive changes without
index 8901090df8b39a42d1e823b4bd83e54f1962bb40..668ef9f1993a648019d29c71870b59cd0374cfd5 100644 (file)
@@ -160,7 +160,7 @@ static void calculate_miptree_layout(radeonContextPtr rmesa, radeon_mipmap_tree
 {
        GLuint curOffset, i, face, level;
 
-       assert(mt->numLevels <= rmesa->glCtx->Const.MaxTextureLevels);
+       assert(mt->numLevels <= rmesa->glCtx.Const.MaxTextureLevels);
 
        curOffset = 0;
        for(face = 0; face < mt->faces; face++) {
index 5c02f5c2ed08e032f5c967bcb4d1d509af9de9ba..705d612e10be55db542933283def8c12bc7f7649 100644 (file)
@@ -111,7 +111,7 @@ static void radeonBeginQuery(struct gl_context *ctx, struct gl_query_object *q)
        assert(radeon->query.current == NULL);
 
        if (radeon->dma.flush)
-               radeon->dma.flush(radeon->glCtx);
+               radeon->dma.flush(&radeon->glCtx);
 
        if (!query->bo) {
                query->bo = radeon_bo_open(radeon->radeonScreen->bom, 0, RADEON_QUERY_PAGE_SIZE, RADEON_QUERY_PAGE_SIZE, RADEON_GEM_DOMAIN_GTT, 0);
@@ -151,7 +151,7 @@ static void radeonEndQuery(struct gl_context *ctx, struct gl_query_object *q)
        radeon_print(RADEON_STATE, RADEON_NORMAL, "%s: query id %d\n", __FUNCTION__, q->Id);
 
        if (radeon->dma.flush)
-               radeon->dma.flush(radeon->glCtx);
+               radeon->dma.flush(&radeon->glCtx);
        radeonEmitQueryEnd(ctx);
 
        radeon->query.current = NULL;
index 237503d7708fb2300b9110cad25277ddaf63cab6..7a637ddf92afbcf734d89850058e07651e1d4026 100644 (file)
@@ -192,7 +192,7 @@ radeonDRI2Flush(__DRIdrawable *drawable)
     radeonContextPtr rmesa;
 
     rmesa = (radeonContextPtr) drawable->driContextPriv->driverPrivate;
-    radeonFlush(rmesa->glCtx);
+    radeonFlush(&rmesa->glCtx);
 }
 
 static const struct __DRI2flushExtensionRec radeonFlushExtension = {
@@ -267,9 +267,9 @@ radeon_create_image_from_renderbuffer(__DRIcontext *context,
    struct gl_renderbuffer *rb;
    struct radeon_renderbuffer *rrb;
 
-   rb = _mesa_lookup_renderbuffer(radeon->glCtx, renderbuffer);
+   rb = _mesa_lookup_renderbuffer(&radeon->glCtx, renderbuffer);
    if (!rb) {
-      _mesa_error(radeon->glCtx,
+      _mesa_error(&radeon->glCtx,
                   GL_INVALID_OPERATION, "glRenderbufferExternalMESA");
       return NULL;
    }
index d930e76736a0db1250a47d677961d70d517f6089..7f12f9c38372bef557f3c6e6ba07658a7b17c350 100644 (file)
@@ -1850,7 +1850,7 @@ void radeonUploadTexMatrix( r100ContextPtr rmesa,
    int idx = TEXMAT_0 + unit;
    float *dest = ((float *)RADEON_DB_STATE( mat[idx] )) + MAT_ELT_0;
    int i;
-   struct gl_texture_unit tUnit = rmesa->radeon.glCtx->Texture.Unit[unit];
+   struct gl_texture_unit tUnit = rmesa->radeon.glCtx.Texture.Unit[unit];
    GLfloat *src = rmesa->tmpmat[unit].m;
 
    rmesa->TexMatColSwap &= ~(1 << unit);
index 5bcb415c65e1971fb91818baf176fd10fc21efd1..cb98969c492f4107e8c4663036446710fd017088 100644 (file)
@@ -57,7 +57,7 @@ extern void radeonFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
 #define FALLBACK( rmesa, bit, mode ) do {                              \
    if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n",               \
                     __FUNCTION__, bit, mode );                         \
-   radeonFallback( rmesa->radeon.glCtx, bit, mode );                           \
+   radeonFallback( &rmesa->radeon.glCtx, bit, mode );                          \
 } while (0)
 
 
index f162f88b25e39c578bed61e090552891484d4a29..8c88dd01831deb4d85b0eb44a8d546519c09df4e 100644 (file)
@@ -503,7 +503,7 @@ static void tex_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom)
  */
 void radeonInitState( r100ContextPtr rmesa )
 {
-   struct gl_context *ctx = rmesa->radeon.glCtx;
+   struct gl_context *ctx = &rmesa->radeon.glCtx;
    GLuint i;
 
    rmesa->radeon.Fallback = 0;
index 52e435c83bbf8d48cf94721804ee859fe7de0388..7abc6c3c8dd59fb16721bf6598c45d7201de0603 100644 (file)
@@ -147,7 +147,7 @@ static GLboolean discrete_prim[0x10] = {
 static GLushort *radeonAllocElts( r100ContextPtr rmesa, GLuint nr ) 
 {
       if (rmesa->radeon.dma.flush)
-        rmesa->radeon.dma.flush( rmesa->radeon.glCtx );
+        rmesa->radeon.dma.flush( &rmesa->radeon.glCtx );
 
       radeonEmitAOS( rmesa,
                     rmesa->radeon.tcl.aos_count, 0 );
@@ -314,7 +314,7 @@ static GLuint radeonEnsureEmitSize( struct gl_context * ctx , GLuint inputs )
     state_size = radeonCountStateEmitSize( &rmesa->radeon );
     /* tcl may be changed in radeonEmitArrays so account for it if not dirty */
     if (!rmesa->hw.tcl.dirty)
-      state_size += rmesa->hw.tcl.check( rmesa->radeon.glCtx, &rmesa->hw.tcl );
+      state_size += rmesa->hw.tcl.check( &rmesa->radeon.glCtx, &rmesa->hw.tcl );
     /* predict size for elements */
     for (i = 0; i < VB->PrimitiveCount; ++i)
     {
@@ -500,7 +500,7 @@ static void transition_to_hwtnl( struct gl_context *ctx )
    tnl->Driver.NotifyMaterialChange = radeonUpdateMaterial;
 
    if ( rmesa->radeon.dma.flush )                      
-      rmesa->radeon.dma.flush( rmesa->radeon.glCtx );  
+      rmesa->radeon.dma.flush( &rmesa->radeon.glCtx ); 
 
    rmesa->radeon.dma.flush = NULL;
    rmesa->swtcl.vertex_format = 0;
index fcd9a76a998beee2d071f0dfb6dc857b15c00137..5ca07e04e792a38b68834053e73b82e1691824fc 100644 (file)
@@ -364,7 +364,7 @@ static void radeonDeleteTexture( struct gl_context *ctx,
 
    if ( rmesa ) {
      radeon_firevertices(&rmesa->radeon);
-     for ( i = 0 ; i < rmesa->radeon.glCtx->Const.MaxTextureUnits ; i++ ) {
+     for ( i = 0 ; i < rmesa->radeon.glCtx.Const.MaxTextureUnits ; i++ ) {
        if ( t == rmesa->state.texture.unit[i].texobj ) {
         rmesa->state.texture.unit[i].texobj = NULL;
         rmesa->hw.tex[i].dirty = GL_FALSE;
index d2b5b755d6e991707914cdd25b5c109d22426ece..944bac6017bb14a792088d2e797fcea30210bd1e 100644 (file)
@@ -619,9 +619,9 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form
        radeon = pDRICtx->driverPrivate;
 
        rfb = dPriv->driverPrivate;
-        texUnit = _mesa_get_current_tex_unit(radeon->glCtx);
-       texObj = _mesa_select_tex_object(radeon->glCtx, texUnit, target);
-        texImage = _mesa_get_tex_image(radeon->glCtx, texObj, target, 0);
+        texUnit = _mesa_get_current_tex_unit(&radeon->glCtx);
+       texObj = _mesa_select_tex_object(&radeon->glCtx, texUnit, target);
+        texImage = _mesa_get_tex_image(&radeon->glCtx, texObj, target, 0);
 
        rImage = get_radeon_texture_image(texImage);
        t = radeon_tex_obj(texObj);
@@ -636,7 +636,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form
                return;
        }
 
-       _mesa_lock_texture(radeon->glCtx, texObj);
+       _mesa_lock_texture(&radeon->glCtx, texObj);
        if (t->bo) {
                radeon_bo_unref(t->bo);
                t->bo = NULL;
@@ -681,7 +681,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form
                break;
        }
 
-       _mesa_init_teximage_fields(radeon->glCtx, texImage,
+       _mesa_init_teximage_fields(&radeon->glCtx, texImage,
                                   rb->base.Base.Width, rb->base.Base.Height,
                                   1, 0,
                                   rb->cpp, texFormat);
@@ -706,7 +706,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form
                             (texImage->HeightLog2 << RADEON_TXFORMAT_HEIGHT_SHIFT));
        }
        t->validated = GL_TRUE;
-       _mesa_unlock_texture(radeon->glCtx, texObj);
+       _mesa_unlock_texture(&radeon->glCtx, texObj);
        return;
 }
 
@@ -747,7 +747,7 @@ static void disable_tex_obj_state( r100ContextPtr rmesa,
                                             RADEON_Q_BIT(unit));
    
    if (rmesa->radeon.TclFallback & (RADEON_TCL_FALLBACK_TEXGEN_0<<unit)) {
-     TCL_FALLBACK( rmesa->radeon.glCtx, (RADEON_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
+     TCL_FALLBACK( &rmesa->radeon.glCtx, (RADEON_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
      rmesa->recheck_texgen[unit] = GL_TRUE;
    }