From: Christian König Date: Wed, 8 Dec 2010 21:35:30 +0000 (+0100) Subject: [g3dvl] move buffer mapping/unmapping out of flush X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3b2ef2d007193f8a5f6979b378ee3c952ff39f7f;p=mesa.git [g3dvl] move buffer mapping/unmapping out of flush --- diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 445e2aae234..4b3d2d6d551 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -989,8 +989,23 @@ vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer) } void -vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer - *renderer, +vl_mpeg12_mc_map_buffer(struct vl_mpeg12_mc_renderer *renderer) +{ + unsigned i; + + assert(renderer); + + vl_idct_map_buffers(&renderer->idct_luma, &renderer->idct_y); + vl_idct_map_buffers(&renderer->idct_chroma, &renderer->idct_cr); + vl_idct_map_buffers(&renderer->idct_chroma, &renderer->idct_cb); + + vl_vb_map(&renderer->pos, renderer->pipe); + for(i = 0; i < 4; ++i) + vl_vb_map(&renderer->mv[i], renderer->pipe); +} + +void +vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer *renderer, struct pipe_surface *surface, struct pipe_surface *past, struct pipe_surface *future, @@ -1024,16 +1039,29 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer num_macroblocks -= num_to_submit; if (renderer->num_macroblocks == renderer->macroblocks_per_batch) { + vl_mpeg12_mc_unmap_buffer(renderer); vl_mpeg12_mc_renderer_flush(renderer); - - /* Next time we get this surface it may have new ref frames */ - pipe_surface_reference(&renderer->surface, NULL); - pipe_surface_reference(&renderer->past, NULL); - pipe_surface_reference(&renderer->future, NULL); + vl_mpeg12_mc_map_buffer(renderer); } } } +void +vl_mpeg12_mc_unmap_buffer(struct vl_mpeg12_mc_renderer *renderer) +{ + unsigned i; + + assert(renderer); + + vl_idct_unmap_buffers(&renderer->idct_luma, &renderer->idct_y); + vl_idct_unmap_buffers(&renderer->idct_chroma, &renderer->idct_cr); + vl_idct_unmap_buffers(&renderer->idct_chroma, &renderer->idct_cb); + + vl_vb_unmap(&renderer->pos, renderer->pipe); + for(i = 0; i < 4; ++i) + vl_vb_unmap(&renderer->mv[i], renderer->pipe); +} + void vl_mpeg12_mc_renderer_flush(struct vl_mpeg12_mc_renderer *renderer) { @@ -1045,20 +1073,13 @@ vl_mpeg12_mc_renderer_flush(struct vl_mpeg12_mc_renderer *renderer) if (renderer->num_macroblocks == 0) return; - vl_idct_unmap_buffers(&renderer->idct_luma, &renderer->idct_y); - vl_idct_unmap_buffers(&renderer->idct_chroma, &renderer->idct_cr); - vl_idct_unmap_buffers(&renderer->idct_chroma, &renderer->idct_cb); - vl_idct_flush(&renderer->idct_luma, &renderer->idct_y); vl_idct_flush(&renderer->idct_chroma, &renderer->idct_cr); vl_idct_flush(&renderer->idct_chroma, &renderer->idct_cb); - vl_vb_unmap(&renderer->pos, renderer->pipe); vl_vb_restart(&renderer->pos); - for(i = 0; i < 4; ++i) { - vl_vb_unmap(&renderer->mv[i], renderer->pipe); + for(i = 0; i < 4; ++i) vl_vb_restart(&renderer->mv[i]); - } renderer->fb_state.cbufs[0] = renderer->surface; renderer->pipe->bind_rasterizer_state(renderer->pipe, renderer->rs_state); @@ -1085,13 +1106,5 @@ vl_mpeg12_mc_renderer_flush(struct vl_mpeg12_mc_renderer *renderer) renderer->pipe->flush(renderer->pipe, PIPE_FLUSH_RENDER_CACHE, renderer->fence); - vl_idct_map_buffers(&renderer->idct_luma, &renderer->idct_y); - vl_idct_map_buffers(&renderer->idct_chroma, &renderer->idct_cr); - vl_idct_map_buffers(&renderer->idct_chroma, &renderer->idct_cb); - - vl_vb_map(&renderer->pos, renderer->pipe); - for(i = 0; i < 4; ++i) - vl_vb_map(&renderer->mv[i], renderer->pipe); - renderer->num_macroblocks = 0; } diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h index e12ac50ae0d..2f35bcbcd45 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -112,6 +112,8 @@ bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer); +void vl_mpeg12_mc_map_buffer(struct vl_mpeg12_mc_renderer *renderer); + void vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer *renderer, struct pipe_surface *surface, struct pipe_surface *past, @@ -120,6 +122,8 @@ void vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer *rend struct pipe_mpeg12_macroblock *mpeg12_macroblocks, struct pipe_fence_handle **fence); +void vl_mpeg12_mc_unmap_buffer(struct vl_mpeg12_mc_renderer *renderer); + void vl_mpeg12_mc_renderer_flush(struct vl_mpeg12_mc_renderer *renderer); #endif /* vl_mpeg12_mc_renderer_h */ diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c index 35636d8475c..166c09e20be 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.c +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -282,7 +282,9 @@ sp_mpeg12_render_picture(struct pipe_video_context *vpipe, assert(dst_surface); assert(dst_area); + vl_mpeg12_mc_unmap_buffer(&ctx->mc_renderer); vl_mpeg12_mc_renderer_flush(&ctx->mc_renderer); + vl_mpeg12_mc_map_buffer(&ctx->mc_renderer); vl_compositor_render(&ctx->compositor, src_surface, picture_type, src_area, dst_surface, dst_area, fence); @@ -328,7 +330,9 @@ sp_mpeg12_set_decode_target(struct pipe_video_context *vpipe, assert(dt); if (ctx->decode_target != dt) { + vl_mpeg12_mc_unmap_buffer(&ctx->mc_renderer); vl_mpeg12_mc_renderer_flush(&ctx->mc_renderer); + vl_mpeg12_mc_map_buffer(&ctx->mc_renderer); pipe_surface_reference(&ctx->decode_target, dt); } }