From 104ac0066394f8246d18c833bca4bcce271b5eef Mon Sep 17 00:00:00 2001 From: Christian König Date: Sun, 24 Apr 2011 20:08:11 +0200 Subject: [g3dvl] rework fence handling and add r600g workaround --- src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 5 +---- src/gallium/include/pipe/p_video_context.h | 3 +-- src/gallium/state_trackers/xorg/xvmc/surface.c | 20 +++++++++++++++++--- src/gallium/state_trackers/xorg/xvmc/xvmc_private.h | 4 +--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 296f46aba52..37789707a6b 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -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 diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h index 88d3ca1f4e4..41f2e320580 100644 --- a/src/gallium/include/pipe/p_video_context.h +++ b/src/gallium/include/pipe/p_video_context.h @@ -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); }; /** diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index cfa15e120d9..fc4593dbc5f 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -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; } diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h index bdcda3bb56f..262adac7ab6 100644 --- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h +++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h @@ -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; -- cgit v1.2.3