grab_macroblock(struct vl_mpeg12_mc_renderer *r,
struct pipe_mpeg12_macroblock *mb)
{
- void *blocks;
-
assert(r);
assert(mb);
+ assert(mb->blocks);
assert(r->num_macroblocks < r->macroblocks_per_batch);
memcpy(&r->macroblock_buf[r->num_macroblocks], mb,
sizeof(struct pipe_mpeg12_macroblock));
- blocks = pipe_buffer_map(r->pipe->screen, mb->blocks,
- PIPE_BUFFER_USAGE_CPU_READ);
- grab_blocks(r, mb->mbx, mb->mby, mb->dct_type, mb->cbp, blocks);
- pipe_buffer_unmap(r->pipe->screen, mb->blocks);
+ grab_blocks(r, mb->mbx, mb->mby, mb->dct_type, mb->cbp, mb->blocks);
++r->num_macroblocks;
}
cleanup_pipe_state(renderer);
cleanup_shaders(renderer);
cleanup_buffers(renderer);
+
+ pipe_surface_reference(&renderer->surface, NULL);
+ pipe_surface_reference(&renderer->past, NULL);
+ pipe_surface_reference(&renderer->future, NULL);
}
void
new_surface = true;
if (new_surface) {
- renderer->surface = surface;
- renderer->past = past;
- renderer->future = future;
+ pipe_surface_reference(&renderer->surface, surface);
+ pipe_surface_reference(&renderer->past, past);
+ pipe_surface_reference(&renderer->future, future);
renderer->fence = fence;
renderer->surface_tex_inv_size.x = 1.0f / surface->width;
renderer->surface_tex_inv_size.y = 1.0f / surface->height;
flush(renderer);
xfer_buffers_map(renderer);
/* Next time we get this surface it may have new ref frames */
- renderer->surface = NULL;
+ pipe_surface_reference(&renderer->surface, NULL);
+ pipe_surface_reference(&renderer->past, NULL);
+ pipe_surface_reference(&renderer->future, NULL);
}
}
}
pipe_macroblocks->pmv[j][k][l] = xvmc_mb->PMV[j][k][l];
pipe_macroblocks->cbp = xvmc_mb->coded_block_pattern;
- pipe_macroblocks->blocks = pipe_user_buffer_create(screen, xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES,
- BLOCK_SIZE_BYTES);
+ pipe_macroblocks->blocks = xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES;
++pipe_macroblocks;
++xvmc_mb;
vpipe->decode_macroblocks(vpipe, p_vsfc, f_vsfc, num_macroblocks,
&pipe_macroblocks->base, target_surface_priv->render_fence);
- for (i = 0; i < num_macroblocks; ++i)
- vpipe->screen->buffer_destroy(pipe_macroblocks[i].blocks);
-
XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for rendering.\n", target_surface);
return Success;