From 2d06ee8bf784d98a822617db5366f56b9bb5d3a2 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Wed, 7 Mar 2012 19:44:10 +0100 Subject: nv50,nvc0: hold references to the framebuffer surfaces --- src/gallium/drivers/nv50/nv50_state.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/nv50/nv50_state.c') diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index e1e1af039bb..bf554427ca0 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -803,10 +803,22 @@ nv50_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { struct nv50_context *nv50 = nv50_context(pipe); + unsigned i; nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_FB); - nv50->framebuffer = *fb; + for (i = 0; i < fb->nr_cbufs; ++i) + pipe_surface_reference(&nv50->framebuffer.cbufs[i], fb->cbufs[i]); + for (; i < nv50->framebuffer.nr_cbufs; ++i) + pipe_surface_reference(&nv50->framebuffer.cbufs[i], NULL); + + nv50->framebuffer.nr_cbufs = fb->nr_cbufs; + + nv50->framebuffer.width = fb->width; + nv50->framebuffer.height = fb->height; + + pipe_surface_reference(&nv50->framebuffer.zsbuf, fb->zsbuf); + nv50->dirty |= NV50_NEW_FRAMEBUFFER; } -- cgit v1.2.3