summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv50/nv50_context.c
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2015-05-08 00:15:22 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2015-05-09 13:36:23 -0400
commitf617029db3f8786d94c64f1a73c42b89b6d261fa (patch)
treee5bc89c2d03d0850b51f403526ab27060392e8a2 /src/gallium/drivers/nouveau/nv50/nv50_context.c
parentd6fb155f30ac2bd7853da32ddf99e9f7840a8f01 (diff)
downloadexternal_mesa3d-f617029db3f8786d94c64f1a73c42b89b6d261fa.zip
external_mesa3d-f617029db3f8786d94c64f1a73c42b89b6d261fa.tar.gz
external_mesa3d-f617029db3f8786d94c64f1a73c42b89b6d261fa.tar.bz2
nv50: keep track of PGRAPH state in nv50_screen
Normally this is kept in nv50_context, and on switching the active context, the state is copied from the previous context. However when the last context is destroyed, this is lost, and a new context might later be created. When the currently-active context is destroyed, save its state in the screen, and restore it when setting the current context. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90363 Reported-by: Matteo Bruni <matteo.mystral@gmail.com> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Tested-by: Matteo Bruni <matteo.mystral@gmail.com> Cc: mesa-stable@lists.freedesktop.org
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50/nv50_context.c')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_context.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index 2cfd5db..5b5d391 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -138,8 +138,11 @@ nv50_destroy(struct pipe_context *pipe)
{
struct nv50_context *nv50 = nv50_context(pipe);
- if (nv50_context_screen(nv50)->cur_ctx == nv50)
- nv50_context_screen(nv50)->cur_ctx = NULL;
+ if (nv50->screen->cur_ctx == nv50) {
+ nv50->screen->cur_ctx = NULL;
+ /* Save off the state in case another context gets created */
+ nv50->screen->save_state = nv50->state;
+ }
nouveau_pushbuf_bufctx(nv50->base.pushbuf, NULL);
nouveau_pushbuf_kick(nv50->base.pushbuf, nv50->base.pushbuf->channel);
@@ -290,6 +293,10 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
pipe->get_sample_position = nv50_context_get_sample_position;
if (!screen->cur_ctx) {
+ /* Restore the last context's state here, normally handled during
+ * context switch
+ */
+ nv50->state = screen->save_state;
screen->cur_ctx = nv50;
nouveau_pushbuf_bufctx(screen->base.pushbuf, nv50->bufctx);
}