[g3dvl] rework fence handling and add r600g workaround

This commit is contained in:
Christian König 2011-04-24 20:08:11 +02:00
parent 3ea7e2713c
commit 104ac00663
4 changed files with 20 additions and 12 deletions

View file

@ -498,8 +498,7 @@ static void
vl_mpeg12_decoder_flush_buffer(struct pipe_video_decode_buffer *buffer,
unsigned num_ycbcr_blocks[3],
struct pipe_video_buffer *refs[2],
struct pipe_video_buffer *dst,
struct pipe_fence_handle **fence)
struct pipe_video_buffer *dst)
{
struct vl_mpeg12_buffer *buf = (struct vl_mpeg12_buffer *)buffer;
struct vl_mpeg12_decoder *dec;
@ -567,8 +566,6 @@ vl_mpeg12_decoder_flush_buffer(struct pipe_video_decode_buffer *buffer,
vl_mc_render_ycbcr(&buf->mc[i], mc_source_sv[component], j, num_ycbcr_blocks[component]);
}
}
dec->pipe->flush(dec->pipe, fence);
}
static bool

View file

@ -159,8 +159,7 @@ struct pipe_video_decoder
void (*flush_buffer)(struct pipe_video_decode_buffer *decbuf,
unsigned num_ycbcr_blocks[3],
struct pipe_video_buffer *ref_frames[2],
struct pipe_video_buffer *dst,
struct pipe_fence_handle **fence);
struct pipe_video_buffer *dst);
};
/**

View file

@ -275,8 +275,7 @@ unmap_and_flush_surface(XvMCSurfacePrivate *surface)
context_priv->decoder->flush_buffer(surface->decode_buffer,
num_ycbcr_blocks,
ref_frames,
surface->video_buffer,
&surface->flush_fence);
surface->video_buffer);
surface->mapped = 0;
}
}
@ -537,7 +536,10 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
subpicture_priv->surface = NULL;
}
compositor->render_picture(compositor, PictureToPipe(flags), drawable_surface, &dst_rect, &surface_priv->disp_fence);
// Workaround for r600g, there seems to be a bug in the fence refcounting code
vpipe->screen->fence_reference(vpipe->screen, &surface_priv->fence, NULL);
compositor->render_picture(compositor, PictureToPipe(flags), drawable_surface, &dst_rect, &surface_priv->fence);
XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface);
@ -572,6 +574,10 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
PUBLIC
Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status)
{
struct pipe_video_context *vpipe;
XvMCSurfacePrivate *surface_priv;
XvMCContextPrivate *context_priv;
assert(dpy);
if (!surface)
@ -579,8 +585,16 @@ Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status)
assert(status);
surface_priv = surface->privData;
context_priv = surface_priv->context->privData;
vpipe = context_priv->vctx->vpipe;
*status = 0;
if (surface_priv->fence)
if (!vpipe->screen->fence_signalled(vpipe->screen, surface_priv->fence))
*status |= XVMC_RENDERING;
return Success;
}

View file

@ -83,9 +83,7 @@ typedef struct
struct pipe_motionvector *mv;
} ref[2];
struct pipe_fence_handle *flush_fence;
struct pipe_fence_handle *render_fence;
struct pipe_fence_handle *disp_fence;
struct pipe_fence_handle *fence;
/* The subpicture associated with this surface, if any. */
XvMCSubpicture *subpicture;