From 8c2bfa34a0d70ab08de44e3b091b3a097abbad97 Mon Sep 17 00:00:00 2001 From: Christian König Date: Fri, 23 Dec 2011 16:14:31 +0100 Subject: vl: replace decode_buffers with auxiliary data field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on patches from Maarten Lankhorst Signed-off-by: Christian König Acked-by: Maarten Lankhorst --- src/gallium/state_trackers/vdpau/decode.c | 43 +--------------------- src/gallium/state_trackers/vdpau/vdpau_private.h | 3 -- src/gallium/state_trackers/xorg/xvmc/context.c | 3 +- src/gallium/state_trackers/xorg/xvmc/surface.c | 6 --- .../state_trackers/xorg/xvmc/xvmc_private.h | 1 - 5 files changed, 4 insertions(+), 52 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index a5a01fb21a3..ab7bf113fa6 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -48,7 +48,6 @@ vlVdpDecoderCreate(VdpDevice device, vlVdpDevice *dev; vlVdpDecoder *vldecoder; VdpStatus ret; - unsigned i; bool supported; VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating decoder\n"); @@ -90,7 +89,8 @@ vlVdpDecoderCreate(VdpDevice device, pipe, p_profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CHROMA_FORMAT_420, - width, height, max_references + width, height, max_references, + false ); if (!vldecoder->decoder) { @@ -98,25 +98,6 @@ vlVdpDecoderCreate(VdpDevice device, goto error_decoder; } - vldecoder->num_buffers = pipe->screen->get_video_param - ( - pipe->screen, p_profile, - PIPE_VIDEO_CAP_NUM_BUFFERS_DESIRED - ); - vldecoder->cur_buffer = 0; - - vldecoder->buffers = CALLOC(vldecoder->num_buffers, sizeof(void*)); - if (!vldecoder->buffers) - goto error_alloc_buffers; - - for (i = 0; i < vldecoder->num_buffers; ++i) { - vldecoder->buffers[i] = vldecoder->decoder->create_buffer(vldecoder->decoder); - if (!vldecoder->buffers[i]) { - ret = VDP_STATUS_ERROR; - goto error_create_buffers; - } - } - *decoder = vlAddDataHTAB(vldecoder); if (*decoder == 0) { ret = VDP_STATUS_ERROR; @@ -128,15 +109,6 @@ vlVdpDecoderCreate(VdpDevice device, return VDP_STATUS_OK; error_handle: -error_create_buffers: - - for (i = 0; i < vldecoder->num_buffers; ++i) - if (vldecoder->buffers[i]) - vldecoder->decoder->destroy_buffer(vldecoder->decoder, vldecoder->buffers[i]); - - FREE(vldecoder->buffers); - -error_alloc_buffers: vldecoder->decoder->destroy(vldecoder->decoder); @@ -152,7 +124,6 @@ VdpStatus vlVdpDecoderDestroy(VdpDecoder decoder) { vlVdpDecoder *vldecoder; - unsigned i; VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying decoder\n"); @@ -160,12 +131,6 @@ vlVdpDecoderDestroy(VdpDecoder decoder) if (!vldecoder) return VDP_STATUS_INVALID_HANDLE; - for (i = 0; i < vldecoder->num_buffers; ++i) - if (vldecoder->buffers[i]) - vldecoder->decoder->destroy_buffer(vldecoder->decoder, vldecoder->buffers[i]); - - FREE(vldecoder->buffers); - vldecoder->decoder->destroy(vldecoder->decoder); FREE(vldecoder); @@ -413,10 +378,6 @@ vlVdpDecoderRender(VdpDecoder decoder, // TODO: Recreate decoder with correct chroma return VDP_STATUS_INVALID_CHROMA_TYPE; - ++vldecoder->cur_buffer; - vldecoder->cur_buffer %= vldecoder->num_buffers; - - dec->set_decode_buffer(dec, vldecoder->buffers[vldecoder->cur_buffer]); dec->set_decode_target(dec, vlsurf->video_buffer); switch (u_reduce_video_profile(dec->profile)) { diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index 84c5b82cacb..1bbbaa9fbea 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -335,9 +335,6 @@ typedef struct { vlVdpDevice *device; struct pipe_video_decoder *decoder; - unsigned num_buffers; - void **buffers; - unsigned cur_buffer; } vlVdpDecoder; typedef uint32_t vlHandle; diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c index 848da408c04..b11f10fe402 100644 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -250,7 +250,8 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, ProfileToPipe(mc_type), (mc_type & XVMC_IDCT) ? PIPE_VIDEO_ENTRYPOINT_IDCT : PIPE_VIDEO_ENTRYPOINT_MC, FormatToPipe(chroma_format), - width, height, 2 + width, height, 2, + true ); if (!context_priv->decoder) { diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index bb7ba1e1ed2..b4447c44609 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -114,8 +114,6 @@ SetDecoderStatus(XvMCSurfacePrivate *surface) context_priv = surface->context->privData; decoder = context_priv->decoder; - if (surface->decode_buffer) - decoder->set_decode_buffer(decoder, surface->decode_buffer); decoder->set_decode_target(decoder, surface->video_buffer); for (i = 0; i < 2; ++i) { @@ -186,8 +184,6 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac if (!surface_priv) return BadAlloc; - if (context_priv->decoder->create_buffer) - surface_priv->decode_buffer = context_priv->decoder->create_buffer(context_priv->decoder); surface_priv->video_buffer = pipe->create_video_buffer ( pipe, PIPE_FORMAT_NV12, context_priv->decoder->chroma_format, @@ -504,8 +500,6 @@ Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface) SetDecoderStatus(surface_priv); context_priv->decoder->end_frame(context_priv->decoder); } - if (surface_priv->decode_buffer) - context_priv->decoder->destroy_buffer(context_priv->decoder, surface_priv->decode_buffer); surface_priv->video_buffer->destroy(surface_priv->video_buffer); FREE(surface_priv); surface->privData = NULL; diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h index 5656c65dc59..daddba5fe54 100644 --- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h +++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h @@ -71,7 +71,6 @@ typedef struct typedef struct { - void *decode_buffer; struct pipe_video_buffer *video_buffer; /* nonzero if this picture is already being decoded */ -- cgit v1.2.3