summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_state.c
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2012-03-07 19:44:10 +0100
committerChristoph Bumiller <[email protected]>2012-04-14 06:14:21 +0200
commit2d06ee8bf784d98a822617db5366f56b9bb5d3a2 (patch)
tree584789e8de984001ec7a7e8d16c06b02346865c3 /src/gallium/drivers/nv50/nv50_state.c
parent687c05661f54dc9a6df5974a91205fc7ed469f2b (diff)
nv50,nvc0: hold references to the framebuffer surfaces
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_state.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c14
1 files changed, 13 insertions, 1 deletions
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;
}