summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/wgl/shared/stw_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/wgl/shared/stw_context.c')
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_context.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c
index 8393efbccf..4968ecc692 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_context.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_context.c
@@ -80,7 +80,7 @@ stw_copy_context(
struct stw_context *dst;
BOOL ret = FALSE;
- pipe_mutex_lock( stw_dev->mutex );
+ pipe_mutex_lock( stw_dev->ctx_mutex );
src = stw_lookup_context_locked( hglrcSrc );
dst = stw_lookup_context_locked( hglrcDst );
@@ -93,7 +93,7 @@ stw_copy_context(
(void) mask;
}
- pipe_mutex_unlock( stw_dev->mutex );
+ pipe_mutex_unlock( stw_dev->ctx_mutex );
return ret;
}
@@ -107,7 +107,7 @@ stw_share_lists(
struct stw_context *ctx2;
BOOL ret = FALSE;
- pipe_mutex_lock( stw_dev->mutex );
+ pipe_mutex_lock( stw_dev->ctx_mutex );
ctx1 = stw_lookup_context_locked( hglrc1 );
ctx2 = stw_lookup_context_locked( hglrc2 );
@@ -117,7 +117,7 @@ stw_share_lists(
ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx);
}
- pipe_mutex_unlock( stw_dev->mutex );
+ pipe_mutex_unlock( stw_dev->ctx_mutex );
return ret;
}
@@ -130,8 +130,10 @@ stw_viewport(GLcontext * glctx, GLint x, GLint y,
struct stw_framebuffer *fb;
fb = stw_framebuffer_from_hdc( ctx->hdc );
- if(fb)
+ if(fb) {
stw_framebuffer_update(fb);
+ stw_framebuffer_release(fb);
+ }
}
UINT_PTR
@@ -195,9 +197,9 @@ stw_create_layer_context(
ctx->st->ctx->DriverCtx = ctx;
ctx->st->ctx->Driver.Viewport = stw_viewport;
- pipe_mutex_lock( stw_dev->mutex );
+ pipe_mutex_lock( stw_dev->ctx_mutex );
ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx);
- pipe_mutex_unlock( stw_dev->mutex );
+ pipe_mutex_unlock( stw_dev->ctx_mutex );
if (!ctx->hglrc)
goto no_hglrc;
@@ -224,10 +226,10 @@ stw_delete_context(
if (!stw_dev)
return FALSE;
- pipe_mutex_lock( stw_dev->mutex );
+ pipe_mutex_lock( stw_dev->ctx_mutex );
ctx = stw_lookup_context_locked(hglrc);
handle_table_remove(stw_dev->ctx_table, hglrc);
- pipe_mutex_unlock( stw_dev->mutex );
+ pipe_mutex_unlock( stw_dev->ctx_mutex );
if (ctx) {
struct stw_context *curctx = stw_current_context();
@@ -254,9 +256,9 @@ stw_release_context(
if (!stw_dev)
return FALSE;
- pipe_mutex_lock( stw_dev->mutex );
+ pipe_mutex_lock( stw_dev->ctx_mutex );
ctx = stw_lookup_context_locked( hglrc );
- pipe_mutex_unlock( stw_dev->mutex );
+ pipe_mutex_unlock( stw_dev->ctx_mutex );
if (!ctx)
return FALSE;
@@ -304,9 +306,9 @@ stw_make_current(
HDC hdc,
UINT_PTR hglrc )
{
- struct stw_context *curctx;
- struct stw_context *ctx;
- struct stw_framebuffer *fb;
+ struct stw_context *curctx = NULL;
+ struct stw_context *ctx = NULL;
+ struct stw_framebuffer *fb = NULL;
if (!stw_dev)
goto fail;
@@ -328,13 +330,13 @@ stw_make_current(
return st_make_current( NULL, NULL, NULL );
}
- pipe_mutex_lock( stw_dev->mutex );
-
+ pipe_mutex_lock( stw_dev->ctx_mutex );
ctx = stw_lookup_context_locked( hglrc );
+ pipe_mutex_unlock( stw_dev->ctx_mutex );
if(!ctx)
goto fail;
- fb = stw_framebuffer_from_hdc_locked( hdc );
+ fb = stw_framebuffer_from_hdc( hdc );
if(!fb) {
/* Applications should call SetPixelFormat before creating a context,
* but not all do, and the opengl32 runtime seems to use a default pixel
@@ -342,13 +344,11 @@ stw_make_current(
*/
int iPixelFormat = GetPixelFormat(hdc);
if(iPixelFormat)
- fb = stw_framebuffer_create_locked( hdc, iPixelFormat );
+ fb = stw_framebuffer_create( hdc, iPixelFormat );
if(!fb)
goto fail;
}
- pipe_mutex_unlock( stw_dev->mutex );
-
if(fb->iPixelFormat != ctx->iPixelFormat)
goto fail;
@@ -367,12 +367,16 @@ stw_make_current(
success:
assert(fb);
- if(fb)
+ if(fb) {
stw_framebuffer_update(fb);
+ stw_framebuffer_release(fb);
+ }
return TRUE;
fail:
+ if(fb)
+ stw_framebuffer_release(fb);
st_make_current( NULL, NULL, NULL );
return FALSE;
}