summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv40
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nv40')
-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
5 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
index ffe25ffebd..b0b90032de 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 3998cf2dd3..958a48f2a4 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 56fb80975c..001147e752 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 98fde8755b..9437aa050d 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 13fe854915..1c4007a129 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++) {