From patchwork Thu May 5 10:53:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Tong1" X-Patchwork-Id: 35602 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp989567pzb; Thu, 5 May 2022 03:54:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQICak77cn3/RL8ZXs1hWbx75zyA6MwBYmNS2YUtd/42wI84mwFmQrsWy3ZEObiRLBy+P5 X-Received: by 2002:a17:907:6e10:b0:6f4:7e59:fed5 with SMTP id sd16-20020a1709076e1000b006f47e59fed5mr14350796ejc.480.1651748044965; Thu, 05 May 2022 03:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651748044; cv=none; d=google.com; s=arc-20160816; b=qS3dHquB07ZrIh+CFRkvUal641LMFQcKmfZywEvU9EDNT9qW/BTU1LijDJYLnPsTEh NJh+L8/f9Jge5Zzwux50RqQANa1LLHTqg5Y39DOo/xinfYfiDWv5Td8bcRycTKkbc1QF LDza3BSsk/hAUdC4NHdv0gyfEv1BrnZ0eC7HXciNNCSKMyokV1eKq16FEQbD/5VEuYcD epmig6Lasgn/EMHpHaV0HOahUraqsarWkayviZ8L1g/yPY4Am2NW4ufCjI9lGrYkBZMZ zM50pODIVNvHHRUgbtarnFVd7x6+a1jCgdxs6uGCYMdPsToAy7fmT2BFE/DMtNt9KK0/ MMqw== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=Nv0Wo2n06Rt1KaVAbnsbrVKbWnrklswBCLYUpcwhWmM=; b=A8MxQvzY7xHpyGen+HChJ5oPgYnay+VWjTDA33McQP0WTwREyNb2FP+6bmVkvxUTLN cYWdTqXwDn3n36NsRrR5JbRQGorUXXmZwlcuiXsSB5zd2EQ1ATwGmfDgHP7tKRTZFKLA eQu46yR9pVjiBSaaRB0wc4DFwXQWekQF0Bu3hg6C4FnLprXYCtSCMIJI1ohJJhW8gp/L /LFCMrU+yX78fIex9Q/BVoLK6MAur5vcGUu/X/AnYNqoFdKjhLsv08v5viDJgnazz84C rS0NyCimbPdgtuUfRxO3aKWJ0fYgb0hT1vsTBQHO6L3jqivySPACBdaBUP9a+VCW7zQc 5XbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=cOqUqhOO; 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 qc17-20020a170906d8b100b006eff1696032si1835838ejb.14.2022.05.05.03.54.04; Thu, 05 May 2022 03:54:04 -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=cOqUqhOO; 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 984B068B391; Thu, 5 May 2022 13:53:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1AD0968B391 for ; Thu, 5 May 2022 13:53:39 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651748025; x=1683284025; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fvpof9+HfrCqRgzsbIqhU0SdoG0zrYEEwBILZu8iV3E=; b=cOqUqhOO08I/ho2QseraQ2ZRGilmeTH2p14iGZZSsk+4ITJbM+BTnZAj pyf6xsowUGTKtmpDb9uM/ggtMP0f62GjYMYaduJpqhrUKdx6n0pEJ230j NGU48aFWEhhdNLfHHMyWWb94oYooNKkZbvCeLRe+wvxf88Zv59smIF/bF m9LuZkcfv+xL25HcnHiwnyltR6ulkbB21KdNVU7GZmqI/5Dl8iarmgn0z 7DwReEJtt8T2LaZ84PUbQQfYnI8yXC6YmEBkTM97rpavYVMTD7eXzzplg uV5LhkG9JaqdpbYVmAgwaUPcqzrh4EGAxZ3RVbSOK0MqfdBoC0BkSJlCU Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10337"; a="328612317" X-IronPort-AV: E=Sophos;i="5.91,201,1647327600"; d="scan'208";a="328612317" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 03:53:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,201,1647327600"; d="scan'208";a="563187284" Received: from gtapc.iind.intel.com (HELO localhost.localdomain) ([10.190.234.85]) by orsmga007.jf.intel.com with ESMTP; 05 May 2022 03:53:28 -0700 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 May 2022 10:53:16 +0000 Message-Id: <20220505105318.716-2-tong1.wu@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220505105318.716-1-tong1.wu@intel.com> References: <20220505105318.716-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/4] avutil/hwcontext_d3d11va: pass the format value from outside for staging texture 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: Tong Wu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qm62Z/U2oiPm In d3d11va_create_staging_texture(), during the hwmap process, the ctx->internal->priv is not initialized, resulting in the texDesc.Format not initialized. Now pass the format value from d3d11va_transfer_data() to fix it. $ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \ -init_hw_device qsv=qsv@d3d11 -c:v h264_qsv \ -i input.h264 -vf "hwmap=derive_device=d3d11va,format=d3d11,hwdownload,format=nv12" \ -f null - Signed-off-by: Tong Wu --- libavutil/hwcontext_d3d11va.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 2b4e24bb56..bb4e9d6965 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -346,7 +346,7 @@ static int d3d11va_transfer_get_formats(AVHWFramesContext *ctx, return 0; } -static int d3d11va_create_staging_texture(AVHWFramesContext *ctx) +static int d3d11va_create_staging_texture(AVHWFramesContext *ctx, DXGI_FORMAT format) { AVD3D11VADeviceContext *device_hwctx = ctx->device_ctx->hwctx; D3D11VAFramesContext *s = ctx->internal->priv; @@ -355,7 +355,7 @@ static int d3d11va_create_staging_texture(AVHWFramesContext *ctx) .Width = ctx->width, .Height = ctx->height, .MipLevels = 1, - .Format = s->format, + .Format = format, .SampleDesc = { .Count = 1 }, .ArraySize = 1, .Usage = D3D11_USAGE_STAGING, @@ -411,7 +411,8 @@ static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, device_hwctx->lock(device_hwctx->lock_ctx); if (!s->staging_texture) { - int res = d3d11va_create_staging_texture(ctx); + ID3D11Texture2D_GetDesc((ID3D11Texture2D *)texture, &desc); + int res = d3d11va_create_staging_texture(ctx, desc.Format); if (res < 0) return res; }