}
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,
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)
{
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);
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;
}
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);
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);
}
}