From patchwork Sun Jan 8 18:14:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 2116 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp6754201vsb; Sun, 8 Jan 2017 10:14:35 -0800 (PST) X-Received: by 10.28.37.70 with SMTP id l67mr2837734wml.128.1483899275641; Sun, 08 Jan 2017 10:14:35 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k11si8049770wmb.125.2017.01.08.10.14.35; Sun, 08 Jan 2017 10:14:35 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20150623.gappssmtp.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CDC3168A567; Sun, 8 Jan 2017 20:14:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 60E1D689749 for ; Sun, 8 Jan 2017 20:14:20 +0200 (EET) Received: by mail-wm0-f49.google.com with SMTP id n129so18687836wmn.0 for ; Sun, 08 Jan 2017 10:14:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=39S/f/lUHxk/miNV0o1gqV96hqQRV/TywvS+YFKTsSk=; b=w+WI9pOekmv2gEgO5EwaWiUrRzrPm9n9cFH3T2WmjOxR9c0fwJKJH6nkISdgks73L3 FTLmz0bycXieUyEHH3rSJ+JuNOsRZ+FBV6g1k/c9ZbMr+KBUfExpesfr1WAa1rCDbqSf 9ysfLLCKAoV51zhnAwpzaS44Hk88bSOhi5yS4ZucwqkQZVVNu5tLKAm4LPg9/dWWCeKW T8fFp6baJs1LT30/2UglIyTW0XeAYO48SqcIDR1XEs28H0/YnZKh24xdQynh+/mxfSV/ rvgaB3VNACjdNAc2vN/oGIdJDZepnacfYEN4Ejn2iEQFrZcCaS+yXRpj0GjNxQfkwD+g Ce5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=39S/f/lUHxk/miNV0o1gqV96hqQRV/TywvS+YFKTsSk=; b=JoXuzflIotSA96zGvKCefkg7IHjwQHJRYe2fIPD9DdPoowKDPSKtlXnUgHSGZZgNKz NeZ0uoHhsjkO91KU1dNKcY2JTciM8pfAliL54brnuHvAcVvcvcH2ocw0nyEPXIYHQcHH t0xRQH/PFW8itnVmT6wC004Dvi2eaVuOgIOmrGmVopBoiSYPU4DDkjlYyu1aYjKcjBuD 0bCcsT08eysmcBtnglciJI7/8T+V2B/fMPXTHt++yZDbJn1sDolKwDNnbdifoKo4BOTX gJ1fXgvWC3G/F/kpV/mv6bxZc3ASzKcS+CD6b6YG2QIeRTE0MDGLLZj9c9FvC4o8138a kbkQ== X-Gm-Message-State: AIkVDXLUNGnWCk+laalvJ7Syqu19NZA0LMKodVTTHDJAJ4UDUg70WI32eMmkt71aAyYxgw== X-Received: by 10.223.161.145 with SMTP id u17mr9057160wru.89.1483899266449; Sun, 08 Jan 2017 10:14:26 -0800 (PST) Received: from [192.168.0.8] (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id vb10sm6198959wjb.28.2017.01.08.10.14.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jan 2017 10:14:25 -0800 (PST) To: FFmpeg development discussions and patches References: <320e2652-f3d9-5509-11ac-fbd84e22db6a@jkqxz.net> From: Mark Thompson Message-ID: Date: Sun, 8 Jan 2017 18:14:25 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <320e2652-f3d9-5509-11ac-fbd84e22db6a@jkqxz.net> Subject: [FFmpeg-devel] [PATCH 13/16] lavc: Remove old vaapi decode infrastructure X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Deprecates struct vaapi_context and the installed header vaapi.h, to be removed at the next version bump. (cherry picked from commit 851960f6f8cf1f946fe42fa36cf6598fac68072c) --- doc/APIchanges | 4 +++ libavcodec/Makefile | 5 ++- libavcodec/vaapi.h | 11 +++++++ libavcodec/vaapi_decode.c | 78 ++++++++++++++++++++++++++++------------------- libavcodec/vaapi_decode.h | 6 ++++ libavcodec/version.h | 5 ++- 6 files changed, 73 insertions(+), 36 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 3279563d47..33c2f33581 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2015-08-28 API changes, most recent first: +2017-01-xx - xxxxxxx - lavc 57.72.100 - vaapi.h + Deprecate struct vaapi_context and the vaapi.h installed header. + Callers should set AVCodecContext.hw_frames_ctx instead. + 2017-01-06 - xxxxxxx - lavf 57.62.100- avio.h Add avio_get_dyn_buf() diff --git a/libavcodec/Makefile b/libavcodec/Makefile index bd4b2315da..70784b74fb 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -769,7 +769,7 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcmenc.o adpcm_data.o # hardware accelerators OBJS-$(CONFIG_D3D11VA) += dxva2.o OBJS-$(CONFIG_DXVA2) += dxva2.o -OBJS-$(CONFIG_VAAPI) += vaapi.o vaapi_decode.o +OBJS-$(CONFIG_VAAPI) += vaapi_decode.o OBJS-$(CONFIG_VDA) += vda.o videotoolbox.o OBJS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.o OBJS-$(CONFIG_VDPAU) += vdpau.o @@ -1000,8 +1000,7 @@ SKIPHEADERS-$(CONFIG_QSV) += qsv.h qsv_internal.h SKIPHEADERS-$(CONFIG_QSVDEC) += qsvdec.h SKIPHEADERS-$(CONFIG_QSVENC) += qsvenc.h SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h -SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_encode.h \ - vaapi_internal.h +SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_encode.h SKIPHEADERS-$(CONFIG_VDA) += vda.h vda_vt_internal.h SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vda_vt_internal.h diff --git a/libavcodec/vaapi.h b/libavcodec/vaapi.h index 7a29f6f881..ab6110ba9c 100644 --- a/libavcodec/vaapi.h +++ b/libavcodec/vaapi.h @@ -34,6 +34,12 @@ #include "libavutil/attributes.h" #include "version.h" +#include "libavutil/attributes.h" + +#include "version.h" + +#if FF_API_STRUCT_VAAPI_CONTEXT + /** * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding * @ingroup lavc_codec_hwaccel @@ -48,7 +54,10 @@ * during initialization or through each AVCodecContext.get_buffer() * function call. In any case, they must be valid prior to calling * decoding functions. + * + * Deprecated: use AVCodecContext.hw_frames_ctx instead. */ +attribute_deprecated struct vaapi_context { /** * Window system dependent data @@ -186,4 +195,6 @@ struct vaapi_context { /* @} */ +#endif /* FF_API_STRUCT_VAAPI_CONTEXT */ + #endif /* AVCODEC_VAAPI_H */ diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 878e8ed3d1..da9e4aedde 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -427,6 +427,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) ctx->va_config = VA_INVALID_ID; ctx->va_context = VA_INVALID_ID; +#if FF_API_STRUCT_VAAPI_CONTEXT if (avctx->hwaccel_context) { av_log(avctx, AV_LOG_WARNING, "Using deprecated struct " "vaapi_context in decode.\n"); @@ -453,7 +454,9 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) ctx->hwctx->driver_quirks = AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS; - } else if (avctx->hw_frames_ctx) { + } else +#endif + if (avctx->hw_frames_ctx) { // This structure has a shorter lifetime than the enclosing // AVCodecContext, so we inherit the references from there // and do not need to make separate ones. @@ -471,6 +474,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) goto fail; } +#if FF_API_STRUCT_VAAPI_CONTEXT if (ctx->have_old_context) { ctx->va_config = ctx->old_context->config_id; ctx->va_context = ctx->old_context->context_id; @@ -478,27 +482,31 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_DEBUG, "Using user-supplied decoder " "context: %#x/%#x.\n", ctx->va_config, ctx->va_context); } else { - err = vaapi_decode_make_config(avctx); - if (err) - goto fail; +#endif - vas = vaCreateContext(ctx->hwctx->display, ctx->va_config, - avctx->coded_width, avctx->coded_height, - VA_PROGRESSIVE, - ctx->hwfc->surface_ids, - ctx->hwfc->nb_surfaces, - &ctx->va_context); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to create decode " - "context: %d (%s).\n", vas, vaErrorStr(vas)); - err = AVERROR(EIO); - goto fail; - } + err = vaapi_decode_make_config(avctx); + if (err) + goto fail; - av_log(avctx, AV_LOG_DEBUG, "Decode context initialised: " - "%#x/%#x.\n", ctx->va_config, ctx->va_context); + vas = vaCreateContext(ctx->hwctx->display, ctx->va_config, + avctx->coded_width, avctx->coded_height, + VA_PROGRESSIVE, + ctx->hwfc->surface_ids, + ctx->hwfc->nb_surfaces, + &ctx->va_context); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to create decode " + "context: %d (%s).\n", vas, vaErrorStr(vas)); + err = AVERROR(EIO); + goto fail; } + av_log(avctx, AV_LOG_DEBUG, "Decode context initialised: " + "%#x/%#x.\n", ctx->va_config, ctx->va_context); +#if FF_API_STRUCT_VAAPI_CONTEXT + } +#endif + return 0; fail: @@ -511,26 +519,32 @@ int ff_vaapi_decode_uninit(AVCodecContext *avctx) VAAPIDecodeContext *ctx = avctx->internal->hwaccel_priv_data; VAStatus vas; +#if FF_API_STRUCT_VAAPI_CONTEXT if (ctx->have_old_context) { av_buffer_unref(&ctx->device_ref); } else { - if (ctx->va_context != VA_INVALID_ID) { - vas = vaDestroyContext(ctx->hwctx->display, ctx->va_context); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to destroy decode " - "context %#x: %d (%s).\n", - ctx->va_context, vas, vaErrorStr(vas)); - } +#endif + + if (ctx->va_context != VA_INVALID_ID) { + vas = vaDestroyContext(ctx->hwctx->display, ctx->va_context); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to destroy decode " + "context %#x: %d (%s).\n", + ctx->va_context, vas, vaErrorStr(vas)); } - if (ctx->va_config != VA_INVALID_ID) { - vas = vaDestroyConfig(ctx->hwctx->display, ctx->va_config); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to destroy decode " - "configuration %#x: %d (%s).\n", - ctx->va_config, vas, vaErrorStr(vas)); - } + } + if (ctx->va_config != VA_INVALID_ID) { + vas = vaDestroyConfig(ctx->hwctx->display, ctx->va_config); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to destroy decode " + "configuration %#x: %d (%s).\n", + ctx->va_config, vas, vaErrorStr(vas)); } } +#if FF_API_STRUCT_VAAPI_CONTEXT + } +#endif + return 0; } diff --git a/libavcodec/vaapi_decode.h b/libavcodec/vaapi_decode.h index f1caa54eca..5ac3069ef3 100644 --- a/libavcodec/vaapi_decode.h +++ b/libavcodec/vaapi_decode.h @@ -26,7 +26,11 @@ #include "libavutil/hwcontext_vaapi.h" #include "avcodec.h" + +#include "version.h" +#if FF_API_STRUCT_VAAPI_CONTEXT #include "vaapi.h" +#endif static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic) { @@ -54,9 +58,11 @@ typedef struct VAAPIDecodeContext { VAConfigID va_config; VAContextID va_context; +#if FF_API_STRUCT_VAAPI_CONTEXT int have_old_context; struct vaapi_context *old_context; AVBufferRef *device_ref; +#endif AVHWDeviceContext *device; AVVAAPIDeviceContext *hwctx; diff --git a/libavcodec/version.h b/libavcodec/version.h index c5a8f55897..5008d50bae 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 71 +#define LIBAVCODEC_VERSION_MINOR 72 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -226,5 +226,8 @@ #ifndef FF_API_NVENC_OLD_NAME #define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_STRUCT_VAAPI_CONTEXT +#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */