From patchwork Mon Feb 12 00:03:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46200 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402204pzc; Sun, 11 Feb 2024 16:02:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWbZC15df3uXA34HPZhp5h3Ex2ZJAiXSvymEWgntdUff8rm21wETNu+DEteJHKQXEqsSv3I/EIP6JlLdtsO5hV+ExWTBKNagoHPbQ== X-Google-Smtp-Source: AGHT+IHTUhPrsZEJ2vjAB4LM1cxUrF6jV61S0amuJ1jR1e0kK1LrOhtPQoAINhEjL10YYvrunUAW X-Received: by 2002:adf:d1ee:0:b0:33b:649a:1a12 with SMTP id g14-20020adfd1ee000000b0033b649a1a12mr4966789wrd.55.1707696165774; Sun, 11 Feb 2024 16:02:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU/AfomarziZ1+W1TdGO58V++W3SB9LGbcgq++P9JpIt9Bj/jylJPNnbFU8F0eqj3wlfw67H5OY15I1LKi+SKJlNaI+I/7fkEoz6OKyB/iPDEyJiJgW2LJX/MK5s+F/fOE04N6m5XjrSQUSSWLbrU2vJzkgm+sgtyM4ckwowNNwzrDdRIKoqsIy+tBQKvqWF4bjHG5T3gcO59tZi+ej3UkWDcQ2JJ5T5eF2/UtPCGPOWLbfHxzjpMP7BRdT8HFbASyih9tvQI449Te/xytuqHXjlRUeD8h3QoG/CuWwhWYX1Z1utHZ/XVNRjK4GSN4cyJ6ItZaHI1tjlE/qskCHQ/BB/00WknMwXdSkkvFzeyCZw0ZufQGDcoqJTep4lacny3AAhlR34t41USV9DbimWzDkfo3ulQoBWEimHyAXR2+Q0wUuhH4n7defHWMbZ337v2CzPJSOxeYO4SNOzavonQ53B6RXY4kpX/FA8ECYe01ICnrK4DLTEz5A7wMBC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c/iks+llkHXOd3Y= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f25-20020a50a6d9000000b0055ffe74c2a9si2118569edc.570.2024.02.11.16.02.45; Sun, 11 Feb 2024 16:02:45 -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=@outlook.com header.s=selector1 header.b=N8UzTJd3; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BFCC268D13D; Mon, 12 Feb 2024 02:02:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03olkn2092.outbound.protection.outlook.com [40.92.59.92]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CA7A68D13D for ; Mon, 12 Feb 2024 02:02:33 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eECAC4yc+t/ucx+zhgsojP3/Lq3A6yJBvggjrNM22sSC4yw3VehZB6Q+PU1qoiY3PHyqGXJmyTvUpGwjG1OzePlKjxvzNHBXKaBlTxAu/C3F+fBTYfQXPDQl3sT1nMwv5Zdb3Bsl+T5XlXPCF56wYZuLJmLjOhT/hzWVBbyRMyzuC9iPtz7MZpS3RdncJmtsrN2gLN8Nm4Xcsi8t566J7WmOQLTybGT52ObPjsQze8fEYyUNHxyk9cWfHwVAY9UxX73WuZqCU/ggHKEQBGbklF6puHin2LsADzkHat1JLklT8RHH2BEuPKHe7YqBD/CE3O0oktuaoLx4ux0ahfv1YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rWYZ6cV5weuUbPBPL6687ZziGTwZr64AK9ee3wMvIEo=; b=jM7oFi0hYjI4UVudE39elqXBe2Xz5HOFeUjKyVRtwOSYo8RrECXMpTfGtkqFFZfv+cg7RVhqxhVUPwIiKBdZwQI7938Z3/bQtWx3RBTWLCnCQJ/W0R5DyH0BnAQFrOUFBbCl0m3/uyPtPRUjyRjn0S0U67kQKfhx1sXLFu/OK1NeYQ81TTrqTLaQxX2v7ksn46VB1jRJcuKQ3QZeU4CqnC6IbAtSYmj8Uif3TGExGBaW4q63aWgH5RmYdAJ0Tv7gx/GUtfTdqvjSSmK2TU0MMHdHjuDyi48m3fGARn9UrZ/bj0n7WykLiJ8pf4N5TxIs8OqxTj7aCaxzTfpQ5LWRqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rWYZ6cV5weuUbPBPL6687ZziGTwZr64AK9ee3wMvIEo=; b=N8UzTJd3sYSPmicDHnVSZWuIXGErAyhlgAV0VuVe1VhiVf/2ZiKvT7hllPDpH54kUbzFszw9M94A62MrNdH9nlnXEksD95j9yAxilUBItBuadKBaMoFIaiHj4L1EPNC6hyc5Vq1x7u+rq5KDLo6EgpC0bSQ5C5oLiPWNFQxge+oIG1m+qo/da0bVQCG5GrQgzvahAYzXK8161qJyxxB/Z8OjQEzkDljrCytbQLjLyRsAZaTnDxiloEYNaELmBWI7qUrScu22mFCyspjdmoyVlBzpfxo90H/LhM0+piy94AfV80tdd16nWgkqq02Q0RtZZt+hLKB86OnlbzLrmjD9Yw== Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) by PR3P250MB0257.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.35; Mon, 12 Feb 2024 00:02:32 +0000 Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM ([fe80::db07:87f6:7c75:38cc]) by DU0P250MB0747.EURP250.PROD.OUTLOOK.COM ([fe80::db07:87f6:7c75:38cc%3]) with mapi id 15.20.7270.036; Mon, 12 Feb 2024 00:02:32 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:20 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [nS8KUbw0HBuxw+mgSJsokBQCa760bF4lJKfR7CGLxY8=] X-ClientProxiedBy: FR3P281CA0146.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:95::18) To DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) X-Microsoft-Original-Message-ID: <20240212000335.27984-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0P250MB0747:EE_|PR3P250MB0257:EE_ X-MS-Office365-Filtering-Correlation-Id: ce7b5e45-9f5a-46db-cfa2-08dc2b5de8d2 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZlvR3ePBoigAG+XoNuI0ci5vYIv49PceBDxymoSFoVCFouZweS88s7sFZzrrqd4/9NSE+/ZtHcKFGwkz1WCFTQXFUZ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ZQddpAcSynEbr+ixpqzk6upEnz/rsSegbMRCXtYoy/iW5rQJ1cw6nuPw4Yi85DqzljBAeaye/BvyugaO4Q+SBcpbZuoknV2MQMA0Qa0cITA9b98QzUihIHnrXUtAPzon+6xen2XGsgqgTsTqohlm3UunABuXvL9aWdKsE8+KG5wrj3pFoL9qJr/geDYKrl8EIjQrVLkraP39gwtcy/rBsEkjS1l/oszNwCB26pIGcIs+3WwZlWfVDLSTi4P9xa3CDZ+7a30abxWQFAWVUMhQmGC4nyAVM/DsSqriDOyf5pxTa0R5Nq7k6W1ta3LHOZxuYTUqRB2Ll51BTVN5Zi/VkPHP89Ti/g3/lfSqQjRhkRtHsnBEn+V903fFInnuSYgQTM6WxXT2zdN5d+GFEEaUoBTXMW9tacoMQwz2U6ky3nUSAr6v5PHiCeXQSjlu3QOxhZCOp37RRWDh0ZK4US+tv7Idq+rBBwrjT+BAq9hts9BCSV38dUVybeLwyOUFGKVo0kdhctPVYigGva2SsUeqWAsxcqFTQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce7b5e45-9f5a-46db-cfa2-08dc2b5de8d2 X-MS-Exchange-CrossTenant-AuthSource: DU0P250MB0747.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2024 00:02:31.9710 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3P250MB0257 Subject: [FFmpeg-devel] [PATCH 08/23] avutil/hwcontext_d3d12va: Allocate pub and priv device hwctx together 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rgRgJBoEXXpi This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to D3D12VADevicePriv as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_d3d12va.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libavutil/hwcontext_d3d12va.c b/libavutil/hwcontext_d3d12va.c index 3acd5ac43a..6b4cd22899 100644 --- a/libavutil/hwcontext_d3d12va.c +++ b/libavutil/hwcontext_d3d12va.c @@ -46,6 +46,10 @@ typedef struct D3D12VAFramesContext { } D3D12VAFramesContext; typedef struct D3D12VADevicePriv { + /** + * The public AVD3D12VADeviceContext. See hwcontext_d3d12va.h for it. + */ + AVD3D12VADeviceContext p; HANDLE d3d12lib; HANDLE dxgilib; PFN_CREATE_DXGI_FACTORY2 create_dxgi_factory2; @@ -526,7 +530,7 @@ fail: static int d3d12va_load_functions(AVHWDeviceContext *hwdev) { - D3D12VADevicePriv *priv = hwdev->internal->priv; + D3D12VADevicePriv *priv = hwdev->hwctx; #if !HAVE_UWP priv->d3d12lib = dlopen("d3d12.dll", 0); @@ -558,8 +562,8 @@ fail: static void d3d12va_device_free(AVHWDeviceContext *hwdev) { - AVD3D12VADeviceContext *ctx = hwdev->hwctx; - D3D12VADevicePriv *priv = hwdev->internal->priv; + D3D12VADevicePriv *priv = hwdev->hwctx; + AVD3D12VADeviceContext *ctx = &priv->p; D3D12_OBJECT_RELEASE(ctx->device); @@ -609,8 +613,8 @@ static void d3d12va_device_uninit(AVHWDeviceContext *hwdev) static int d3d12va_device_create(AVHWDeviceContext *hwdev, const char *device, AVDictionary *opts, int flags) { - AVD3D12VADeviceContext *ctx = hwdev->hwctx; - D3D12VADevicePriv *priv = hwdev->internal->priv; + D3D12VADevicePriv *priv = hwdev->hwctx; + AVD3D12VADeviceContext *ctx = &priv->p; HRESULT hr; UINT create_flags = 0; @@ -670,8 +674,7 @@ const HWContextType ff_hwcontext_type_d3d12va = { .type = AV_HWDEVICE_TYPE_D3D12VA, .name = "D3D12VA", - .device_hwctx_size = sizeof(AVD3D12VADeviceContext), - .device_priv_size = sizeof(D3D12VADevicePriv), + .device_hwctx_size = sizeof(D3D12VADevicePriv), .frames_hwctx_size = sizeof(AVD3D12VAFramesContext), .frames_priv_size = sizeof(D3D12VAFramesContext),