From patchwork Sat May 7 06:24:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Tong1" X-Patchwork-Id: 35621 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp2035033pzb; Fri, 6 May 2022 23:25:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGXKAkWvg/LUiw+L99C9oxs133zmcCx/GHNE9wpXKsE2KlNOCzUpoZnz2EfR0Pw6n5WCun X-Received: by 2002:a17:906:4944:b0:6e8:a48d:804e with SMTP id f4-20020a170906494400b006e8a48d804emr6256724ejt.164.1651904723886; Fri, 06 May 2022 23:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651904723; cv=none; d=google.com; s=arc-20160816; b=UbKR0kxPzpfs6olkte4qacCWkBEJkbK9Ry83IBnaAqrl+/Ozvk+uz9Ro9E23GqTkPY a/oC1qj6FkjAXhjkEw8hwqYuSGwt17DEgEhXN+fwSvuC5j21ZOeyx+ewc1Qsf7w5sX6P byf2G6R9+YeYZBSAz05RZSaU84qK0rwe6URh1TGpIHEyKkshxSc041I0+79XdLPCe8FU CmyGgdNdQLZPEr9FuDDWrBgUrjaMoc2qrCcY2ido8DXZLyTkN70LwqLCQpnS+uzXdkDr 4RaievRIU0NZsBTYo6qV9WPHqo1qJauezNCnk0lOm5P5+a2zFVrdfsX2qMH6Xfw95DLe XH/Q== 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=PfZFMVcK2KEcdmKa5lOsYPy2Refw3T/1/JSqQzrSk3N53QVo9b7fNkEORluxTOqAiL 3gKMWqsIGzMi8D687TtRtZk+4efSiWmbDMf17ljNGLYikmO8XsvO7wkYtHpNB/9Ze4o+ 9CtDrXK8DMX2JJaWpKwGmJhayJeyfZIoTPtFIUF9VZH+4weaEyENwnaStvY4x8Uee49s LrtYy8zG7VF5LuuVu0FudOQBTp5Y6YwNe8SlRHy1KANoDTagVoqRpsOXIz0LVVhPgqTe XuOhD+7RC9X8bgdSwb87kM9yIwplTJDRTJMqFL1+mXlUQaR4Fx1dT1PQ5ZERvGOtIdO9 lxdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=Pt9funt6; 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 jx15-20020a170906ca4f00b006e87cd34739si6058448ejb.103.2022.05.06.23.25.23; Fri, 06 May 2022 23:25:23 -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=Pt9funt6; 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 4ABE368B373; Sat, 7 May 2022 09:25:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EB33E68B104 for ; Sat, 7 May 2022 09:25:06 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651904712; x=1683440712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fvpof9+HfrCqRgzsbIqhU0SdoG0zrYEEwBILZu8iV3E=; b=Pt9funt6O9RtUQfkvbdMOitci8ePuGoLb4mOW5eXlGdzQZyNFst7rEuy tzDyskgm9Ax93CkgAnnEe11IyMcSUcHwF0N25AWEF0hX4uLz3FqQa61ZK YDuTEibT9DBMLKFKLB5hv8wb0mZQpz7eeSgxG22f11Ah/ebfzo/JQro8K dHcIfup7+Rl+tcv8pFTM5VU5pVF2d1TYU2wkGJc+VEQBUKQD0b/4TCRLo mcAd7ARIze0nIRiZplGemsE6xks+JWNpiLS1yMio43eMeorzVdZWByNhD A6bqURpXnIiQgMkFhx4rJVLHnuGTiCCknUXgt2rj5njcF1xohhyWUsrD1 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="268557751" X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="268557751" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 23:24:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="586385472" Received: from gtapc.iind.intel.com (HELO localhost.localdomain) ([10.190.234.85]) by orsmga008.jf.intel.com with ESMTP; 06 May 2022 23:24:57 -0700 From: Tong Wu To: ffmpeg-devel@ffmpeg.org Date: Sat, 7 May 2022 06:24:40 +0000 Message-Id: <20220507062441.779-2-tong1.wu@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220507062441.779-1-tong1.wu@intel.com> References: <20220507062441.779-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 2/3] 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: +qvUf8rCpVOI 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; }