diff options
author | Christoph Bumiller <[email protected]> | 2012-03-07 19:44:10 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-04-14 06:14:21 +0200 |
commit | 2d06ee8bf784d98a822617db5366f56b9bb5d3a2 (patch) | |
tree | 584789e8de984001ec7a7e8d16c06b02346865c3 /src/gallium/drivers/nvc0 | |
parent | 687c05661f54dc9a6df5974a91205fc7ed469f2b (diff) |
nv50,nvc0: hold references to the framebuffer surfaces
Diffstat (limited to 'src/gallium/drivers/nvc0')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_context.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_state.c | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c index dcdc830c408..471c7be77e0 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nvc0/nvc0_context.c @@ -22,6 +22,7 @@ #include "draw/draw_context.h" #include "pipe/p_defines.h" +#include "util/u_framebuffer.h" #include "nvc0_context.h" #include "nvc0_screen.h" @@ -57,6 +58,8 @@ nvc0_context_unreference_resources(struct nvc0_context *nvc0) nouveau_bufctx_del(&nvc0->bufctx_3d); nouveau_bufctx_del(&nvc0->bufctx); + util_unreference_framebuffer_state(&nvc0->framebuffer); + for (i = 0; i < nvc0->num_vtxbufs; ++i) pipe_resource_reference(&nvc0->vtxbuf[i].buffer, NULL); diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index e349491b66e..b2cd54af129 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -679,10 +679,22 @@ nvc0_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { struct nvc0_context *nvc0 = nvc0_context(pipe); + unsigned i; nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB); - nvc0->framebuffer = *fb; + for (i = 0; i < fb->nr_cbufs; ++i) + pipe_surface_reference(&nvc0->framebuffer.cbufs[i], fb->cbufs[i]); + for (; i < nvc0->framebuffer.nr_cbufs; ++i) + pipe_surface_reference(&nvc0->framebuffer.cbufs[i], NULL); + + nvc0->framebuffer.nr_cbufs = fb->nr_cbufs; + + nvc0->framebuffer.width = fb->width; + nvc0->framebuffer.height = fb->height; + + pipe_surface_reference(&nvc0->framebuffer.zsbuf, fb->zsbuf); + nvc0->dirty |= NVC0_NEW_FRAMEBUFFER; } |