aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-02-16 19:50:48 +0000
committerKeith Whitwell <[email protected]>2009-02-16 19:50:48 +0000
commit59d54334c96f44ed1d8bf660dc96221362a77d04 (patch)
treee9ab34e568256bcdc2a88602c47072ab769211e8 /src/gallium/state_trackers
parent7c8836e9ef49d938aa55a1c385b95c6371c301f1 (diff)
parentc5c383596ddb26cd75e4b355918ad16915283b59 (diff)
Merge branch 'master' into gallium-texture-transfer
Conflicts: src/mesa/state_tracker/st_cb_accum.c src/mesa/state_tracker/st_cb_drawpixels.c
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/Makefile2
-rw-r--r--src/gallium/state_trackers/egl/Makefile3
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c4
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.c2
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.h2
-rw-r--r--src/gallium/state_trackers/g3dvl/Makefile2
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_basic_csc.c10
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_context.c2
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c10
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_surface.c10
-rw-r--r--src/gallium/state_trackers/glx/xlib/SConscript3
-rw-r--r--src/gallium/state_trackers/wgl/icd/stw_icd.c243
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_pixelformat.c8
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_quirks.c5
14 files changed, 198 insertions, 108 deletions
diff --git a/src/gallium/state_trackers/Makefile b/src/gallium/state_trackers/Makefile
index 07b3fbf3119..265ca468c2d 100644
--- a/src/gallium/state_trackers/Makefile
+++ b/src/gallium/state_trackers/Makefile
@@ -2,7 +2,7 @@ TOP = ../../..
include $(TOP)/configs/current
-SUBDIRS = glx
+SUBDIRS = $(GALLIUM_STATE_TRACKERS_DIRS)
default: subdirs
diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
index 17d1a7a8e40..ea4cec0bb84 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -6,8 +6,7 @@ TOP = ../../../..
include ${TOP}/configs/current
-CFLAGS += -g -Wall -Werror=implicit-function-declaration -fPIC \
- $(shell pkg-config --cflags pixman-1 xorg-server) \
+CFLAGS += -g -Wall -Werror-implicit-function-declaration -fPIC \
-I${GALLIUMDIR}/include \
-I${GALLIUMDIR}/auxiliary \
-I${TOP}/src/mesa/drivers/dri/common \
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index 091d437d81b..281dff9f8a7 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -16,11 +16,11 @@
* Util functions
*/
-static struct drm_mode_modeinfo *
+static drmModeModeInfoPtr
drm_find_mode(drmModeConnectorPtr connector, _EGLMode *mode)
{
int i;
- struct drm_mode_modeinfo *m = NULL;
+ drmModeModeInfoPtr m = NULL;
for (i = 0; i < connector->count_modes; i++) {
m = &connector->modes[i];
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
index dec82c3a002..2813bf43609 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ b/src/gallium/state_trackers/egl/egl_tracker.c
@@ -92,7 +92,7 @@ drm_update_res(struct drm_device *dev)
static void
drm_add_modes_from_connector(_EGLScreen *screen, drmModeConnectorPtr connector)
{
- struct drm_mode_modeinfo *m;
+ drmModeModeInfoPtr m = NULL;
int i;
for (i = 0; i < connector->count_modes; i++) {
diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h
index 0b4dd9797d5..908bab5f9bf 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.h
+++ b/src/gallium/state_trackers/egl/egl_tracker.h
@@ -128,7 +128,7 @@ struct drm_screen
/*drmModeCrtcPtr crtc;*/
uint32_t crtcID;
- struct drm_mode_modeinfo *mode;
+ drmModeModeInfoPtr mode;
};
diff --git a/src/gallium/state_trackers/g3dvl/Makefile b/src/gallium/state_trackers/g3dvl/Makefile
index cddfca54fe5..f9f4d6be3c3 100644
--- a/src/gallium/state_trackers/g3dvl/Makefile
+++ b/src/gallium/state_trackers/g3dvl/Makefile
@@ -3,7 +3,7 @@ OBJECTS = vl_display.o vl_screen.o vl_context.o vl_surface.o vl_shader_build.o
vl_r16snorm_mc_buf.o
GALLIUMDIR = ../..
-CFLAGS += -g -Wall -Werror=implicit-function-declaration -fPIC \
+CFLAGS += -g -Wall -Werror-implicit-function-declaration -fPIC \
-I${GALLIUMDIR}/include \
-I${GALLIUMDIR}/auxiliary \
-I${GALLIUMDIR}/winsys/g3dvl \
diff --git a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
index 122c42ed0e6..187a13a5605 100644
--- a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
+++ b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
@@ -544,7 +544,7 @@ static int vlCreateDataBufs
* to display a rendered surface
* Quad is rendered as a tri strip
*/
- csc->vertex_bufs[0].pitch = sizeof(struct vlVertex2f);
+ csc->vertex_bufs[0].stride = sizeof(struct vlVertex2f);
csc->vertex_bufs[0].max_index = 3;
csc->vertex_bufs[0].buffer_offset = 0;
csc->vertex_bufs[0].buffer = pipe_buffer_create
@@ -573,7 +573,7 @@ static int vlCreateDataBufs
* Create our texcoord buffer and texcoord buffer element
* Texcoord buffer contains the TCs for mapping the rendered surface to the 4 vertices
*/
- csc->vertex_bufs[1].pitch = sizeof(struct vlVertex2f);
+ csc->vertex_bufs[1].stride = sizeof(struct vlVertex2f);
csc->vertex_bufs[1].max_index = 3;
csc->vertex_bufs[1].buffer_offset = 0;
csc->vertex_bufs[1].buffer = pipe_buffer_create
@@ -602,26 +602,24 @@ static int vlCreateDataBufs
* Create our vertex shader's constant buffer
* Const buffer contains scaling and translation vectors
*/
- csc->vs_const_buf.size = sizeof(struct vlVertexShaderConsts);
csc->vs_const_buf.buffer = pipe_buffer_create
(
pipe->screen,
1,
PIPE_BUFFER_USAGE_CONSTANT | PIPE_BUFFER_USAGE_DISCARD,
- csc->vs_const_buf.size
+ sizeof(struct vlVertexShaderConsts)
);
/*
* Create our fragment shader's constant buffer
* Const buffer contains the color conversion matrix and bias vectors
*/
- csc->fs_const_buf.size = sizeof(struct vlFragmentShaderConsts);
csc->fs_const_buf.buffer = pipe_buffer_create
(
pipe->screen,
1,
PIPE_BUFFER_USAGE_CONSTANT,
- csc->fs_const_buf.size
+ sizeof(struct vlFragmentShaderConsts)
);
/*
diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c
index c4c4e23c157..65ddb9f01ef 100644
--- a/src/gallium/state_trackers/g3dvl/vl_context.c
+++ b/src/gallium/state_trackers/g3dvl/vl_context.c
@@ -86,7 +86,7 @@ static int vlInitCommon(struct vlContext *context)
}
dsa.alpha.enabled = 0;
dsa.alpha.func = PIPE_FUNC_ALWAYS;
- dsa.alpha.ref = 0;
+ dsa.alpha.ref_value = 0;
context->dsa = pipe->create_depth_stencil_alpha_state(pipe, &dsa);
pipe->bind_depth_stencil_alpha_state(pipe, context->dsa);
diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
index fb9585063e4..7cd753f7363 100644
--- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
+++ b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
@@ -913,7 +913,7 @@ static int vlCreateDataBufs
mc->macroblocks_per_picture = mbw * mbh;
/* Create our vertex buffers */
- mc->vertex_bufs.ycbcr.pitch = sizeof(struct vlVertex2f) * 4;
+ mc->vertex_bufs.ycbcr.stride = sizeof(struct vlVertex2f) * 4;
mc->vertex_bufs.ycbcr.max_index = 24 * mc->macroblocks_per_picture - 1;
mc->vertex_bufs.ycbcr.buffer_offset = 0;
mc->vertex_bufs.ycbcr.buffer = pipe_buffer_create
@@ -926,7 +926,7 @@ static int vlCreateDataBufs
for (i = 1; i < 3; ++i)
{
- mc->vertex_bufs.all[i].pitch = sizeof(struct vlVertex2f) * 2;
+ mc->vertex_bufs.all[i].stride = sizeof(struct vlVertex2f) * 2;
mc->vertex_bufs.all[i].max_index = 24 * mc->macroblocks_per_picture - 1;
mc->vertex_bufs.all[i].buffer_offset = 0;
mc->vertex_bufs.all[i].buffer = pipe_buffer_create
@@ -987,22 +987,20 @@ static int vlCreateDataBufs
mc->vertex_elems[7].src_format = PIPE_FORMAT_R32G32_FLOAT;
/* Create our constant buffer */
- mc->vs_const_buf.size = sizeof(struct vlVertexShaderConsts);
mc->vs_const_buf.buffer = pipe_buffer_create
(
pipe->screen,
DEFAULT_BUF_ALIGNMENT,
PIPE_BUFFER_USAGE_CONSTANT | PIPE_BUFFER_USAGE_DISCARD,
- mc->vs_const_buf.size
+ sizeof(struct vlVertexShaderConsts)
);
- mc->fs_const_buf.size = sizeof(struct vlFragmentShaderConsts);
mc->fs_const_buf.buffer = pipe_buffer_create
(
pipe->screen,
DEFAULT_BUF_ALIGNMENT,
PIPE_BUFFER_USAGE_CONSTANT,
- mc->fs_const_buf.size
+ sizeof(struct vlFragmentShaderConsts)
);
memcpy
diff --git a/src/gallium/state_trackers/g3dvl/vl_surface.c b/src/gallium/state_trackers/g3dvl/vl_surface.c
index 0fa7b25b92e..92388f7978d 100644
--- a/src/gallium/state_trackers/g3dvl/vl_surface.c
+++ b/src/gallium/state_trackers/g3dvl/vl_surface.c
@@ -152,9 +152,9 @@ int vlPutPicture
bind_pipe_drawable(pipe, drawable);
- pipe->winsys->flush_frontbuffer
+ pipe->screen->flush_frontbuffer
(
- pipe->winsys,
+ pipe->screen,
csc->vlGetFrameBuffer(csc),
pipe->priv
);
@@ -172,13 +172,13 @@ int vlSurfaceGetStatus
assert(surface->context);
assert(status);
- if (surface->render_fence && !surface->context->pipe->winsys->fence_signalled(surface->context->pipe->winsys, surface->render_fence, 0))
+ if (surface->render_fence && !surface->context->pipe->screen->fence_signalled(surface->context->pipe->screen, surface->render_fence, 0))
{
*status = vlResourceStatusRendering;
return 0;
}
- if (surface->disp_fence && !surface->context->pipe->winsys->fence_signalled(surface->context->pipe->winsys, surface->disp_fence, 0))
+ if (surface->disp_fence && !surface->context->pipe->screen->fence_signalled(surface->context->pipe->screen, surface->disp_fence, 0))
{
*status = vlResourceStatusDisplaying;
return 0;
@@ -211,7 +211,7 @@ int vlSurfaceSync
assert(surface->context);
assert(surface->render_fence);
- surface->context->pipe->winsys->fence_finish(surface->context->pipe->winsys, surface->render_fence, 0);
+ surface->context->pipe->screen->fence_finish(surface->context->pipe->screen, surface->render_fence, 0);
return 0;
}
diff --git a/src/gallium/state_trackers/glx/xlib/SConscript b/src/gallium/state_trackers/glx/xlib/SConscript
index 14cdad69cbe..01641e90e47 100644
--- a/src/gallium/state_trackers/glx/xlib/SConscript
+++ b/src/gallium/state_trackers/glx/xlib/SConscript
@@ -5,8 +5,7 @@ Import('*')
if env['platform'] == 'linux' \
and 'mesa' in env['statetrackers'] \
- and ('softpipe' or 'i915simple' or 'trace') in env['drivers'] \
- and not env['dri']:
+ and ('softpipe' or 'i915simple' or 'trace') in env['drivers']:
env = env.Clone()
diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c
index 70e346a5394..1aa4b8a6e22 100644
--- a/src/gallium/state_trackers/wgl/icd/stw_icd.c
+++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c
@@ -31,6 +31,7 @@
#include "GL/gl.h"
#include "pipe/p_debug.h"
+#include "pipe/p_thread.h"
#include "shared/stw_public.h"
#include "icd/stw_icd.h"
@@ -41,11 +42,14 @@
struct stw_icd
{
+ pipe_mutex mutex;
+
+ GLCLTPROCTABLE cpt;
+ boolean cpt_initialized;
+
struct {
struct stw_context *ctx;
} ctx_array[DRV_CONTEXT_MAX];
-
- DHGLRC ctx_current;
};
@@ -62,6 +66,8 @@ stw_icd_init( void )
stw_icd = &stw_icd_storage;
memset(stw_icd, 0, sizeof *stw_icd);
+ pipe_mutex_init( stw_icd->mutex );
+
return TRUE;
}
@@ -70,26 +76,35 @@ stw_icd_cleanup(void)
{
int i;
- if(!stw_icd)
+ if (!stw_icd)
return;
+
+ pipe_mutex_lock( stw_icd->mutex );
+ {
+ /* Ensure all contexts are destroyed */
+ for (i = 0; i < DRV_CONTEXT_MAX; i++)
+ if (stw_icd->ctx_array[i].ctx)
+ stw_delete_context( stw_icd->ctx_array[i].ctx );
+ }
+ pipe_mutex_unlock( stw_icd->mutex );
- /* Ensure all contexts are destroyed */
- for (i = 0; i < DRV_CONTEXT_MAX; i++)
- if (stw_icd->ctx_array[i].ctx)
- stw_delete_context( stw_icd->ctx_array[i].ctx );
-
+ pipe_mutex_init( stw_icd->mutex );
stw_icd = NULL;
}
static struct stw_context *
-lookup_context( DHGLRC dhglrc )
+lookup_context( struct stw_icd *icd,
+ DHGLRC dhglrc )
{
if (dhglrc == 0 ||
dhglrc >= DRV_CONTEXT_MAX)
return NULL;
- return stw_icd->ctx_array[dhglrc - 1].ctx;
+ if (icd == NULL)
+ return NULL;
+
+ return icd->ctx_array[dhglrc - 1].ctx;
}
BOOL APIENTRY
@@ -98,14 +113,25 @@ DrvCopyContext(
DHGLRC dhrcDest,
UINT fuMask )
{
- struct stw_context *src = lookup_context( dhrcSource );
- struct stw_context *dst = lookup_context( dhrcDest );
-
- if (src == NULL ||
- dst == NULL)
+ BOOL ret = FALSE;
+
+ if (!stw_icd)
return FALSE;
- return stw_copy_context( src, dst, fuMask );
+ pipe_mutex_lock( stw_icd->mutex );
+ {
+ struct stw_context *src = lookup_context( stw_icd, dhrcSource );
+ struct stw_context *dst = lookup_context( stw_icd, dhrcDest );
+
+ if (src == NULL || dst == NULL)
+ goto done;
+
+ ret = stw_copy_context( src, dst, fuMask );
+ }
+done:
+ pipe_mutex_unlock( stw_icd->mutex );
+
+ return ret;
}
DHGLRC APIENTRY
@@ -113,23 +139,37 @@ DrvCreateLayerContext(
HDC hdc,
INT iLayerPlane )
{
- DWORD i;
+ DHGLRC handle = 0;
+
+ if (!stw_icd)
+ return handle;
+
+ pipe_mutex_lock( stw_icd->mutex );
+ {
+ int i;
+
+ for (i = 0; i < DRV_CONTEXT_MAX; i++) {
+ if (stw_icd->ctx_array[i].ctx == NULL)
+ break;
+ }
- for (i = 0; i < DRV_CONTEXT_MAX; i++) {
- if (stw_icd->ctx_array[i].ctx == NULL)
- goto found_slot;
+ /* No slot available, fail:
+ */
+ if (i == DRV_CONTEXT_MAX)
+ goto done;
+
+ stw_icd->ctx_array[i].ctx = stw_create_context( hdc, iLayerPlane );
+ if (stw_icd->ctx_array[i].ctx == NULL)
+ goto done;
+
+ /* success:
+ */
+ handle = (DHGLRC) i + 1;
}
-
- /* No slot available, fail:
- */
- return 0;
+done:
+ pipe_mutex_unlock( stw_icd->mutex );
-found_slot:
- stw_icd->ctx_array[i].ctx = stw_create_context( hdc, iLayerPlane );
- if (stw_icd->ctx_array[i].ctx == NULL)
- return 0;
-
- return (DHGLRC) i + 1;
+ return handle;
}
DHGLRC APIENTRY
@@ -143,20 +183,30 @@ BOOL APIENTRY
DrvDeleteContext(
DHGLRC dhglrc )
{
- struct stw_context *ctx;
+ BOOL ret = FALSE;
+
+ if (!stw_icd)
+ return ret;
- ctx = lookup_context( dhglrc );
- if (ctx == NULL)
- goto fail;
+ pipe_mutex_lock( stw_icd->mutex );
+ {
+ struct stw_context *ctx;
- if (stw_delete_context( ctx ) == FALSE)
- goto fail;
+ ctx = lookup_context( stw_icd, dhglrc );
+ if (ctx == NULL)
+ goto done;
+
+ if (stw_delete_context( ctx ) == FALSE)
+ goto done;
+
+ stw_icd->ctx_array[dhglrc - 1].ctx = NULL;
+ ret = TRUE;
- stw_icd->ctx_array[dhglrc - 1].ctx = NULL;
- return TRUE;
+ }
+done:
+ pipe_mutex_unlock( stw_icd->mutex );
-fail:
- return FALSE;
+ return ret;
}
BOOL APIENTRY
@@ -183,7 +233,7 @@ DrvDescribePixelFormat(
r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd );
- debug_printf( "%s( 0x%p, %d, %u, 0x%p ) = %d\n",
+ debug_printf( "%s( %p, %d, %u, %p ) = %d\n",
__FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r );
return r;
@@ -210,7 +260,7 @@ DrvGetProcAddress(
r = stw_get_proc_address( lpszProc );
- debug_printf( "%s( \", __FUNCTION__%s\" ) = 0x%p\n", lpszProc, r );
+ debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r );
return r;
}
@@ -230,23 +280,32 @@ BOOL APIENTRY
DrvReleaseContext(
DHGLRC dhglrc )
{
- struct stw_context *ctx;
+ BOOL ret = FALSE;
- if (dhglrc != stw_icd->ctx_current)
- goto fail;
+ if (!stw_icd)
+ return ret;
- ctx = lookup_context( dhglrc );
- if (ctx == NULL)
- goto fail;
+ pipe_mutex_lock( stw_icd->mutex );
+ {
+ struct stw_context *ctx;
- if (stw_make_current( NULL, NULL ) == FALSE)
- goto fail;
+ /* XXX: The expectation is that ctx is the same context which is
+ * current for this thread. We should check that and return False
+ * if not the case.
+ */
+ ctx = lookup_context( stw_icd, dhglrc );
+ if (ctx == NULL)
+ goto done;
- stw_icd->ctx_current = 0;
- return TRUE;
+ if (stw_make_current( NULL, NULL ) == FALSE)
+ goto done;
-fail:
- return FALSE;
+ ret = TRUE;
+ }
+done:
+ pipe_mutex_unlock( stw_icd->mutex );
+
+ return ret;
}
void APIENTRY
@@ -254,36 +313,20 @@ DrvSetCallbackProcs(
INT nProcs,
PROC *pProcs )
{
- debug_printf( "%s( %d, 0x%p )\n", __FUNCTION__, nProcs, pProcs );
+ debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs );
return;
}
-#define GPA_GL( NAME ) disp->NAME = gl##NAME
-static GLCLTPROCTABLE cpt;
+static void init_proc_table( GLCLTPROCTABLE *cpt )
+{
+ GLDISPATCHTABLE *disp = &cpt->glDispatchTable;
-PGLCLTPROCTABLE APIENTRY
-DrvSetContext(
- HDC hdc,
- DHGLRC dhglrc,
- PFN_SETPROCTABLE pfnSetProcTable )
-{
- struct stw_context *ctx;
- GLDISPATCHTABLE *disp = &cpt.glDispatchTable;
-
- debug_printf( "%s( 0x%p, %u, 0x%p )\n", __FUNCTION__, hdc, dhglrc, pfnSetProcTable );
-
- ctx = lookup_context( dhglrc );
- if (ctx == NULL)
- return NULL;
-
- if (!stw_make_current( hdc, ctx ))
- return NULL;
-
- memset( &cpt, 0, sizeof( cpt ) );
- cpt.cEntries = OPENGL_VERSION_110_ENTRIES;
+ memset( cpt, 0, sizeof *cpt );
+ cpt->cEntries = OPENGL_VERSION_110_ENTRIES;
+#define GPA_GL( NAME ) disp->NAME = gl##NAME
GPA_GL( NewList );
GPA_GL( EndList );
GPA_GL( CallList );
@@ -620,8 +663,46 @@ DrvSetContext(
GPA_GL( TexSubImage2D );
GPA_GL( PopClientAttrib );
GPA_GL( PushClientAttrib );
+}
- return &cpt;
+PGLCLTPROCTABLE APIENTRY
+DrvSetContext(
+ HDC hdc,
+ DHGLRC dhglrc,
+ PFN_SETPROCTABLE pfnSetProcTable )
+{
+ PGLCLTPROCTABLE result = NULL;
+
+ if (!stw_icd)
+ return result;
+
+ pipe_mutex_lock( stw_icd->mutex );
+ {
+ struct stw_context *ctx;
+
+ debug_printf( "%s( 0x%p, %u, 0x%p )\n",
+ __FUNCTION__, hdc, dhglrc, pfnSetProcTable );
+
+ /* Although WGL allows different dispatch entrypoints per
+ */
+ if (!stw_icd->cpt_initialized) {
+ init_proc_table( &stw_icd->cpt );
+ stw_icd->cpt_initialized = TRUE;
+ }
+
+ ctx = lookup_context( stw_icd, dhglrc );
+ if (ctx == NULL)
+ goto done;
+
+ if (!stw_make_current( hdc, ctx ))
+ goto done;
+
+ result = &stw_icd->cpt;
+ }
+done:
+ pipe_mutex_unlock( stw_icd->mutex );
+
+ return result;
}
int APIENTRY
@@ -646,7 +727,7 @@ DrvSetPixelFormat(
r = stw_pixelformat_set( hdc, iPixelFormat );
- debug_printf( "%s( 0x%p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
+ debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" );
return r;
}
@@ -665,7 +746,7 @@ BOOL APIENTRY
DrvSwapBuffers(
HDC hdc )
{
- debug_printf( "%s( 0x%p )\n", __FUNCTION__, hdc );
+ debug_printf( "%s( %p )\n", __FUNCTION__, hdc );
return stw_swap_buffers( hdc );
}
@@ -686,5 +767,7 @@ DrvValidateVersion(
{
debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion );
+ /* TODO: get the expected version from the winsys */
+
return ulVersion == 1;
}
diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c
index 12b5ac6d91e..84b7b287b91 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c
@@ -256,6 +256,14 @@ stw_pixelformat_set(
return FALSE;
currentpixelformat = iPixelFormat;
+
+ /* Some applications mistakenly use the undocumented wglSetPixelFormat
+ * function instead of SetPixelFormat, so we call SetPixelFormat here to
+ * avoid opengl32.dll's wglCreateContext to fail */
+ if (GetPixelFormat(hdc) == 0) {
+ SetPixelFormat(hdc, iPixelFormat, NULL);
+ }
+
return TRUE;
}
diff --git a/src/gallium/state_trackers/wgl/shared/stw_quirks.c b/src/gallium/state_trackers/wgl/shared/stw_quirks.c
index bf1ec3fee76..0961ce3bb0e 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_quirks.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_quirks.c
@@ -55,9 +55,12 @@ void gl_dispatch_stub_560(void){}
void gl_dispatch_stub_561(void){}
void gl_dispatch_stub_565(void){}
void gl_dispatch_stub_566(void){}
+void gl_dispatch_stub_570(void){}
void gl_dispatch_stub_577(void){}
void gl_dispatch_stub_578(void){}
+void gl_dispatch_stub_582(void){}
void gl_dispatch_stub_603(void){}
+void gl_dispatch_stub_607(void){}
void gl_dispatch_stub_645(void){}
void gl_dispatch_stub_646(void){}
void gl_dispatch_stub_647(void){}
@@ -67,6 +70,7 @@ void gl_dispatch_stub_650(void){}
void gl_dispatch_stub_651(void){}
void gl_dispatch_stub_652(void){}
void gl_dispatch_stub_653(void){}
+void gl_dispatch_stub_657(void){}
void gl_dispatch_stub_733(void){}
void gl_dispatch_stub_734(void){}
void gl_dispatch_stub_735(void){}
@@ -79,6 +83,7 @@ void gl_dispatch_stub_746(void){}
void gl_dispatch_stub_760(void){}
void gl_dispatch_stub_761(void){}
void gl_dispatch_stub_763(void){}
+void gl_dispatch_stub_764(void){}
void gl_dispatch_stub_765(void){}
void gl_dispatch_stub_766(void){}
void gl_dispatch_stub_767(void){}