summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/docs/source/screen.rst9
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.c5
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.h5
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.c1
-rw-r--r--src/gallium/drivers/cell/ppu/cell_winsys.h5
-rw-r--r--src/gallium/drivers/i915/i915_context.c3
-rw-r--r--src/gallium/drivers/i915/i915_context.h5
-rw-r--r--src/gallium/drivers/i915/i915_screen.c2
-rw-r--r--src/gallium/drivers/i915/intel_winsys.h4
-rw-r--r--src/gallium/drivers/i965/brw_context.c4
-rw-r--r--src/gallium/drivers/i965/brw_context.h4
-rw-r--r--src/gallium/drivers/i965/brw_screen.c1
-rw-r--r--src/gallium/drivers/i965/brw_winsys.h4
-rw-r--r--src/gallium/drivers/identity/id_context.c2
-rw-r--r--src/gallium/drivers/identity/id_context.h4
-rw-r--r--src/gallium/drivers/identity/id_drm.c17
-rw-r--r--src/gallium/drivers/identity/id_public.h3
-rw-r--r--src/gallium/drivers/identity/id_screen.c16
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_winsys.h3
-rw-r--r--src/gallium/drivers/nouveau/nouveau_winsys.h9
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c4
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h5
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c4
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.h2
-rw-r--r--src/gallium/drivers/nv30/nv30_state_emit.c6
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c4
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h5
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.h2
-rw-r--r--src/gallium/drivers/nv40/nv40_state_emit.c6
-rw-r--r--src/gallium/drivers/nv50/nv50_context.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h5
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.h1
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c10
-rw-r--r--src/gallium/drivers/r300/r300_context.c4
-rw-r--r--src/gallium/drivers/r300/r300_context.h4
-rw-r--r--src/gallium/drivers/r300/r300_screen.c3
-rw-r--r--src/gallium/drivers/r300/r300_screen.h5
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h7
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_context.h3
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_video_context.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_winsys.h1
-rw-r--r--src/gallium/drivers/svga/svga_context.c4
-rw-r--r--src/gallium/drivers/svga/svga_context.h4
-rw-r--r--src/gallium/drivers/svga/svga_screen.c1
-rw-r--r--src/gallium/drivers/svga/svga_winsys.h3
-rw-r--r--src/gallium/drivers/trace/tr_context.c17
-rw-r--r--src/gallium/drivers/trace/tr_context.h5
-rw-r--r--src/gallium/drivers/trace/tr_drm.c19
-rw-r--r--src/gallium/drivers/trace/tr_screen.c26
-rw-r--r--src/gallium/include/pipe/p_screen.h3
-rw-r--r--src/gallium/include/state_tracker/drm_api.h2
-rw-r--r--src/gallium/state_trackers/dri/dri_context.c6
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c7
-rw-r--r--src/gallium/state_trackers/egl/common/native.h5
-rw-r--r--src/gallium/state_trackers/egl/kms/native_kms.c12
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c13
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c11
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c10
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_winsys.h7
-rw-r--r--src/gallium/state_trackers/python/st_device.c11
-rw-r--r--src/gallium/state_trackers/python/st_device.h1
-rw-r--r--src/gallium/state_trackers/python/st_hardpipe_winsys.c17
-rw-r--r--src/gallium/state_trackers/python/st_llvmpipe_winsys.c9
-rw-r--r--src/gallium/state_trackers/python/st_softpipe_winsys.c3
-rw-r--r--src/gallium/state_trackers/python/st_winsys.h3
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.c28
-rw-r--r--src/gallium/state_trackers/wgl/stw_ext_gallium.c26
-rw-r--r--src/gallium/state_trackers/wgl/stw_winsys.h3
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c5
-rw-r--r--src/gallium/winsys/drm/i965/gem/i965_drm_api.c6
-rw-r--r--src/gallium/winsys/drm/i965/xlib/xlib_i965.c19
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_drm_api.c7
-rw-r--r--src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c45
-rw-r--r--src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h3
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.c14
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.h2
-rw-r--r--src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c8
-rw-r--r--src/gallium/winsys/drm/vmware/core/vmw_context.c5
-rw-r--r--src/gallium/winsys/drm/vmware/core/vmw_context.h3
-rw-r--r--src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c7
-rw-r--r--src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c6
-rw-r--r--src/gallium/winsys/gdi/gdi_softpipe_winsys.c8
-rw-r--r--src/gallium/winsys/xlib/xlib_cell.c26
-rw-r--r--src/gallium/winsys/xlib/xlib_llvmpipe.c20
-rw-r--r--src/gallium/winsys/xlib/xlib_softpipe.c19
92 files changed, 193 insertions, 476 deletions
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 55a4c6990de..27f65522b69 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -190,6 +190,15 @@ Get a floating-point screen parameter.
**param** is one of the :ref:`PIPE_CAP` names.
+context_create
+^^^^^^^^^^^^^^
+
+Create a pipe_context.
+
+**priv** is private data of the caller, which may be put to various
+unspecified uses, typically to do with implementing swapbuffers
+and/or front-buffer rendering.
+
is_format_supported
^^^^^^^^^^^^^^^^^^^
diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c
index 30aa04482e3..5bff9869fd0 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -124,7 +124,7 @@ cell_is_buffer_referenced( struct pipe_context *pipe,
struct pipe_context *
cell_create_context(struct pipe_screen *screen,
- struct cell_winsys *cws)
+ void *priv )
{
struct cell_context *cell;
uint i;
@@ -136,9 +136,10 @@ cell_create_context(struct pipe_screen *screen,
memset(cell, 0, sizeof(*cell));
- cell->winsys = cws;
+ cell->winsys = NULL; /* XXX: fixme - get this from screen? */
cell->pipe.winsys = screen->winsys;
cell->pipe.screen = screen;
+ cell->pipe.priv = priv;
cell->pipe.destroy = cell_destroy_context;
cell->pipe.clear = cell_clear;
diff --git a/src/gallium/drivers/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h
index e402ed29220..905cd5db390 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.h
+++ b/src/gallium/drivers/cell/ppu/cell_context.h
@@ -188,8 +188,9 @@ cell_context(struct pipe_context *pipe)
}
-extern struct pipe_context *
-cell_create_context(struct pipe_screen *screen, struct cell_winsys *cws);
+struct pipe_context *
+cell_create_context(struct pipe_screen *screen,
+ void *priv );
extern void
cell_vertex_shader_queue_flush(struct draw_context *draw);
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c
index c329c6682dd..7681e3411e8 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.c
+++ b/src/gallium/drivers/cell/ppu/cell_screen.c
@@ -174,6 +174,7 @@ cell_create_screen(struct pipe_winsys *winsys)
screen->get_param = cell_get_param;
screen->get_paramf = cell_get_paramf;
screen->is_format_supported = cell_is_format_supported;
+ screen->context_create = cell_create_context;
cell_init_screen_texture_funcs(screen);
u_simple_screen_init(screen);
diff --git a/src/gallium/drivers/cell/ppu/cell_winsys.h b/src/gallium/drivers/cell/ppu/cell_winsys.h
index ae2af5696b5..e227e065ff3 100644
--- a/src/gallium/drivers/cell/ppu/cell_winsys.h
+++ b/src/gallium/drivers/cell/ppu/cell_winsys.h
@@ -38,13 +38,10 @@
*/
struct cell_winsys
{
- uint preferredFormat;
+ uint dummy;
};
-extern struct cell_winsys *
-cell_get_winsys(uint format);
-
#endif
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index f8219c9f299..3d45a22b7e7 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -183,7 +183,7 @@ static void i915_destroy(struct pipe_context *pipe)
}
struct pipe_context *
-i915_create_context(struct pipe_screen *screen)
+i915_create_context(struct pipe_screen *screen, void *priv)
{
struct i915_context *i915;
@@ -194,6 +194,7 @@ i915_create_context(struct pipe_screen *screen)
i915->iws = i915_screen(screen)->iws;
i915->base.winsys = NULL;
i915->base.screen = screen;
+ i915->base.priv = priv;
i915->base.destroy = i915_destroy;
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index 6ec5566d5df..1479d2201a9 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -334,6 +334,11 @@ void i915_init_flush_functions( struct i915_context *i915 );
void i915_init_string_functions( struct i915_context *i915 );
+/************************************************************************
+ * i915_context.c
+ */
+struct pipe_context *i915_create_context(struct pipe_screen *screen,
+ void *priv);
/***********************************************************************
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index e6b560bc212..c450854c982 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -294,6 +294,8 @@ i915_create_screen(struct intel_winsys *iws, uint pci_id)
is->base.get_paramf = i915_get_paramf;
is->base.is_format_supported = i915_is_format_supported;
+ is->base.context_create = i915_create_context;
+
is->base.fence_reference = i915_fence_reference;
is->base.fence_signalled = i915_fence_signalled;
is->base.fence_finish = i915_fence_finish;
diff --git a/src/gallium/drivers/i915/intel_winsys.h b/src/gallium/drivers/i915/intel_winsys.h
index c6bf6e6f7f1..b3a802b0e29 100644
--- a/src/gallium/drivers/i915/intel_winsys.h
+++ b/src/gallium/drivers/i915/intel_winsys.h
@@ -203,10 +203,6 @@ struct intel_winsys {
*/
struct pipe_screen *i915_create_screen(struct intel_winsys *iws, unsigned pci_id);
-/**
- * Create a i915 pipe_context.
- */
-struct pipe_context *i915_create_context(struct pipe_screen *screen);
/**
* Get the intel_winsys buffer backing the texture.
diff --git a/src/gallium/drivers/i965/brw_context.c b/src/gallium/drivers/i965/brw_context.c
index 7cbda05ac58..3dbe2b91308 100644
--- a/src/gallium/drivers/i965/brw_context.c
+++ b/src/gallium/drivers/i965/brw_context.c
@@ -102,7 +102,8 @@ static void brw_destroy_context( struct pipe_context *pipe )
}
-struct pipe_context *brw_create_context(struct pipe_screen *screen)
+struct pipe_context *brw_create_context(struct pipe_screen *screen,
+ void *priv)
{
struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context);
@@ -112,6 +113,7 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen)
}
brw->base.screen = screen;
+ brw->base.priv = priv;
brw->base.destroy = brw_destroy_context;
brw->sws = brw_screen(screen)->sws;
brw->chipset = brw_screen(screen)->chipset;
diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h
index 8c006bb95b2..19fda423de0 100644
--- a/src/gallium/drivers/i965/brw_context.h
+++ b/src/gallium/drivers/i965/brw_context.h
@@ -837,6 +837,10 @@ int brw_upload_urb_fence(struct brw_context *brw);
*/
int brw_upload_cs_urb_state(struct brw_context *brw);
+/* brw_context.c
+ */
+struct pipe_context *brw_create_context(struct pipe_screen *screen,
+ void *priv);
/*======================================================================
* Inline conversion functions. These are better-typed than the
diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c
index 1d79d84dc65..184cd490e55 100644
--- a/src/gallium/drivers/i965/brw_screen.c
+++ b/src/gallium/drivers/i965/brw_screen.c
@@ -397,6 +397,7 @@ brw_create_screen(struct brw_winsys_screen *sws, uint pci_id)
bscreen->base.get_param = brw_get_param;
bscreen->base.get_paramf = brw_get_paramf;
bscreen->base.is_format_supported = brw_is_format_supported;
+ bscreen->base.context_create = brw_create_context;
bscreen->base.fence_reference = brw_fence_reference;
bscreen->base.fence_signalled = brw_fence_signalled;
bscreen->base.fence_finish = brw_fence_finish;
diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h
index 8841de2611e..c82d00f4a47 100644
--- a/src/gallium/drivers/i965/brw_winsys.h
+++ b/src/gallium/drivers/i965/brw_winsys.h
@@ -256,10 +256,6 @@ bo_reference(struct brw_winsys_buffer **ptr, struct brw_winsys_buffer *buf)
*/
struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws, unsigned pci_id);
-/**
- * Create a brw pipe_context.
- */
-struct pipe_context *brw_create_context(struct pipe_screen *screen);
/**
* Get the brw_winsys buffer backing the texture.
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index f9063d90fb1..40962a3ccf6 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -692,7 +692,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.winsys = NULL;
id_pipe->base.screen = _screen;
- id_pipe->base.priv = pipe->priv;
+ id_pipe->base.priv = pipe->priv; /* expose wrapped data */
id_pipe->base.draw = NULL;
id_pipe->base.destroy = identity_destroy;
diff --git a/src/gallium/drivers/identity/id_context.h b/src/gallium/drivers/identity/id_context.h
index 75b73fc7df6..6d3c1899d59 100644
--- a/src/gallium/drivers/identity/id_context.h
+++ b/src/gallium/drivers/identity/id_context.h
@@ -39,6 +39,10 @@ struct identity_context {
};
+struct pipe_context *
+identity_context_create(struct pipe_screen *screen, struct pipe_context *pipe);
+
+
static INLINE struct identity_context *
identity_context(struct pipe_context *pipe)
{
diff --git a/src/gallium/drivers/identity/id_drm.c b/src/gallium/drivers/identity/id_drm.c
index 14f68ac0d00..12b516b445f 100644
--- a/src/gallium/drivers/identity/id_drm.c
+++ b/src/gallium/drivers/identity/id_drm.c
@@ -63,22 +63,6 @@ identity_drm_create_screen(struct drm_api *_api, int fd,
return identity_screen_create(screen);
}
-static struct pipe_context *
-identity_drm_create_context(struct drm_api *_api,
- struct pipe_screen *_screen)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_drm_api *id_api = identity_drm_api(_api);
- struct pipe_screen *screen = id_screen->screen;
- struct drm_api *api = id_api->api;
- struct pipe_context *pipe;
-
- pipe = api->create_context(api, screen);
-
- pipe = identity_context_create(_screen, pipe);
-
- return pipe;
-}
static struct pipe_texture *
identity_drm_texture_from_shared_handle(struct drm_api *_api,
@@ -159,7 +143,6 @@ identity_drm_create(struct drm_api *api)
goto error;
id_api->base.create_screen = identity_drm_create_screen;
- id_api->base.create_context = identity_drm_create_context;
id_api->base.texture_from_shared_handle = identity_drm_texture_from_shared_handle;
id_api->base.shared_handle_from_texture = identity_drm_shared_handle_from_texture;
id_api->base.local_handle_from_texture = identity_drm_local_handle_from_texture;
diff --git a/src/gallium/drivers/identity/id_public.h b/src/gallium/drivers/identity/id_public.h
index 3d2862eaa01..d0d5847c61c 100644
--- a/src/gallium/drivers/identity/id_public.h
+++ b/src/gallium/drivers/identity/id_public.h
@@ -34,7 +34,4 @@ struct pipe_context;
struct pipe_screen *
identity_screen_create(struct pipe_screen *screen);
-struct pipe_context *
-identity_context_create(struct pipe_screen *screen, struct pipe_context *pipe);
-
#endif /* ID_PUBLIC_H */
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index 53eae3ef544..b85492114a3 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -32,6 +32,7 @@
#include "id_public.h"
#include "id_screen.h"
+#include "id_context.h"
#include "id_objects.h"
@@ -103,6 +104,20 @@ identity_screen_is_format_supported(struct pipe_screen *_screen,
geom_flags);
}
+static struct pipe_context *
+identity_screen_context_create(struct pipe_screen *_screen,
+ void *priv)
+{
+ struct identity_screen *id_screen = identity_screen(_screen);
+ struct pipe_screen *screen = id_screen->screen;
+ struct pipe_context *result;
+
+ result = screen->context_create(screen, priv);
+ if (result)
+ return identity_context_create(_screen, result);
+ return NULL;
+}
+
static struct pipe_texture *
identity_screen_texture_create(struct pipe_screen *_screen,
const struct pipe_texture *templat)
@@ -478,6 +493,7 @@ identity_screen_create(struct pipe_screen *screen)
id_screen->base.get_param = identity_screen_get_param;
id_screen->base.get_paramf = identity_screen_get_paramf;
id_screen->base.is_format_supported = identity_screen_is_format_supported;
+ id_screen->base.context_create = identity_screen_context_create;
id_screen->base.texture_create = identity_screen_texture_create;
id_screen->base.texture_blanket = identity_screen_texture_blanket;
id_screen->base.texture_destroy = identity_screen_texture_destroy;
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index a76bde39054..43d610631da 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -104,7 +104,7 @@ llvmpipe_is_buffer_referenced( struct pipe_context *pipe,
}
struct pipe_context *
-llvmpipe_create( struct pipe_screen *screen )
+llvmpipe_create_context( struct pipe_screen *screen, void *priv )
{
struct llvmpipe_context *llvmpipe;
@@ -118,6 +118,7 @@ llvmpipe_create( struct pipe_screen *screen )
llvmpipe->pipe.winsys = screen->winsys;
llvmpipe->pipe.screen = screen;
+ llvmpipe->pipe.priv = priv;
llvmpipe->pipe.destroy = llvmpipe_destroy;
/* state setters */
diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h
index 3af7b62a53b..3bde485ac0c 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_context.h
@@ -108,6 +108,10 @@ struct llvmpipe_context {
};
+struct pipe_context *
+llvmpipe_create_context( struct pipe_screen *screen, void *priv );
+
+
static INLINE struct llvmpipe_context *
llvmpipe_context( struct pipe_context *pipe )
{
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index ca64c418276..1cd3ea9a840 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -37,6 +37,7 @@
#include "lp_winsys.h"
#include "lp_jit.h"
#include "lp_screen.h"
+#include "lp_context.h"
#include "lp_debug.h"
#ifdef DEBUG
@@ -310,6 +311,7 @@ llvmpipe_create_screen(struct llvmpipe_winsys *winsys)
screen->base.is_format_supported = llvmpipe_is_format_supported;
screen->base.surface_buffer_create = llvmpipe_surface_buffer_create;
+ screen->base.context_create = llvmpipe_create_context;
screen->base.flush_frontbuffer = llvmpipe_flush_frontbuffer;
llvmpipe_init_screen_texture_funcs(&screen->base);
diff --git a/src/gallium/drivers/llvmpipe/lp_winsys.h b/src/gallium/drivers/llvmpipe/lp_winsys.h
index 74b472b6531..ce11fa93041 100644
--- a/src/gallium/drivers/llvmpipe/lp_winsys.h
+++ b/src/gallium/drivers/llvmpipe/lp_winsys.h
@@ -113,9 +113,6 @@ struct llvmpipe_winsys
};
-struct pipe_context *
-llvmpipe_create( struct pipe_screen * );
-
struct pipe_screen *
llvmpipe_create_screen( struct llvmpipe_winsys * );
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 4c5d2f8b1c1..af9ddd558c8 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -29,19 +29,10 @@
extern struct pipe_screen *
nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
-extern struct pipe_context *
-nv30_create(struct pipe_screen *, unsigned pctx_id);
-
extern struct pipe_screen *
nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
-extern struct pipe_context *
-nv40_create(struct pipe_screen *, unsigned pctx_id);
-
extern struct pipe_screen *
nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
-extern struct pipe_context *
-nv50_create(struct pipe_screen *, unsigned pctx_id);
-
#endif
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
index 8a40cea2e50..8bfd7b2c909 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -43,7 +43,7 @@ nv30_destroy(struct pipe_context *pipe)
}
struct pipe_context *
-nv30_create(struct pipe_screen *pscreen, unsigned pctx_id)
+nv30_create(struct pipe_screen *pscreen, void *priv)
{
struct nv30_screen *screen = nv30_screen(pscreen);
struct pipe_winsys *ws = pscreen->winsys;
@@ -54,12 +54,12 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id)
if (!nv30)
return NULL;
nv30->screen = screen;
- nv30->pctx_id = pctx_id;
nv30->nvws = nvws;
nv30->pipe.winsys = ws;
nv30->pipe.screen = pscreen;
+ nv30->pipe.priv = priv;
nv30->pipe.destroy = nv30_destroy;
nv30->pipe.draw_arrays = nv30_draw_arrays;
nv30->pipe.draw_elements = nv30_draw_elements;
diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h
index 7d053383278..b3b26f7f94a 100644
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ b/src/gallium/drivers/nv30/nv30_context.h
@@ -111,7 +111,6 @@ struct nv30_context {
struct nouveau_winsys *nvws;
struct nv30_screen *screen;
- unsigned pctx_id;
struct draw_context *draw;
@@ -209,4 +208,8 @@ extern void nv30_draw_elements(struct pipe_context *pipe,
extern void nv30_clear(struct pipe_context *pipe, unsigned buffers,
const float *rgba, double depth, unsigned stencil);
+/* nv30_context.c */
+struct pipe_context *
+nv30_create(struct pipe_screen *pscreen, void *priv);
+
#endif
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 62ee2e7697a..8f9b26ea56f 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -20,9 +20,6 @@ struct nouveau_winsys {
struct pipe_screen *pscreen;
- unsigned nr_pctx;
- struct pipe_context **pctx;
-
struct pipe_surface *front;
};
@@ -212,6 +209,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->get_param = nv30_screen_get_param;
pscreen->get_paramf = nv30_screen_get_paramf;
pscreen->is_format_supported = nv30_screen_surface_format_supported;
+ pscreen->context_create = nv30_create;
nv30_screen_init_miptree_functions(pscreen);
nv30_screen_init_transfer_functions(pscreen);
diff --git a/src/gallium/drivers/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h
index 744a72de91a..8591cd31cab 100644
--- a/src/gallium/drivers/nv30/nv30_screen.h
+++ b/src/gallium/drivers/nv30/nv30_screen.h
@@ -10,7 +10,7 @@ struct nv30_screen {
struct nouveau_winsys *nvws;
- unsigned cur_pctx;
+ struct nv30_context *cur_ctx;
/* HW graphics objects */
struct nv04_surface_2d *eng2d;
diff --git a/src/gallium/drivers/nv30/nv30_state_emit.c b/src/gallium/drivers/nv30/nv30_state_emit.c
index ac52d946f02..d9650f63eb2 100644
--- a/src/gallium/drivers/nv30/nv30_state_emit.c
+++ b/src/gallium/drivers/nv30/nv30_state_emit.c
@@ -44,13 +44,15 @@ nv30_state_emit(struct nv30_context *nv30)
unsigned i;
uint64_t states;
- if (nv30->pctx_id != screen->cur_pctx) {
+ /* XXX: racy!
+ */
+ if (nv30 != screen->cur_ctx) {
for (i = 0; i < NV30_STATE_MAX; i++) {
if (state->hw[i] && screen->state[i] != state->hw[i])
state->dirty |= (1ULL << i);
}
- screen->cur_pctx = nv30->pctx_id;
+ screen->cur_ctx = nv30;
}
for (i = 0, states = state->dirty; states; i++) {
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
index ffe25ffebd5..b0b90032de1 100644
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ b/src/gallium/drivers/nv40/nv40_context.c
@@ -43,7 +43,7 @@ nv40_destroy(struct pipe_context *pipe)
}
struct pipe_context *
-nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
+nv40_create(struct pipe_screen *pscreen, void *priv)
{
struct nv40_screen *screen = nv40_screen(pscreen);
struct pipe_winsys *ws = pscreen->winsys;
@@ -54,11 +54,11 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
if (!nv40)
return NULL;
nv40->screen = screen;
- nv40->pctx_id = pctx_id;
nv40->nvws = nvws;
nv40->pipe.winsys = ws;
+ nv40->pipe.priv = priv;
nv40->pipe.screen = pscreen;
nv40->pipe.destroy = nv40_destroy;
nv40->pipe.draw_arrays = nv40_draw_arrays;
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
index 3998cf2dd35..958a48f2a4a 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -111,7 +111,6 @@ struct nv40_context {
struct nouveau_winsys *nvws;
struct nv40_screen *screen;
- unsigned pctx_id;
struct draw_context *draw;
@@ -230,4 +229,8 @@ extern void nv40_draw_elements(struct pipe_context *pipe,
extern void nv40_clear(struct pipe_context *pipe, unsigned buffers,
const float *rgba, double depth, unsigned stencil);
+/* nv40_context.c */
+struct pipe_context *
+nv40_create(struct pipe_screen *pscreen, void *priv);
+
#endif
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
index 56fb80975cc..001147e752f 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -196,6 +196,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->get_param = nv40_screen_get_param;
pscreen->get_paramf = nv40_screen_get_paramf;
pscreen->is_format_supported = nv40_screen_surface_format_supported;
+ pscreen->context_create = nv40_create;
nv40_screen_init_miptree_functions(pscreen);
nv40_screen_init_transfer_functions(pscreen);
diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nv40/nv40_screen.h
index 98fde8755b9..9437aa050d4 100644
--- a/src/gallium/drivers/nv40/nv40_screen.h
+++ b/src/gallium/drivers/nv40/nv40_screen.h
@@ -9,7 +9,7 @@ struct nv40_screen {
struct nouveau_winsys *nvws;
- unsigned cur_pctx;
+ struct nv40_context *cur_ctx;
/* HW graphics objects */
struct nv04_surface_2d *eng2d;
diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c
index 13fe854915b..1c4007a129e 100644
--- a/src/gallium/drivers/nv40/nv40_state_emit.c
+++ b/src/gallium/drivers/nv40/nv40_state_emit.c
@@ -61,13 +61,15 @@ nv40_state_emit(struct nv40_context *nv40)
unsigned i;
uint64_t states;
- if (nv40->pctx_id != screen->cur_pctx) {
+ /* XXX: race conditions
+ */
+ if (nv40 != screen->cur_ctx) {
for (i = 0; i < NV40_STATE_MAX; i++) {
if (state->hw[i] && screen->state[i] != state->hw[i])
state->dirty |= (1ULL << i);
}
- screen->cur_pctx = nv40->pctx_id;
+ screen->cur_ctx = nv40;
}
for (i = 0, states = state->dirty; states; i++) {
diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c
index ac1abc1d5cc..867bd03e69d 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -95,7 +95,7 @@ nv50_destroy(struct pipe_context *pipe)
struct pipe_context *
-nv50_create(struct pipe_screen *pscreen, unsigned pctx_id)
+nv50_create(struct pipe_screen *pscreen, void *priv)
{
struct pipe_winsys *pipe_winsys = pscreen->winsys;
struct nv50_screen *screen = nv50_screen(pscreen);
@@ -105,10 +105,10 @@ nv50_create(struct pipe_screen *pscreen, unsigned pctx_id)
if (!nv50)
return NULL;
nv50->screen = screen;
- nv50->pctx_id = pctx_id;
nv50->pipe.winsys = pipe_winsys;
nv50->pipe.screen = pscreen;
+ nv50->pipe.priv = priv;
nv50->pipe.destroy = nv50_destroy;
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index 44d8f613427..14cef4c0bf8 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -145,7 +145,6 @@ struct nv50_context {
struct pipe_context pipe;
struct nv50_screen *screen;
- unsigned pctx_id;
struct draw_context *draw;
@@ -250,4 +249,8 @@ nv50_upload_sifc(struct nv50_context *nv50,
void *src, unsigned src_format, int src_pitch,
int x, int y, int w, int h, int cpp);
+/* nv50_context.c */
+struct pipe_context *
+nv50_create(struct pipe_screen *pscreen, void *priv);
+
#endif
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 48c7b19584f..8c4478e483b 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -251,6 +251,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->get_param = nv50_screen_get_param;
pscreen->get_paramf = nv50_screen_get_paramf;
pscreen->is_format_supported = nv50_screen_is_format_supported;
+ pscreen->context_create = nv50_create;
screen->base.pre_pipebuffer_map_callback = nv50_pre_pipebuffer_map;
nv50_screen_init_miptree_functions(pscreen);
diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h
index 0d786b0f2e3..2687b721277 100644
--- a/src/gallium/drivers/nv50/nv50_screen.h
+++ b/src/gallium/drivers/nv50/nv50_screen.h
@@ -9,7 +9,6 @@ struct nv50_screen {
struct nouveau_winsys *nvws;
- unsigned cur_pctx;
struct nv50_context *cur_ctx;
struct nouveau_grobj *tesla;
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 956da9b304c..ee28fa63c14 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -185,10 +185,10 @@ nv50_state_emit(struct nv50_context *nv50)
struct nv50_screen *screen = nv50->screen;
struct nouveau_channel *chan = screen->base.channel;
- /* I don't want to copy headers from the winsys. */
- screen->cur_ctx = nv50;
-
- if (nv50->pctx_id != screen->cur_pctx) {
+ /* XXX: this is racy for multiple contexts active on separate
+ * threads.
+ */
+ if (screen->cur_ctx != nv50) {
if (nv50->state.fb)
nv50->state.dirty |= NV50_NEW_FRAMEBUFFER;
if (nv50->state.blend)
@@ -217,7 +217,7 @@ nv50_state_emit(struct nv50_context *nv50)
nv50->state.dirty |= NV50_NEW_TEXTURE;
if (nv50->state.vtxfmt && nv50->state.vtxbuf)
nv50->state.dirty |= NV50_NEW_ARRAYS;
- screen->cur_pctx = nv50->pctx_id;
+ screen->cur_ctx = nv50;
}
if (nv50->state.dirty & NV50_NEW_FRAMEBUFFER)
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 2df2dcfcad9..14820ca8547 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -131,10 +131,11 @@ static void r300_setup_atoms(struct r300_context* r300)
}
struct pipe_context* r300_create_context(struct pipe_screen* screen,
- struct radeon_winsys* radeon_winsys)
+ void *priv)
{
struct r300_context* r300 = CALLOC_STRUCT(r300_context);
struct r300_screen* r300screen = r300_screen(screen);
+ struct radeon_winsys* radeon_winsys = r300screen->radeon_winsys;
if (!r300)
return NULL;
@@ -143,6 +144,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.winsys = (struct pipe_winsys*)radeon_winsys;
r300->context.screen = screen;
+ r300->context.priv = priv;
r300->context.destroy = r300_destroy_context;
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index ea9b4abfdeb..84617578128 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -336,6 +336,10 @@ static INLINE struct r300_context* r300_context(struct pipe_context* context)
return (struct r300_context*)context;
}
+
+struct pipe_context* r300_create_context(struct pipe_screen* screen,
+ void *priv);
+
/* Context initialization. */
struct draw_stage* r300_draw_stage(struct r300_context* r300);
void r300_init_state_functions(struct r300_context* r300);
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 2e04e313767..da4ec542ade 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -30,6 +30,7 @@
#include "r300_texture.h"
#include "radeon_winsys.h"
+#include "r300_winsys.h"
/* Return the identifier behind whom the brave coders responsible for this
* amalgamation of code, sweat, and duct tape, routinely obscure their names.
@@ -391,6 +392,7 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
r300_parse_chipset(caps);
r300screen->caps = caps;
+ r300screen->radeon_winsys = radeon_winsys;
r300screen->screen.winsys = (struct pipe_winsys*)radeon_winsys;
r300screen->screen.destroy = r300_destroy_screen;
r300screen->screen.get_name = r300_get_name;
@@ -398,6 +400,7 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
r300screen->screen.get_param = r300_get_param;
r300screen->screen.get_paramf = r300_get_paramf;
r300screen->screen.is_format_supported = r300_is_format_supported;
+ r300screen->screen.context_create = r300_create_context;
r300screen->screen.get_tex_transfer = r300_get_tex_transfer;
r300screen->screen.tex_transfer_destroy = r300_tex_transfer_destroy;
r300screen->screen.transfer_map = r300_transfer_map;
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 580fda3984e..502fbfa5a24 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -33,6 +33,8 @@ struct r300_screen {
/* Parent class */
struct pipe_screen screen;
+ struct radeon_winsys* radeon_winsys;
+
/* Chipset capabilities */
struct r300_capabilities* caps;
@@ -60,9 +62,6 @@ r300_transfer(struct pipe_transfer* transfer)
return (struct r300_transfer*)transfer;
}
-/* Creates a new r300 screen. */
-struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys);
-
/* Debug functionality. */
/**
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index d4842e94ae9..f4a8ae120c8 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -29,7 +29,7 @@ extern "C" {
/* The public interface header for the r300 pipe driver.
* Any winsys hosting this pipe needs to implement r300_winsys and then
- * call r300_create_context to start things. */
+ * call r300_create_screen to start things. */
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
@@ -37,8 +37,9 @@ extern "C" {
#include "radeon_winsys.h"
-struct pipe_context* r300_create_context(struct pipe_screen* screen,
- struct radeon_winsys* radeon_winsys);
+/* Creates a new r300 screen. */
+struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys);
+
boolean r300_get_texture_buffer(struct pipe_screen* screen,
struct pipe_texture* texture,
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index b1cfe59bc18..480b269e7f5 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -194,7 +194,8 @@ softpipe_render_condition( struct pipe_context *pipe,
struct pipe_context *
-softpipe_create( struct pipe_screen *screen )
+softpipe_create_context( struct pipe_screen *screen,
+ void *priv )
{
struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
uint i;
@@ -213,6 +214,7 @@ softpipe_create( struct pipe_screen *screen )
softpipe->pipe.winsys = screen->winsys;
softpipe->pipe.screen = screen;
softpipe->pipe.destroy = softpipe_destroy;
+ softpipe->pipe.priv = priv;
/* state setters */
softpipe->pipe.create_blend_state = softpipe_create_blend_state;
diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h
index be4613b6228..62f9e7aad3d 100644
--- a/src/gallium/drivers/softpipe/sp_context.h
+++ b/src/gallium/drivers/softpipe/sp_context.h
@@ -166,5 +166,8 @@ softpipe_context( struct pipe_context *pipe )
void
softpipe_reset_sampler_varients(struct softpipe_context *softpipe);
+struct pipe_context *
+softpipe_create_context( struct pipe_screen *, void *priv );
+
#endif /* SP_CONTEXT_H */
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index ee6969e60fb..87415f43404 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -35,6 +35,7 @@
#include "sp_texture.h"
#include "sp_winsys.h"
#include "sp_screen.h"
+#include "sp_context.h"
static const char *
@@ -204,6 +205,7 @@ softpipe_create_screen(struct pipe_winsys *winsys)
screen->base.get_param = softpipe_get_param;
screen->base.get_paramf = softpipe_get_paramf;
screen->base.is_format_supported = softpipe_is_format_supported;
+ screen->base.context_create = softpipe_create_context;
softpipe_init_screen_texture_funcs(&screen->base);
u_simple_screen_init(&screen->base);
diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c
index 7a8b132ddcd..f3dab83fa61 100644
--- a/src/gallium/drivers/softpipe/sp_video_context.c
+++ b/src/gallium/drivers/softpipe/sp_video_context.c
@@ -250,7 +250,7 @@ sp_mpeg12_create(struct pipe_screen *screen, enum pipe_video_profile profile,
ctx->base.set_decode_target = sp_mpeg12_set_decode_target;
ctx->base.set_csc_matrix = sp_mpeg12_set_csc_matrix;
- ctx->pipe = softpipe_create(screen);
+ ctx->pipe = screen->context_create(screen, NULL);
if (!ctx->pipe) {
FREE(ctx);
return NULL;
diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h
index 3042e01a05c..6e3920c49b2 100644
--- a/src/gallium/drivers/softpipe/sp_winsys.h
+++ b/src/gallium/drivers/softpipe/sp_winsys.h
@@ -47,7 +47,6 @@ struct pipe_texture;
struct pipe_buffer;
-struct pipe_context *softpipe_create( struct pipe_screen * );
/**
* Create a softpipe screen that uses the
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index c4181c3f5b7..d499ae6acc9 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -126,7 +126,8 @@ svga_is_buffer_referenced( struct pipe_context *pipe,
}
-struct pipe_context *svga_context_create( struct pipe_screen *screen )
+struct pipe_context *svga_context_create( struct pipe_screen *screen,
+ void *priv )
{
struct svga_screen *svgascreen = svga_screen(screen);
struct svga_context *svga = NULL;
@@ -138,6 +139,7 @@ struct pipe_context *svga_context_create( struct pipe_screen *screen )
svga->pipe.winsys = screen->winsys;
svga->pipe.screen = screen;
+ svga->pipe.priv = priv;
svga->pipe.destroy = svga_destroy;
svga->pipe.clear = svga_clear;
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index ba86256eb26..e93acc5f9f7 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -426,6 +426,10 @@ void svga_context_flush( struct svga_context *svga,
void svga_hwtnl_flush_retry( struct svga_context *svga );
+struct pipe_context *
+svga_context_create(struct pipe_screen *screen,
+ void *priv);
+
/***********************************************************************
* Inline conversion functions. These are better-typed than the
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 6933d515629..5e11163d180 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -366,6 +366,7 @@ svga_screen_create(struct svga_winsys_screen *sws)
screen->get_param = svga_get_param;
screen->get_paramf = svga_get_paramf;
screen->is_format_supported = svga_is_format_supported;
+ screen->context_create = svga_context_create;
screen->fence_reference = svga_fence_reference;
screen->fence_signalled = svga_fence_signalled;
screen->fence_finish = svga_fence_finish;
diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
index 27b99fe4c10..b4e3af0eafc 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -272,9 +272,6 @@ struct svga_winsys_screen
};
-struct pipe_context *
-svga_context_create(struct pipe_screen *screen);
-
struct pipe_screen *
svga_screen_create(struct svga_winsys_screen *sws);
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index 5a9f0fc6901..34ceaa41c15 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1236,12 +1236,10 @@ static const struct debug_named_value rbug_blocker_flags[] = {
};
struct pipe_context *
-trace_context_create(struct pipe_screen *_screen,
+trace_context_create(struct trace_screen *tr_scr,
struct pipe_context *pipe)
{
- struct trace_screen *tr_scr;
struct trace_context *tr_ctx;
- struct pipe_screen *screen;
if(!pipe)
goto error1;
@@ -1249,13 +1247,13 @@ trace_context_create(struct pipe_screen *_screen,
if(!trace_enabled())
goto error1;
- tr_scr = trace_screen(_screen);
- screen = tr_scr->screen;
-
tr_ctx = CALLOC_STRUCT(trace_context);
if(!tr_ctx)
goto error1;
+ tr_ctx->base.winsys = NULL;
+ tr_ctx->base.priv = pipe->priv; /* expose wrapped priv data */
+ tr_ctx->base.screen = &tr_scr->base;
tr_ctx->draw_blocker = debug_get_flags_option("RBUG_BLOCK",
rbug_blocker_flags,
0);
@@ -1264,8 +1262,6 @@ trace_context_create(struct pipe_screen *_screen,
pipe_mutex_init(tr_ctx->list_mutex);
make_empty_list(&tr_ctx->shaders);
- tr_ctx->base.winsys = _screen->winsys;
- tr_ctx->base.screen = _screen;
tr_ctx->base.destroy = trace_context_destroy;
tr_ctx->base.draw_arrays = trace_context_draw_arrays;
tr_ctx->base.draw_elements = trace_context_draw_elements;
@@ -1316,11 +1312,6 @@ trace_context_create(struct pipe_screen *_screen,
tr_ctx->pipe = pipe;
- trace_dump_call_begin("", "pipe_context_create");
- trace_dump_arg(ptr, screen);
- trace_dump_ret(ptr, pipe);
- trace_dump_call_end();
-
trace_screen_add_to_list(tr_scr, contexts, tr_ctx);
return &tr_ctx->base;
diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h
index 852b480765a..14284232485 100644
--- a/src/gallium/drivers/trace/tr_context.h
+++ b/src/gallium/drivers/trace/tr_context.h
@@ -40,6 +40,8 @@ extern "C" {
#endif
+struct trace_screen;
+
struct trace_context
{
struct pipe_context base;
@@ -95,9 +97,8 @@ trace_context(struct pipe_context *pipe)
}
-
struct pipe_context *
-trace_context_create(struct pipe_screen *screen,
+trace_context_create(struct trace_screen *tr_scr,
struct pipe_context *pipe);
void
diff --git a/src/gallium/drivers/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c
index e7ca3a86ead..919dc1b309f 100644
--- a/src/gallium/drivers/trace/tr_drm.c
+++ b/src/gallium/drivers/trace/tr_drm.c
@@ -65,24 +65,6 @@ trace_drm_create_screen(struct drm_api *_api, int fd,
return trace_screen_create(screen);
}
-static struct pipe_context *
-trace_drm_create_context(struct drm_api *_api,
- struct pipe_screen *_screen)
-{
- struct trace_screen *tr_screen = trace_screen(_screen);
- struct trace_drm_api *tr_api = trace_drm_api(_api);
- struct pipe_screen *screen = tr_screen->screen;
- struct drm_api *api = tr_api->api;
- struct pipe_context *pipe;
-
- /* TODO trace call */
-
- pipe = api->create_context(api, screen);
-
- pipe = trace_context_create(_screen, pipe);
-
- return pipe;
-}
static struct pipe_texture *
trace_drm_texture_from_shared_handle(struct drm_api *_api,
@@ -175,7 +157,6 @@ trace_drm_create(struct drm_api *api)
tr_api->base.driver_name = api->driver_name;
tr_api->base.create_screen = trace_drm_create_screen;
- tr_api->base.create_context = trace_drm_create_context;
tr_api->base.texture_from_shared_handle = trace_drm_texture_from_shared_handle;
tr_api->base.shared_handle_from_texture = trace_drm_shared_handle_from_texture;
tr_api->base.local_handle_from_texture = trace_drm_local_handle_from_texture;
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 6cdb4c04a81..388d83eb5c2 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -33,6 +33,7 @@
#include "tr_dump.h"
#include "tr_dump_state.h"
#include "tr_texture.h"
+#include "tr_context.h"
#include "tr_screen.h"
#include "util/u_inlines.h"
@@ -159,6 +160,29 @@ trace_screen_is_format_supported(struct pipe_screen *_screen,
}
+static struct pipe_context *
+trace_screen_context_create(struct pipe_screen *_screen, void *priv)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_context *result;
+
+ trace_dump_call_begin("pipe_screen", "context_create");
+
+ trace_dump_arg(ptr, screen);
+
+ result = screen->context_create(screen, priv);
+
+ trace_dump_ret(ptr, result);
+
+ trace_dump_call_end();
+
+ result = trace_context_create(tr_scr, result);
+
+ return result;
+}
+
+
static void
trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_surface *_surface,
@@ -904,6 +928,8 @@ trace_screen_create(struct pipe_screen *screen)
tr_scr->base.get_param = trace_screen_get_param;
tr_scr->base.get_paramf = trace_screen_get_paramf;
tr_scr->base.is_format_supported = trace_screen_is_format_supported;
+ assert(screen->context_create);
+ tr_scr->base.context_create = trace_screen_context_create;
tr_scr->base.texture_create = trace_screen_texture_create;
tr_scr->base.texture_blanket = trace_screen_texture_blanket;
tr_scr->base.texture_destroy = trace_screen_texture_destroy;
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index b8e001a6b01..48625bf3127 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -86,6 +86,9 @@ struct pipe_screen {
*/
float (*get_paramf)( struct pipe_screen *, int param );
+ struct pipe_context * (*context_create)( struct pipe_screen *,
+ void *priv );
+
/**
* Check if the given pipe_format is supported as a texture or
* drawing surface.
diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h
index b248a818808..e9fa9b4d2a3 100644
--- a/src/gallium/include/state_tracker/drm_api.h
+++ b/src/gallium/include/state_tracker/drm_api.h
@@ -41,8 +41,6 @@ struct drm_api
/*@{*/
struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd,
struct drm_create_screen_arg *arg);
- struct pipe_context* (*create_context)(struct drm_api *api,
- struct pipe_screen *screen);
/*@}*/
/**
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index 07f0554cc0d..6edbd9d9b15 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -69,14 +69,12 @@ dri_create_context(const __GLcontextModes * visual,
driParseConfigFiles(&ctx->optionCache,
&screen->optionCache, sPriv->myNum, "dri");
- ctx->pipe = screen->api->create_context(screen->api, screen->pipe_screen);
+ ctx->pipe = screen->pipe_screen->create_context( screen->pipe_screen,
+ ctx );
if (ctx->pipe == NULL)
goto fail;
- /* used in dri_flush_frontbuffer */
- ctx->pipe->priv = ctx;
-
ctx->st = st_create_context(ctx->pipe, visual, st_share);
if (ctx->st == NULL)
goto fail;
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 70216177bdb..424be493117 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -645,8 +645,11 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
}
mode = &gconf->native->mode;
- gctx->pipe =
- gdpy->native->create_context(gdpy->native, (void *) &gctx->base);
+
+ gctx->pipe = gdpy->native->screen->create_context(
+ gdpy->native->screen,
+ (void *) &gctx->base);
+
if (!gctx->pipe) {
free(gctx);
return NULL;
diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 72a9cec7ef1..4f9758545ab 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -167,11 +167,6 @@ struct native_display {
EGLNativePixmapType pix,
const struct native_config *nconf);
- /**
- * Create a pipe context.
- */
- struct pipe_context *(*create_context)(struct native_display *ndpy,
- void *context_private);
/**
* Create a window surface. Required unless no config has GLX_WINDOW_BIT
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c
index 445c28c383c..91cefc538d1 100644
--- a/src/gallium/state_trackers/egl/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
@@ -575,17 +575,6 @@ kms_display_create_pbuffer_surface(struct native_display *ndpy,
return &ksurf->base;
}
-static struct pipe_context *
-kms_display_create_context(struct native_display *ndpy, void *context_private)
-{
- struct kms_display *kdpy = kms_display(ndpy);
- struct pipe_context *pctx;
-
- pctx = kdpy->api->create_context(kdpy->api, kdpy->base.screen);
- if (pctx)
- pctx->priv = context_private;
- return pctx;
-}
static boolean
kms_display_is_format_supported(struct native_display *ndpy,
@@ -814,7 +803,6 @@ kms_create_display(EGLNativeDisplayType dpy, struct drm_api *api)
kdpy->base.destroy = kms_display_destroy;
kdpy->base.get_configs = kms_display_get_configs;
- kdpy->base.create_context = kms_display_create_context;
kdpy->base.create_pbuffer_surface = kms_display_create_pbuffer_surface;
kdpy->base.modeset = &kms_display_modeset;
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index b2eba7219f4..5f2fd412604 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -402,18 +402,6 @@ dri2_display_create_pbuffer_surface(struct native_display *ndpy,
return (dri2surf) ? &dri2surf->base : NULL;
}
-static struct pipe_context *
-dri2_display_create_context(struct native_display *ndpy, void *context_private)
-{
- struct dri2_display *dri2dpy = dri2_display(ndpy);
- struct pipe_context *pctx;
-
- pctx = dri2dpy->api->create_context(dri2dpy->api, dri2dpy->base.screen);
- if (pctx)
- pctx->priv = context_private;
- return pctx;
-}
-
static int
choose_color_format(const __GLcontextModes *mode, enum pipe_format formats[32])
{
@@ -697,7 +685,6 @@ x11_create_dri2_display(EGLNativeDisplayType dpy, struct drm_api *api)
dri2dpy->base.destroy = dri2_display_destroy;
dri2dpy->base.get_configs = dri2_display_get_configs;
dri2dpy->base.is_pixmap_supported = dri2_display_is_pixmap_supported;
- dri2dpy->base.create_context = dri2_display_create_context;
dri2dpy->base.create_window_surface = dri2_display_create_window_surface;
dri2dpy->base.create_pixmap_surface = dri2_display_create_pixmap_surface;
dri2dpy->base.create_pbuffer_surface = dri2_display_create_pbuffer_surface;
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index 7946415ce77..92a62f230e0 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -492,16 +492,6 @@ ximage_display_create_pbuffer_surface(struct native_display *ndpy,
return (xsurf) ? &xsurf->base : NULL;
}
-static struct pipe_context *
-ximage_display_create_context(struct native_display *ndpy,
- void *context_private)
-{
- struct pipe_context *pctx = softpipe_create(ndpy->screen);
- if (pctx)
- pctx->priv = context_private;
- return pctx;
-}
-
static enum pipe_format
choose_format(const XVisualInfo *vinfo)
{
@@ -686,7 +676,6 @@ x11_create_ximage_display(EGLNativeDisplayType dpy, boolean use_xshm)
xdpy->base.get_configs = ximage_display_get_configs;
xdpy->base.is_pixmap_supported = ximage_display_is_pixmap_supported;
- xdpy->base.create_context = ximage_display_create_context;
xdpy->base.create_window_surface = ximage_display_create_window_surface;
xdpy->base.create_pixmap_surface = ximage_display_create_pixmap_surface;
xdpy->base.create_pbuffer_surface = ximage_display_create_pbuffer_surface;
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 1783bc504d9..fb314f3b528 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -760,7 +760,6 @@ PUBLIC
XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
{
static GLboolean firstTime = GL_TRUE;
- struct pipe_context *_pipe = NULL;
struct pipe_context *pipe = NULL;
XMesaContext c;
GLcontext *mesaCtx;
@@ -788,11 +787,12 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
if (screen == NULL)
goto fail;
- _pipe = driver.create_pipe_context(_screen, (void *) c);
- if (_pipe == NULL)
+ /* Trace screen knows how to properly wrap context creation in the
+ * wrapped screen, so nothing special to do here:
+ */
+ pipe = screen->context_create(screen, (void *) c);
+ if (pipe == NULL)
goto fail;
- pipe = trace_context_create(screen, _pipe);
- pipe->priv = c;
c->st = st_create_context(pipe,
&v->mesa_visual,
diff --git a/src/gallium/state_trackers/glx/xlib/xm_winsys.h b/src/gallium/state_trackers/glx/xlib/xm_winsys.h
index 0e57605c34b..4bd5b5c8d3b 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_winsys.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_winsys.h
@@ -39,13 +39,6 @@ struct xm_driver {
struct pipe_screen *(*create_pipe_screen)( void );
- /* The context_private argument needs to go away. Is currently used
- * in a round-about way to associate a display-target surface with its
- * Xlib window.
- */
- struct pipe_context *(*create_pipe_context)( struct pipe_screen *,
- void *context_private );
-
void (*display_surface)( struct xmesa_buffer *,
struct pipe_surface * );
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 467e20207a3..1146a8b0c38 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -80,8 +80,7 @@ st_device_create_from_st_winsys(const struct st_winsys *st_ws)
{
struct st_device *st_dev;
- if(!st_ws->screen_create ||
- !st_ws->context_create)
+ if(!st_ws->screen_create)
return NULL;
st_dev = CALLOC_STRUCT(st_device);
@@ -158,13 +157,7 @@ st_context_create(struct st_device *st_dev)
st_device_reference(&st_ctx->st_dev, st_dev);
- st_ctx->real_pipe = st_dev->st_ws->context_create(st_dev->real_screen);
- if(!st_ctx->real_pipe) {
- st_context_destroy(st_ctx);
- return NULL;
- }
-
- st_ctx->pipe = trace_context_create(st_dev->screen, st_ctx->real_pipe);
+ st_ctx->pipe = st_dev->screen->create_context(st_dev->screen, NULL);
if(!st_ctx->pipe) {
st_context_destroy(st_ctx);
return NULL;
diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h
index f786e134118..de9e0215d8e 100644
--- a/src/gallium/state_trackers/python/st_device.h
+++ b/src/gallium/state_trackers/python/st_device.h
@@ -50,7 +50,6 @@ struct st_surface
struct st_context {
struct st_device *st_dev;
- struct pipe_context *real_pipe;
struct pipe_context *pipe;
struct cso_context *cso;
diff --git a/src/gallium/state_trackers/python/st_hardpipe_winsys.c b/src/gallium/state_trackers/python/st_hardpipe_winsys.c
index 43aaaabf2a1..a3110a19d5d 100644
--- a/src/gallium/state_trackers/python/st_hardpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_hardpipe_winsys.c
@@ -217,21 +217,6 @@ st_hardpipe_screen_create(void)
}
-static struct pipe_context *
-st_hardpipe_context_create(struct pipe_screen *screen)
-{
- if(st_hardpipe_load()) {
- if(screen == pfnGetGalliumScreenMESA())
- return pfnCreateGalliumContextMESA();
- else
- return NULL;
- }
- else
- return st_softpipe_winsys.context_create(screen);
-}
-
-
const struct st_winsys st_hardpipe_winsys = {
- &st_hardpipe_screen_create,
- &st_hardpipe_context_create
+ &st_hardpipe_screen_create
};
diff --git a/src/gallium/state_trackers/python/st_llvmpipe_winsys.c b/src/gallium/state_trackers/python/st_llvmpipe_winsys.c
index c5ee1679f04..5d83b5a9e15 100644
--- a/src/gallium/state_trackers/python/st_llvmpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_llvmpipe_winsys.c
@@ -135,14 +135,7 @@ no_winsys:
}
-static struct pipe_context *
-st_llvmpipe_context_create(struct pipe_screen *screen)
-{
- return llvmpipe_create(screen);
-}
-
const struct st_winsys st_softpipe_winsys = {
- &st_llvmpipe_screen_create,
- &st_llvmpipe_context_create,
+ &st_llvmpipe_screen_create
};
diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c
index dfe3e465f77..81676bc3a4f 100644
--- a/src/gallium/state_trackers/python/st_softpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c
@@ -39,6 +39,5 @@
#include "st_winsys.h"
const struct st_winsys st_softpipe_winsys = {
- &softpipe_create_screen_malloc,
- &softpipe_create,
+ &softpipe_create_screen_malloc
};
diff --git a/src/gallium/state_trackers/python/st_winsys.h b/src/gallium/state_trackers/python/st_winsys.h
index b8cb612d863..0c7b6a200e1 100644
--- a/src/gallium/state_trackers/python/st_winsys.h
+++ b/src/gallium/state_trackers/python/st_winsys.h
@@ -38,9 +38,6 @@ struct st_winsys
{
struct pipe_screen *
(*screen_create)(void);
-
- struct pipe_context *
- (*context_create)(struct pipe_screen *screen);
};
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index f2f0264844a..0785d2c6b85 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -34,11 +34,6 @@
#include "state_tracker/st_context.h"
#include "state_tracker/st_public.h"
-#ifdef DEBUG
-#include "trace/tr_screen.h"
-#include "trace/tr_context.h"
-#endif
-
#include "stw_icd.h"
#include "stw_device.h"
#include "stw_winsys.h"
@@ -152,7 +147,6 @@ DrvCreateLayerContext(
const struct stw_pixelformat_info *pfi;
GLvisual visual;
struct stw_context *ctx = NULL;
- struct pipe_screen *screen = NULL;
struct pipe_context *pipe = NULL;
if(!stw_dev)
@@ -175,28 +169,12 @@ DrvCreateLayerContext(
ctx->hdc = hdc;
ctx->iPixelFormat = iPixelFormat;
- screen = stw_dev->screen;
-
-#ifdef DEBUG
- /* Unwrap screen */
- if(stw_dev->trace_running)
- screen = trace_screen(screen)->screen;
-#endif
-
- pipe = stw_dev->stw_winsys->create_context( screen );
+ /* priv == hdc, pass to stw_flush_frontbuffer as context_private
+ */
+ pipe = stw_dev->screen->context_create( stw_dev->screen, hdc );
if (pipe == NULL)
goto no_pipe;
-#ifdef DEBUG
- /* Wrap context */
- if(stw_dev->trace_running)
- pipe = trace_context_create(stw_dev->screen, pipe);
-#endif
-
- /* pass to stw_flush_frontbuffer as context_private */
- assert(!pipe->priv);
- pipe->priv = hdc;
-
ctx->st = st_create_context( pipe, &visual, NULL );
if (ctx->st == NULL)
goto no_st_ctx;
diff --git a/src/gallium/state_trackers/wgl/stw_ext_gallium.c b/src/gallium/state_trackers/wgl/stw_ext_gallium.c
index fb30ec5dba9..8dd63f124ad 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_gallium.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_gallium.c
@@ -48,32 +48,8 @@ wglGetGalliumScreenMESA(void)
struct pipe_context * APIENTRY
wglCreateGalliumContextMESA(void)
{
- struct pipe_screen *screen = NULL;
- struct pipe_context *pipe = NULL;
-
if(!stw_dev)
return NULL;
- screen = stw_dev->screen;
-
-#ifdef DEBUG
- /* Unwrap screen */
- if(stw_dev->trace_running)
- screen = trace_screen(screen)->screen;
-#endif
-
- pipe = stw_dev->stw_winsys->create_context( screen );
- if (pipe == NULL)
- goto no_pipe;
-
-#ifdef DEBUG
- /* Wrap context */
- if(stw_dev->trace_running)
- pipe = trace_context_create(stw_dev->screen, pipe);
-#endif
-
- return pipe;
-
-no_pipe:
- return NULL;
+ return stw_dev->screen->context_create( stw_dev->screen, NULL );
}
diff --git a/src/gallium/state_trackers/wgl/stw_winsys.h b/src/gallium/state_trackers/wgl/stw_winsys.h
index 1de6e906d0d..270fad56a19 100644
--- a/src/gallium/state_trackers/wgl/stw_winsys.h
+++ b/src/gallium/state_trackers/wgl/stw_winsys.h
@@ -43,9 +43,6 @@ struct stw_winsys
struct pipe_screen *
(*create_screen)( void );
- struct pipe_context *
- (*create_context)( struct pipe_screen *screen );
-
/**
* Present the color buffer to the window associated with the device context.
*/
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 70af0c5fed3..ae66c4baa91 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -1061,7 +1061,10 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
}
exa->scrn = ms->screen;
- exa->pipe = ms->api->create_context(ms->api, exa->scrn);
+ exa->pipe = exa->scrn->context_create(exa->scrn, NULL);
+ if (exa->pipe == NULL)
+ goto out_err;
+
/* Share context with DRI */
ms->ctx = exa->pipe;
diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_api.c b/src/gallium/winsys/drm/i965/gem/i965_drm_api.c
index 9a2203fc6d7..a061eef0beb 100644
--- a/src/gallium/winsys/drm/i965/gem/i965_drm_api.c
+++ b/src/gallium/winsys/drm/i965/gem/i965_drm_api.c
@@ -212,11 +212,6 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD,
return brw_create_screen(&idws->base, deviceID);
}
-static struct pipe_context *
-i965_libdrm_create_context(struct drm_api *api, struct pipe_screen *screen)
-{
- return brw_create_context(screen);
-}
static void
destroy(struct drm_api *api)
@@ -229,7 +224,6 @@ destroy(struct drm_api *api)
struct drm_api i965_libdrm_api =
{
.name = "i965",
- .create_context = i965_libdrm_create_context,
.create_screen = i965_libdrm_create_screen,
.texture_from_shared_handle = i965_libdrm_texture_from_shared_handle,
.shared_handle_from_texture = i965_libdrm_shared_handle_from_texture,
diff --git a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c b/src/gallium/winsys/drm/i965/xlib/xlib_i965.c
index d2b9a1ab311..74501eeb16f 100644
--- a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c
+++ b/src/gallium/winsys/drm/i965/xlib/xlib_i965.c
@@ -469,31 +469,12 @@ fail:
}
-static struct pipe_context *
-xlib_create_i965_context( struct pipe_screen *screen,
- void *context_private )
-{
- struct pipe_context *pipe;
-
- pipe = brw_create_context(screen);
- if (pipe == NULL)
- goto fail;
-
- pipe->priv = context_private;
- return pipe;
-
-fail:
- /* Free stuff here */
- return NULL;
-}
-
struct xm_driver xlib_i965_driver =
{
.create_pipe_screen = xlib_create_i965_screen,
- .create_pipe_context = xlib_create_i965_context,
.display_surface = xlib_i965_display_surface
};
diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
index 118afc33950..4f4d4bb86b2 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
@@ -182,12 +182,6 @@ intel_drm_create_screen(struct drm_api *api, int drmFD,
return i915_create_screen(&idws->base, deviceID);
}
-static struct pipe_context *
-intel_drm_create_context(struct drm_api *api, struct pipe_screen *screen)
-{
- return i915_create_context(screen);
-}
-
static void
destroy(struct drm_api *api)
{
@@ -198,7 +192,6 @@ struct drm_api intel_drm_api =
{
.name = "i915",
.driver_name = "i915",
- .create_context = intel_drm_create_context,
.create_screen = intel_drm_create_screen,
.texture_from_shared_handle = intel_drm_texture_from_shared_handle,
.shared_handle_from_texture = intel_drm_shared_handle_from_texture,
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
index 8e5f821c8a3..c814d986b1d 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
+++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
@@ -61,7 +61,6 @@ nouveau_drm_destroy_winsys(struct pipe_winsys *s)
struct nouveau_winsys *nv_winsys = nouveau_winsys(s);
struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen);
nouveau_device_close(&nv_screen->device);
- FREE(nv_winsys->pctx);
FREE(nv_winsys);
}
@@ -143,49 +142,6 @@ nouveau_drm_create_screen(struct drm_api *api, int fd,
return nvws->pscreen;
}
-static struct pipe_context *
-nouveau_drm_create_context(struct drm_api *api, struct pipe_screen *pscreen)
-{
- struct nouveau_winsys *nvws = nouveau_winsys_screen(pscreen);
- struct pipe_context *(*init)(struct pipe_screen *, unsigned);
- unsigned chipset = nouveau_screen(pscreen)->device->chipset;
- int i;
-
- switch (chipset & 0xf0) {
- case 0x30:
- init = nv30_create;
- break;
- case 0x40:
- case 0x60:
- init = nv40_create;
- break;
- case 0x50:
- case 0x80:
- case 0x90:
- case 0xa0:
- init = nv50_create;
- break;
- default:
- debug_printf("%s: unknown chipset nv%02x\n", __func__, chipset);
- return NULL;
- }
-
- /* Find a free slot for a pipe context, allocate a new one if needed */
- for (i = 0; i < nvws->nr_pctx; i++) {
- if (nvws->pctx[i] == NULL)
- break;
- }
-
- if (i == nvws->nr_pctx) {
- nvws->nr_pctx++;
- nvws->pctx = realloc(nvws->pctx,
- sizeof(*nvws->pctx) * nvws->nr_pctx);
- }
-
- nvws->pctx[i] = init(pscreen, i);
- return nvws->pctx[i];
-}
-
static struct pipe_texture *
nouveau_drm_pt_from_name(struct drm_api *api, struct pipe_screen *pscreen,
struct pipe_texture *templ, const char *name,
@@ -251,7 +207,6 @@ struct drm_api drm_api_hooks = {
.name = "nouveau",
.driver_name = "nouveau",
.create_screen = nouveau_drm_create_screen,
- .create_context = nouveau_drm_create_context,
.texture_from_shared_handle = nouveau_drm_pt_from_name,
.shared_handle_from_texture = nouveau_drm_name_from_pt,
.local_handle_from_texture = nouveau_drm_handle_from_pt,
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h
index a32f2907b37..a91aad7df8e 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h
+++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h
@@ -13,9 +13,6 @@ struct nouveau_winsys {
struct pipe_screen *pscreen;
- unsigned nr_pctx;
- struct pipe_context **pctx;
-
struct pipe_surface *front;
};
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index bff6fdc1ad0..d1cb6493668 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -137,19 +137,6 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api,
}
}
-/* Create a pipe_context. */
-struct pipe_context* radeon_create_context(struct drm_api* api,
- struct pipe_screen* screen)
-{
- struct radeon_winsys* rwinsys = (struct radeon_winsys*)screen->winsys;
-
- if (!is_r3xx(rwinsys->pci_id) ||
- debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) {
- return softpipe_create(screen);
- } else {
- return r300_create_context(screen, rwinsys);
- }
-}
boolean radeon_buffer_from_texture(struct drm_api* api,
struct pipe_screen* screen,
@@ -272,7 +259,6 @@ struct drm_api drm_api_hooks = {
.name = "radeon",
.driver_name = "radeon",
.create_screen = radeon_create_screen,
- .create_context = radeon_create_context,
.texture_from_shared_handle = radeon_texture_from_shared_handle,
.shared_handle_from_texture = radeon_shared_handle_from_texture,
.local_handle_from_texture = radeon_local_handle_from_texture,
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
index 077388ee028..8d74cbafc2f 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
@@ -52,8 +52,6 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api,
int drmFB,
struct drm_create_screen_arg *arg);
-struct pipe_context* radeon_create_context(struct drm_api* api,
- struct pipe_screen* screen);
boolean radeon_buffer_from_texture(struct drm_api* api,
struct pipe_screen* screen,
diff --git a/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c b/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c
index c3ec24aaf78..fc63081a4cc 100644
--- a/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c
+++ b/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c
@@ -124,17 +124,9 @@ error:
}
-static struct pipe_context *
-radeon_hardpipe_context_create(struct pipe_screen *screen)
-{
- /* FIXME: create a radon pipe_context from screen */
-
- return NULL;
-}
const struct st_winsys st_hardpipe_winsys = {
&radeon_hardpipe_screen_create,
- &radeon_hardpipe_context_create,
};
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.c b/src/gallium/winsys/drm/vmware/core/vmw_context.c
index b5fd4f5a6a1..90ffc4868f7 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_context.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_context.c
@@ -380,8 +380,3 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws)
}
-struct pipe_context *
-vmw_svga_context_create(struct pipe_screen *screen)
-{
- return svga_context_create(screen);
-}
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.h b/src/gallium/winsys/drm/vmware/core/vmw_context.h
index 305ce9b5bec..d4884d24e99 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_context.h
+++ b/src/gallium/winsys/drm/vmware/core/vmw_context.h
@@ -52,8 +52,5 @@ struct pipe_screen;
struct svga_winsys_context *
vmw_svga_winsys_context_create(struct svga_winsys_screen *sws);
-struct pipe_context *
-vmw_svga_context_create(struct pipe_screen *screen);
-
#endif /* VMW_CONTEXT_H_ */
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
index 2939c10918c..917b49f1c12 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
@@ -333,12 +333,6 @@ vmw_drm_handle_from_texture(struct drm_api *drm_api,
return TRUE;
}
-static struct pipe_context*
-vmw_drm_create_context(struct drm_api *drm_api,
- struct pipe_screen *screen)
-{
- return vmw_svga_context_create(screen);
-}
static struct dri1_api dri1_api_hooks = {
.front_srf_locked = NULL,
@@ -349,7 +343,6 @@ static struct drm_api vmw_drm_api_hooks = {
.name = "vmwgfx",
.driver_name = "vmwgfx",
.create_screen = vmw_drm_create_screen,
- .create_context = vmw_drm_create_context,
.texture_from_shared_handle = vmw_drm_texture_from_handle,
.shared_handle_from_texture = vmw_drm_handle_from_texture,
.local_handle_from_texture = vmw_drm_handle_from_texture,
diff --git a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
index 33c83210eb3..03dbd76c375 100644
--- a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
+++ b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
@@ -216,11 +216,6 @@ no_winsys:
}
-static struct pipe_context *
-gdi_llvmpipe_context_create(struct pipe_screen *screen)
-{
- return llvmpipe_create(screen);
-}
static void
@@ -243,7 +238,6 @@ gdi_llvmpipe_present(struct pipe_screen *screen,
static const struct stw_winsys stw_winsys = {
&gdi_llvmpipe_screen_create,
- &gdi_llvmpipe_context_create,
&gdi_llvmpipe_present,
NULL, /* get_adapter_luid */
NULL, /* shared_surface_open */
diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
index 36bf867f193..2078020f8f7 100644
--- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
+++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
@@ -249,13 +249,6 @@ gdi_softpipe_screen_create(void)
}
-static struct pipe_context *
-gdi_softpipe_context_create(struct pipe_screen *screen)
-{
- return softpipe_create(screen);
-}
-
-
static void
gdi_softpipe_present(struct pipe_screen *screen,
struct pipe_surface *surface,
@@ -291,7 +284,6 @@ gdi_softpipe_present(struct pipe_screen *screen,
static const struct stw_winsys stw_winsys = {
&gdi_softpipe_screen_create,
- &gdi_softpipe_context_create,
&gdi_softpipe_present,
NULL, /* get_adapter_luid */
NULL, /* shared_surface_open */
diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c
index 9520bac69db..1dc9e8fa11f 100644
--- a/src/gallium/winsys/xlib/xlib_cell.c
+++ b/src/gallium/winsys/xlib/xlib_cell.c
@@ -383,35 +383,10 @@ fail:
}
-static struct pipe_context *
-xlib_create_cell_context( struct pipe_screen *screen,
- void *priv )
-{
- struct pipe_context *pipe;
-
-
- /* This takes a cell_winsys pointer, but probably that should be
- * created and stored at screen creation, not context creation.
- *
- * The actual cell_winsys value isn't used for anything, so just
- * passing NULL for now.
- */
- pipe = cell_create_context( screen, NULL);
- if (pipe == NULL)
- goto fail;
-
- pipe->priv = priv;
-
- return pipe;
-
-fail:
- return NULL;
-}
struct xm_driver xlib_cell_driver =
{
.create_pipe_screen = xlib_create_cell_screen,
- .create_pipe_context = xlib_create_cell_context,
.display_surface = xlib_cell_display_surface,
};
@@ -420,7 +395,6 @@ struct xm_driver xlib_cell_driver =
struct xm_driver xlib_cell_driver =
{
.create_pipe_screen = NULL,
- .create_pipe_context = NULL,
.display_surface = NULL,
};
diff --git a/src/gallium/winsys/xlib/xlib_llvmpipe.c b/src/gallium/winsys/xlib/xlib_llvmpipe.c
index 503addb55c6..6cebd4c2012 100644
--- a/src/gallium/winsys/xlib/xlib_llvmpipe.c
+++ b/src/gallium/winsys/xlib/xlib_llvmpipe.c
@@ -419,25 +419,6 @@ fail:
}
-static struct pipe_context *
-xlib_create_llvmpipe_context( struct pipe_screen *screen,
- void *context_private )
-{
- struct pipe_context *pipe;
-
- pipe = llvmpipe_create(screen);
- if (pipe == NULL)
- goto fail;
-
- pipe->priv = context_private;
- return pipe;
-
-fail:
- /* Free stuff here */
- return NULL;
-}
-
-
static void
xlib_llvmpipe_display_surface(struct xmesa_buffer *xm_buffer,
struct pipe_surface *surf)
@@ -453,7 +434,6 @@ xlib_llvmpipe_display_surface(struct xmesa_buffer *xm_buffer,
struct xm_driver xlib_llvmpipe_driver =
{
.create_pipe_screen = xlib_create_llvmpipe_screen,
- .create_pipe_context = xlib_create_llvmpipe_context,
.display_surface = xlib_llvmpipe_display_surface
};
diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
index 8ce1ea79366..716338aef47 100644
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ b/src/gallium/winsys/xlib/xlib_softpipe.c
@@ -498,28 +498,9 @@ fail:
}
-static struct pipe_context *
-xlib_create_softpipe_context( struct pipe_screen *screen,
- void *context_private )
-{
- struct pipe_context *pipe;
-
- pipe = softpipe_create(screen);
- if (pipe == NULL)
- goto fail;
-
- pipe->priv = context_private;
- return pipe;
-
-fail:
- /* Free stuff here */
- return NULL;
-}
-
struct xm_driver xlib_softpipe_driver =
{
.create_pipe_screen = xlib_create_softpipe_screen,
- .create_pipe_context = xlib_create_softpipe_context,
.display_surface = xlib_softpipe_display_surface
};