diff options
author | Brian Paul <brianp@vmware.com> | 2012-09-29 08:47:55 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2012-10-05 17:13:03 -0600 |
commit | 5a63634a136caa905e7a1fa5da8fe5dc9f26add5 (patch) | |
tree | 5c443a81a5f65de3916cdbbe943d5d0f72b00fd9 /src/mesa/drivers/dri/radeon/radeon_common_context.c | |
parent | 7fa0f10cd85ccb5afbc3a961164011de70970ff3 (diff) | |
download | external_mesa3d-5a63634a136caa905e7a1fa5da8fe5dc9f26add5.zip external_mesa3d-5a63634a136caa905e7a1fa5da8fe5dc9f26add5.tar.gz external_mesa3d-5a63634a136caa905e7a1fa5da8fe5dc9f26add5.tar.bz2 |
radeon/r200: make radeon_context subclass of gl_context
radeon_context now contains a gl_context, rather than a pointer to one.
This will allow some minor core Mesa clean-up.
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_common_context.c')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_common_context.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 67f588c..a56d72a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -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); } |