diff options
author | Ilia Mirkin <[email protected]> | 2015-05-08 00:26:24 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-05-09 13:36:23 -0400 |
commit | e9b1ea29bf1e8f09e83bd6358d0d2068053f09d4 (patch) | |
tree | 5f6d3ba792f03316dcccd691e67e6535674a0e32 /src/gallium | |
parent | f617029db3f8786d94c64f1a73c42b89b6d261fa (diff) |
nvc0: keep track of PGRAPH state in nvc0_screen
See identical commit for nv50. Destroying the current context and then
creating a new one or switching to another existing context would cause
the "current" state to not be properly initialized, so we save it off in
the screen.
Signed-off-by: Ilia Mirkin <[email protected]>
Cc: [email protected]
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_context.h | 24 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 25 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 2 |
4 files changed, 34 insertions, 24 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c index 7662fb50f61..7904984f503 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c @@ -139,8 +139,12 @@ nvc0_destroy(struct pipe_context *pipe) { struct nvc0_context *nvc0 = nvc0_context(pipe); - if (nvc0->screen->cur_ctx == nvc0) + if (nvc0->screen->cur_ctx == nvc0) { nvc0->screen->cur_ctx = NULL; + nvc0->screen->save_state = nvc0->state; + nvc0->screen->save_state.tfb = NULL; + } + /* Unset bufctx, we don't want to revalidate any resources after the flush. * Other contexts will always set their bufctx again on action calls. */ @@ -303,6 +307,7 @@ nvc0_create(struct pipe_screen *pscreen, void *priv) pipe->get_sample_position = nvc0_context_get_sample_position; if (!screen->cur_ctx) { + nvc0->state = screen->save_state; screen->cur_ctx = nvc0; nouveau_pushbuf_bufctx(screen->base.pushbuf, nvc0->bufctx); } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h index ef251f35a1b..a8d7593b398 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h @@ -113,29 +113,7 @@ struct nvc0_context { uint32_t dirty; uint32_t dirty_cp; /* dirty flags for compute state */ - struct { - boolean flushed; - boolean rasterizer_discard; - boolean early_z_forced; - boolean prim_restart; - uint32_t instance_elts; /* bitmask of per-instance elements */ - uint32_t instance_base; - uint32_t constant_vbos; - uint32_t constant_elts; - int32_t index_bias; - uint16_t scissor; - uint8_t vbo_mode; /* 0 = normal, 1 = translate, 3 = translate, forced */ - uint8_t num_vtxbufs; - uint8_t num_vtxelts; - uint8_t num_textures[6]; - uint8_t num_samplers[6]; - uint8_t tls_required; /* bitmask of shader types using l[] */ - uint8_t c14_bound; /* whether immediate array constbuf is bound */ - uint8_t clip_enable; - uint32_t clip_mode; - uint32_t uniform_buffer_bound[5]; - struct nvc0_transform_feedback_state *tfb; - } state; + struct nvc0_graph_state state; struct nvc0_blend_stateobj *blend; struct nvc0_rasterizer_stateobj *rast; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h index 1a7d5027a7c..ef2bd43f006 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h @@ -27,10 +27,35 @@ struct nvc0_context; struct nvc0_blitter; +struct nvc0_graph_state { + boolean flushed; + boolean rasterizer_discard; + boolean early_z_forced; + boolean prim_restart; + uint32_t instance_elts; /* bitmask of per-instance elements */ + uint32_t instance_base; + uint32_t constant_vbos; + uint32_t constant_elts; + int32_t index_bias; + uint16_t scissor; + uint8_t vbo_mode; /* 0 = normal, 1 = translate, 3 = translate, forced */ + uint8_t num_vtxbufs; + uint8_t num_vtxelts; + uint8_t num_textures[6]; + uint8_t num_samplers[6]; + uint8_t tls_required; /* bitmask of shader types using l[] */ + uint8_t c14_bound; /* whether immediate array constbuf is bound */ + uint8_t clip_enable; + uint32_t clip_mode; + uint32_t uniform_buffer_bound[5]; + struct nvc0_transform_feedback_state *tfb; +}; + struct nvc0_screen { struct nouveau_screen base; struct nvc0_context *cur_ctx; + struct nvc0_graph_state save_state; int num_occlusion_queries_active; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c index 6051f128f66..d3ad81d2d66 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c @@ -543,6 +543,8 @@ nvc0_switch_pipe_context(struct nvc0_context *ctx_to) if (ctx_from) ctx_to->state = ctx_from->state; + else + ctx_to->state = ctx_to->screen->save_state; ctx_to->dirty = ~0; ctx_to->viewports_dirty = ~0; |