From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 1853E4D0B4 for ; Fri, 30 May 2025 13:59:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 71D3568DCDF; Fri, 30 May 2025 16:58:39 +0300 (EEST) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 0314568DCAA for ; Fri, 30 May 2025 16:58:31 +0300 (EEST) Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-ac34257295dso372420266b.2 for ; Fri, 30 May 2025 06:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748613511; x=1749218311; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gh7d9+FqcDDwUtKCFl/PEyN1DlLz8Ov90hSj2VBKXz0=; b=NVEHngSZmLtkpFTam9yAqbwOBycndvb9LAEpePhJ9OtGGaj6A/DIayPXYl/AAeBJeT LzOoMFPM6PfmzB/seqbIc0BjtCg9I9LqOqO2E+/EjN+WrEFkFapsFzUE8y0cNtaTsJSa WayUuUzMo9TqXloaPwjTTYKPmpRFSVLxGOqssyIp3fP+rQ9or13o6oaL/hVzuLQ/gn3U RTq3CbnU1cQ3Ao+MKca7g6QGy7ydUZc/s9LXkmGQcgNaQZE5nFmcsfmgnLnIZSIHlKNw lKUS+vK9Nd7Y9jwprrvf7G4xSeadg1ds9oYukCphCf+nUABs2tAjXG1lnE2kkSC50Rgd Evew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748613511; x=1749218311; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gh7d9+FqcDDwUtKCFl/PEyN1DlLz8Ov90hSj2VBKXz0=; b=m3ZqKnj4afytJciP3pWzJNxR4ONfjHix5YX5HxnCoKCV8OOsaHYhZzNuu/ZPObQo+K QSLZfoOE14G0+7A3mnSfikqGQIQNKRwzVaExxiFJLKc1RqRce8w2qzigQ1T5PHIHv/W7 +oJy9sSikzlyOn4/PGp4/Qba3yXI3tLb7eJJfEbs0WxJwgVo0ZF9R7CRwKZN70DOCxAH EnuYKo2TzFby54iMG2UxanNRvsrWVY+SiawSPeBNcNMQ84uel1BYx5c+dAQC2Ql8e+gU +3xjw5iLZoksk7bqalI5zzHgTgVMITjc4Ty061Ca+oK8EukJgejxv92Mk8Ajujopiz81 60sA== X-Gm-Message-State: AOJu0Yw8j2uN9UHkjJdR5YepWTTbxxOtkNOnWzakNPgekMwyrd8ybu44 BTX6OsOittwgvMn9/9k9oz+KPYr0J9OrlyOSucdf+PVcfJ28Mgbicw1h07lioA9nnqc= X-Gm-Gg: ASbGnct3yCcp7OzrG8HTRvvL8VpFr6Vvw+P4MwNwO8D32eqWYxQ14WA7BiCud+p3kmz QTDXbxsjHigt4PdE5tsZcEelb+VBGcigsJ7735ZMu8fhu5IUnY3QGMaOe0vqZ7+j5IIIG6q4SqZ vy1OFKwhm7Cw5n46gmaeemm2GVpSU6eetBKMHyHLHZFAFN0ktXHJFJ0CjQdg63bUgLzKjzHCMgC Lb/9WqX+6IU9XDetXmkQ+GWwGZr1cpD20wgmNkaaFUf3oUw4GF7d63X1U2rT2QJwrrltZ/BXgLL K7woWBGIBaiaI1FdITESPg1YF0/RXG/8FQNVKQD18bSshy63Y31ZmirkyOybDfoBn+xN61cb7I8 lcjDLamjvXuNY X-Google-Smtp-Source: AGHT+IGEKVQtDrGq+xpLXt8Eyu6e3INzrLoJVKcnmSbnEvgLJLL35c12+suO9qTnCvm2LJshwWZCBA== X-Received: by 2002:a17:907:7f04:b0:ad8:9dba:fb35 with SMTP id a640c23a62f3a-adb32583a44mr339286266b.40.1748613510427; Fri, 30 May 2025 06:58:30 -0700 (PDT) Received: from localhost.localdomain ([87.116.182.236]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ada5d7ff08bsm332972066b.17.2025.05.30.06.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 May 2025 06:58:29 -0700 (PDT) From: Dmitrii Ovchinnikov To: ffmpeg-devel@ffmpeg.org Date: Fri, 30 May 2025 15:58:14 +0200 Message-ID: <20250530135814.656-3-ovchinnikov.dmitrii@gmail.com> X-Mailer: git-send-email 2.47.1.windows.1 In-Reply-To: <20250530135814.656-1-ovchinnikov.dmitrii@gmail.com> References: <20250530135814.656-1-ovchinnikov.dmitrii@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avutil/hwcontext_amf: fix error logging on amf_init_from_device. 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: Dmitrii Ovchinnikov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- libavutil/hwcontext_amf.c | 40 ++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/libavutil/hwcontext_amf.c b/libavutil/hwcontext_amf.c index 7903109445..a020b0e2e1 100644 --- a/libavutil/hwcontext_amf.c +++ b/libavutil/hwcontext_amf.c @@ -505,8 +505,9 @@ static int amf_device_create(AVHWDeviceContext *device_ctx, } #if CONFIG_DXVA2 -static int amf_init_from_dxva2_device(AVAMFDeviceContext * amf_ctx, AVDXVA2DeviceContext *hwctx) +static int amf_init_from_dxva2_device(AVAMFDeviceContext * amf_ctx, AVHWDeviceContext *child_device_ctx) { + AVDXVA2DeviceContext *hwctx = child_device_ctx->hwctx; IDirect3DDevice9 *device; HANDLE device_handle; HRESULT hr; @@ -515,7 +516,7 @@ static int amf_init_from_dxva2_device(AVAMFDeviceContext * amf_ctx, AVDXVA2Devic hr = IDirect3DDeviceManager9_OpenDeviceHandle(hwctx->devmgr, &device_handle); if (FAILED(hr)) { - av_log(hwctx, AV_LOG_ERROR, "Failed to open device handle for Direct3D9 device: %lx.\n", (unsigned long)hr); + av_log(child_device_ctx, AV_LOG_ERROR, "Failed to open device handle for Direct3D9 device: %lx.\n", (unsigned long)hr); return AVERROR_EXTERNAL; } @@ -524,7 +525,7 @@ static int amf_init_from_dxva2_device(AVAMFDeviceContext * amf_ctx, AVDXVA2Devic IDirect3DDeviceManager9_UnlockDevice(hwctx->devmgr, device_handle, FALSE); ret = 0; } else { - av_log(hwctx, AV_LOG_ERROR, "Failed to lock device handle for Direct3D9 device: %lx.\n", (unsigned long)hr); + av_log(child_device_ctx, AV_LOG_ERROR, "Failed to lock device handle for Direct3D9 device: %lx.\n", (unsigned long)hr); ret = AVERROR_EXTERNAL; } @@ -540,49 +541,53 @@ static int amf_init_from_dxva2_device(AVAMFDeviceContext * amf_ctx, AVDXVA2Devic if (res != AMF_OK && res != AMF_ALREADY_INITIALIZED) { if (res == AMF_NOT_SUPPORTED) - av_log(hwctx, AV_LOG_ERROR, "AMF via D3D9 is not supported on the given device.\n"); + av_log(child_device_ctx, AV_LOG_ERROR, "AMF via D3D9 is not supported on the given device.\n"); else - av_log(hwctx, AV_LOG_ERROR, "AMF failed to initialise on given D3D9 device: %d.\n", res); + av_log(child_device_ctx, AV_LOG_ERROR, "AMF failed to initialise on given D3D9 device: %d.\n", res); return AVERROR(ENODEV); } + av_log(child_device_ctx, AV_LOG_INFO, "AMF via DXVA2.\n"); return 0; } #endif #if CONFIG_D3D11VA -static int amf_init_from_d3d11_device(AVAMFDeviceContext* amf_ctx, AVD3D11VADeviceContext *hwctx) +static int amf_init_from_d3d11_device(AVAMFDeviceContext* amf_ctx, AVHWDeviceContext *child_device_ctx) { AMF_RESULT res; + AVD3D11VADeviceContext *hwctx = child_device_ctx->hwctx; res = amf_ctx->context->pVtbl->InitDX11(amf_ctx->context, hwctx->device, AMF_DX11_1); if (res != AMF_OK && res != AMF_ALREADY_INITIALIZED) { if (res == AMF_NOT_SUPPORTED) - av_log(hwctx, AV_LOG_ERROR, "AMF via D3D11 is not supported on the given device.\n"); + av_log(child_device_ctx, AV_LOG_ERROR, "AMF via D3D11 is not supported on the given device.\n"); else - av_log(hwctx, AV_LOG_ERROR, "AMF failed to initialise on the given D3D11 device: %d.\n", res); + av_log(child_device_ctx, AV_LOG_ERROR, "AMF failed to initialise on the given D3D11 device: %d.\n", res); return AVERROR(ENODEV); } - av_log(hwctx, AV_LOG_ERROR, "AMF via D3D11"); + av_log(child_device_ctx, AV_LOG_INFO, "AMF via D3D11.\n"); return 0; } #endif #if CONFIG_D3D12VA -static int amf_init_from_d3d12_device(AVAMFDeviceContext* amf_ctx, AVD3D12VADeviceContext *hwctx) +static int amf_init_from_d3d12_device(AVAMFDeviceContext* amf_ctx, AVHWDeviceContext *child_device_ctx) { + AVD3D12VADeviceContext *hwctx = child_device_ctx->hwctx; AMF_RESULT res; AMFContext2 *context2 = NULL; AMFGuid guid = IID_AMFContext2(); res = amf_ctx->context->pVtbl->QueryInterface(amf_ctx->context, &guid, (void**)&context2); - AMF_RETURN_IF_FALSE(hwctx, res == AMF_OK, AVERROR_UNKNOWN, "CreateContext2() failed with error %d\n", res); + AMF_RETURN_IF_FALSE(child_device_ctx, res == AMF_OK, AVERROR_UNKNOWN, "CreateContext2() failed with error %d\n", res); res = context2->pVtbl->InitDX12(context2, hwctx->device, AMF_DX12); context2->pVtbl->Release(context2); if (res != AMF_OK && res != AMF_ALREADY_INITIALIZED) { if (res == AMF_NOT_SUPPORTED) - av_log(hwctx, AV_LOG_ERROR, "AMF via D3D12 is not supported on the given device.\n"); + av_log(child_device_ctx, AV_LOG_ERROR, "AMF via D3D12 is not supported on the given device.\n"); else - av_log(hwctx, AV_LOG_ERROR, "AMF failed to initialise on the given D3D12 device: %d.\n", res); + av_log(child_device_ctx, AV_LOG_ERROR, "AMF failed to initialise on the given D3D12 device: %d.\n", res); return AVERROR(ENODEV); } + av_log(child_device_ctx, AV_LOG_INFO, "AMF via D3D12.\n"); return 0; } #endif @@ -605,23 +610,20 @@ static int amf_device_derive(AVHWDeviceContext *device_ctx, #if CONFIG_DXVA2 case AV_HWDEVICE_TYPE_DXVA2: { - AVDXVA2DeviceContext *child_device_hwctx = child_device_ctx->hwctx; - return amf_init_from_dxva2_device(amf_ctx, child_device_hwctx); + return amf_init_from_dxva2_device(amf_ctx, child_device_ctx); } break; #endif #if CONFIG_D3D11VA case AV_HWDEVICE_TYPE_D3D11VA: { - AVD3D11VADeviceContext *child_device_hwctx = child_device_ctx->hwctx; - return amf_init_from_d3d11_device(amf_ctx, child_device_hwctx); + return amf_init_from_d3d11_device(amf_ctx, child_device_ctx); } break; #endif #if CONFIG_D3D12VA case AV_HWDEVICE_TYPE_D3D12VA: { - AVD3D12VADeviceContext *child_device_hwctx = child_device_ctx->hwctx; - return amf_init_from_d3d12_device(amf_ctx, child_device_hwctx); + return amf_init_from_d3d12_device(amf_ctx, child_device_ctx); } break; #endif -- 2.47.1.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".