From: Younes Manton Date: Tue, 3 Nov 2009 03:03:09 +0000 (-0500) Subject: g3dvl: Wrap macroblock block buffer in a pipe user buffer. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dcccbfd14e46a4b69d3e89666d57f07589eaef9b;p=mesa.git g3dvl: Wrap macroblock block buffer in a pipe user buffer. --- diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 6b3614821cc..bc4ab5fb357 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -1507,6 +1507,8 @@ static void 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); @@ -1514,7 +1516,10 @@ grab_macroblock(struct vl_mpeg12_mc_renderer *r, 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; } diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index 9ff6bdaa2b6..23f2cb74270 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -108,7 +108,7 @@ struct pipe_mpeg12_macroblock enum pipe_mpeg12_dct_type dct_type; signed pmv[2][2][2]; unsigned cbp; - void *blocks; + struct pipe_buffer *blocks; }; #if 0 diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index e1779eafa27..24c413bc04d 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "xvmc_private.h" @@ -132,7 +133,8 @@ CreateOrResizeBackBuffer(struct vl_context *vctx, unsigned int width, unsigned i } 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, @@ -167,7 +169,8 @@ MacroBlocksToPipe(const XvMCMacroBlockArray *xvmc_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; @@ -232,6 +235,7 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur XvMCSurfacePrivate *past_surface_priv; XvMCSurfacePrivate *future_surface_priv; struct pipe_mpeg12_macroblock pipe_macroblocks[num_macroblocks]; + unsigned int i; assert(dpy); @@ -275,13 +279,16 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur 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; }