From patchwork Sun Jan 2 03:41:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 33003 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp15150204iog; Sat, 1 Jan 2022 19:42:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2rl+ljW5GkdlInOe0TyHqmgAN8BKTkvmw2vJcHbLvGDv3hpxN2KzCGqds8u4jcNYEF5RE X-Received: by 2002:a17:906:1db2:: with SMTP id u18mr32086361ejh.729.1641094923492; Sat, 01 Jan 2022 19:42:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641094923; cv=none; d=google.com; s=arc-20160816; b=SZWvWxzyWoaT/6ARMi0m4NacVgBpZ2y7TIyf5hzn+S6LGaCR7ljUEGmG90vXrRp3U2 rLVT6Gz2+nzrb5wGk9C4pYo3DomB1qrug/I9CO4VYLYiuCMNGpkl6Cx2hFaS4EBzSS1t pGCL83Iq0iMVr+m3KpVALZI1HFazE+qM7b/ISaBpmoTVeB01WEg0iqGYl8AVSPKNjoG1 DGU1p6c3tWxRoC4nWJefYWhBLVh/eA206jC50ptFcKI6HklSuNhn9E+ZTUO5XKSJ/DjG PxaaLZpt6NWb6n42Q7IQhfSQ1kTAChtdN+FpL4WD6VmUi9+dudYjQIcHdFq0fkcEwdU5 SRHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:mime-version:fcc:date:from:references :in-reply-to:message-id:dkim-signature:delivered-to; bh=y0w7lI8iqPC2rzoDXCYo2oJXBGpdGwsV2+RUPjT/kjo=; b=K/vtcRajynr1UMnEisyenj5AaBnlfpTx96fOBncQ5+U7ZopUh6yNOjJD3yAsWrkyFO YlfiA7PLnQru3fCoiEhPNI4455VCHEFJJ3eT0aIUukgKyKRmfCbszjwfzHdVIrJE5eit Wwi2mPnNPd3N/7dBfTBBeL8z01i4nty0iFdwGYpsOsK0STXuWO1jCpN+HuvTadHMX+Ui r2Gi6U2Q25lKjhgh67hA5E+q3QglY8eaVfE7/9ywx0RUkTgbgIECyc+wislxXrObSF+9 QNvUdoGX8IprUCEXY5vZ4AExyo0OHyJdMSl8vHQTq4pwAVIUbZtRVWrZKdrEy1CYwr/j nUXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=o4CgheTO; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qw41si15852360ejc.808.2022.01.01.19.42.02; Sat, 01 Jan 2022 19:42:03 -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=@gmail.com header.s=20210112 header.b=o4CgheTO; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A144468B159; Sun, 2 Jan 2022 05:41:59 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 643B368A516 for ; Sun, 2 Jan 2022 05:41:53 +0200 (EET) Received: by mail-pl1-f176.google.com with SMTP id i6so16707711pla.0 for ; Sat, 01 Jan 2022 19:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=lfZ1vdY8aESwc/759KH8Q/lacXyb/77LBbarp91y9i8=; b=o4CgheTOG86o8YnWd5HUyUw0O+acodaCgGnLfAyI/J/xJO8FvgQaM4RuxigDQL3+P9 V6mm/TYA5moDmLi2OdiTMA0qbVpRuDJdkbe0qguTevkMhpomHcD6eEQeXSM8XC/6ywSo V+mnBeoWBJCEdCA1M06wFQvaliExSNcDGUevh9Cj2rmpCprjOA18Y9ARkhdmz1+nIc+D WKvsvtr3eqketHQbcUwlvVbhsmPIIQeoLq6DkjjQotNnY3XJBoyRFSaSv5gparUp3Mj2 4qNiZrxKsycOtAnf5XFSjrM1yeODZ2ZbYka3T7q92FmCTUqnCiX+DE1HQGQNahyiJHvO juaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=lfZ1vdY8aESwc/759KH8Q/lacXyb/77LBbarp91y9i8=; b=5TuHYUCjgL2IMMezj7jl3T32lGZ+n+dhLpgnmg4sBRrCU1qtYxar+Bbt8coqhbFoxB pnubV5Pac7W+tKMB+odsu8c/BkwgjRsGrYLVD2XM1+YpxPmimjYfwuC6ZC4X2N71t1ND plfr6te56G90K8T8ACBekB1DfqMrIWd0b74WPE5CURr2gru/SUqNAjVmmNczmLLgMBaU AidbVjkAEwzn1y6ADgmi6n1V/uQkFerv7zdeoxtdXP8OV0yJpdKIh1uU2ksb2NT4hYOg a5fVFBr4gmohFPFiJ3w8j4vyiVL+9JdI901D691BF0cJQZpzbzPveZeiksCu3r6qym8E SrWA== X-Gm-Message-State: AOAM532Q9/INwzYleeGXdzPuBEe6SVUlyLby8AyBlhfU5e1WoBGZmG21 kkn47fh++zrvKpyCWqTASV5HBYLTqRtH1C5C X-Received: by 2002:a17:902:e546:b0:149:2f0f:e460 with SMTP id n6-20020a170902e54600b001492f0fe460mr40625218plf.135.1641094911710; Sat, 01 Jan 2022 19:41:51 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id b4sm32086253pjm.17.2022.01.01.19.41.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Jan 2022 19:41:51 -0800 (PST) Message-Id: In-Reply-To: References: From: ffmpegagent Date: Sun, 02 Jan 2022 03:41:50 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2] avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: softworkz Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: QUkIgVcxeJ0n From: softworkz Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a regression in a way that scaling via vpp_qsv doesn't work any longer for devices with an MSDK runtime version lower than 1.19. This is true for older CPUs which are stuck at 1.11. The commit added checks for the compile-sdk version but it didn't test for the runtime version. Signed-off-by: softworkz --- avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) Fix a recently introduced regression when using QSV VPP. v2: Fixed commit message wrapping Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-15%2Fsoftworkz%2Fqsv_vpp_regression-v2 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-15/softworkz/qsv_vpp_regression-v2 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/15 Range-diff vs v1: 1: eea966f702 ! 1: ccede9d840 avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) @@ Metadata ## Commit message ## avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) - Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a regression in a way - that scaling via vpp_qsv didn't work any longer for devices with an MSDK runtime - version lower than 1.19. This is true for older CPUs which are stuck at 1.11. - The commit added checks for the compile-sdk version but it didn't test for the - runtime version. + Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a + regression in a way that scaling via vpp_qsv doesn't work any longer + for devices with an MSDK runtime version lower than 1.19. This is true + for older CPUs which are stuck at 1.11. + The commit added checks for the compile-sdk version but it didn't test + for the runtime version. Signed-off-by: softworkz libavfilter/vf_vpp_qsv.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) base-commit: d6b2357eddca392ee137cb2a92ff178a0a7d0cce diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index ab58a5777e..09590157e3 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -139,8 +139,9 @@ static const AVOption options[] = { { "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS }, { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS }, +#ifdef QSV_HAVE_SCALING_CONFIG { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" }, - +#endif { NULL } }; @@ -304,6 +305,7 @@ static int config_output(AVFilterLink *outlink) QSVVPPParam param = { NULL }; QSVVPPCrop crop = { 0 }; mfxExtBuffer *ext_buf[ENH_FILTERS_COUNT]; + mfxVersion mfx_version; AVFilterLink *inlink = ctx->inputs[0]; enum AVPixelFormat in_format; @@ -317,6 +319,11 @@ static int config_output(AVFilterLink *outlink) param.ext_buf = ext_buf; param.async_depth = vpp->async_depth; + if (MFXQueryVersion(vpp->qsv->session, &mfx_version) < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to query mfx version.\n"); + return AVERROR(EINVAL); + } + if (inlink->format == AV_PIX_FMT_QSV) { if (!inlink->hw_frames_ctx || !inlink->hw_frames_ctx->data) return AVERROR(EINVAL); @@ -467,19 +474,20 @@ static int config_output(AVFilterLink *outlink) #endif } - if (inlink->w != outlink->w || inlink->h != outlink->h) { #ifdef QSV_HAVE_SCALING_CONFIG - memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); - vpp->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING; - vpp->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling); - vpp->scale_conf.ScalingMode = vpp->scale_mode; - - param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; -#else - av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is " - "not supported with this MSDK version.\n"); -#endif + if (inlink->w != outlink->w || inlink->h != outlink->h) { + if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) { + memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); + vpp->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING; + vpp->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling); + vpp->scale_conf.ScalingMode = vpp->scale_mode; + + param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; + } else + av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is " + "not supported with this MSDK version.\n"); } +#endif if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise || vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||