diff options
author | Maarten Lankhorst <[email protected]> | 2011-09-02 16:20:02 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-09-04 13:51:50 +0200 |
commit | a09754c15fc48e5fed347f478a301a02ee69fe8c (patch) | |
tree | a1d015250cc391e42dd173335a90eb3d75f3e6ba /src/gallium/state_trackers/xorg | |
parent | 0a00a9a05b357dafae86bf8af879aa601f101eba (diff) |
xvmc: Replace frame_started by picture_structure
The preferred solution to keeping track of the picture structure
has been putting it in the state tracker, so use picture_structure
instead of frame_started to check if a frame needs to begin.
If picture_structure has been changed, end the frame and start again.
Signed-off-by: Maarten Lankhorst <[email protected]>
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/surface.c | 22 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/xvmc_private.h | 4 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index 9a512c43670..e6c5a898b05 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -101,11 +101,14 @@ SetDecoderStatus(XvMCSurfacePrivate *surface) { struct pipe_video_decoder *decoder; struct pipe_video_buffer *ref_frames[2]; + struct pipe_mpeg12_picture_desc desc = { { PIPE_VIDEO_PROFILE_MPEG1} }; XvMCContextPrivate *context_priv; unsigned i, num_refs = 0; + desc.picture_structure = surface->picture_structure; + assert(surface); context_priv = surface->context->privData; @@ -124,6 +127,7 @@ SetDecoderStatus(XvMCSurfacePrivate *surface) } } decoder->set_reference_frames(decoder, ref_frames, num_refs); + decoder->set_picture_parameters(context_priv->decoder, &desc.base); } static void @@ -148,9 +152,9 @@ RecursiveEndFrame(XvMCSurfacePrivate *surface) } } - if (surface->frame_started) { - surface->frame_started = 0; + if (surface->picture_structure) { SetDecoderStatus(surface); + surface->picture_structure = 0; for (i = 0; i < 2; ++i) surface->ref[i] = NULL; @@ -273,7 +277,8 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur xvmc_mb = macroblocks->macro_blocks + first_macroblock; /* If the surface we're rendering hasn't changed the ref frames shouldn't change. */ - if (target_surface_priv->frame_started && ( + if (target_surface_priv->picture_structure > 0 && ( + target_surface_priv->picture_structure != picture_structure || target_surface_priv->ref[0] != past_surface || target_surface_priv->ref[1] != future_surface || (xvmc_mb->x == 0 && xvmc_mb->y == 0))) { @@ -285,10 +290,11 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur target_surface_priv->ref[0] = past_surface; target_surface_priv->ref[1] = future_surface; - SetDecoderStatus(target_surface_priv); - - if (!target_surface_priv->frame_started) { - target_surface_priv->frame_started = 1; + if (target_surface_priv->picture_structure) + SetDecoderStatus(target_surface_priv); + else { + target_surface_priv->picture_structure = picture_structure; + SetDecoderStatus(target_surface_priv); decoder->begin_frame(decoder); } @@ -494,7 +500,7 @@ Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface) surface_priv = surface->privData; context_priv = surface_priv->context->privData; - if (surface_priv->frame_started) { + if (surface_priv->picture_structure) { SetDecoderStatus(surface_priv); context_priv->decoder->end_frame(context_priv->decoder); } diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h index 43ae7171389..305e51fb416 100644 --- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h +++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h @@ -72,8 +72,8 @@ typedef struct void *decode_buffer; struct pipe_video_buffer *video_buffer; - // have we allready told the decoder to start a frame - bool frame_started; + /* nonzero if this picture is already being decoded */ + int picture_structure; XvMCSurface *ref[2]; |