From patchwork Tue Jul 23 01:27:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 50700 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp2345049vqm; Mon, 22 Jul 2024 18:31:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXOU4bF3ZM93vl8urXbUDapgN5gGmLIpETTxxD+WBCJmiIrDJYjmHgPfocalx4VgDY5NN0Oyb7DfGhpk7v0l7WazB1OUJtOQEvGnw== X-Google-Smtp-Source: AGHT+IH08FrWPT7eo2SOSaf9XKSEAAqHg2Ep68P+nLyU5x8JrS2P2UaP0aE1L0jUrSEKts3sAa1P X-Received: by 2002:a2e:a30d:0:b0:2f0:1bb6:dbce with SMTP id 38308e7fff4ca-2f01bb6e96emr18206381fa.41.1721698311360; Mon, 22 Jul 2024 18:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721698311; cv=none; d=google.com; s=arc-20160816; b=csLiQP+wnWYV8A8nuWQnl3WdDUwm91cXG763U/8SvfVf8uqVd6JLNgwtpKxKf0hpJ5 lDLJqchrzoWwdvFlP3UAKU1hYCp/o25bqMgbQL5DJ4RuUMmH6kZPtJqHrBF2v9iTMxo3 4K1UIPiGxFH7oe5Ej5eaGa4GYgMXkgBHV1doyGJ10ripmJ/Fyrbz1YKxrUroSRpa1eP1 1uEyuRQ/TP9Wn12fywHYzCNBf+TzYo5JxVQ/vFsUd7F3R9D1PgBqgStgMJBOAko4pCKr so1vBN/x7XPRe8PzdSKuBDIp7WSdBKdQAswOzoCnVWQtOJv+CwfnINhUQUN0izr1A/Wx 2EGA== 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:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=My8XVLO7NmhtCUWzv46S7ES5UUu1IRX0/4OwCKhVv+M=; fh=i4ESP4ZRFDcfYfwXKWpOXjc2YhmIGuOsCfZUnwNO0gc=; b=H56CVfmj6ePSITOmyo3gjNPcLzPQGJZEy5Xz8qHbqnMgvd4sFC9ACUFOOYCnpiZLm8 bAaFelKmqZh7WscPyaWwOEmtSFyZMCU1lZtkwc/NEwMcSDfBPopVyzuHxqcQ/7Vc13i6 +yzI5BhLJVUU/bpUmnBACmAuQqO8TmQZvE/f7gNi1E/rf6fZIyIo3H7aVNGSGcIHRjv3 KdeHzUsw8mtY3jRL1qzazNHnE51qgXewS6e+YoGWpXGD/Wn8TVeL3xZgcgKBcS4wI44J n1cohb47dsjj4CY6Qy9MT6BgbN1uShLbEENFMl5WmSS4cNJ++wpgbH668Aw9RnhZfAV2 pDnA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=CRfgcGeh; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2ef1baf886asi15887681fa.312.2024.07.22.18.31.50; Mon, 22 Jul 2024 18:31:51 -0700 (PDT) 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=@intel.com header.s=Intel header.b=CRfgcGeh; 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 D5EEA68D4AF; Tue, 23 Jul 2024 04:24:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E3BF768D00E for ; Tue, 23 Jul 2024 04:24:43 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721697889; x=1753233889; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=00YHethxOkxDuTmWguFfV4nTjf/6YYh3oIWt/XuCNrI=; b=CRfgcGeh5XuzLJ5L7/eC3xNl5WoTpMF52OeFqoRjEtKbKioRIAHGnQIp tggLm/S0Mzf4G5oIq2kPYQnnIM88CyjjTEj9BAJG9EL8Ozy2x5IhLOdau Rwp9noSNNOrV98kjffhqBHhCLfo7nlD8MkOAiMXpO+ubvD5LDrzCRt3Go MgulPhq5N8EVBzj2kRw3VCEItsEzmAqFUl16NoS1uoNTJkxYzRZML1mtv OYwtCItt8F0HPDzArzg83guBXDb0cNXT5leUGId1e6fz0UPTp+fOqt7FC hYwIOP8OOb9JGyZXTx/lhRDtL36BaX0l0PNMIVriHFFUaJY/B1t78/PMR A==; X-CSE-ConnectionGUID: ri1rOBQ3Sziaj8GFYj0jMA== X-CSE-MsgGUID: KZ4h22MFTIOo/mnEb+WFYg== X-IronPort-AV: E=McAfee;i="6700,10204,11141"; a="19424703" X-IronPort-AV: E=Sophos;i="6.09,229,1716274800"; d="scan'208";a="19424703" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 18:24:41 -0700 X-CSE-ConnectionGUID: QSPtHY5mSReUsL+l56whjA== X-CSE-MsgGUID: vIXyaZZTRRy5SJQRx4t4uw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,229,1716274800"; d="scan'208";a="51769482" Received: from feiwan1-desk3.sh.intel.com ([10.238.208.39]) by fmviesa007.fm.intel.com with ESMTP; 22 Jul 2024 18:24:40 -0700 From: fei.w.wang-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Jul 2024 09:27:02 +0800 Message-Id: <20240723012702.1111362-1-fei.w.wang@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: Derive bind flag from frame type if no valid surface 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: fei.w.wang@intel.com Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wZREuEwyVv6M From: Fei Wang Fix cmd: ffmpeg.exe -init_hw_device d3d11va=d3d -init_hw_device qsv=qsv@d3d \ -filter_hw_device d3d -hwaccel qsv -hwaccel_output_format qsv \ -i in.h264 -vf "hwmap,format=d3d11,hwdownload,format=nv12" -y out.yuv Signed-off-by: Fei Wang Signed-off-by: Fei Wang > --- libavutil/hwcontext_qsv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 7cec347478..09156275ec 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -1549,8 +1549,11 @@ static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx, dst_hwctx->texture_infos[i].texture = (ID3D11Texture2D*)pair->first; dst_hwctx->texture_infos[i].index = pair->second == (mfxMemId)MFX_INFINITE ? (intptr_t)0 : (intptr_t)pair->second; } - ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture, &texDesc); - dst_hwctx->BindFlags = texDesc.BindFlags; + if (src_hwctx->nb_surfaces) { + ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture, &texDesc); + dst_hwctx->BindFlags = texDesc.BindFlags; + } else + dst_hwctx->BindFlags = qsv_get_d3d11va_bind_flags(src_hwctx->frame_type); } break; #endif