grab_macroblock(struct vl_mpeg12_mc_renderer *r,
struct pipe_mpeg12_macroblock *mb)
{
+ void *blocks;
+
assert(r);
assert(mb);
assert(r->num_macroblocks < r->macroblocks_per_batch);
memcpy(&r->macroblock_buf[r->num_macroblocks], mb,
sizeof(struct pipe_mpeg12_macroblock));
- grab_blocks(r, mb->mbx, mb->mby, mb->dct_type, mb->cbp, mb->blocks);
+ 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);
++r->num_macroblocks;
}
#include <pipe/p_video_context.h>
#include <pipe/p_video_state.h>
#include <pipe/p_state.h>
+#include <pipe/p_inlines.h>
#include <util/u_memory.h>
#include "xvmc_private.h"
}
static void
-MacroBlocksToPipe(const XvMCMacroBlockArray *xvmc_macroblocks,
+MacroBlocksToPipe(struct pipe_screen *screen,
+ const XvMCMacroBlockArray *xvmc_macroblocks,
const XvMCBlockArray *xvmc_blocks,
unsigned int first_macroblock,
unsigned int num_macroblocks,
pipe_macroblocks->pmv[j][k][l] = xvmc_mb->PMV[j][k][l];
pipe_macroblocks->cbp = xvmc_mb->coded_block_pattern;
- pipe_macroblocks->blocks = xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES;
+ pipe_macroblocks->blocks = pipe_user_buffer_create(screen, xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES,
+ BLOCK_SIZE_BYTES);
++pipe_macroblocks;
++xvmc_mb;
XvMCSurfacePrivate *past_surface_priv;
XvMCSurfacePrivate *future_surface_priv;
struct pipe_mpeg12_macroblock pipe_macroblocks[num_macroblocks];
+ unsigned int i;
assert(dpy);
p_vsfc = past_surface ? past_surface_priv->pipe_vsfc : NULL;
f_vsfc = future_surface ? future_surface_priv->pipe_vsfc : NULL;
- MacroBlocksToPipe(macroblocks, blocks, first_macroblock,
+ MacroBlocksToPipe(vpipe->screen, macroblocks, blocks, first_macroblock,
num_macroblocks, pipe_macroblocks);
vpipe->set_decode_target(vpipe, t_vsfc);
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);
+
return Success;
}