diff options
author | Christian König <[email protected]> | 2010-12-09 22:28:31 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2010-12-09 22:28:31 +0100 |
commit | 25cdc79f32f9e4242d53a22a4debe80ca6a66348 (patch) | |
tree | 1579da385e0a79e7d12b98eaea87d6d8734491f6 /src | |
parent | 7c4887f5ae642131d7895da5bffda77a6287c6d4 (diff) |
[g3dvl] fix buffer handling in mc code
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 97548491147..c688f2c5140 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -1054,6 +1054,10 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer *renderer, pipe_surface_reference(&buffer->past, past); pipe_surface_reference(&buffer->future, future); buffer->fence = fence; + } else { + /* If the surface we're rendering hasn't changed the ref frames shouldn't change. */ + assert(buffer->past == past); + assert(buffer->future == future); } while (num_macroblocks) { @@ -1071,6 +1075,9 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer *renderer, if (buffer->num_macroblocks == renderer->macroblocks_per_batch) { vl_mpeg12_mc_unmap_buffer(renderer, buffer); vl_mpeg12_mc_renderer_flush(renderer, buffer); + pipe_surface_reference(&buffer->surface, surface); + pipe_surface_reference(&buffer->past, past); + pipe_surface_reference(&buffer->future, future); vl_mpeg12_mc_map_buffer(renderer, buffer); } } @@ -1121,12 +1128,19 @@ vl_mpeg12_mc_renderer_flush(struct vl_mpeg12_mc_renderer *renderer, struct vl_mp if (buffer->past) { buffer->textures.individual.ref[0] = buffer->past->texture; buffer->sampler_views.individual.ref[0] = find_or_create_sampler_view(renderer, buffer->past); + } else { + buffer->textures.individual.ref[0] = buffer->surface->texture; + buffer->sampler_views.individual.ref[0] = find_or_create_sampler_view(renderer, buffer->surface); } if (buffer->future) { buffer->textures.individual.ref[1] = buffer->future->texture; buffer->sampler_views.individual.ref[1] = find_or_create_sampler_view(renderer, buffer->future); + } else { + buffer->textures.individual.ref[1] = buffer->surface->texture; + buffer->sampler_views.individual.ref[1] = find_or_create_sampler_view(renderer, buffer->surface); } + renderer->pipe->set_fragment_sampler_views(renderer->pipe, 5, buffer->sampler_views.all); renderer->pipe->bind_fragment_sampler_states(renderer->pipe, 5, renderer->samplers.all); @@ -1136,5 +1150,10 @@ vl_mpeg12_mc_renderer_flush(struct vl_mpeg12_mc_renderer *renderer, struct vl_mp renderer->pipe->flush(renderer->pipe, PIPE_FLUSH_RENDER_CACHE, buffer->fence); + /* Next time we get this surface it may have new ref frames */ + pipe_surface_reference(&buffer->surface, NULL); + pipe_surface_reference(&buffer->past, NULL); + pipe_surface_reference(&buffer->future, NULL); + buffer->num_macroblocks = 0; } |