summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_context.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-09-07 12:40:39 -0700
committerEric Anholt <[email protected]>2016-09-14 06:08:03 +0100
commitc31a7f529fadc016786eedc35ce65802a915ce09 (patch)
tree3d613e0273d4873a9e5758032df88ac30ffd8f38 /src/gallium/drivers/vc4/vc4_context.c
parent774a556b6dc0d49f9f29c438349a66e69062e6e4 (diff)
vc4: Always unref the current job surfaces at job reset time.
Drops some tricky logic in vc4_flush() trying to update the pointers, and fixes a broken lack of unref for MSAA surfaces at context destroy time.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_context.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_context.c37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index e7f63d69735..6f50b97f447 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -45,43 +45,29 @@ vc4_flush(struct pipe_context *pctx)
struct pipe_surface *zsbuf = vc4->framebuffer.zsbuf;
if (cbuf && (vc4->resolve & PIPE_CLEAR_COLOR0)) {
- pipe_surface_reference(&vc4->color_write,
- cbuf->texture->nr_samples > 1 ?
- NULL : cbuf);
- pipe_surface_reference(&vc4->msaa_color_write,
- cbuf->texture->nr_samples > 1 ?
- cbuf : NULL);
+ if (cbuf->texture->nr_samples > 1) {
+ pipe_surface_reference(&vc4->msaa_color_write, cbuf);
+ } else {
+ pipe_surface_reference(&vc4->color_write, cbuf);
+ }
if (!(vc4->cleared & PIPE_CLEAR_COLOR0)) {
pipe_surface_reference(&vc4->color_read, cbuf);
- } else {
- pipe_surface_reference(&vc4->color_read, NULL);
}
- } else {
- pipe_surface_reference(&vc4->color_write, NULL);
- pipe_surface_reference(&vc4->color_read, NULL);
- pipe_surface_reference(&vc4->msaa_color_write, NULL);
}
if (vc4->framebuffer.zsbuf &&
(vc4->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) {
- pipe_surface_reference(&vc4->zs_write,
- zsbuf->texture->nr_samples > 1 ?
- NULL : zsbuf);
- pipe_surface_reference(&vc4->msaa_zs_write,
- zsbuf->texture->nr_samples > 1 ?
- zsbuf : NULL);
+ if (zsbuf->texture->nr_samples > 1) {
+ pipe_surface_reference(&vc4->msaa_zs_write, zsbuf);
+ } else {
+ pipe_surface_reference(&vc4->zs_write, zsbuf);
+ }
if (!(vc4->cleared & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) {
pipe_surface_reference(&vc4->zs_read, zsbuf);
- } else {
- pipe_surface_reference(&vc4->zs_read, NULL);
}
- } else {
- pipe_surface_reference(&vc4->zs_write, NULL);
- pipe_surface_reference(&vc4->zs_read, NULL);
- pipe_surface_reference(&vc4->msaa_zs_write, NULL);
}
vc4_job_submit(vc4);
@@ -182,9 +168,6 @@ vc4_context_destroy(struct pipe_context *pctx)
pipe_surface_reference(&vc4->framebuffer.cbufs[0], NULL);
pipe_surface_reference(&vc4->framebuffer.zsbuf, NULL);
- pipe_surface_reference(&vc4->color_write, NULL);
- pipe_surface_reference(&vc4->color_read, NULL);
-
vc4_program_fini(pctx);
ralloc_free(vc4);