From patchwork Mon Feb 12 00:01:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46194 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp401153pzc; Sun, 11 Feb 2024 16:00:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXqnClHJKRN3n3PG791eSHNOVMCmcV8kIDQQpUiKLm3FykPRK7tBmaFoLlSS4Vx/oVYT/u6aJK9TDPFTztZX2/xm04ZlA74Wo4Hmw== X-Google-Smtp-Source: AGHT+IGnbr+aP2okZv3hlRrX6M+0EB5G1LI2XLjITCtNGJHbeCOTyg5PYMWOhJc8jvGrsilfMXWA X-Received: by 2002:aa7:d7d4:0:b0:55f:e574:4ea6 with SMTP id e20-20020aa7d7d4000000b0055fe5744ea6mr4045130eds.2.1707696044764; Sun, 11 Feb 2024 16:00:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVBUQOTUcfLHfUpel7ejt80hkXQKn2NdGeip7b/J0DP1bLiDMrBVFBMsvj5J/T90p1+F0ivgAO8agdWVSSrNmOKtVx9HbVZ3XGMRzA9wczXsjbqqDwTVt6fRJNE0jQS3XTcIMhxZRPTCcBhpjRzjMr9QxMivdjFSg95iCQ4SRBuUfBLiugmANzg8rOcPxNEY6pMyaPC2EF0WIRxRetVJoHo5znWWd7AjaUCnfW2sii/1tcL7LJMJLIeLYkOC9fO/jjIvLIpkMbepj384v01IYgd+VOq7aLgjxlrws/AzxT2sGeqgWMVWY6WA8Av/iNoD0uLMqa8Ur+a2hABs6y1Z/4g8E6/GY+4iVd9fx4YeicH8HRGtxF+lLzSjkkWtctwvnhHUk07fCQxBtweBCn5mYk++jIen1YXfn2/cZOp9L9ignqJHlOxiYJbMhREAavOu4DFQqE/JenabNtcUYBsNcwgV8loM/gBBXHE4EzScZdkC/GH96tBmbEPG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-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n23-20020a056402061700b00561b9f3d9b7si306586edv.138.2024.02.11.16.00.43; Sun, 11 Feb 2024 16:00:44 -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=IS2s63jZ; 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 1EFE468D127; Mon, 12 Feb 2024 02:00:40 +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-am7eur03olkn2036.outbound.protection.outlook.com [40.92.59.36]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 971F268BCDC for ; Mon, 12 Feb 2024 02:00:32 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AMewnH8cs6VLIgEs5C7W3bBT+aiRvU9gZc2sZZvsaJyt91JCTxbDqDfGBjtihvUQ2TgbePSeW9a5DJiKohPJMtv9b8mgwyRxyPMhYqVC5WESzRx/b8842QQZGxlnQHHVnG0TWtNsiu0mNP3eU7Vc50aeMX0cT4bydlrY2TVw8/ctTq9Fqged5ALl8LbaKvK8eITTsRp0APVGfOMawE28tgms7WF+M8HU7X7875oPZAfZp0Ncw55IL85EIhsRh0iPwWQUNOrQ/+OS86utYvwCL3xbFis/Dc5L0IoFyLbEz3sw/pESm8Y9mk8D19GoTikkDeiIUO2MYuJkhpWXLijL9g== 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=hddSvO3dNCHfH+TEtjRG/0K0BM3RJ6DScfgs5ZyG7VA=; b=kS6ZX9fueXjSqnVqKQausyal/t+n60BG5vGmU+x39GM9j4DXaXQJmq+dEaa15G/U3coC38rZtyihXiTEyJqwPZCXTIVZtrOHlbwCdvJax9seKfEyQogNymS2GIS4B6ME8tYWvijVV3lQumoRfmw1J3rVjdMrp69AH9g61GoEsj9efqvJyw12TpUpKYAaIbA99zVT+dscBBUnleX9MtqEm1zSPHKYdEDBp0q+Ep7oZdb47hE7IpSqrO6Yl+lCrZNyj1yU76QaRjlW8KH+hRmI4mDbJtODpwM7tWe+ajfpc9h/Voc0GzkLE4A3Lman1gvlwnLAlZCHbc6IDUod4TFsHA== 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=hddSvO3dNCHfH+TEtjRG/0K0BM3RJ6DScfgs5ZyG7VA=; b=IS2s63jZR1TSXuhsCw0djA6MG9l6cxaONoIVhuOsKy3Px9ThKrZ1BMVDRP16GxlTwXRPCb1mH//P3qcbvTbZX8ibsqz/Oie70fU5IHU6Ucv731qSok+ezhGOAZ8uHI0He9HcAEMTYzL2IlLwccpoQ1sz8GRxhBBo/u23B4x0lT9p3rCLfGmTn4tlkjFgejqqvLl35Ke5OACEdKZpKZcO8V0NHil7UD7O3Ja9AFlh6wyBw0Z7H78A6qpWnadlbrcDLYxCU6RpuA5WvRb4YNqi0N25XpHinzyqn6/1F817InfTJOkdrUvbb18i7hQr8MHs5s3Xwrj/2pqD2dRvl6Q3CA== 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:00:30 +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:00:30 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:01:58 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [2YH+wuPoMAxStF/DPkWcfVkVTD3rZYm2pvmJEwdUceA=] X-ClientProxiedBy: FR0P281CA0181.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:ab::8) To DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) X-Microsoft-Original-Message-ID: <20240212000220.3975928-1-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: c549edbe-419c-4015-7f31-08dc2b5da07c X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZkxqMYEXwih1EpybtniBlX4/vb5b2TrpeTWp8yp8Yd/2t7Mw9j8ENRd/jeLwYANnitnVZNHD8QDIHEhP4aGA/sUGuyaGMgVF9HlHZTq6xrsaBn6HCStAZR6vgO21ehcbgX+o4W/3bv2Oltef3LjxzHf1co9bab8C3wg0SoOtAuO+3mCZfE4B2jPLWTYz5eT6oiFqNSA8shcKFqtdX3uGLQX29BkPgvRrWZxavVHCZnRzxMXQALgIgmrG38Dixzbo6euXmlOf4zQEIQivqIjqT40dUmKvRb2ekyfl1eP27jUzyibImIUifix5sp2seQG7rNXJJ7x3Yzjy7h+givMR+RKkJkMlpmV9FU/XSCmCuXE36nzhVoNNSkcXliE2wyG0BwhvezLctehMnmCxaZrJWvjB6BFUXJLcqMWBglrDTQX7rBOWBSm5x0/25Y10Io8tEBUi4G2Ft8rA4/NkiFtP+afW6SJoP8hZbkpdb4zfyLkM5sa//+JI0LZ11zLU/IS/2N70gG4RUtC+GNq9zmvYqnPo68GNmdzTICwleT7uOVsDKEutGAeYgh9hW0DjGK4MDA2b949kmxbHTsjiYEaSLUJZ17MiZLdQgxlGBcTqywWp8/DTacw+5DCtPJ4VtaRamBFkxnW36XXaMm39xr4K17EZWhiHZykzTxC3G7kWANii0scK/bIGGJSshId9srvEtrcAThr8zaRPhmhfZLK2y9Sm0CKu/iqHTtkn5TthOle0= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TwR7las0fxTQKbzduUkfHgHZqcCGAS8NxkaonpPFoqjHwrztEThcEl1YMTzYW+GEJ/G/FTULbIimd3KtKOhoE1WALgXa9TTOPWs/meHkbkvhDAp19BTOZ0Ab/hcJ1M/ACftIH6w/7PsCQyPWiMxV3+n6tZWy3Gnnki/R0uODRNOQ1nl0pd1FGLnWJQF+GePhxmPDSDpSMz+uP3aPspHnKfvJrqJtXNrJMC21ZV/Zc2BfXndSugeX0e6NCeu1NpdckV0nG7YHuUtoGoGTWU5kPufj69ejICt2xopQUpKr33uMI6O03c8ef1PotdNle8zIul/bwumqEeii1+z5lf82OKhRkESijEvzetQOxLUq2lDreWJKREcciBf6w/4zKjjnBM4F9MlOtC3mnBYKL6QKz3uJmcI6bcrtgph+3cTBHXV+ojf9kYxXfOp+wS3g6hIx1T0bf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aThOUa2AdOwr3NrrTEzzaQ0TFzB1ESWNYIjuhid4PeKouM8NyR2EKi8f5h3/SP3C2skI3+6Ue45XEvYDVHBppmUpmzmbyNpDTbGbzGDAir6FzQ6WScECeiHbzcVAnN4fsQ12CkaGBCfciMyhawGkNc+4yjdHIgPIIRf8OdGad0rEtoi9CSjigDQT6HrNg36beD+ZHE70xyCa2IwAE4/lEQ0uhwTmbO4SYDfRgssGdPPS4AfsJMF/Af9NlZybkaTVsF5Rt8tWmDq9sgRd2SaqOlYBHoNN5z6DH7nIcrlNCxnQQbwdbrwpcBFM2SX+d2eH7kOWKmO5uFZ3a9Gus8Dz6ezrjrKsw7neTzS+RHaqrWPK937RxGk4JeCwgPFKKzIad9ucjsoMbOQJ4eiHBejzOniY6QPrbvV21NluTFobjYLhYoC79xsXlGe9CaDUAXgHmaiaJbAFCh9TRzKYQDoyyW40TQt/+lTtuVy4EQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c549edbe-419c-4015-7f31-08dc2b5da07c 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:00:30.6937 (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 01/23] avutil/hwcontext_opencl: Use proper OpenCLFramesContext 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: AFmZ9jiRo97n The currently used pointer when unmapping DXVA2 and D3D11 actually points to an OpenCLDeviceContext. Signed-off-by: Andreas Rheinhardt --- 1. I'd appreciate testing of this. 2. Most of the patches in this patchset can be applied immediately; only those two patches that remove AVHWDeviceInternal and AVHWFramesInternal need to be applied at the bump. libavutil/hwcontext_opencl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index 247834aaf6..c1764ed098 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -2346,7 +2346,7 @@ static void opencl_unmap_from_dxva2(AVHWFramesContext *dst_fc, { AVOpenCLFrameDescriptor *desc = hwmap->priv; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; - OpenCLFramesContext *frames_priv = dst_fc->device_ctx->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->internal->priv; cl_event event; cl_int cle; @@ -2511,7 +2511,7 @@ static void opencl_unmap_from_d3d11(AVHWFramesContext *dst_fc, { AVOpenCLFrameDescriptor *desc = hwmap->priv; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; - OpenCLFramesContext *frames_priv = dst_fc->device_ctx->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->internal->priv; cl_event event; cl_int cle; From patchwork Mon Feb 12 00:03:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46192 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp401801pzc; Sun, 11 Feb 2024 16:01:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUdT9jIPEhQiSTuCZpUV/Bxq/wVUnPc2qLBTwPXNzgPm5tUyB8FDaZoGOo+xq+PVRxHj70fEiM3EtWWETxqWz36WbUgRJ4KngUDeg== X-Google-Smtp-Source: AGHT+IEiKaynEYGowsppWn84Of26VnKl1eT3TusCQvybxVezHQZAJJCNqGN03RJ3xgdGtCObqxsj X-Received: by 2002:a17:906:6d7:b0:a3c:240e:e1db with SMTP id v23-20020a17090606d700b00a3c240ee1dbmr4202594ejb.33.1707696117948; Sun, 11 Feb 2024 16:01:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXkORBDS8oQwD68Q5A/7mlo7cdHtTweUrSziF/IJZOX5eQFsAXWakKGlUCFboWFaQwoNDnS9/muIsIPKZKiRVx0mu/rKqJZjXdc60cuAHmu9PGPoszEbpsQ0qpCfy10xpE/M4AFW9ewdvZ/m0/5ZqbWy6Q12zxe1op0mmHUSDPqqI9KvJmMpJsMe3uWM/FbEqzmCFwABun2a8YA2m/LUTUsHzX6e7L422oFYIJ64Sn1VZ5/EHK/7nfhQKaTLOCzUldABXv1vjyHkmwuZlslBBXAyshu5bXUFPrTXqBDLt7HlTaBelXHHu7ypmS/dKXQF9wvb0kDOJSgeD7UI3fLbepsoQvcBEi4p9xSO97NgBK7DTFKskvqLI//gg8ZHNp/2kRXVlTilMfrQwQoQqiNWmaYUDRSqnKnx7WME/dSE+NFsHRxeRNkseeLAth9FOsAhJVFyjfSYLtb1ts3lfC8Ce/OgO5OGQox+RiUeuwTmLcuZ+w0JuwDF9HvHu6RTA8qnZUR7mnEpREN0oX5IRgK5C4ybek3MJzBB6ha66eyc/zap6l1eHC014xheW/+hOx0foqKr1PaDsYytlE3G6/83JR8RixrSraaXkp7aGH2fqrbNQXgBLiR8W9sZyefZv5OVQMqnKBnU2W3O38QaCRngfZ77f7rKuTNBlwsUSMSS6jDl/5JeYOeQ19SjgEGETANoSONeWKB9iZSDApQtPm/Q1w1XNNWXdDhfag0VBGGiA6vbR2LMggsNIxn67g7vby0ax9SMjFqKBtSqiRdRER3lhQ9nDUTm9hWEMCQSay9t/sghcW+01uPBDiOEBYzyb0Pd8FvbLakLJb2WrMtP1U8I1r+aSDLFZi0WEBJ5QDFe/8suU+hnjje+vc0yi6lM04bpWB32UhOgGBIHH36Or9xQ1xwQpBVaVdXLcJmUOV9jkaO7D7geSfKtF0VJ6cNFgkoBOyTF7 5t2Qv7ueSn8oKdeluHIVlq1lhIZ/TKbCU+eU2waS68NSxUqWuy9vTvyGNhRiGQ9Rn1Jf248pwyfFe3YBFrvoLA/SfoGJqbhDXfG13sXFCo34O+GK+MT9wCxnjNxipbUBx7r4IImsyPIJjloUwZlsOqd8fu4gM2CHzZvbDy5cm7KgPmScKxKbiA7c6q3CC97T0DcZlwBHdAbj9zJBi/zpz1TkqvDTl9JaSsRS/PVhgRVanNCVN0/uE2mI1hSn+xkh8BP2I62Lr1fI/gFe1R5ucmokxF9ziUJra7R869JupSIQb1Ck6trXHNAxkWV5A+RzQ8lNzu/hwLII3xyab2AxCOPhdRQq+XRVtzMW7KkfMdYfyWvMGCxcIhhR5yocXOnMlrCEVd3wk+AJMTrZGFYYBwlZZT61uX0yWAIuyapodBKpxM8FMIXkJyrnMgSnrazrdgwY7XV30b1DZA16hepKJ/qzrr7rbUGYdsCUv3GUMGEWtMX+iMT/LH8n4uC7KXCpkaefVlS4Tadh3ZW5u8g8xMz771sDm3nSyEjzEs24JQ4lpiqG3fqlc0YjIaKgvvWMxYttADLCuUJWLDVxpvHU+6KuA8pQzSIG9HZfJxh/63kUNEtp/yOv6yabzx9Yw= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id cr16-20020a170906d55000b00a3cbe1832b9si53868ejc.358.2024.02.11.16.01.57; Sun, 11 Feb 2024 16:01:57 -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=f8eZ12ws; 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 5B0A168CA65; Mon, 12 Feb 2024 02:01:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2104.outbound.protection.outlook.com [40.92.73.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C53DC68CA65 for ; Mon, 12 Feb 2024 02:01:47 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TmcYeoZpuipoHM5M26CUkGmt/RGWwRKALfku9TizEIwwl/JzkeM9+TEnirDSnr/1jVZf2xPDBYZ47EREfKzOx2BOYha3CPB72x94N6kZcF1YTgtninaIb815fMNmQ+3I5QsTNNuB8u88Odg6hA+IqBChhmurdnu6sTmSxN3JaInDpsNKKkdxLcs4s7Ld3rtdLjgIhrH9Og8r7mPTJNsv+/6KJ50IOxxo/iHR8uvSbOoDBhk4I0M6x//3ZBHHB9tDX4d8ePzRBOIh5EjM4TbcKqyfJRWdwHPxUFY2djEJrMoWbWYQc6W1PWxB0LGJnZ0i1bQZkJHMSCSQgzw8o8Bh3Q== 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=9LzUB4X5GTQAk2G2SxutOUyyHG0UbwMwBXp6iYEnD+U=; b=U7q0pXxcLRZYvuNrmRx3ox9plKyvC78qI9uMHp8zQrOR5iiuCsjfG1Pb/ap6EAw4ROXTOl9NrwwFROy2QJhdEEAM5cbf2JyS8KzFPCa8p7qDURFZ4/gC3kFSHyMNRNjUjtJDkd49RJaWcAvQNWxNIp3e0cIBzBNosNzZ01amGJC4ZXeM1EV/LUh5YwF2fFM7RMZWbnyLrrwkDJAZ7QpNjobPeIf3jgKulIXmkCZXBiveXI1562fT0uRozh7k5i4Y98ILU9n4jtE3VX1/BBVqy8kac61jsG5y99QF8o8FlYm4fliPH/WqUU0V2tTOx+/fb8F8jriCnCFnfGe4yJ6eHg== 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=9LzUB4X5GTQAk2G2SxutOUyyHG0UbwMwBXp6iYEnD+U=; b=f8eZ12wsCHVGzesPNidUErKG5ZW8FMkDeHg1+NUCMPTO4Z8hbF4RIRDma9takVx43f6S0818cBFwn7kxnyIvAJjsqHeA4k432F22dWSmZY6wdqLy+3UcPzC1aZ1JvKkBbRvMAhtNMgIsSdrfcBOOy1o1w9f/DK7S/uOwhrn0mK4xujPt+NvVJ7j33UOrH47AfIhpSLCtr3UU6v/SUgepO62skXB3pyeO6WnWRihUhl0RXNWw9moA1UATjszuHViXN+a+34KfjLROQ3wfXRZdLVWME4ExjyoIAKgFAHr2Q9IoAhJhhPYWRdYNzNID5hBAPaKZCP2zPy2YcpO4gX+LAQ== 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:01:46 +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:01:45 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:14 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [Q0u4TF6g9PF7n8AXCb6MJe5y/76EXsIh71+nQFgufmw=] 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-1-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: 1d88f734-b3ac-48e8-b8f2-08dc2b5dcd53 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZXybJGuVRTD22UsYM0S3ja3kNaT+Hd1A60+P3v6d23HjrY9gbC8B7o1xrLaR37f45yxgjjxM5XHcaoJmUdg17heGoRcL/EgS5HlkVSBJLIYCb9maVKC6rbRGDnTCHeLKmUoOVSeliq2Thrp0P/L/P8Idn6v+6XPyBZF4ZJNj4B0XPalpAgg4iV6aDBbNHdjL06UuFzMmggzlHWswjTK8W4+YQNPozpyvTt1oN8wImuZNMrzvY4tr4vxIanG/0c8+EG45S6AmU4DrMDElBdPTwhFmvIwihXz4hBVPpnDIgWs8vkO4FfdVlRJjdO6BWXUpv2umORenxsLJfwtITe9Y60zhA93Sc+RnM6fEE95CV7vdrpCBhEVWtWtX0mU6C2NRFkv9TEnqhhmMf5H4hJcNEYCQfvMFoB5lpgQHGp/y+WXE6WMIwQ3MlGfLlnIb4Gp5GVEXyn0J1oowZBlhMKMb+d1QiLnUtnc8Zb3lkGEkJKH79XoZh/dHPsZBHaPEG5P9rjeuu8kIvIa+5iBg8uIdCJToAhPnJHhZ8ohRr42IVQk8B18YdX/F6Tb3T+d2icUmL6VKfjYn/bbpN4GtQObuddISGmChTVe58kDw1kZyd8dpvN9AFGBbBE8WTQYLjsIuj+fTmkBELPfoI7lYJ6gfXncqluLmwN42mExjn6g4w8MSaWjAhb0WDNMx2iYRRbaXh+ETJan9lsFD1ZG8imNJz1n/rSOTskc+DUaweM9j5dRg= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 00RSFxEeGuqwKxBEQsx/J6bau2wFqu6HYa+lwho6uuCNrZwR8A7QVksx5mNsBij09ia6RbzViWUCSnzUdtqEbScIMxFcBMu3KC2B4PXbHDaT291phw8zzekgniEE3ENKPc3boj94ypKpXx3jxFj+KNyME47yNFrgacbi59cGy7NGrMrwhHkCFCV/dc1Gu77+xB/kMitP7Ks/PUivarOUC1Zr26Ku9znz6D+JC7JEuT+cqm7EWj2qvnK8GFuKEq7fu88Yl2musFUvm4aYy/+ylLkDRlV9C81yVFefecdNK8VtSYaPwIuccUZ9+JMMUIBoFSD8ibx4Jm8jSjCHOHWKxHRBIRJ9lC8EWdl3hnxUIvFlpWtV1icnA/WjnIyGCL+nb9iNroOQpWn/UwRF+oEkhahlQNtWpJOibe8JVKhckpIZts3YPoC3V+EHSalauK/uIjrYGfi355JDGK4Xg1n34+3VogMIM0O+dbjKP3w6fmF/V8KLcy5CLqhxi39v5csJDSnN5ZVB590jScpUecvmeM8ChNZOV9QE8FnOuBnWve45+rTBNEzhG8xxNBUoVSTdVYjju2YdfCO3rXq8umld+qOPwsQrjte7M4fdjFG1BsQ= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1udoiL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JIqiFM/cct4nYEdcWRZ36NLaSvJXP5Fv81Pn6ef9ZI6rCZyFcn/qpKeNJlZ51SwJTp5fa5beJFlVyJ9aXICk8ekNvdEPrBU+rNts/HVKRYmfJbEUetWIHQxD9IO0hA+ZYg7IyK74LNSG1/A2kGvj0c7fM7mSvRPM7h/78W8+0tN0s9Mh5D0MqEl1LD6T5nMzN03VDc/e8waO+pehAw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d88f734-b3ac-48e8-b8f2-08dc2b5dcd53 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:01:45.8696 (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 02/23] avutil/hwcontext: Don't check before av_buffer_unref() 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: vlVnyB8dITCr av_buffer_unref() can handle AVBufferRef** that point to a NULL AVBufferRef*. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index e23bad230f..63fc1a6a22 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -297,8 +297,7 @@ AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in) return buf; fail: - if (device_ref) - av_buffer_unref(&device_ref); + av_buffer_unref(&device_ref); if (ctx->internal) av_freep(&ctx->internal->priv); av_freep(&ctx->internal); From patchwork Mon Feb 12 00:03:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46195 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp401881pzc; Sun, 11 Feb 2024 16:02:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU9J/ucNdJ+tEkTqiUBusldFk7CoNMUmyG64YTG4AFr1WmPxgrPE4QUF2wLN4pOhNiUYUeBfXxasP58XiTB0RgDBPTnPSEEA9UOOA== X-Google-Smtp-Source: AGHT+IFfXm6FxsaeNttfiEwIkwhAI/0wnoeeSZf80HiBhjVK6jt1SoidfSWS9OlW0sylF3/kffsQ X-Received: by 2002:aa7:c543:0:b0:55f:adc6:47e8 with SMTP id s3-20020aa7c543000000b0055fadc647e8mr3668580edr.7.1707696125641; Sun, 11 Feb 2024 16:02:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUTYhWToszXWCCitmDRJTmrlhdnvz1o8rslLjXfIS9jFA5/c+zTLGc7ldBvGiTGyEV1q7WCGQe/WFB5OhzGN1sZAJPVPG985ivy92H7Cx4j62Xe5fqOiO1GhZiv+l1+t3M1TTR3i6K6y5qixea48A0LouT4ChLK2HbzBfUpXcyS2apSuH/vSoHECAjxscyRvWkZoo4g+sy+sX82sppv8V5x+IJso0JeKuSRDdIOmq7cSPd2c+T7f1+TJrBqeCBlYhpuI4aLpYXwkTsPRq8ndL+sR/oQqTtyMOOZfwWmVUj8mCwgaZz6RUAC0/uVlStFQRsTp1gfUvcTq5QTPWTVe3uUW6aVfk8hfRQqiI5HMJfUMY0rG7rTo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9N70UL+n+KamniN70ZEnmF/ydpEEmxe0fZQdkLYvDS8vh+NovkqLB8Ez37xy5koT890+G262nCO/1Q6hqYJlz7N9Y6MFPet4iCw24eoPMwnibrUyBZKMPuSua2XWAH0S5T+Eyr7jrhU0+0Z3qXJyRrE70mppGyP84rpvxC Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r10-20020aa7d14a000000b0055f43af8a99si2225565edo.350.2024.02.11.16.02.05; Sun, 11 Feb 2024 16:02:05 -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=lbWO0S2y; 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 7655868D13B; Mon, 12 Feb 2024 02:02:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2069.outbound.protection.outlook.com [40.92.73.69]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8743468BF73 for ; Mon, 12 Feb 2024 02:01:54 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hfhx1b5hOfyn2XduQpvsZBY9EVeUngk2v0wlUZiagmH5LkReKskCLASO54bXdAalRSuLYx00RMrJuKHuOG2WMZChS3TLtDlX4cX7dTZFxurYR/I7eUOMoT9FvZa5G7Y9WVOfmyqrRXQbcYD1r/XMeCdCHc5ilvwFO1s78vlOlb+2YacgZF08kLtTE8qMrbf+IlSqViq6IhAEnEa7aChaWbmTW5EdUYSN1IURVrskvctah/i8wC2QXfTWvofMb3mJbnpIz1YzltxHeP/8hk9w2qQQPx0QfL3cGEOVgHixdgDGUmsXN7fIu/CRg6L+PSHaN1kftiJtuFBPAgXNzNI8bA== 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=mVwrkkNF53odas0860lgcv0OtrX9YxsNW2Xmiqzpqy0=; b=hqma/MWND8rtGbUWnjRfLPwkwYmG6HBKW/awv0rb9MgUWPqqEfXZ0/SZGeNrgkf/ZH377bQc0tP7+XmPijWfLFAhF+n/z3STtsuF0vEMq0xEB6wgG6Bq7cXFjUCyoctTfy5iQyk/dA/dNeuFmA1xtJKWSGU2tXShjEx1dHPnBaZ888/0YeWVUL3biU6UN87CGt9GsEg4TqUD5fiz1lmsUuHvIyJRvkewK7k6MzUH3mdLqn9TBdyKV5skiHD8hjLGGol80eSEx4ZoJq1vFqgTGpSZ9ecCou+GmZ5hml0kjMc3MmAlCOPuedgGcKXgRAAouApQWdRaRyIVHgkTZ2tFRg== 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=mVwrkkNF53odas0860lgcv0OtrX9YxsNW2Xmiqzpqy0=; b=lbWO0S2y4M795X9yAhWZdUvIxIVzmsJC1d3Kr14tt88slDis07kcr1+wxfZ7SE9dzPCdR7JHolfryZsUptJvN7ZB/r9ux7JKqoaGs5QoVS3HMrniuY+5DmCBW/giiLjA5fQv0HVuuDQGjwm1+7uF4x2MxXEaXnuMW3uS3rM/2d7Ien8sdT3tE7btjFDRscAcjz1ftXJAp4f5V4akqOk06PcMswfOgViIO89Fq9PiJuwHvibXJa9tesRCKfJk0uZ+t46SLB9qsPpNL1uDXsTS3A6FuatQfYi3ScABcmgLD34cf8beBy44jp/aiQGAkNIFdKSek8fxaEx7ZUVsKLma1w== 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:01:53 +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:01:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:15 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [ZXzDzKk3MyQiGngNK1VEvUGxLwBf/NYiqj64h/gRjb8=] 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-2-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: 6c20aae9-e894-4da1-33a6-08dc2b5dd187 X-MS-Exchange-SLBlob-MailProps: 9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m/x5/AKOzW10Jn49pFHQyH66qyB7Wi8fYWAeV/UU2N0C0AH59I6Q5X8qYtgpT8ThEg/lR+X3jqbVsfQjDjAlYLHx5z6TOsjhWea89LtVlRG12AIUSXzipglLRrucrU7fXjLUBXqfpONLywo/7lJqvLiz9CNI0PMUgrhHurzKd5/1oxVf4nTcrPupVdO2gM3oEqXU7XP31Xwo31QmRTYIZI4DQhMRRV4Bbt/DyzTo5DkhXefCvQsx20G6dxCkTHrlGOcyfbAyrdj7xBu346avZSinSIh7OPj5jDHyS6LKfZ+XtBq0ObaJmvr9pe4M7pTtfe38Fb9s4AlK2cqP2BRquGTK16dN1ENkazxj78bQuGihESxHSFncpqUxOAp10vo7j9H/4WLckdNGS673mG4YCL1laD3f57Tki2+Oxa+QaDqZudPgAzHleekF+5t0BBw70d6hgX1UOhGDjqmNj1WuMRbyNofQ575T4cJvw55q/oTNOR0nEiUdOW8zhZcWIgd393z2yfcUV0b0nTJEvjRiqOCp5MqWVgK4ahFLZgTjB49OBEouIONzEg+wHzxF6roKj7cJkU1Hm2Gl/GACsWMam7SWpCQFfDhq4fDpJLnvG38lgKfiyOjwv0M4yQaqOQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c20aae9-e894-4da1-33a6-08dc2b5dd187 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:01:53.0031 (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 03/23] avutil/hwcontext_vaapi: Allocate public 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: 6URfry7hcoIR This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VAAPIDeviceContext as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_vaapi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 29fc8bd648..7019769f24 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -75,6 +75,11 @@ typedef struct VAAPISurfaceFormat { } VAAPISurfaceFormat; typedef struct VAAPIDeviceContext { + /** + * The public AVVAAPIDeviceContext. See hwcontext_vaapi.h for it. + */ + AVVAAPIDeviceContext p; + // Surface formats which can be used with this device. VAAPISurfaceFormat *formats; int nb_formats; @@ -207,7 +212,7 @@ static int vaapi_get_image_format(AVHWDeviceContext *hwdev, enum AVPixelFormat pix_fmt, VAImageFormat **image_format) { - VAAPIDeviceContext *ctx = hwdev->internal->priv; + VAAPIDeviceContext *ctx = hwdev->hwctx; int i; for (i = 0; i < ctx->nb_formats; i++) { @@ -224,9 +229,9 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, const void *hwconfig, AVHWFramesConstraints *constraints) { - AVVAAPIDeviceContext *hwctx = hwdev->hwctx; + VAAPIDeviceContext *ctx = hwdev->hwctx; + AVVAAPIDeviceContext *hwctx = &ctx->p; const AVVAAPIHWConfig *config = hwconfig; - VAAPIDeviceContext *ctx = hwdev->internal->priv; VASurfaceAttrib *attr_list = NULL; VAStatus vas; enum AVPixelFormat pix_fmt; @@ -384,8 +389,8 @@ static const struct { static int vaapi_device_init(AVHWDeviceContext *hwdev) { - VAAPIDeviceContext *ctx = hwdev->internal->priv; - AVVAAPIDeviceContext *hwctx = hwdev->hwctx; + VAAPIDeviceContext *ctx = hwdev->hwctx; + AVVAAPIDeviceContext *hwctx = &ctx->p; VAImageFormat *image_list = NULL; VAStatus vas; const char *vendor_string; @@ -474,7 +479,7 @@ fail: static void vaapi_device_uninit(AVHWDeviceContext *hwdev) { - VAAPIDeviceContext *ctx = hwdev->internal->priv; + VAAPIDeviceContext *ctx = hwdev->hwctx; av_freep(&ctx->formats); } @@ -718,7 +723,7 @@ static int vaapi_transfer_get_formats(AVHWFramesContext *hwfc, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats) { - VAAPIDeviceContext *ctx = hwfc->device_ctx->internal->priv; + VAAPIDeviceContext *ctx = hwfc->device_ctx->hwctx; enum AVPixelFormat *pix_fmts; int i, k, sw_format_available; @@ -2007,8 +2012,7 @@ const HWContextType ff_hwcontext_type_vaapi = { .type = AV_HWDEVICE_TYPE_VAAPI, .name = "VAAPI", - .device_hwctx_size = sizeof(AVVAAPIDeviceContext), - .device_priv_size = sizeof(VAAPIDeviceContext), + .device_hwctx_size = sizeof(VAAPIDeviceContext), .device_hwconfig_size = sizeof(AVVAAPIHWConfig), .frames_hwctx_size = sizeof(AVVAAPIFramesContext), .frames_priv_size = sizeof(VAAPIFramesContext), From patchwork Mon Feb 12 00:03:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46196 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp401955pzc; Sun, 11 Feb 2024 16:02:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXRzP0hdCpE5VX0bUJKmdBStN7VUAa9MQbO4LKDabEt4GFWpgTlxftEJTqwFHy25nl62we0ZJqiH9wm82sDuawH/zCjnxHvCcqgwA== X-Google-Smtp-Source: AGHT+IFPd8hdX6cHbNzjYQVBFC6r8uZfV9NVQwj0+UcQZOB4Oj8xSoTz+4LJKz/hKJHZhbvJCf+N X-Received: by 2002:aa7:df8e:0:b0:560:f94f:a39b with SMTP id b14-20020aa7df8e000000b00560f94fa39bmr3307291edy.16.1707696134389; Sun, 11 Feb 2024 16:02:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVRjrJeDR/b/In/kgvpUjOYnxKK0NBLN4bwWfUcr4MOKp/CeJmAVgxxDWaqppbES6PVDnjfjshGhiUTiUWOfBM91sOwBpgNg36tB0HcwITMFLRuZR/ajHMf7im34/77tCSXilbyxA8jisCi4QXAVlpy/L82vicFchBWkpkc8rvkeH/WN8e0NWuj727qvD/hn89yGpg2xwQiru55Pbs9RDzYMgYsbHcrgb1uzv3PZBtrjovh043TdKykMS2BypVbzvcraCRjOD/bC+cRLfJGSCK+2vaQKkLeBj/R4kNuMn84hRNTCXCDokmX2d4w5ZWkxIv4cQVVIXsE3sLIVNGVrKUSO9H7ra08bUC8T3yQ+WiwUO6x33/+CZN9xE4kFD+o2c3bo1hPOF569ubxL3QsZLVY4a6r+iYIqc8fM4C8t/z7LLgqlILpBW1TbQlRQkbaTll5ESboEgLtr/8E+IqTOdUBvxkWlS/0PsQ/O8Qk2hadG6gnzxIqaYYWXqAgmOXLL0MpeUfEEDEnZ4GQlyIuRByiKsuYh2iks2kaBPDOkGYH4rWhznbBrxCW0qVDU8Zb2u6UWzKxPcjKwm6Ak1lJFKLy3ZdeelgUTzhicPsf/4Xom4X6T/tbnwrRnYSfM3+mGglt/RlPWafQCp8iztMGGE71vc7H2xpMnIfycfll+lEx8uO21GR5/MGquP7mso0AZrowDKaR7IjQPt5EYrwFYjCTP4NoXfhU8fYy6ui/bc1MEc79syhptwkPBkSy997WvXPFhUWTMFnY1RR7EL3605cKEaWFw9oVb9u0MXLym4sWqpkODaOXmGIlORkZ2+DNeDXTX4uWDUGL6h12bToz4888mDPcj3GW51bFw8jbcL42Q4foNGo7VBOW8PzsXNXAwKTkXYkUm7VaRL3xfOC6yoySwrDIdbid/11D+T+TDk1go33/e2ODhAesNvVkN7GJvASZfC GxuRXuj5YK1KCxFbVzwByRRh5SMkljaePuEmsAGzRsrbmwwxwdo5iA9zNGQZ4lKhrKFS5pGLYkEf5F5an+1iJlj5NttR7QbijEp82vyMCW9WVSi4dG8NPw5WDKmYZM73upScO6PQuO2eGfKI035g/mBqbX9AZYARgaxIn5dZ1INsYNvTsYRxgVUeW7vsHuSmGpoLflCP6iJB+woDV6p3C7mYCM+y9OzUajoH397wdt+adZQWJhPbxRtN51yQVfmBJPdsBmKbcJfjYkptSdF0CNbFT5KqvSl+S8eGY3uA59CGab9/sohqEXIbRp4scPZA98TpCF6av8zXtflI3Fmf+S+scRxOEB/PtPOfCK0v980Rx+MkvkFCzQdHbW2dT/3mst+KGtCxiwlIS6cLd+9e/UW8MDp/IJF75DtuFWK7DAAVL6kPtoFrtLKMHYHPOrB4Ba3aozFu/8Z5lzj9HUyv9u+F78kjc9S6pkrqL+8vvdCAb9c8qYMXluZ6CCBo2jOuZxSN7gnrLgp1cYFp3h4basb9WiLidb2CMJBoH7djuZzQE4/iOuNoQ00NsD6gpPtjVpD5iIHqwH5iB7KcI1QOu+wUHUvuRRXxe2BSLAVB2Kct8zdUQ33vOhUHayHZozwwuY Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t24-20020a50d718000000b00561bb5918c5si285463edi.640.2024.02.11.16.02.13; Sun, 11 Feb 2024 16:02:14 -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=sloyIMkn; 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 9F08268D140; Mon, 12 Feb 2024 02:02:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2069.outbound.protection.outlook.com [40.92.73.69]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BB80F68D13D for ; Mon, 12 Feb 2024 02:01:59 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BHHP7StdW7xeFjglhD4MUkAjYgCCO46wg4AXn6YRWqWxqpzZIh0411J6pOUa3gFKYS/MfP/hyfl2baC/q6qUjonF5KmOLLLHqPeW9qLub+/5iXBpvofm6jeuyjK7kCtyW9Hq0qggEDwIKXBQ7ted3TOcZnwJdXLp87vXNat2cIH1Gtl/beCJf60X2hXrBY5AtQuAd2k/VWqqUST0HMtKZotJetNjlplpSKFjH4Grkqm+Ztugd/Z44MyJvDPjFrCUXs8SvwbhKMiR8bv9Rqj84R6hd0BUrjh8UesWwLtjogUc3pepxQ31Osts18vK4MnVWLsnDOYpQOZtB5EEFSca0A== 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=szF4T8bxqKHtvN+I/2W+NDkQS3b/yLdF0dTKlBvst2E=; b=h6CNRuMJNg4yvFbJaExnmm0uUQchoj6tq+dWmAqdD/T2otxivuwg7G2dSWobYPsDHSIK0tGJxt3EPDkjNvMiEZ/GOpcRXaLQLjn/HGScEkmRoTt3qdHEmRNtv7noFSInb3I1fQoJwUrUwX2j8oy9K418j1viDGny3TsHxraRN7Ql+7esPpXZemiXA8AeU/DLyU0v6sFt7nEp88iXf+xxOA+arYPhxIaGY22MIinKnwQ3uG/9VPGTwVXAZOfsKivtEYkYrUvFQshzktcbeFXA+JWTco7NUeYkm9tq27ViLK6Txnsm/bTKnygIbKYyN17DY3JSlW8c77W5bhfkDsVu2g== 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=szF4T8bxqKHtvN+I/2W+NDkQS3b/yLdF0dTKlBvst2E=; b=sloyIMknhfRuLzqhn2ipsVU5RoKGHXqBCtukJM/nGSNeuykuCJ6v0Ymfc6gZsXCoebA8G6SeRk07V1J2pc/hrjtZqY9NK7BWeP2PnumSzyPQOpV7UkXJA9XtoyflgRTqRiRVk84vywTwEdi/v6Kv35I1so3qOfC0edxDbuATPTOR0dUZrcD7qinErDNUzCCGMhALtFct0P+BlPcjkS7IDDWgXCnFoGthrxD9Y2gvh1S3r7+wgX3WTM9sg11PMp21JiP9gNoWATkb02PbseQ2+Gy45cEFZ494e2DB4tKvFxIMq8TiudihsA8feNQytGvOswyB8ZqsMk+5zJFuY2krhw== 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:01:55 +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:01:54 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:16 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [E/uTq8hgp9ptBFGgfRsn4uOXxzrMRx4sgYU//qb+8nc=] 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-3-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: 9e36c955-7b39-40f5-0485-08dc2b5dd2be X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZFZfeLo88iPyJuTAtvE8aRrrQGCjHciFVmFE3mQddXAkjlRN09gyw8huW9G0FJuAul90VarnWEq31IE42hwoqKKwtraXCmno0wBR/JF4/vDOUvPk6KYVQdxLugOYBqJ7+LByX2J6PpexVuqG1G5DLQNr8vsF4el2p7wVwb2QLI2XjcYzmtHnebC/bwFgaYJL+WkC+XQlCzz4DJtYUap3S4qNedfjB6xCh1W8kr9L7cThmxohabMD5TXFORsCLlofQL1od+oaFsKLqgqixCQgClNTep9vwI5RSVMiIjoSL0ifWa8XaGqbaASqj5bpKWzPltWPdN6wpfaGdbIAwXZKFvR6hygRzKhyoM7FO4hk1SmmjuG6u+3etSIEA+8Lp72MGb/8tcBrRxLiganTejkMr3dzjzSMWHD0PDGSCBFZthKoCyoDecJI5r4L2PIAjlB/wWSgJMynZNp5z9foDTQwteE6MC3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ozlYnEqEbtqrmy8P6zDzR+EV1nx6gL+kXTZbjuFQos1BrQ7vTqNJ+Z40po4H81UqNfJpCYlV6Z80PpqgwuNtdV6oEYaWvgzcstS9JEcbq+EDqtQBr2dk63lNPzHGrTkJcdqLzS8RmNG3o+4uKg2eum4Se6KwOSsyCYoa2DDHOUchZe4KS4BtiBhedDog== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e36c955-7b39-40f5-0485-08dc2b5dd2be 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:01:54.9353 (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 04/23] avutil/hwcontext_vulkan: Allocate public 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: 1MqG5i0iJ1i7 This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VulkanDevicePriv as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_vulkan.c | 109 ++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index a84713e621..3d591dedf9 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -81,6 +81,11 @@ typedef struct VulkanQueueCtx { } VulkanQueueCtx; typedef struct VulkanDevicePriv { + /** + * The public AVVulkanDeviceContext. See hwcontext_vulkan.h for it. + */ + AVVulkanDeviceContext p; + /* Vulkan library and loader functions */ void *libvulkan; @@ -288,8 +293,8 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p, VkImageUsageFlags *supported_usage, /* Output supported usage */ int disable_multiplane, int need_storage) { - AVVulkanDeviceContext *hwctx = dev_ctx->hwctx; - VulkanDevicePriv *priv = dev_ctx->internal->priv; + VulkanDevicePriv *priv = dev_ctx->hwctx; + AVVulkanDeviceContext *hwctx = &priv->p; FFVulkanFunctions *vk = &priv->vkctx.vkfn; const VkFormatFeatureFlagBits2 basic_flags = VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT | @@ -369,8 +374,8 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p, static int load_libvulkan(AVHWDeviceContext *ctx) { - AVVulkanDeviceContext *hwctx = ctx->hwctx; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; static const char *lib_names[] = { #if defined(_WIN32) @@ -488,9 +493,9 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, { const char *tstr; const char **extension_names = NULL; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; - AVVulkanDeviceContext *hwctx = ctx->hwctx; int err = 0, found, extensions_found = 0; const char *mod; @@ -619,7 +624,7 @@ static int check_validation_layers(AVHWDeviceContext *ctx, AVDictionary *opts, static const char default_layer[] = { "VK_LAYER_KHRONOS_validation" }; int found = 0, err = 0; - VulkanDevicePriv *priv = ctx->internal->priv; + VulkanDevicePriv *priv = ctx->hwctx; FFVulkanFunctions *vk = &priv->vkctx.vkfn; uint32_t sup_layer_count; @@ -726,9 +731,9 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) { int err = 0, debug_mode = 0; VkResult ret; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; - AVVulkanDeviceContext *hwctx = ctx->hwctx; VkApplicationInfo application_info = { .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pApplicationName = "ffmpeg", @@ -866,13 +871,13 @@ static int find_device(AVHWDeviceContext *ctx, VulkanDeviceSelection *select) int err = 0, choice = -1; uint32_t num; VkResult ret; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; VkPhysicalDevice *devices = NULL; VkPhysicalDeviceIDProperties *idp = NULL; VkPhysicalDeviceProperties2 *prop = NULL; VkPhysicalDeviceDrmPropertiesEXT *drm_prop = NULL; - AVVulkanDeviceContext *hwctx = ctx->hwctx; ret = vk->EnumeratePhysicalDevices(hwctx->inst, &num, NULL); if (ret != VK_SUCCESS || !num) { @@ -1046,9 +1051,9 @@ static int setup_queue_families(AVHWDeviceContext *ctx, VkDeviceCreateInfo *cd) uint32_t num; float *weights; VkQueueFamilyProperties *qf = NULL; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; - AVVulkanDeviceContext *hwctx = ctx->hwctx; int graph_index, comp_index, tx_index, enc_index, dec_index; /* First get the number of queue families */ @@ -1182,9 +1187,9 @@ static int setup_queue_families(AVHWDeviceContext *ctx, VkDeviceCreateInfo *cd) */ static void vulkan_device_free(AVHWDeviceContext *ctx) { - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; - AVVulkanDeviceContext *hwctx = ctx->hwctx; if (hwctx->act_dev) vk->DestroyDevice(hwctx->act_dev, hwctx->alloc); @@ -1205,7 +1210,7 @@ static void vulkan_device_free(AVHWDeviceContext *ctx) static void vulkan_device_uninit(AVHWDeviceContext *ctx) { - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; for (uint32_t i = 0; i < p->nb_tot_qfs; i++) { pthread_mutex_destroy(p->qf_mutex[i]); @@ -1224,9 +1229,9 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, int err = 0; VkResult ret; AVDictionaryEntry *opt_d; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; - AVVulkanDeviceContext *hwctx = ctx->hwctx; /* * VkPhysicalDeviceVulkan12Features has a timelineSemaphore field, but @@ -1401,13 +1406,13 @@ end: static void lock_queue(AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index) { - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; pthread_mutex_lock(&p->qf_mutex[queue_family][index]); } static void unlock_queue(AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index) { - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; pthread_mutex_unlock(&p->qf_mutex[queue_family][index]); } @@ -1415,8 +1420,8 @@ static int vulkan_device_init(AVHWDeviceContext *ctx) { int err; uint32_t qf_num; - AVVulkanDeviceContext *hwctx = ctx->hwctx; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; VkQueueFamilyProperties *qf; int graph_index, comp_index, tx_index, enc_index, dec_index; @@ -1666,7 +1671,7 @@ static int vulkan_frames_get_constraints(AVHWDeviceContext *ctx, AVHWFramesConstraints *constraints) { int count = 0; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; for (enum AVPixelFormat i = 0; i < nb_vk_formats_list; i++) { count += vkfmt_from_pixfmt2(ctx, vk_formats_list[i].pixfmt, @@ -1713,9 +1718,9 @@ static int alloc_mem(AVHWDeviceContext *ctx, VkMemoryRequirements *req, { VkResult ret; int index = -1; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; FFVulkanFunctions *vk = &p->vkctx.vkfn; - AVVulkanDeviceContext *dev_hwctx = ctx->hwctx; + AVVulkanDeviceContext *dev_hwctx = &p->p; VkMemoryAllocateInfo alloc_info = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .pNext = alloc_extension, @@ -1803,8 +1808,8 @@ static void vulkan_free_internal(AVVkFrame *f) static void vulkan_frame_free(AVHWFramesContext *hwfc, AVVkFrame *f) { - AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = hwfc->device_ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; int nb_images = ff_vk_count_images(f); @@ -1840,12 +1845,11 @@ static int alloc_bind_mem(AVHWFramesContext *hwfc, AVVkFrame *f, int img_cnt = 0, err; VkResult ret; AVHWDeviceContext *ctx = hwfc->device_ctx; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; VkBindImageMemoryInfo bind_info[AV_NUM_DATA_POINTERS] = { { 0 } }; - AVVulkanDeviceContext *hwctx = ctx->hwctx; - while (f->img[img_cnt]) { int use_ded_mem; VkImageMemoryRequirementsInfo2 req_desc = { @@ -1916,7 +1920,7 @@ static int prepare_frame(AVHWFramesContext *hwfc, FFVkExecPool *ectx, AVVkFrame *frame, enum PrepMode pmode) { int err; - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = hwfc->device_ctx->hwctx; FFVulkanFunctions *vk = &p->vkctx.vkfn; VkImageMemoryBarrier2 img_bar[AV_NUM_DATA_POINTERS]; int nb_img_bar = 0; @@ -2020,9 +2024,9 @@ static int create_frame(AVHWFramesContext *hwfc, AVVkFrame **frame, VkResult ret; AVVulkanFramesContext *hwfc_vk = hwfc->hwctx; AVHWDeviceContext *ctx = hwfc->device_ctx; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; - AVVulkanDeviceContext *hwctx = ctx->hwctx; VkExportSemaphoreCreateInfo ext_sem_info = { .sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO, @@ -2126,8 +2130,8 @@ static void try_export_flags(AVHWFramesContext *hwfc, { VkResult ret; AVVulkanFramesContext *hwctx = hwfc->hwctx; - AVVulkanDeviceContext *dev_hwctx = hwfc->device_ctx->hwctx; - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = hwfc->device_ctx->hwctx; + AVVulkanDeviceContext *dev_hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; const VkImageDrmFormatModifierListCreateInfoEXT *drm_mod_info = @@ -2188,7 +2192,7 @@ static AVBufferRef *vulkan_pool_alloc(void *opaque, size_t size) AVBufferRef *avbuf = NULL; AVHWFramesContext *hwfc = opaque; AVVulkanFramesContext *hwctx = hwfc->hwctx; - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = hwfc->device_ctx->hwctx; VulkanFramesPriv *fp = hwfc->internal->priv; VkExternalMemoryHandleTypeFlags e = 0x0; VkExportMemoryAllocateInfo eminfo[AV_NUM_DATA_POINTERS]; @@ -2259,7 +2263,7 @@ static void unlock_frame(AVHWFramesContext *fc, AVVkFrame *vkf) static void vulkan_frames_uninit(AVHWFramesContext *hwfc) { - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = hwfc->device_ctx->hwctx; VulkanFramesPriv *fp = hwfc->internal->priv; if (fp->modifier_info) { @@ -2279,7 +2283,7 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc) AVVkFrame *f; AVVulkanFramesContext *hwctx = hwfc->hwctx; VulkanFramesPriv *fp = hwfc->internal->priv; - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = hwfc->device_ctx->hwctx; VkImageUsageFlagBits supported_usage; const struct FFVkFormatEntry *fmt; int disable_multiplane = p->disable_multiplane || @@ -2486,8 +2490,8 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f AVVkFrame *f; int bind_counts = 0; AVHWDeviceContext *ctx = hwfc->device_ctx; - AVVulkanDeviceContext *hwctx = ctx->hwctx; - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; VulkanFramesPriv *fp = hwfc->internal->priv; const AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor *)src->data[0]; @@ -2831,10 +2835,10 @@ static int vulkan_export_to_cuda(AVHWFramesContext *hwfc, AVVkFrame *dst_f; AVVkFrameInternal *dst_int; AVHWDeviceContext *ctx = hwfc->device_ctx; - AVVulkanDeviceContext *hwctx = ctx->hwctx; const int planes = av_pix_fmt_count_planes(hwfc->sw_format); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(hwfc->sw_format); - VulkanDevicePriv *p = ctx->internal->priv; + VulkanDevicePriv *p = ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; AVHWFramesContext *cuda_fc = (AVHWFramesContext*)cuda_hwfc->data; @@ -3087,7 +3091,7 @@ fail: static int vulkan_map_to(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) { - av_unused VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + av_unused VulkanDevicePriv *p = hwfc->device_ctx->hwctx; switch (src->format) { #if CONFIG_LIBDRM @@ -3139,10 +3143,10 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, int err = 0; VkResult ret; AVVkFrame *f = (AVVkFrame *)src->data[0]; - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = hwfc->device_ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; VulkanFramesPriv *fp = hwfc->internal->priv; - AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; AVVulkanFramesContext *hwfctx = hwfc->hwctx; const int planes = av_pix_fmt_count_planes(hwfc->sw_format); VkImageDrmFormatModifierPropertiesEXT drm_mod = { @@ -3274,7 +3278,7 @@ fail: static int vulkan_map_from(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) { - av_unused VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + av_unused VulkanDevicePriv *p = hwfc->device_ctx->hwctx; switch (dst->format) { #if CONFIG_LIBDRM @@ -3314,7 +3318,7 @@ static int transfer_image_buf(AVHWFramesContext *hwfc, AVFrame *f, int err; AVVkFrame *frame = (AVVkFrame *)f->data[0]; VulkanFramesPriv *fp = hwfc->internal->priv; - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = hwfc->device_ctx->hwctx; FFVulkanFunctions *vk = &p->vkctx.vkfn; VkImageMemoryBarrier2 img_bar[AV_NUM_DATA_POINTERS]; int nb_img_bar = 0; @@ -3406,8 +3410,8 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf, int err = 0; VkResult ret; AVHWDeviceContext *dev_ctx = hwfc->device_ctx; - AVVulkanDeviceContext *hwctx = dev_ctx->hwctx; - VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + VulkanDevicePriv *p = dev_ctx->hwctx; + AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; AVFrame tmp; @@ -3546,7 +3550,7 @@ end: static int vulkan_transfer_data_to(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src) { - av_unused VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + av_unused VulkanDevicePriv *p = hwfc->device_ctx->hwctx; switch (src->format) { #if CONFIG_CUDA @@ -3663,7 +3667,7 @@ fail: static int vulkan_transfer_data_from(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src) { - av_unused VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; + av_unused VulkanDevicePriv *p = hwfc->device_ctx->hwctx; switch (dst->format) { #if CONFIG_CUDA @@ -3718,8 +3722,7 @@ const HWContextType ff_hwcontext_type_vulkan = { .type = AV_HWDEVICE_TYPE_VULKAN, .name = "Vulkan", - .device_hwctx_size = sizeof(AVVulkanDeviceContext), - .device_priv_size = sizeof(VulkanDevicePriv), + .device_hwctx_size = sizeof(VulkanDevicePriv), .frames_hwctx_size = sizeof(AVVulkanFramesContext), .frames_priv_size = sizeof(VulkanFramesPriv), From patchwork Mon Feb 12 00:03:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46198 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402040pzc; Sun, 11 Feb 2024 16:02:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU7aNLbJuNBrk46z//oMSqClU1M2salV3oVzbfDFb0RAlF8YT3MALM/9JTxkLtcuNJpwOoVZjmxVAqdNTbfFXCD2iduGB98HG8BBg== X-Google-Smtp-Source: AGHT+IH/fLzmQRc+aVgUmweVkQzSqbh17b/ov1hNhMnig5jsMW1Kr5G4+n1dY3OK6YRuJDq8Yiu8 X-Received: by 2002:a2e:a0cc:0:b0:2d0:ce72:570b with SMTP id f12-20020a2ea0cc000000b002d0ce72570bmr2944480ljm.48.1707696147640; Sun, 11 Feb 2024 16:02:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX8FvRbmYx6TZW+4bsl0tV/H4EhUQZ/mcevqvvtx5argWQILjjY9FmqN+lOD5fU4GPjInUbVII3PUU5M+DhVbV8oJLiFj3ug/p87i6v3oS9ggeTend7by5OKjDWAziAxLW31oL1xmeKNl/Iu50gkiNEUzzkAaEfFzSKyE5E2maicHpR+3PRRPJ/qxsTM9/oASaqoTH7e9P7QWIbjTfpya44sVZa+Zvu7pWluQxV/b7WBZnhVfS604P94xKCAhH/sqC/Ljqu1KF2Untlhny9+leVTRiylggjiiHK9r6gnjZ+f3rMM5NxR0t2YbXamC/+Arsz4J0OHn20p9To06COLDleDX61s3Jx0PTyGOdF9IPARUOVNEqWjurNbTHxml0bJZAWbDEdzqeZFR8iICWa7pYmAddTk4wy5qvi59tGHwcvGzDE64x9C++yFAzPo+HdD3Av5IRQFaLDDtVAgp4soHmd+R1JcAl1YwpW8JZQUVKKKpsD3yTEE2I1kwSe7w4ulZbnfX6u5JBAL5upyUr1TaLP1HuP6kFTOoQ4GV2i4jTn1nV+9qIbp2jw5ZHQAsY1fQWxEyESFI9iqDLyD6KDaCPb8WTBRJZuz+uNPSOzEpp+z+69jLvBVrvHwLrFv3vTO5G8j/0imlS5avz/dCABlPCoFCDiE0BvxazDaaUUzB0t0eRuMxUQCVExD8QlZ52etcZUJC88t2F4aA+kRAMN9LzbcXvcUsYo8X3WQ3frgrL1ioYsa3aY8pVW5JVmtAe2EmKhoXbX9MVml4eM563NVhWHycutBtkAPXVyWAJxgkEHI3od320JduJUZM2GzAWUFaWKp8ZPYbgzT8m/FyUfdITwFfegJC4oND/qLyLBsjp60gNK6mgSongI4NU4IiKuEljIOC9XAD8SjE1aDIlEOpp4RFQ4RThwdIaXOFebKzWcalu4/vlqyksrak1b5aH9FHTYV1 +PByRC7+H+zU4yeJ0F4510P4fUZFp6LMM0sbu3ILSf297UQsvzdXHkrXZ0LIisI4zUh8UBvJyfDaNRg8XryDJvCKfV5XiVl3KaOXIW9fk0VfH++fni21W1dsilesIONKqkleDUDtuXCSimQ728qGONL8Xa0jYhVHy4k4RdPpXt6MScgsucEJYireUBL0D4vjqWc+yibwIeposcg3TEZMSAxc+xmMENe+F7/0nbmO/eZeKOT8cNYvHTnfkDJz6NrnUWshglXCD23wGoUi1ro5S6syLTLcUGD4jIdulWY+2dXmiVKcMUuoR6EadOrkmZnGqbcE30JcSLfVzs/j5SEVQXJv5s+wzcrRB6f1nJHhI2+HYsfJcoGfVVzKH2uL/RM6pn5kZItAEtb1kFQk/mzudc1nKDRfiNEQGLQ9e1BXtNXoYDLr08ePM9z/7Ur3o4xGKHsKSexQ9TnCa+oF2hJHzp68zYOznHIoDYhpcLA5FtUdkPusy8lFW/cG+rNfMNBANHKMFiOn4xy3KIVya3oGh4XIub/cJ8QuJ4kCanPercqDSrB+nYWEHbhY0NBPyQGXotezPcGtDfC2jISZyGeZcyCKYPA1DSifFNxFe8VCwtsJbcKmpFJNQArArYGtE= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x22-20020aa7dad6000000b0056120916a5csi2249287eds.459.2024.02.11.16.02.27; Sun, 11 Feb 2024 16:02:27 -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=Ma7vxWuY; 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 C883968D139; Mon, 12 Feb 2024 02:02:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2089.outbound.protection.outlook.com [40.92.73.89]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2AE6768BF73 for ; Mon, 12 Feb 2024 02:02:22 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VqBSASjDH6k2TGxwafmn7f3VoLyIOLK8Mt7thJGaNJuqcyIGLHjjT/RdtE+8qJil1qX+d/p8NBoKds5TfIzc2Lw4+zmwT6TbRRY/bJbhU6RX3yBRlgFw0Hc4aOwU3IaW4WkaQW7SdjkqfnVzg7VBFZ+XPA6V85kCLAE5qikAP22ptlh9xk8W13ODIJADvfDLHFCp8bPkfk3dprOdLdNqrZ7DyKYsYQi4P226Ea92XgChM9m2JhyrveR5+DPjEquqlUjNdZ96IlO49la2bhltmcJ3iYCV2wtZLfq2dS0vzg+tl88jOIGHuI85lj5Ot4dERruy6DFRAaNeStXvOTr6Xg== 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=LbvtNyEkCsCwkmk9lGiV3yj4TZm1rwcFjMNH2LggpsM=; b=TVGIPDxXcAGLxJXpWP9aU1+Hcvn5IWNdsZtyAYJm7c4LXhBYSflYHXXS9ASqKz6nl+B/GjBAacpc1GZv+uTUEVsU60bN/fXPJJDpm7VVaY+0y992oviXQ/jnmVSDcGRgAx/oBi/LK4RGpXqLlbg1pwwS9P53bVIqvXxWIa/1Zxes0GgK3+TAcL2AaVR0/rLVqLNgWkY0LC/P668dTnJdkPqeN6tZDORbGD1+/5FwL23sGaoJEPNL/2E+0eXHT6XfNvMyCsrrtlcKPYhT+CFi0gVldAPOnxQlV29ip5Tuzy2nV6JCBHdMTCv897gtqAdH2PLsP79pUdNgLm/jCx4QwA== 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=LbvtNyEkCsCwkmk9lGiV3yj4TZm1rwcFjMNH2LggpsM=; b=Ma7vxWuYnSSEbP+9YTGc4XFltKUpHn0c4SlB/Ah5DXS56sjuLyVrGMYiSb9il33uhLyfZx2PesG0G3xiC2jbVHSBzsqS/9myX++2G41UCS+vZgYI2cdMXlQWpF5u09WGHQvIpuujmfLalyJ4+ZiM+9zw0nnDx8U8ynpwbGDM9JVVNISfxGZboCtomTzupsJ96jQYoMk2+SnsoVhWGLscCta6lndOFYBLlFneNJ8dKK8TTLgZ12yx9478gRVcGJ8JyTPFZramGD6SPT3dqW/DjDS2rxXjrTgeBpA4s79cN8IMaNlPsuf/KGKBK6yyjgD0YIOus5VJFEs6rjJ+PU7Lsg== 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:21 +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:21 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:17 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [uyQcfDNf8cHNlquus6zO5C2uwbtigGEgFrmYLY9YROA=] 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-4-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: 17a98321-b8a3-4bef-33e9-08dc2b5de279 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZlvR3ePBoigAG+XoNuI0ci4HHsMPlqiFRwd5KRwH0OxolusGYLSO1cs54VzZnUAUwBhDZYTK9Z3z3G26G3qCPWE7L2bkU5MWGDr/HOuzDVHITFy8SwdhWEw5hKQNYxRmu3ChGgG8f6nbTXxFJHN6yWxZ8/suv9HR17fWofK6wLGynTlggM1ub0W40UqRFeBavzECu2MZ8GobIH1tNO/3m8R7yUxXs6iQ1yunT7TSXgJOBMEuLhCvHkK4GMopdmgfUhfdUz9EPI+sTzxps2IsLqt5apAc07mh6g7XwA1zEiBkov00BOxArRqS5XRKREUF6IjuXfMcU3KNbnzyPM/iqD4M0RPgBNzbno19m00F31nOsb87QqRixxsDU+NjZLQ386NlgP/ToCGj+WtW+K4Xm3TY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GLMkujfdn1eUHcSS0/WkO1PcxJjcIhqxzvy7U9YzKg05KOhyVRlSABact/xfQWvrZH+YkjAzYs0aRle6gsboOBXD9oqPlWmbWaoLvn6j0bsMPjG2x3G4txVUbO3Eyo0wfYYkY+WANcYzMf1OJv2mPXLTmcn2GE/NArh3QEYAN81EtrErhDX9UiCYh20mlB8/LpMExxNc8BlyvX9CWPdwxmHiu/K5zGxGKv+w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17a98321-b8a3-4bef-33e9-08dc2b5de279 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:21.3528 (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 05/23] avutil/hwcontext_qsv: Allocate public 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: TA/twl1I4ZjD This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to QSVDeviceContext as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_qsv.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index a67552b5ac..99d974f25f 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -70,6 +70,11 @@ typedef struct QSVDevicePriv { } QSVDevicePriv; typedef struct QSVDeviceContext { + /** + * The public AVQSVDeviceContext. See hwcontext_qsv.h for it. + */ + AVQSVDeviceContext p; + mfxHDL handle; mfxHandleType handle_type; mfxVersion ver; @@ -268,8 +273,8 @@ static int qsv_fill_border(AVFrame *dst, const AVFrame *src) static int qsv_device_init(AVHWDeviceContext *ctx) { - AVQSVDeviceContext *hwctx = ctx->hwctx; - QSVDeviceContext *s = ctx->internal->priv; + QSVDeviceContext *s = ctx->hwctx; + AVQSVDeviceContext *hwctx = &s->p; int hw_handle_supported = 0; mfxHandleType handle_type; enum AVHWDeviceType device_type; @@ -378,7 +383,7 @@ static int qsv_init_child_ctx(AVHWFramesContext *ctx) { AVQSVFramesContext *hwctx = ctx->hwctx; QSVFramesContext *s = ctx->internal->priv; - QSVDeviceContext *device_priv = ctx->device_ctx->internal->priv; + QSVDeviceContext *device_priv = ctx->device_ctx->hwctx; AVBufferRef *child_device_ref = NULL; AVBufferRef *child_frames_ref = NULL; @@ -1108,7 +1113,8 @@ static int qsv_init_internal_session(AVHWFramesContext *ctx, mfxSession *session, int upload) { AVQSVFramesContext *frames_hwctx = ctx->hwctx; - QSVDeviceContext *device_priv = ctx->device_ctx->internal->priv; + QSVDeviceContext *device_priv = ctx->device_ctx->hwctx; + AVQSVDeviceContext *hwctx = &device_priv->p; int opaque = 0; mfxFrameAllocator frame_allocator = { @@ -1123,7 +1129,6 @@ static int qsv_init_internal_session(AVHWFramesContext *ctx, mfxVideoParam par; mfxStatus err; int ret = AVERROR_UNKNOWN; - AVQSVDeviceContext *hwctx = ctx->device_ctx->hwctx; /* hwctx->loader is non-NULL for oneVPL user and NULL for non-oneVPL user */ void **loader = &hwctx->loader; @@ -2246,8 +2251,7 @@ const HWContextType ff_hwcontext_type_qsv = { .type = AV_HWDEVICE_TYPE_QSV, .name = "QSV", - .device_hwctx_size = sizeof(AVQSVDeviceContext), - .device_priv_size = sizeof(QSVDeviceContext), + .device_hwctx_size = sizeof(QSVDeviceContext), .frames_hwctx_size = sizeof(AVQSVFramesContext), .frames_priv_size = sizeof(QSVFramesContext), From patchwork Mon Feb 12 00:03:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46199 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402123pzc; Sun, 11 Feb 2024 16:02:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoTVgBbA2SCEYbXirzyjQyrcgY4BiXKkUxPADQBoY6ggTvTq+w+TV8wx7E+QwDGZWkj7Fb X-Received: by 2002:ac2:4c07:0:b0:511:5569:680d with SMTP id t7-20020ac24c07000000b005115569680dmr3752414lfq.22.1707696156829; Sun, 11 Feb 2024 16:02:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXPMIFOaJMeARz1ymdsxw5AMz6gBTrnr+KjBxM8RaFLm/tI5jYJpotVeTNtQaIos0aq0wuu/T9PXu88AOC25DGRGyeWd0szDPImjbVPuFnpYF4tqTyHFNTJ3/6HGJoX1386ImRGSISarMXnp8KtjShu107XwrSoHNqnMqVZHCGQcr53dMMCzIIDkRDpLYk1XQOyUoEt5RzcejgCnmz7RLTqShdtAngyYYy1QTuQ3qsEbC8y3Jyk7ArlG4aCdstVDygVCtbWg04mb5ongmRMksEW6fTzJRGz+WwvNb0glnkGgxR3cHAX4jjueiMgsUFBiHHtaiLtuuWh3PzNDIWKC3GtjxyX0hHGSayK+xJPZubv+iR+EDI6oDHQVYKpUSt3WfeFoxQehlEraP9y80U9YEmfkisScdUycbb0qOGLb5SNQd+gby/v2ePfcBQaxe8MbRJbjaU2sthDx81U0CTydD45H5jkAtCL86EOFq0HUvseGO6UQi7yniLL69tcsx6O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lah6Of Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id mf11-20020a170906cb8b00b00a3c00c8f229si2702773ejb.80.2024.02.11.16.02.36; Sun, 11 Feb 2024 16:02:36 -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=e2B9IwXo; 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 C9D7768D137; Mon, 12 Feb 2024 02:02:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2019.outbound.protection.outlook.com [40.92.73.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3362068CC85 for ; Mon, 12 Feb 2024 02:02:25 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UYCbKXB+4H+phHgN0b3eqvbzxRpm2aApMv0v78efJNPuT56OfdXCElLvHG0o3tCIVcj3cvaH/a2RiA5Kqpud+bjjSQTAW2KHth5+zSWXTink97r5ORNSErA3wyuq/wplF0VbgnXz6foq10dbSzEL3l3MzsBL2GmBFa3sJNkIfoZUdFsli+LYyCHoyxfpdpdpVXRqYu/AJcD70ne/OCLNf+YxDfX4II/yHuVSaADGaIooV3ZPYDLqEldtNO+zAWd477uut/rKvHUsRtDByi/OyGiJL35QYkv8DXHsK9nAd8TBzvv2rJqlt3WuFm+9XyOqbfLYCs5nySMCZWj3zPrjQg== 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=3x5eUqtZiMONQIhlOA5aG1L84fabdoxFtzltPfOdjBI=; b=D1VgdLJ3LIqK/j2guY2dVNgDEDuEASa1QQHIIhn2kpB/vM3h35bVlxQWlAdGZg4HV4/oEwA0cRhiiRmvU7sgiPCgVhjQWPUPUsi51zi6j+toYB/peY3t+xVHV2OyS1/iLTIGCRRGXSXEIOv/TowfS81J2cq/NrEqDCGko5/hEwecAkJ9cZxQ7pOzNRku4py5rYwi6Lz1mOObGE6pxUOKLFgY3k9wuogd7PczjFKPGp5mzTlE5BqS/CjmMf+VBtqGlFAHIy0hU2lFqEejDMRx4eVn9aQHKskPVpsB/hx2aZ1oxndEtTQ9DtwcKq3BSVPwsezz+KzitBbH7kn0uujhUA== 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=3x5eUqtZiMONQIhlOA5aG1L84fabdoxFtzltPfOdjBI=; b=e2B9IwXo1CWRaokPuAFrjtOlOM7K0elQ6mLQDBjKVG5cyjqfxDzb35ifPkHE49C4NNgIod8s1Ts011BAmN7fsxYbJNqEJgOHsAuT2wGfi+/0DWyxNrGhvzNtYlvgeUDb0yHhJcSRRHp591udmKHl6CjGUXausgMTisPlSqCGkrG4S32GtJBeHPa4MH76MWKjUKEFsf/s8VH/RFUb31bh4/PBPekd0H1p+g7ZwLmbHgHXJvBEWb/UoLv8P8dbt7gUSvaSylMoCtd6sUmnzMsd1AEelDiNSIjdhztJbMJ6RUyDnCfZkuKK83iJ5Ym+VZKefKM5ZNzF3ViBpAd+rw/+IA== 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:24 +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:24 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:18 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [eb2b/x+GMHfK+3/tvx75VNUQajxfFu0fsgS1ePcVD5g=] 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-5-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: 4ae66cdb-ba20-4f85-4589-08dc2b5de437 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZMqDtUbVXlqbQjzPZSPZsn/5VOPUuB1enSJ0XhznULWsWupSjZCYoxyi31wclaRcE1CJKfEhqXnrJhZkhwXE6GNGhG0Osq73PeBlzzUWY0Ti9mXlujZqwXY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l8qh9sqRcoEyWUuVqHcbHv4BecPaeSs9Cf40KlHMA7F1pNvXaWQ/34nQbxM1YQnRnfxiAM9qhWDjfLJ88URp3KNtXbSBUIg4Bcivr+yE3B5uoCPVranqTxbmtdeGgdAGm7xvSKzcum3+M/X/B7E43pV2vY2PEjFFffREafvC32yUSwAVDWU6+c+I/wBrGq4rvBk18mmVu5pX2mXYCmFteeJCdvfOaFJMNkTIMTHskpSWKRVBfIiAJWtArZX830DuhFb77RB+qCBvBlDIoP763wVLxoXDD9368Q3SDnrJFRGI4NbprfISLVQIx044Jz0al9UF7+miF8RItnZSMgjZ3eVFj9srXuvFStbfEKeEOxgOYsYAG8Q4lIjVpG3ASlxupw49TH05JsdeHoqIr2xu2psejsfRgbtHeNSdSUdJR/viVtGg+XzL3k4hG/6rBd9zgdTnPyY5rAfX6Fp8LMrPz5L+4Z+z750KUhPjOHhdtqE6KLidmhlbrMnqEhdsoZOQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ae66cdb-ba20-4f85-4589-08dc2b5de437 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:24.2538 (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 06/23] avutil/hwcontext_vdpau: Allocate public 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: Hl9xgkyLkEzl This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VDPAUDeviceContext as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_vdpau.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c index 5b78e95529..016300db1e 100644 --- a/libavutil/hwcontext_vdpau.c +++ b/libavutil/hwcontext_vdpau.c @@ -83,6 +83,11 @@ static const struct { }; typedef struct VDPAUDeviceContext { + /** + * The public AVVDPAUDeviceContext. See hwcontext_vdpau.h for it. + */ + AVVDPAUDeviceContext p; + VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities *get_transfer_caps; VdpVideoSurfaceGetBitsYCbCr *get_data; VdpVideoSurfacePutBitsYCbCr *put_data; @@ -115,8 +120,8 @@ static int count_pixfmts(const VDPAUPixFmtMap *map) static int vdpau_init_pixmfts(AVHWDeviceContext *ctx) { - AVVDPAUDeviceContext *hwctx = ctx->hwctx; - VDPAUDeviceContext *priv = ctx->internal->priv; + VDPAUDeviceContext *priv = ctx->hwctx; + AVVDPAUDeviceContext *hwctx = &priv->p; int i; for (i = 0; i < FF_ARRAY_ELEMS(priv->pix_fmts); i++) { @@ -157,8 +162,8 @@ do { static int vdpau_device_init(AVHWDeviceContext *ctx) { - AVVDPAUDeviceContext *hwctx = ctx->hwctx; - VDPAUDeviceContext *priv = ctx->internal->priv; + VDPAUDeviceContext *priv = ctx->hwctx; + AVVDPAUDeviceContext *hwctx = &priv->p; VdpStatus err; int ret; @@ -180,7 +185,7 @@ static int vdpau_device_init(AVHWDeviceContext *ctx) static void vdpau_device_uninit(AVHWDeviceContext *ctx) { - VDPAUDeviceContext *priv = ctx->internal->priv; + VDPAUDeviceContext *priv = ctx->hwctx; int i; for (i = 0; i < FF_ARRAY_ELEMS(priv->pix_fmts); i++) @@ -191,7 +196,7 @@ static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints) { - VDPAUDeviceContext *priv = ctx->internal->priv; + VDPAUDeviceContext *priv = ctx->hwctx; int nb_sw_formats = 0; int i; @@ -219,7 +224,7 @@ static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx, static void vdpau_buffer_free(void *opaque, uint8_t *data) { AVHWFramesContext *ctx = opaque; - VDPAUDeviceContext *device_priv = ctx->device_ctx->internal->priv; + VDPAUDeviceContext *device_priv = ctx->device_ctx->hwctx; VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)data; device_priv->surf_destroy(surf); @@ -229,8 +234,8 @@ static AVBufferRef *vdpau_pool_alloc(void *opaque, size_t size) { AVHWFramesContext *ctx = opaque; VDPAUFramesContext *priv = ctx->internal->priv; - AVVDPAUDeviceContext *device_hwctx = ctx->device_ctx->hwctx; - VDPAUDeviceContext *device_priv = ctx->device_ctx->internal->priv; + VDPAUDeviceContext *device_priv = ctx->device_ctx->hwctx; + AVVDPAUDeviceContext *device_hwctx = &device_priv->p; AVBufferRef *ret; VdpVideoSurface surf; @@ -255,7 +260,7 @@ static AVBufferRef *vdpau_pool_alloc(void *opaque, size_t size) static int vdpau_frames_init(AVHWFramesContext *ctx) { - VDPAUDeviceContext *device_priv = ctx->device_ctx->internal->priv; + VDPAUDeviceContext *device_priv = ctx->device_ctx->hwctx; VDPAUFramesContext *priv = ctx->internal->priv; int i; @@ -508,8 +513,7 @@ const HWContextType ff_hwcontext_type_vdpau = { .type = AV_HWDEVICE_TYPE_VDPAU, .name = "VDPAU", - .device_hwctx_size = sizeof(AVVDPAUDeviceContext), - .device_priv_size = sizeof(VDPAUDeviceContext), + .device_hwctx_size = sizeof(VDPAUDeviceContext), .frames_priv_size = sizeof(VDPAUFramesContext), #if HAVE_VDPAU_X11 From patchwork Mon Feb 12 00:03:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46215 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp407567pzc; Sun, 11 Feb 2024 16:17:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IECv9FPHu7veHw4jWZREa/hOBS08/pqGxUQKEJftD3Tc7vcL9CUyvycv1veqqQrPwR3Vo3V X-Received: by 2002:a17:906:c411:b0:a38:551d:ff1d with SMTP id u17-20020a170906c41100b00a38551dff1dmr3975669ejz.73.1707697041687; Sun, 11 Feb 2024 16:17:21 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU1C1RXXj/ofcl2BjnTmJ4b3lsYg8j4wkPnsD5FDBlpD+Fr1OeSPDAkgO5PMAFN8kdWYMt+7v5M/HxzrVO/eh0R/TQ/QIKDP1e6gXbSB6JU914HVykTzc11uaxAlUqoW7QYGFCVY2tmM1vpRLhTrMHwFze3NGxHRSsok5SJ6wrtY56FjJLcM9dDUUyScnlRanlr/LWWCHjpqxt3fbq3AaVkD6IC8UF/VHExIlgM1IOVS11w8CAvU3BriSQZaEnNUpNoCCdHIuImJH+lAsFvt0s/1SYNIyemfRykEI5kPmpYbcoPTEb34W4yafOSo8In/4nRHDwH7Vg3LYUlQpYfLb1f9L2o8/Ahqf9ApAgfC6fpRN0jD2KwiBnPZBajq1mnwgO7sX8nYSo+xhmGswXIZwAqWen/Fr9dmecHryPgBXo9EyYoID8ngAArhAfQQbP5wAzhEofFJMeO6WUmrNA+vqhD/8ExB6Jxjky9o+vaiX+fLui8fDM1N5UePKrBAohv9GFYPSt4U9rnj/zt7uEnuxhCri2IzBKYHd8A3ilpRr5Tc4xWoHd58VdkCvEx5S65icDc13LHM5NSad9XA0g2lY7vOkI/+yhvtepydD6hzbn1Rn6bEQqRXD2L3W7ncggY7dzwXwNvyS2cU/UcHDwL6hYACXTWxHlQzSoFZV0ef8oVWfz+U4AUHHtbBb4suWMwiobp0/nqfiQiKMamPPxUfPtViASqkiN9POxbwoW/hOC+ozv+JhuvCVVt2jiZ6eXDUp701iOXUygTcG0WZnIk19ccr9DBCEK7GcZvBICDF3uV7tsofiBP2IkgqwdDcATzZUy2+zd2dsR6815cmgHdD6MdzDIKsqqOtGM77woyZgEjXkpnkro4KnZ5r+t6AFdI7s7NPMY4TsdlHWcjOJUlXUptTBYmpIMIhg6TVZPXwACVxGCEsZhtPu6s9zpvA3F5d4uYRu AtXyOOGJOexkgtKnAb2KoKtYo1q5V3ntugYKveXYthY0axzxqeaeY826n61Y9oMnlBqFgx9aeiaVXJPrnPv9oBSg46hI2SPzt4XOEDmwnPvbib3652tcNMJlDodf+DkIjD02KBJuYOWgm+EU5OEdngdiVzniDT+h4WMHpgOfPGjzTfjADrnvN/IwvofFgijcuvtmthlE3GFw3I10TKe71+Sass9L4QP+klyTJDDw8zAMOv6XExhcGc9AVxndqFbsEBourM6asu6cJtAruRkzb1xPzhutDrGG6RD9D4rMbm7/zWarrp6Cs7RNrDIaOMEfDUDjOA7Tf255RAs1pzbudGSDN6wuAd61/WOLfKHMAYPML0a2nBDWV0iz9UYlSyiwdD5xNsRPoAk5ZW2DhE88OuM60scHm4e2aRTUMoNiEh/4f/qJZ+HwtVQAt/n38GuXzklwwRx5Qx6DepGVZfraYWCvdObVzw7tu1gCLEzbTZnx02JzH2yJt2pPlA2XSiKlhrAyxxcKtHBD6VRAkz6hvWARXQIbzouqXmXLX147XOWsOt2jI3F+fykibw1bArPnvdkiodkuuKkvuRpF80vFECXQs6aEmBtjEDz5kDzT3hFxjTcyi9fcPZBaPkECMEYKdV Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id cb5-20020a170906a44500b00a3c3a28afd3si1878041ejb.616.2024.02.11.16.17.21; Sun, 11 Feb 2024 16:17:21 -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=K76oL+OI; 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 5469868D14B; Mon, 12 Feb 2024 02:17:19 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2089.outbound.protection.outlook.com [40.92.66.89]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7516468CF92 for ; Mon, 12 Feb 2024 02:17:12 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hjKRYpkhtQo4wl4OMRPVxXPwFCfqrk+b3LDolQnszAbXxYjEJ/pOQAb+xsbnpEjs2ixjxypGXyLCTMvaExlzZKlEjIIBHMXOA0ZxZ+HbP0I0FyxaxIWTq35aCzudt1PwmFG+Qj25yGYCXqz8Y1cyFpj3q1JbqRfj8RjNI750ioqSxVHF5cq+aTUgr4xZ5OjaqZqZdte4LLzhKoaW7ZLGn6lWsb3UmzRPAhyEUK3+Y+H6X40TjpfuadpjNVEVWBCBXuxCE6SyboWquJGWTtwGjPOiqj8CuFb3y4VCzs/Ew4CtKjU5LKq72/jgcnCvb9PPo1ka/HY8d9badskmED49kw== 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=05fL07DPzvLXs0zAzCf4eDl5XuKvbt3Qf7Rokd94/Nk=; b=Xj/SXRT68FcuxTDEEiVwlvsNtviviSytmj5OmmSNthMehzwL8vdyJteHpJ/EHIrSU5pxZOalkwXId0kx8gGTLOP/5clXjdCgdrLaHfDi5+5vT2UkQ/qB/KzYeDfdPJelAZY85wqZp8XUZ3VbrgbqMxI1vOmAlDaJaMgYoGJ0njke7ZaJukbsh6hbDORDScyCKHGVLoxPdSbeyAYt/9kfKz4+rV8yN0qiigurTErcl4mWJmzJ/t+4gvBmre+ey4Ws5eQxI6v03iS/ZytORJs/xSxujiWFYKp42bjs7GJIompmA3M3w4hAdrZuVMRcpYIAmKI9JozLIA6fEXfh5LuWyQ== 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=05fL07DPzvLXs0zAzCf4eDl5XuKvbt3Qf7Rokd94/Nk=; b=K76oL+OIX3a4xQcWVaapGdEbBabuQT5jV2puTzGi4ipfcunUDMe6nkTH17o4h/s02gWGbHLs0XHN61PAz8c6Znx2Q71fGVsF/2wpe4i4pH91NMvTjwLrG32EXkNbbjKD7P91EtPB9urQJQJHBuBMMxRTNLJCnX2tH2e/aDqCWXJcwn/EP7BA4IFi44gmTUo6JM9Uz5r1CxFvwVm/Zx+dQBpqJNk4chaiMWYR9m0hTDzLOlLehcpcFJsrVdDVp9sgQUDN4Bo6BvLy19jTmjHKUQh+NK+73jyAYhLqZK+LuFl9tCqsXRWNRRW8laoq8fHnSbznecBPTCnJMV6lk2xrvQ== 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:26 +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:26 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:19 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [0wlSzRIv0KUIap4BsqsRDwpFYMVGjITBmLaoQVwCGx4=] 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-6-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: 76b65316-e861-40cc-b132-08dc2b5de59b X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZMqDtUbVXlqasn6cfMx/BBt5oep8ZNiPVMHpY1yNbAfkVH9PMLikUi2QoeRpSSJKcuWRm8eJ+YL/sOGSHb8PpFFuosWXlkvSV7THub4Y+8g3mJGgEkWCR2F8C3PQfswdZsBvLncNzebzGCDK23AwtvHsvrt/5Nm6LLLowzaLP4RmS/7WkAC6DJBomlAHpgvdEL52/NjizA5Lb2tHo5CZepYIpRDFT3dvWb3vH3BCEbO9FfQzjCTU2nE5ktsC2m/yXk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0i0z26wYtvOg+eODQDimy/1o+Q8MS9ktW4cSeU0dRwGP+Hh4fVEe9myeL2NB9/x6Y67U17/c7WKdPW5rR7CK4lA016RosuJiQxZkDHRsvdSkBj7G8HQl1tRdlFMWfmrFq0s+Dt/35123K7QPnxlpZOuvjLNbEZSegFFcbM861OLDbODGesiyyspkUiC+cr2ihk5iVe+/Ex5Z7K0ibTuDzRU2i1cWH8e58vWVfA2gONWaYDakfyJR81fpcwAhqHZn4HgRmgCd7qr4/0WKHIYr4pluRPVUWClWDklxnNiJLXKF2UY6pzf6nuC5H/YYT0FF43k2O+riHAWXKkadXlyBbfAuQFCWc1cfkF7jnxnuv+LT+/9NvhBIxRXqdgRNYPPB0UJX6KYuoQR/VFJOUA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76b65316-e861-40cc-b132-08dc2b5de59b 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:26.6028 (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 07/23] avutil/hwcontext_opencl: 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: iJdZadPHnLXg This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to OpenCLDeviceContext as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_opencl.c | 50 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index c1764ed098..54c050ab40 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -80,6 +80,11 @@ extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf, typedef struct OpenCLDeviceContext { + /** + * The public AVOpenCLDeviceContext. See hwcontext_opencl.h for it. + */ + AVOpenCLDeviceContext p; + // Default command queue to use for transfer/mapping operations on // the device. If the user supplies one, this is a reference to it. // Otherwise, it is newly-created. @@ -276,8 +281,8 @@ static int opencl_check_device_extension(cl_device_id device_id, static av_unused int opencl_check_extension(AVHWDeviceContext *hwdev, const char *name) { - AVOpenCLDeviceContext *hwctx = hwdev->hwctx; - OpenCLDeviceContext *priv = hwdev->internal->priv; + OpenCLDeviceContext *priv = hwdev->hwctx; + AVOpenCLDeviceContext *hwctx = &priv->p; if (opencl_check_platform_extension(priv->platform_id, name)) { av_log(hwdev, AV_LOG_DEBUG, @@ -658,8 +663,8 @@ static int opencl_device_create(AVHWDeviceContext *hwdev, const char *device, static int opencl_device_init(AVHWDeviceContext *hwdev) { - AVOpenCLDeviceContext *hwctx = hwdev->hwctx; - OpenCLDeviceContext *priv = hwdev->internal->priv; + OpenCLDeviceContext *priv = hwdev->hwctx; + AVOpenCLDeviceContext *hwctx = &priv->p; cl_int cle; if (hwctx->command_queue) { @@ -894,7 +899,7 @@ static int opencl_device_init(AVHWDeviceContext *hwdev) static void opencl_device_uninit(AVHWDeviceContext *hwdev) { - OpenCLDeviceContext *priv = hwdev->internal->priv; + OpenCLDeviceContext *priv = hwdev->hwctx; cl_int cle; if (priv->command_queue) { @@ -1685,7 +1690,7 @@ fail: static int opencl_frames_init_command_queue(AVHWFramesContext *hwfc) { AVOpenCLFramesContext *hwctx = hwfc->hwctx; - OpenCLDeviceContext *devpriv = hwfc->device_ctx->internal->priv; + OpenCLDeviceContext *devpriv = hwfc->device_ctx->hwctx; OpenCLFramesContext *priv = hwfc->internal->priv; cl_int cle; @@ -2079,8 +2084,8 @@ static int opencl_map_from_drm_beignet(AVHWFramesContext *dst_fc, AVFrame *dst, const AVFrame *src, int flags) { - AVOpenCLDeviceContext *hwctx = dst_fc->device_ctx->hwctx; - OpenCLDeviceContext *priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *priv = dst_fc->device_ctx->hwctx; + AVOpenCLDeviceContext *hwctx = &priv->p; DRMBeignetToOpenCLMapping *mapping; const AVDRMFrameDescriptor *desc; cl_int cle; @@ -2211,7 +2216,7 @@ static void opencl_unmap_from_qsv(AVHWFramesContext *dst_fc, HWMapDescriptor *hwmap) { AVOpenCLFrameDescriptor *desc = hwmap->priv; - OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; OpenCLFramesContext *frames_priv = dst_fc->internal->priv; cl_event event; cl_int cle; @@ -2246,8 +2251,8 @@ static int opencl_map_from_qsv(AVHWFramesContext *dst_fc, AVFrame *dst, { AVHWFramesContext *src_fc = (AVHWFramesContext*)src->hw_frames_ctx->data; - AVOpenCLDeviceContext *dst_dev = dst_fc->device_ctx->hwctx; - OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; + AVOpenCLDeviceContext *dst_dev = &device_priv->p; OpenCLFramesContext *frames_priv = dst_fc->internal->priv; AVOpenCLFrameDescriptor *desc; VASurfaceID va_surface; @@ -2345,7 +2350,7 @@ static void opencl_unmap_from_dxva2(AVHWFramesContext *dst_fc, HWMapDescriptor *hwmap) { AVOpenCLFrameDescriptor *desc = hwmap->priv; - OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; OpenCLFramesContext *frames_priv = dst_fc->internal->priv; cl_event event; cl_int cle; @@ -2370,7 +2375,7 @@ static int opencl_map_from_dxva2(AVHWFramesContext *dst_fc, AVFrame *dst, AVHWFramesContext *src_fc = (AVHWFramesContext*)src->hw_frames_ctx->data; AVDXVA2FramesContext *src_hwctx = src_fc->hwctx; - OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; OpenCLFramesContext *frames_priv = dst_fc->internal->priv; AVOpenCLFrameDescriptor *desc; cl_event event; @@ -2431,9 +2436,9 @@ fail: static int opencl_frames_derive_from_dxva2(AVHWFramesContext *dst_fc, AVHWFramesContext *src_fc, int flags) { - AVOpenCLDeviceContext *dst_dev = dst_fc->device_ctx->hwctx; AVDXVA2FramesContext *src_hwctx = src_fc->hwctx; - OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; + AVOpenCLDeviceContext *dst_dev = &device_priv->p; OpenCLFramesContext *frames_priv = dst_fc->internal->priv; cl_mem_flags cl_flags; cl_int cle; @@ -2510,7 +2515,7 @@ static void opencl_unmap_from_d3d11(AVHWFramesContext *dst_fc, HWMapDescriptor *hwmap) { AVOpenCLFrameDescriptor *desc = hwmap->priv; - OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; OpenCLFramesContext *frames_priv = dst_fc->internal->priv; cl_event event; cl_int cle; @@ -2529,7 +2534,7 @@ static void opencl_unmap_from_d3d11(AVHWFramesContext *dst_fc, static int opencl_map_from_d3d11(AVHWFramesContext *dst_fc, AVFrame *dst, const AVFrame *src, int flags) { - OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; OpenCLFramesContext *frames_priv = dst_fc->internal->priv; AVOpenCLFrameDescriptor *desc; cl_event event; @@ -2587,9 +2592,9 @@ fail: static int opencl_frames_derive_from_d3d11(AVHWFramesContext *dst_fc, AVHWFramesContext *src_fc, int flags) { - AVOpenCLDeviceContext *dst_dev = dst_fc->device_ctx->hwctx; AVD3D11VAFramesContext *src_hwctx = src_fc->hwctx; - OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv; + OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; + AVOpenCLDeviceContext *dst_dev = &device_priv->p; OpenCLFramesContext *frames_priv = dst_fc->internal->priv; cl_mem_flags cl_flags; cl_int cle; @@ -2830,7 +2835,7 @@ static int opencl_map_from(AVHWFramesContext *hwfc, AVFrame *dst, static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) { - av_unused OpenCLDeviceContext *priv = hwfc->device_ctx->internal->priv; + av_unused OpenCLDeviceContext *priv = hwfc->device_ctx->hwctx; av_assert0(dst->format == AV_PIX_FMT_OPENCL); switch (src->format) { #if HAVE_OPENCL_DRM_BEIGNET @@ -2871,7 +2876,7 @@ static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame *dst, static int opencl_frames_derive_to(AVHWFramesContext *dst_fc, AVHWFramesContext *src_fc, int flags) { - av_unused OpenCLDeviceContext *priv = dst_fc->device_ctx->internal->priv; + av_unused OpenCLDeviceContext *priv = dst_fc->device_ctx->hwctx; switch (src_fc->device_ctx->type) { #if HAVE_OPENCL_DRM_BEIGNET case AV_HWDEVICE_TYPE_DRM: @@ -2932,8 +2937,7 @@ const HWContextType ff_hwcontext_type_opencl = { .type = AV_HWDEVICE_TYPE_OPENCL, .name = "OpenCL", - .device_hwctx_size = sizeof(AVOpenCLDeviceContext), - .device_priv_size = sizeof(OpenCLDeviceContext), + .device_hwctx_size = sizeof(OpenCLDeviceContext), .frames_hwctx_size = sizeof(AVOpenCLFramesContext), .frames_priv_size = sizeof(OpenCLFramesContext), 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/FA8ECYe01ICnrK4DLTEz5A7wMBCVbgdZFlH9h1sQ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y= 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+/ZtHcKFGwkz1WCFTQXFUZ1g6hVjTuXVH36y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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), From patchwork Mon Feb 12 00:03:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46201 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402274pzc; Sun, 11 Feb 2024 16:02:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV7OTskxm+znzvODslnw+sEnIAb8X8B2eiBw0+C86UaGDqXHPqDjEqU9neqUTteAkXJGozNT7zjrCg2N0xzf2X5mkXJbaQ8AjIUZQ== X-Google-Smtp-Source: AGHT+IGLF2CNvjkBkOE5RXvN38m39HGr9ZJaYeJNVEZSfJEE/ad8B/lNu4JGX1zUj0uewBU0KRdu X-Received: by 2002:a05:6402:28c9:b0:560:5c7b:ba5 with SMTP id ef9-20020a05640228c900b005605c7b0ba5mr7168030edb.19.1707696175095; Sun, 11 Feb 2024 16:02:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVFfg1NlHuKfp2Af0esu7JbMHP1fafhfGcTQEwf3ivm1hLdfnnQpaa5oQ9swOm3rluDd+g4ZA2Vwr2SOaUMHRldYzRoh2BLoQ55o3NpzIvnMV+SNm6IllHLAu2tB2bxfk6MuXDlZh8JM34f3egPh4kfewGI9xDwE78ZMM5HQex1adbcc6iGJSOvcRGRqZEvVRUutyKQ5otKn6Cew3SSgNz+0dOhXZOh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U6Wi7hMCcWNnwoHM8v94lqWtZKtMvotlbi1yunoprVCdxKkXP2bhKOEz1ikVD4f+r1pDYm15OrgqqilRjMDQO8MDRAYllQyWFO7KwbJ/klgwoEvDNCjjnneDGhKMlx7v6XMmxJq/oSqdO7LG4UQJCTujQP1CDV9jMokh97i+xlXAysXs3F0O2/2arWOROkNhnqh/OXOS8RE/iZmLlsLKj212DV3HbMsV2Q2my2doXgalxR3Ueolqa0hEd8Qgb9kjXVjAZKMwf/3xBfGsR5NRWMbFKZ7EbnN2Xnjiup/6TP5xTVlHBA1uOejDSVLW932hqm15PZ4O4 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b8-20020aa7c908000000b00561280dbb8asi2155536edt.289.2024.02.11.16.02.54; Sun, 11 Feb 2024 16:02:55 -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=ZGlPQ5Xh; 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 C0F5168D169; Mon, 12 Feb 2024 02:02:42 +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-am7eur03olkn2059.outbound.protection.outlook.com [40.92.59.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D19B368D130 for ; Mon, 12 Feb 2024 02:02:35 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=coHBpeRKJmbezeort152ICcxHYrBgFuH2iVaDCS0nbbXwtk3PesXZgAe7QH3QLAOo7803OWcVm6ulk+QgVE3aaaNYIw0QNyr8FWIS29VBaI/t/u6WG66QCM+d00/tHJegSXxn/vwOIQeLebqxoKpVb6qBQEgGHjO2CEaW818tv33JZOAVyhaprVgRLNK7vXIM2Sg0rky5LIo5wZZ9pF3EsQ3di6wCuRWwiRhX9RraSDygHM0UyLH1FvOC+emSTuFKiO13uO/nDcM8eOHeRBLWVmKBXR5Xbz1Hhl6xP5F2MukMOB2KCGXC5GNMjzdvsaClAC6+9Zt/jOjaijDQI+XmQ== 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=Jh7+2wd8ZDs5dZx3wUe7LS2S0jvsjAvorhgJUZ2ANac=; b=jQ3/7YmZEa5SOTssriFjpW+Pznq8g0NpwSqcgigGS+X83bYR5wSKt7L660NP9XhPjMIHO+egutdj8x/Ka+tvm7yCZ0FgXbS/p+b1Z6GSOso2Huu/aveWwI1j7r0ifk3a1u2Dx3xCZuwUkTF8YOmMTkMazcqle6vOfnMb9moLOZGb98yEfrXIr+c4Uf3I6nJZiJzMFJdqM48ANLJbdns32Dre5HOsIzJEWhOcSOLZynVXoUvnz5GKCZfegb4wu2pT4JsvgMM4qzN6XATjWEXyj9WMb0/gcD9KUO5t8Hrj7wnk7eM1cFub0z5iXtWsyUrJzIoTZc9oAlLGnyh04PpSsw== 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=Jh7+2wd8ZDs5dZx3wUe7LS2S0jvsjAvorhgJUZ2ANac=; b=ZGlPQ5XhLXVvESrbUxDoTGBPlcUkACURLLebM5irrbIClFxzZF/PGS9h/BePjRY2k1+JdLIEFc3oPQjLnsp1PmK7bapkMPTMpgeMCzn46KJjeylggEuLQVgVx5lwieuFNm0x/wOL0aMLeRIaBdrBYFAGfybD1QZqeWqo1L4udB7ozjWs2dfSmVHkOHMQ4GQ3AETsDKwpaQJu9mSL/yNM3B1dh6AxTVa4h0naQAmYOgjobVlHAgOZU6lYePTKdmo/rjc9sVlOPIeq2U63bMBkWe0n4zova/JPKzkq6/+P6Y0unH82Zj6uEwlTewyJN00AGHA73EFy4d+iyDXfnbXCxg== 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:34 +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:34 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:21 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [JXEIiIZl51WRbK1fZoj2YPfzODBBX/muG9e3dpx5+9s=] 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-8-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: 2a615317-684d-4461-ac27-08dc2b5dea5c X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZkxqMYEXwih1EpybtniBlX4mT9oezuAz3boa/4plBQXmmZyqnxLHzpvt88hSfVFd1ojmqelRJBlUdauiGmbHrzBksqITm3OBlHg0EmlMY/Glh72p4GqtxUyQOunWxcWyq/mzCHtcRgiwEjTkITErxvot6CsAhrNfKkCRPO6gTTKUgHEV7OTfqxqb+W2yhv4ld/GGBBR3Yzhp7R9jLniegOaN8ekVvuvjSFUsKUQPdupJS0540tdCWFMetJNjz90O6Szzf6nWMVQxE5yZmBOlOInOf58//ektwiJaWEmcjIGW11WcJ+l0rbYViM5Dlxswaid2EMbwL7R6L33/g+cY3O1IBnZfRq1JJ9QYuh3B3Mc8e6vyMrYnVA7aZIUhDa6UdOJhSDMryLPos3WxsDd/8jjlNeF2Ig6XaK3GODlItYXumRRVr87nFvueUJqaWMj8E6Zk2x0582q8B3OK0ctjnQs1hVjDA//wNIVKt6mHr9lnJgClK94Mippjbq7N+FWmNU6f3dRk8VIAgExmte8RYOEIoK5+Gu4mNSIDETAMv3J4MWP1VHWZqCLQ3wEVUFIyXklOc1bSik/qtz2PNMEjHLBfpBAG3G5HYFElGQplHv4ZEg1qI4WQhH5edydT+jn4O2nym6n/Yp5VF01l7jHS+Z1Hc+CKA6N60W5yN3u7vLlDou+m/0mGt+UXMT8D30ucX114oYt6wmw1R6TM1lUYyhMEjC/BcoXjTK0Jrtz2N4p8= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZE17XCbrKkBBv9lpnKJL+izi2aV866HvXNC6qvQNKZr8Z7lwwYrSj39JEP9dZ3KniLlmzvai2IHShnKyXyao4LfJ6Lq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ZHOHX1uzXKlRD/4n5NulUf2TcBi/Xczba0WVvxmklxTlTz67TBpaxix1WwIJ/n4cexJKWg6kuN6UzQnmB5urO+toEqmQ2Rs8nTtIBEDyXpzIn6hjfLeKH/R/GoS4MAdG+8R/s6bbPgv8avl7HzkTcVmhl8b8LqC88dowAMQwmiKYAeLVMwioii0jPTjC0JOkCfNmZ1LTXKn4ltMs8qVK1VaaTHhE8TAGzgGIRSBVIkq5L2kOICtgwFmp9ckxZkATFjW3RiA9cotH53vTffbgEzL4o1QdIKI/2+o89VaUOdRLMAJhdp7x7OMYO+fT7HMqPBoj5isrJz8qhkCiOM2RSlhP5adNPg9duG4HS6K4K81rGAAdCw1uA54bV2kvI4/rvL2ZUmVvBOtxtMYzeU55QtDJ8vC89viox3haVVJWojvupK+j77m4Q7THWVEt6t5TmNBNSkSOWyhc+pfsTb8LHPb/PxYAt0i6PDja4RxEYXNSh5DsLHSFgppCn/W0GyJlN+EPMKeidWCopN/leeveg6E7Slf7USwk/0fYoN2Kc+4rsaqfKbOxkyfxnDO2dIFLMbenHCGX8X5KgpBkD/9K3yGty7yzueYWlvQRdIXUUsmUJxWuDE34np6jQ57+96NrgnuO7FgwXkdYaWDi31iC9DbtPO18JWKovIe8W22edLKg36rbsUtO2EdcDhWamFTWZLHG9imaOcFMYL/tEvebi6KgSlkIL9EeGEacb/kBv6W9YevzjqKxLQ/wQlJp6OJYoV4CWQmdwbpbwsFK7hltJqglbNxlwlnPhi4lbqcHBogqUtyTzyPqBWKTz0+dMrIpazWpvj788yAfT9DjgVgBNqhSCNEg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a615317-684d-4461-ac27-08dc2b5dea5c 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:34.5919 (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 09/23] avutil/hwcontext: Remove unused AVHWDeviceInternal.priv 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: uPUx5FeDFlKp It is no longer used by any hwcontext, as they all allocate their private data together with their public data and access it via AVHWDeviceContext.hwctx. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext.c | 9 --------- libavutil/hwcontext_internal.h | 6 ------ 2 files changed, 15 deletions(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 63fc1a6a22..02e9668c31 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -139,7 +139,6 @@ static void hwdevice_ctx_free(void *opaque, uint8_t *data) av_buffer_unref(&ctx->internal->source_device); av_freep(&ctx->hwctx); - av_freep(&ctx->internal->priv); av_freep(&ctx->internal); av_freep(&ctx); } @@ -168,12 +167,6 @@ AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type) if (!ctx->internal) goto fail; - if (hw_type->device_priv_size) { - ctx->internal->priv = av_mallocz(hw_type->device_priv_size); - if (!ctx->internal->priv) - goto fail; - } - if (hw_type->device_hwctx_size) { ctx->hwctx = av_mallocz(hw_type->device_hwctx_size); if (!ctx->hwctx) @@ -194,8 +187,6 @@ AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type) return buf; fail: - if (ctx->internal) - av_freep(&ctx->internal->priv); av_freep(&ctx->internal); av_freep(&ctx->hwctx); av_freep(&ctx); diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h index 4df516ee6a..374c6dde2f 100644 --- a/libavutil/hwcontext_internal.h +++ b/libavutil/hwcontext_internal.h @@ -41,11 +41,6 @@ typedef struct HWContextType { * i.e. AVHWDeviceContext.hwctx */ size_t device_hwctx_size; - /** - * size of the private data, i.e. - * AVHWDeviceInternal.priv - */ - size_t device_priv_size; /** * Size of the hardware-specific device configuration. @@ -102,7 +97,6 @@ typedef struct HWContextType { struct AVHWDeviceInternal { const HWContextType *hw_type; - void *priv; /** * For a derived device, a reference to the original device From patchwork Mon Feb 12 00:03:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46202 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402334pzc; Sun, 11 Feb 2024 16:03:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWGTajT0ALmh7XuuEQXt3ExDk5vtiH8RCRpP1CfpxX59aXJvTUnNXNBKtP7PX/FtsNjR5mAmlGZPaixw3keqR626P6/IXK0hG5BMg== X-Google-Smtp-Source: AGHT+IHOd2Gp1kaJWMxrbwPcQ5uvMEIsOa0HOWKbTBy7/RCKh6WO0DDn12y2Uq4Xj+pjfa3iqht/ X-Received: by 2002:a17:907:c207:b0:a3b:b390:2257 with SMTP id ti7-20020a170907c20700b00a3bb3902257mr4324478ejc.2.1707696184502; Sun, 11 Feb 2024 16:03:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXyWNXfLqUylIAg9jVipG6q79oK40v9tRhWbNGTOxPamhkr+6/En8VG/85XDViUkeNAKwNVvgPuVEDrpaEAKqQgmPVCE/nm3+e/XfhPWiEKZrVHz5wMcx2R8N33K31a3A4bjIr+ncGX2CbDQK1YWOy6PE+LOZ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5O4XJ7skLwuN3HRSrKcQ7NXeLUvYaiyJD73yOAtpYPDFf5I/9N82sfoj2bh6khQ6QDbj6U+T6AoNimag1z7/BUbCHR9urN27bolyPkgOkSNv7uUo4ggVEF3UufnzDpK7sZ26KhhgnPEi/sqI7Q7F5tXjVHHsaXGjLiZe4ItxCfeM4WlR7955REjIci3exsVxKqsGln6u3UdY1Z56tAyFY3VQpmtmL/c4TQSf+crTfEkBFCv5FoITYdynijNrMfmbQ1+jO+p6Z+HpQ9+3BI2gFxfjlY1f3TFEHoJd9P4E/qoV4VUBoYQy/8cbMGaKGds0rF7/36+vfo Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ds22-20020a170907725600b00a3c22fa7588si2232956ejc.469.2024.02.11.16.03.04; Sun, 11 Feb 2024 16:03:04 -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=E6hZfjwf; 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 B2D4168D16B; Mon, 12 Feb 2024 02:02:43 +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-am7eur03olkn2059.outbound.protection.outlook.com [40.92.59.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0F66768D145 for ; Mon, 12 Feb 2024 02:02:40 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZnQTQQoZFZmEy7UCGqj3wmsmykz9rYpbaMk5d4uDjjW1ti8sgdlw3LJYUsadERrTFnrQ+hv85jNoNFNBsRfqrZZ24T+ZuQj+rSPdUY3WVz/q79pT8tAno9Mo8o26xU65zSbx3WpxUAWoCNNhJU+zAhYke9xQP97f7hgWYj2xGwHnZgbfh+gQxiT/cvCzLcncF3yreImyGnwnJ0ERbsMtBoXvgTpvpofLAp2jUJCcJzB2Q/8ciKWT2aH6YPj3LwRVSI4KRtAUoY9B2FfS0b/hodLlPD4lhF49A2pYi2PRF707tKbOGZyHg9sGWWlTAnimm82On86GNbY5fKVRvyoLlg== 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=CgsmnX8df1TU/dE+E8TXtujyQAItO78Yj7axXi+zw3g=; b=FrlLho0LH+DaUx1W6f3H0LTY5iJAQhxUYcTomxSrg32BdORIuTogzND92esXHTQRfNhwgkGAt4pJUJdrfnqABiQ8qle3rDTpiyXOhQgbNqUeRkRu98KbRexTp+HQXChMEmUlKILx6DSvkiFX/vdO7QI2Md2fPIq0ulEYGdE8anJJaEC+LpBGJcVwFA/vkI02T+Gcv9TdWzq5pnegz10cj1B0Gp5fBzm/B9wmYHybCSjUOFk3jp3kHgkop9/7UfshmS7/wln6WLhba7eyCvBMaJu1ejhxs5ssHxq4O6OZOoYOzQpkvvB3iaDiTrTd8YGq47X6LE0taXnnTl2zgSWb+g== 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=CgsmnX8df1TU/dE+E8TXtujyQAItO78Yj7axXi+zw3g=; b=E6hZfjwfgFgw8C6Bt5yo4eAsq5abQEGqy8DpukyquCAsZDwQDLh0AQrb2y8DbdV3qu++tVPmaJlFbaYzL5B53pQ4KTWFhSEf+LG8HSPgvWdIxLuLFBRrZc/mVahW8Pe+oBSjdWvzSe/d1Be73pSg/+Y1yVeiHRID5FWdP8T2MUXA2YzUzoQEPY13lmFkeHAegqFbYzVG3aLQVMvBAAgYcHeeodMQrRcj6LFuLKbPEdD15bI95GONSFcWpJ6nHn0YDvxkTFxzSoeSjCSrGqugEwpHbUPrdvF+G31W93rjBPdM2oNXT4cV6VskKdSsyJsHpmrwhXgOfRVrKa3cydg8kQ== 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:37 +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:37 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:22 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [KrAVtOmSMhIpah9mUpP0EqiibsSnMKaA3MFLRwJW+iQ=] 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-9-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: f6265646-2087-4116-a5da-08dc2b5debdc X-MS-Exchange-SLBlob-MailProps: quCBMN2EvO87oPFJ6NqZfVGd+0JvB+2cqVz8KqbD4GLWy42wyoOI0uEyE55ETG/19mqwetNt6oBnmJRkW0JESoxn7A7Mt+2B+k/4PDJbw7Vt3LvZCTp/qQ24S8lkHB8PGr0WvdRjB1YlHG+axxP5WEWjnsOD7BUlC9vUxkWk07Y3PD0U5RVc1vj9UUk9+hjdTf32rDs95g95bO3tn8Us3lGUUSOX2EyEn15CcmTcnCnMkA+cX8WuLVWmuK87IYw2HhrrpdzJtOahCWUXSfosLujMg9pzYBsx2Hi+cLVMoZlgipA3ILzfOFCjF35ihsxmH/Q+H2w/2ARrp3JQh18RVTUnHhEFN+QouSTVsFGFlkwVU0a6bd607aE3aXMiFnNZQFwq+tuzwBOLRGpFBz/HEOY4cX/ASehTfKLsFdTJNWEE5SjcYtzDWDGVC3uHsGI8CImp1Ghq3iF08EAg1oGcXtnN6tSV6o0VhHPjJqx9SdydW9TFqZSDSK9URZNkjvEA7nPZAiRgbwXAZ2BCgJRljJ5eyzoV1Vo2n6jfbsSDPThJIeknnjuG2RbtCqr6XK11jmWW6/adUJOVB0nM6zmOUgdqNoId8uiknbwUTqg+TktUWdfrjmlT3T4+68RNLCF/mxPmCeNmt1H2t1vYQg9brFU0M79tvxnWbwlcYeV4569z2Dd0LAlr94Km53e/qw836qMTNiHCQeRAAMpFgxL+0w== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G0lXV3NFtigCHUPwuXeto2m52JWeO/Sw6/TTsDPM3lryk5DCX5vJiJROnvkzWAnynFEYm0VX/6PaafdfKveKb/74ehy1hymS9Y3c9iNFkEIEVhBKwk87PRjA9MMX4WnYWCiEa/XOekyn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8rpW31Q8gm7Aj1Wm3YKM5WUbv/FLZUfQu+Eg7Sts1yYcAdKmEAhPBMbn/smJS2bkGOom+lCOAl33LlbXrOqGNOgtQ/qoOkmR1TskGwgzSIIGgfTDbKVndlyhz3qtDbU9k1rBcvQ21Gc3HqAYIdQU61+LBxoJgpg4xuW2/ek+qSlPoNAO6Rysz33UoY60GPYDNW/8N+m21cs7SohkKn3cYUSJaArvnUkztfuLdFdQhlddOUzHPoA8J5LkqblNiJDiqveUTmNYQKa50i3Tvc2eNvgyb+ouLjvxE7D4+5SCAcTjUfabCA0WZyEJsvs8ZTfOB8v99m6WpgWlVzFFt9Z61+kyDHU+pHxCmwhZFbgBXiyzW+E0lrlrAAmkJUxIE270fRfFfyPL49f+UOJq//0NiTBlfYo+3HMPxJzW61KUQPb7ghhKd1vykcrWe868it9KE1JZ25ASn2X1vJRrYlRmpk8Qok5F41ZatnG7qSaAsVFKgmA/9xiXTm29b2HLemh1uSHK3hJoUm7LaChoR4d/TMHwfwyMPk+8QW+vewYR3JkQEMeq92PY8w2oK8hvLg7QC98n/NsZ0M84LcXV1Ntv8fu8NfYzlT9Rpd0QjSzZjbRO9f2jHSgHRIBqrBzAIPQEhd7QApRc7tTCB6d8o+/jfDuA1FssmCZeM+EqZxjAu5ou8TypLfBXNltDCS7utekqXubqwEexWJGGaO63+FeYE5ZiKNfDlgfZJ7m8s5vkqEmYm+wwXU09RFxRnDytzcQBYnZ6stamrgYA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6265646-2087-4116-a5da-08dc2b5debdc 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:37.0513 (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 10/23] avutil/hwcontext: Allocate AVHWDevCtx jointly with its internals 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: byBfLjW7xTLG This is possible because the lifetime of these structures coincide. It has the advantage of allowing to remove the AVHWDeviceInternal from the public header; given that AVHWDeviceInternal.priv is no more, all accesses to it happen in hwcontext.c, so that this commit moves the joint structure there. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext.c | 102 ++++++++++++++++++--------------- libavutil/hwcontext.h | 8 --- libavutil/hwcontext_internal.h | 10 ---- 3 files changed, 57 insertions(+), 63 deletions(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 02e9668c31..c962c19f3e 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -84,6 +84,21 @@ static const char *const hw_type_names[] = { [AV_HWDEVICE_TYPE_VULKAN] = "vulkan", }; +typedef struct FFHWDeviceContext { + /** + * The public AVHWDeviceContext. See hwcontext.h for it. + */ + AVHWDeviceContext p; + + const HWContextType *hw_type; + + /** + * For a derived device, a reference to the original device + * context it was derived from. + */ + AVBufferRef *source_device; +} FFHWDeviceContext; + enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name) { int type; @@ -126,25 +141,26 @@ static const AVClass hwdevice_ctx_class = { static void hwdevice_ctx_free(void *opaque, uint8_t *data) { - AVHWDeviceContext *ctx = (AVHWDeviceContext*)data; + FFHWDeviceContext *ctxi = (FFHWDeviceContext*)data; + AVHWDeviceContext *ctx = &ctxi->p; /* uninit might still want access the hw context and the user * free() callback might destroy it, so uninit has to be called first */ - if (ctx->internal->hw_type->device_uninit) - ctx->internal->hw_type->device_uninit(ctx); + if (ctxi->hw_type->device_uninit) + ctxi->hw_type->device_uninit(ctx); if (ctx->free) ctx->free(ctx); - av_buffer_unref(&ctx->internal->source_device); + av_buffer_unref(&ctxi->source_device); av_freep(&ctx->hwctx); - av_freep(&ctx->internal); av_freep(&ctx); } AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type) { + FFHWDeviceContext *ctxi; AVHWDeviceContext *ctx; AVBufferRef *buf; const HWContextType *hw_type = NULL; @@ -159,13 +175,10 @@ AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type) if (!hw_type) return NULL; - ctx = av_mallocz(sizeof(*ctx)); - if (!ctx) + ctxi = av_mallocz(sizeof(*ctxi)); + if (!ctxi) return NULL; - - ctx->internal = av_mallocz(sizeof(*ctx->internal)); - if (!ctx->internal) - goto fail; + ctx = &ctxi->p; if (hw_type->device_hwctx_size) { ctx->hwctx = av_mallocz(hw_type->device_hwctx_size); @@ -182,12 +195,11 @@ AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type) ctx->type = type; ctx->av_class = &hwdevice_ctx_class; - ctx->internal->hw_type = hw_type; + ctxi->hw_type = hw_type; return buf; fail: - av_freep(&ctx->internal); av_freep(&ctx->hwctx); av_freep(&ctx); return NULL; @@ -195,19 +207,20 @@ fail: int av_hwdevice_ctx_init(AVBufferRef *ref) { - AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data; + FFHWDeviceContext *ctxi = (FFHWDeviceContext*)ref->data; + AVHWDeviceContext *ctx = &ctxi->p; int ret; - if (ctx->internal->hw_type->device_init) { - ret = ctx->internal->hw_type->device_init(ctx); + if (ctxi->hw_type->device_init) { + ret = ctxi->hw_type->device_init(ctx); if (ret < 0) goto fail; } return 0; fail: - if (ctx->internal->hw_type->device_uninit) - ctx->internal->hw_type->device_uninit(ctx); + if (ctxi->hw_type->device_uninit) + ctxi->hw_type->device_uninit(ctx); return ret; } @@ -242,8 +255,8 @@ static void hwframe_ctx_free(void *opaque, uint8_t *data) AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in) { - AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)device_ref_in->data; - const HWContextType *hw_type = device_ctx->internal->hw_type; + FFHWDeviceContext *device_ctx = (FFHWDeviceContext*)device_ref_in->data; + const HWContextType *hw_type = device_ctx->hw_type; AVHWFramesContext *ctx; AVBufferRef *buf, *device_ref = NULL; @@ -279,7 +292,7 @@ AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in) ctx->av_class = &hwframe_ctx_class; ctx->device_ref = device_ref; - ctx->device_ctx = device_ctx; + ctx->device_ctx = &device_ctx->p; ctx->format = AV_PIX_FMT_NONE; ctx->sw_format = AV_PIX_FMT_NONE; @@ -563,8 +576,8 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags) void *av_hwdevice_hwconfig_alloc(AVBufferRef *ref) { - AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data; - const HWContextType *hw_type = ctx->internal->hw_type; + FFHWDeviceContext *ctx = (FFHWDeviceContext*)ref->data; + const HWContextType *hw_type = ctx->hw_type; if (hw_type->device_hwconfig_size == 0) return NULL; @@ -575,8 +588,8 @@ void *av_hwdevice_hwconfig_alloc(AVBufferRef *ref) AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, const void *hwconfig) { - AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data; - const HWContextType *hw_type = ctx->internal->hw_type; + FFHWDeviceContext *ctx = (FFHWDeviceContext*)ref->data; + const HWContextType *hw_type = ctx->hw_type; AVHWFramesConstraints *constraints; if (!hw_type->frames_get_constraints) @@ -589,7 +602,7 @@ AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, constraints->min_width = constraints->min_height = 0; constraints->max_width = constraints->max_height = INT_MAX; - if (hw_type->frames_get_constraints(ctx, hwconfig, constraints) >= 0) { + if (hw_type->frames_get_constraints(&ctx->p, hwconfig, constraints) >= 0) { return constraints; } else { av_hwframe_constraints_free(&constraints); @@ -610,7 +623,7 @@ int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags) { AVBufferRef *device_ref = NULL; - AVHWDeviceContext *device_ctx; + FFHWDeviceContext *device_ctx; int ret = 0; device_ref = av_hwdevice_ctx_alloc(type); @@ -618,15 +631,15 @@ int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, ret = AVERROR(ENOMEM); goto fail; } - device_ctx = (AVHWDeviceContext*)device_ref->data; + device_ctx = (FFHWDeviceContext*)device_ref->data; - if (!device_ctx->internal->hw_type->device_create) { + if (!device_ctx->hw_type->device_create) { ret = AVERROR(ENOSYS); goto fail; } - ret = device_ctx->internal->hw_type->device_create(device_ctx, device, - opts, flags); + ret = device_ctx->hw_type->device_create(&device_ctx->p, device, + opts, flags); if (ret < 0) goto fail; @@ -648,13 +661,13 @@ int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ref_ptr, AVDictionary *options, int flags) { AVBufferRef *dst_ref = NULL, *tmp_ref; - AVHWDeviceContext *dst_ctx, *tmp_ctx; + FFHWDeviceContext *dst_ctx; int ret = 0; tmp_ref = src_ref; while (tmp_ref) { - tmp_ctx = (AVHWDeviceContext*)tmp_ref->data; - if (tmp_ctx->type == type) { + FFHWDeviceContext *tmp_ctx = (FFHWDeviceContext*)tmp_ref->data; + if (tmp_ctx->p.type == type) { dst_ref = av_buffer_ref(tmp_ref); if (!dst_ref) { ret = AVERROR(ENOMEM); @@ -662,7 +675,7 @@ int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ref_ptr, } goto done; } - tmp_ref = tmp_ctx->internal->source_device; + tmp_ref = tmp_ctx->source_device; } dst_ref = av_hwdevice_ctx_alloc(type); @@ -670,19 +683,18 @@ int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ref_ptr, ret = AVERROR(ENOMEM); goto fail; } - dst_ctx = (AVHWDeviceContext*)dst_ref->data; + dst_ctx = (FFHWDeviceContext*)dst_ref->data; tmp_ref = src_ref; while (tmp_ref) { - tmp_ctx = (AVHWDeviceContext*)tmp_ref->data; - if (dst_ctx->internal->hw_type->device_derive) { - ret = dst_ctx->internal->hw_type->device_derive(dst_ctx, - tmp_ctx, - options, - flags); + FFHWDeviceContext *tmp_ctx = (FFHWDeviceContext*)tmp_ref->data; + if (dst_ctx->hw_type->device_derive) { + ret = dst_ctx->hw_type->device_derive(&dst_ctx->p, + &tmp_ctx->p, + options, flags); if (ret == 0) { - dst_ctx->internal->source_device = av_buffer_ref(src_ref); - if (!dst_ctx->internal->source_device) { + dst_ctx->source_device = av_buffer_ref(src_ref); + if (!dst_ctx->source_device) { ret = AVERROR(ENOMEM); goto fail; } @@ -694,7 +706,7 @@ int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ref_ptr, if (ret != AVERROR(ENOSYS)) goto fail; } - tmp_ref = tmp_ctx->internal->source_device; + tmp_ref = tmp_ctx->source_device; } ret = AVERROR(ENOSYS); diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h index 2b33721a97..d91391294b 100644 --- a/libavutil/hwcontext.h +++ b/libavutil/hwcontext.h @@ -40,8 +40,6 @@ enum AVHWDeviceType { AV_HWDEVICE_TYPE_D3D12VA, }; -typedef struct AVHWDeviceInternal AVHWDeviceInternal; - /** * This struct aggregates all the (hardware/vendor-specific) "high-level" state, * i.e. state that is not tied to a concrete processing configuration. @@ -65,12 +63,6 @@ typedef struct AVHWDeviceContext { */ const AVClass *av_class; - /** - * Private data used internally by libavutil. Must not be accessed in any - * way by the caller. - */ - AVHWDeviceInternal *internal; - /** * This field identifies the underlying API used for hardware access. * diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h index 374c6dde2f..3745867283 100644 --- a/libavutil/hwcontext_internal.h +++ b/libavutil/hwcontext_internal.h @@ -95,16 +95,6 @@ typedef struct HWContextType { AVHWFramesContext *src_ctx, int flags); } HWContextType; -struct AVHWDeviceInternal { - const HWContextType *hw_type; - - /** - * For a derived device, a reference to the original device - * context it was derived from. - */ - AVBufferRef *source_device; -}; - struct AVHWFramesInternal { const HWContextType *hw_type; void *priv; From patchwork Mon Feb 12 00:03:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46203 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402383pzc; Sun, 11 Feb 2024 16:03:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9ziTPrBXqzmK42rJMrxaBuuRZlAiJCzuIIYewl/9aKdX+baq5kDwJlrT5ljREgjHgISri X-Received: by 2002:a05:6402:2051:b0:55f:fd36:6b3b with SMTP id bc17-20020a056402205100b0055ffd366b3bmr3944294edb.12.1707696193295; Sun, 11 Feb 2024 16:03:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUAkJ3jEeu2bT7gEjJY0WeUgDPjlxlJTIyfgVSD8JOEkna6P6tgmxbkAQWaSnSPwnFjxxR23RJVvy7593BVpqjGfq6z5nCH6v1ZhTWWmyEaJm9RzN6zigrMhvqRz26LIhXjCVmSJ/ylz6HXUpWmbqnzs7+BaVX7LgY+dqVZungXWWUpBSe6J05R/i5ThQVzv4iTS9R4SnkJCjwpaLpfHD8DIm0XXW25OtrqQK5JFDCcLOMq5zs6mOTblIkSXHVCEAWK8EsriDFi5FwLq5k1HTU8hmUBEV2j74AbvLTOtA8fP/CJPwLLtbOrukMfdxX4VHbP94bsuP3E+Hwj1q14PgGIdeqVb098NhJQhw6blVrEZhsrjpjJ4DxS2IXr/9wuTUz/DXjabp6XO9ud9eWej7sIC7xEQEzy46a3L4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IPV70fI1nXdPnK3Up0AGKV6bayZHFCP9TvZ45JOgflamMs67CNHeiPaAFS6lAPGi0q2vIbkEPFS7W7nrsp0WR9toAgahcGo9fsMYEVocXvD25MX+0 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i1-20020a056402054100b0055eba1df579si2113872edx.571.2024.02.11.16.03.12; Sun, 11 Feb 2024 16:03:13 -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=Jo2YARB0; 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 A5B1068D173; Mon, 12 Feb 2024 02:02:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2079.outbound.protection.outlook.com [40.92.73.79]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B86D068D14C for ; Mon, 12 Feb 2024 02:02:42 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CuLyUqCpICTECinY0lQZlbooDkVMhZAE5Mid5R0/B5ppWYZoOuSHTN6qjBviyk8qWWPPlLNd7uXAS1mZLni6jeSq5BiKBZKze6xQ9TeG25btzaoaxq2O459qVMu8dL+OVLA7qHV6XCdAec8v0Wj002IPilWVSGlsGjatKjiw8IucbyaKrZnqZ0/LPVHDBEWfCpzx/7V73ax9vpZJ9LzqpdCWM8kYGyHmswuVfI69evCdAvFm2ZncNLlMTSrX2+/qC0hY26k3BlKD65gglWdOJjt5eLWCr1ZZP1oaPUOMHzicdCHNxBHnaMieMW/lyJIKgomx6vd2SHBLjdjiw9zCzw== 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=WFmOBj9L8JNSAiZAoUDL5QmE0y1Yrh+f6iuaDZbVTVQ=; b=BS0dVZ/2tw/ofI2BBm+9HmDTpFuWrl0HH+pLtz2z2Z6HgQgixw8s3x2YPIkgfKhW90wtklIDam9iMhfUzI3ke8Zv+08Z+XK/dt0OC4pJGZWoya2y12jAuk1LxK7WzmmPhuq15DlASaUDzeSRdmMdIcOI85YTEr0O+nDYcUCn1ukdFj9+jYrRRvp6/h3XlP/2aYTxQkcUaFcJDXQhxE/iETiJZj2Cd917K7a3zIv5wQCh0rVRsOOhWgQ+yXTmXnkiiclqAhZWOs6ULXsYuYgOkbPSzpzgk4qzOv6u+xmjPV5hEjmyQfBAGBUYI4yLQh8UG0TFjRgjmQuZ8LdlWRcVag== 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=WFmOBj9L8JNSAiZAoUDL5QmE0y1Yrh+f6iuaDZbVTVQ=; b=Jo2YARB0z1A4A9ofg1lsdA+kuct+TNThU6KrtpD5La9AvrFzMV9HD1bWkxhLHLBhI5qFhxeTlaml7+EHWx1IGvbxZyq1+59ZZ6bjIHZFs59Hqf49vXUCrgZlLUV7D/vgOH5ZM8VUfw3U9FwPy/0P6mZJgGsQXLlGEgAlWsz6hAeM+Ff5YkSGjwaEpYHoULmTMaWY0TvqguH0EYU08l9Smhmd6xJCOB1OpVWRhYfwwUh0d+EROhJ6SpQCC9RrWqj2wj6nAj9/t46iV5/hUWpg9Y3MvtkZD+aTeaX/pdIg8ALNFf9fR7z3ZI5IdsmFTEtSlqK/5mse2uxTKK3NvbAQ+w== 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:41 +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:40 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:23 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [sRFveUtDJ0Uvp5c7rZHX7+PLv+1pK0Gr0yk5JchdQ/k=] 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-10-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: db03d81e-6d7a-446e-14db-08dc2b5dee1e X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0Hf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+mOun7clWDUXjBXOeGNV9U3VdnU1HnmCWMqeQaE0Ky96zOAQ4FhcaaJ4Udyx+8XMiwjHgH9hvqUjYdh7nmaXPh5ls0x0WVFpzfIWIjmyWvRUknGTlyBq6hQIiuYe2u0/ZuAPEIyFhTt3aiTl0M9CKo+e5ardpExEMTx+YVjh1SJXI0GpJtmL8gkc0WMEYOfYgmGKhENmg5o8ALEzJAOKdgXI3KDf3uL4uet8K1Z1dIS21UPhbpCGMSsWNT5jQjHhzoV1iYE808nOnqvfPP/+K63QI9ODeVDWPqXTsr/lj6d+C7Gd0SvjiuyeWd9AYkHsRFJpC0QzdyKJ7uhewYiqBdAsEwjOjrmsz/ENQz4tdn6nd9VtDs41QZ3fbjq3gEPNNPL12qgxBR6eirhfpaylxFzqvAF9G4+iVezudDK+ipAEFcrse/Pmwsk8G7qrv+myqpZ8B9Ww/CvoVmYVaN5fd+E+eTPRtn4rlGB7l+8PbF8faJ1GzJcidmD1MTp6DvC4piU08i1J93o5FD9Jug5SdrItYctPkuYAjZEXsKDf7NCzZqmtk0ncMddIQ7cnxTpBo0p84o0HozCwVwVQWyuETNTzVifny2nVCZIGhnfgGRqdFgXj+aJI+OHzr7QhBbFgcizBPXYjbfiDXLkur9vmzaxWYzU1xzdXXo/I9w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: db03d81e-6d7a-446e-14db-08dc2b5dee1e 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:40.8342 (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 11/23] avutil/hwcontext_vaapi: Allocate pub and priv frames 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: 8X5BxPIXWLwe This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VAAPIFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_vaapi.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 7019769f24..2c75f5f5b1 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -86,6 +86,11 @@ typedef struct VAAPIDeviceContext { } VAAPIDeviceContext; typedef struct VAAPIFramesContext { + /** + * The public AVVAAPIFramesContext. See hwcontext_vaapi.h for it. + */ + AVVAAPIFramesContext p; + // Surface attributes set at create time. VASurfaceAttrib *attributes; int nb_attributes; @@ -503,9 +508,9 @@ static void vaapi_buffer_free(void *opaque, uint8_t *data) static AVBufferRef *vaapi_pool_alloc(void *opaque, size_t size) { AVHWFramesContext *hwfc = opaque; - VAAPIFramesContext *ctx = hwfc->internal->priv; + VAAPIFramesContext *ctx = hwfc->hwctx; + AVVAAPIFramesContext *avfc = &ctx->p; AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx; - AVVAAPIFramesContext *avfc = hwfc->hwctx; VASurfaceID surface_id; VAStatus vas; AVBufferRef *ref; @@ -546,8 +551,8 @@ static AVBufferRef *vaapi_pool_alloc(void *opaque, size_t size) static int vaapi_frames_init(AVHWFramesContext *hwfc) { - AVVAAPIFramesContext *avfc = hwfc->hwctx; - VAAPIFramesContext *ctx = hwfc->internal->priv; + VAAPIFramesContext *ctx = hwfc->hwctx; + AVVAAPIFramesContext *avfc = &ctx->p; AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx; const VAAPIFormatDescriptor *desc; VAImageFormat *expected_format; @@ -698,8 +703,8 @@ fail: static void vaapi_frames_uninit(AVHWFramesContext *hwfc) { - AVVAAPIFramesContext *avfc = hwfc->hwctx; - VAAPIFramesContext *ctx = hwfc->internal->priv; + VAAPIFramesContext *ctx = hwfc->hwctx; + AVVAAPIFramesContext *avfc = &ctx->p; av_freep(&avfc->surface_ids); av_freep(&ctx->attributes); @@ -796,7 +801,7 @@ static int vaapi_map_frame(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) { AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx; - VAAPIFramesContext *ctx = hwfc->internal->priv; + VAAPIFramesContext *ctx = hwfc->hwctx; VASurfaceID surface_id; const VAAPIFormatDescriptor *desc; VAImageFormat *image_format; @@ -1075,7 +1080,7 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, const AVFrame *src, int flags) { #if VA_CHECK_VERSION(1, 1, 0) - VAAPIFramesContext *src_vafc = src_fc->internal->priv; + VAAPIFramesContext *src_vafc = src_fc->hwctx; int use_prime2; #else int k; @@ -2014,8 +2019,7 @@ const HWContextType ff_hwcontext_type_vaapi = { .device_hwctx_size = sizeof(VAAPIDeviceContext), .device_hwconfig_size = sizeof(AVVAAPIHWConfig), - .frames_hwctx_size = sizeof(AVVAAPIFramesContext), - .frames_priv_size = sizeof(VAAPIFramesContext), + .frames_hwctx_size = sizeof(VAAPIFramesContext), .device_create = &vaapi_device_create, .device_derive = &vaapi_device_derive, From patchwork Mon Feb 12 00:03:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46204 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402454pzc; Sun, 11 Feb 2024 16:03:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHyGi3YTtdmGSwZthJj9j9njCljlzhFL0x7WTyAoj6tC2UObcr8Ujslsy3iezd+/jlTHKWc X-Received: by 2002:aa7:db54:0:b0:560:4ee6:cf78 with SMTP id n20-20020aa7db54000000b005604ee6cf78mr4675318edt.31.1707696202234; Sun, 11 Feb 2024 16:03:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV9FCd+pkuHpyt7tZvxmjLlOl5gT9upipi5PBWzh+I9oLW0YcUnISHVhhbrXkCaZFmQjAuZqs+n/WjRigjQ6cWeO4MJDoHTz5R64YFCBoixrPrhTs68kGNOfnvSuOK9PH1KNWWpEk9IvOwLJ8Gpdf+qKSkM5M7Bu1yawrT1q6pFr20AhNajZjIzYhG0LApxf+F6iaJcZMyFX4NWb2LtR5+uMBEIiqtEMT2yZkbSPbvBCQAegHwHrn1dL+cRUUGqfjxkO7U2UpU8TZJ5wi1NgAfsNd4wE8pAilABWUL7G4Uib6VGhl8dZmaozeZ85EmkN02JQYmzrAr7J+2OeqxoGQnN3Z7ayL1I79EzuHJDGvqW/w/DrXvbJo53tKklOp7T0fUKSu5YcCX0ms82iNZvtGIfvzwEggkSfiVRAKjsQ/hKC9v2g4DRod5Reo0q+qUEgifQFtdR861L84vrN4NhgT5Ht3lwJ6EOoa8oXbBXe/Vs5rn3wi9PZgq9qHuGShpUZCSA2Q+F536f8ACBxNCWmWkt+FRVtua80cBEffxsykNaWs7WK8mhYg1BhXCyiRx+PsSIKjOGQ4alPUZ6jtVqljzBcKzDxQQm0JO+5CLczdGbZmi/OibyqAKp7sWIMjuKbnLrgS7tkNCIzP009Hpoo7GPjO31oQP7UTEXKXj2Uf0dDKBvjsKeAcShjzJGaXi/g9Op6RV0kDromg41Baz4+KVTSJPet5TczFj6XC7lj8axM7laXA7afYzpeWw+Q45JjldGKKFpFRGfI/q7hqhEYvLTpQraYMVPOqN7cHZs7Vg5c9RSDWuF99fliy1iEIucelpuTR5Mzv9SI7AleAnxVhFl4dwmCTAbyPF3GFhH9t7/YIxJziHVEtnVvtSb67nzhsgFOGLPiSIS5WycHKE1RLPwmBjyXkNXzv5z/uGMxeWMY9GNcooEngPR7FYe9tEu6ait5h /5qVVhxXthhQysrGVYal/+FKl1+mA99AsBcT78yE7mRV3YpLV91ffqgqUWc4J/4hvc8A42uHxUSVPiwH4FNgmuKkpAfbOwczFn9nk2qVDop0HNtths3VQd5IRNWbslTeD467h/E0IZCUJJ0dwu3Rr7lYWFVVraqNDQLpPvlWYNWKx09Q9dgjgjhrsy9sWArvjByQfYQMmniE6cJxnMp8NG+oc4USaOqT/xMvSALR8N9v3eFeB4EWCjyr+ukBkzOMTLmvS2TKf4ZSlvJpvIZBt0aKuG4XQisDYzwbYejBKbeIwiqrS5gfUhJOn3yVd/IpkWNMycwsAo90+O014arZh3tHJ5yIKqOgwsKVyIVnJQ4vG/ArcpUN6tItn+20vqbpoZlkKVu6o+QcdvY1uFGJd+5pBCMaNh6dden3YuyAZuqjJzf2boLdTB6i2d7HgtAOBavmRN9QPv3DnwvbVXKIR+o76qWvsOzCI43ExtBnpwES/3kASVMZTbKz4/PXOhCaWTw9jyjx7nKw0dVhnK+VSy6FL2qGF7a72IBusGpWBBNfME5OQFVjRKYDnLLQAb1YqsLHrf6xgONmnpxa/LNIRZb0rT5S4qmm7ukfy1cyvnAXU0O0a8jh+UN63Oo8A= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v25-20020aa7d9d9000000b005611242acf3si2232629eds.531.2024.02.11.16.03.21; Sun, 11 Feb 2024 16:03:22 -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=bXTA3uIB; 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 A539668D17F; Mon, 12 Feb 2024 02:02:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2093.outbound.protection.outlook.com [40.92.73.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F0A268D171 for ; Mon, 12 Feb 2024 02:02:44 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UTZGpgmNOTKKOq6eZAnVJiMEOf+9cUx7wAlzZtV4/tnLp0qx1UUNhEWeht/8eV0WhVsmzxs0oBjMPNUq82gCtBSI3dk/CEHZlQvK4S3RCGCS+XfI9HlydwHB1n7ecLe04N8q5+n/hugf+wnhjHBmA2EAUCmhY3Lj/KSpfg8GJi8DwfIyKLdoezMr98hAC+xTDWY4P/FTOp9DBkdsDBlkVRmsH2q6STH7OyMVlbMw/DTTuPbH+Xzt/Jee3RtS32pioT7FS1+xv1kjIYInK+9bsiGmAGt6TId/v1s6mS3WUtf82IbSfzhwfLTNO9Scyew1aqw1EkaXL0YaS2DC6ZdrZw== 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=2yuqbF6n9S7RHYz/ta1io3H7qOsActEJ6XjkkNZvWWA=; b=EDyK9cZ2aO/w1hoBvc7fOrJTjYHHOcz4SoiY4AeKvH+mFWEQsGe5+48m9EyJCeokRMBnnYgrHcguvLQh1VWdBQ87J0Uj5mSwZTECfRHUz4sBAGLwEFteqBtnCXkqkow9+g0QGy/hiPuhOIkcz3NVNCsNYFhgqO5tfyRMni0gBrPAVIaJQaKDhBA4fx/5a3U7/ay1gXSJiE5Y+vlbOOtnq30m1vFW1xPlk6gI3unenXjs1+zB/Lb3blH0cq2jtle12em9oTw19H19UWSaj+RfWcMXRjdceDr0ktFqMxMvh/DrBqeRxbCOzqk/0HQ5XUMGuE4OKV4H65ivZM9qiUN87g== 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=2yuqbF6n9S7RHYz/ta1io3H7qOsActEJ6XjkkNZvWWA=; b=bXTA3uIBoQidliSQHd5AkDQNNfbCCtoGR7tuimzi5nSJwHT78TyFaXr6j84207F64TbYF6S5qZyiwTzJ7KIptOtr0cnEid77sdiIs8tGB2YxBIiLLpKENwIOCmvzvi5FQVTaaZQbAMTG+qgY+mi8O9TrkuzIkA8KkcYGcKIuYwX42593XAB6bq0cKt02x1z1gWMBh+45zJM1RCi0MbKESdF/owOh3+d+tqsvbzBOybmE4H6xS0UV1Le91vRFX2uvEJhc5QPLy6z4OeDaMtw4V5wArtH73NScl1Fmpeb3ajFAWRmnaeiHBjkdv2xcQduOQqx7Of47fXUXynoMt8K9Og== 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:42 +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:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:24 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [JnTi0UoRm59RPGO5mcfTcBcxbkN6f7vPSwYno+Ax8xo=] 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-11-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: 8eafd965-63cb-49fc-1bfe-08dc2b5def09 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZMqDtUbVXlqasn6cfMx/BBt5oep8ZNiPVMHpY1yNbAfkVH9PMLikUi2QoeRpSSJKcuWRm8eJ+YL+Q8H0Y1c4DBKyC+xL7YUGZZ4UFOJyf2uSTpQSQPE8Gd5fVQRm08Yny9s20301AMEt81DVRYqK8VKW5cRjR+SCMbuhjl+kC90lsXHHcS+cebsQzSU0GvadGCfHjrokBwmLqNLXQZmbllysDbzOvIdT21QII8iGQpNphH4FtsAynVR7yTrf8+2R49zB/8KH12PRRPsufJmywydWL6yy4qZBXt2y357BYD5Dq66lcqcP+7YbbMNcrLScd+vgsAtcuQA/87Qvz433gO31XstAlEm44FxH4epA5ocGxDdyYe9dDBV8eEcdQ0U2hKhi0pG/eXcFJ0II3sqOr2NpKsq+h+kEx4D12iSEgeLyCbkzEDMmG+uuNQvSZeJzxWos3D3AOl7zDaiyNvPs6xUyH7LYQG/QBweUUTzXDlNNuPdZN0ivu46f/N3RPjZVhwNdaID7d6i02H2YmZvlGn8GMHYSImYVA45n/3mNrPHqjw+F5jJYEIotT+vgt08P/+No5zOf4+5afNquzJe0rPxIyOndAeorchIAueP6CFnTQalhIEWNIAlpp7V19iy5HluKhE/vJnDq4tY7QhswiV17zRI2x4OLDz5ZzGKzlBczpoe8JDuFpXXOe9VUP7HmXKrHxQULYDBIgOozsC73mXWESC4/yifdiKpgqmW9Qy1g= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jqWAxwAtymgslB02RqW6mwaCvmwaD0Zp8vMS7qvMLPYi4mj3peN76pWgMBaockq41AnH478a9KYNj/+ZVdGpzYtBBZzyL0x05NGB4ONUEvzkjokWL78WaeEgGdRtFhzCf6mq2KqxaKr3sABgSJ8mgORMdfkhr6AWvdbTTB0aEua9XQwrCtNSWfalIL7a5ThPHCGh++3/L5zmLTx8FQueN2MC1a4i/rrlew9U9n34ss5v+dC8YI8T2d48XXCKXfpt3jztPtSRL4DusNJyu3lM02qXXxauJ31bsQrOpTxm6Ji1TEGHejFBWd8aVJwvgSL8YFduLgBRw++d7KKVGaDqZRMcetaEfk3/1DNussWmgrOe8k7aSoUPyIeP0F+bDiHIuYJ7imbLiKpQ5N6MrIgNjYmZ2w6P2PBN8gk3BHAzw2XJha+Xnwp+qZnENTwOvpwPbufMLqxQpEjwq29VRfEhhXJzucvL+/ISPf8zo5IzHwByBzzWftmPYOTxxy2ParmhpTSOoU8E9r8j84VdTT/oxAEto4R59WF6NpPs/wLaWxXOZ/8i4qjKwIFHnsTTAVR4irgh37fhzUGnTTET1iO6kPB87gx0dnRp2sxABAlxgfP2nxyqjROPt7QSueqLPHXd X-MS-Exchange-AntiSpam-MessageData-Chunk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moTP1o/PzvvgGDy65y9LjZGCzVzbOfUmj1TnmV9tKBhPE3ketrYw1Np+Ll7dLRT1GBHzO9y+sLa5lcnM3cYJ8+p4HSQ6nR2d0oxbt9PUfPyyVLa+fMNCAXQf7OlOdh7teft4kkpYh3r2O6cx1PpHIt72rUmOku4cyjYvIcHXmAhoxAc8SW3FPedH+YBQtFnLzaMmq66Pu/nEOh4c8Xjx2sWBny48Vt9fzfDjE+fyp7R5vzkGPwpX+urw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8eafd965-63cb-49fc-1bfe-08dc2b5def09 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:42.3725 (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 12/23] avutil/hwcontext_vulkan: Allocate pub and priv frames 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: OBYAM+ZZd3VP This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VulkanFramesPriv as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_vulkan.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 3d591dedf9..449a6a2fef 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -129,6 +129,11 @@ typedef struct VulkanDevicePriv { } VulkanDevicePriv; typedef struct VulkanFramesPriv { + /** + * The public AVVulkanFramesContext. See hwcontext_vulkan.h for it. + */ + AVVulkanFramesContext p; + /* Image conversions */ FFVkExecPool compute_exec; @@ -2191,9 +2196,9 @@ static AVBufferRef *vulkan_pool_alloc(void *opaque, size_t size) AVVkFrame *f; AVBufferRef *avbuf = NULL; AVHWFramesContext *hwfc = opaque; - AVVulkanFramesContext *hwctx = hwfc->hwctx; VulkanDevicePriv *p = hwfc->device_ctx->hwctx; - VulkanFramesPriv *fp = hwfc->internal->priv; + VulkanFramesPriv *fp = hwfc->hwctx; + AVVulkanFramesContext *hwctx = &fp->p; VkExternalMemoryHandleTypeFlags e = 0x0; VkExportMemoryAllocateInfo eminfo[AV_NUM_DATA_POINTERS]; @@ -2264,7 +2269,7 @@ static void unlock_frame(AVHWFramesContext *fc, AVVkFrame *vkf) static void vulkan_frames_uninit(AVHWFramesContext *hwfc) { VulkanDevicePriv *p = hwfc->device_ctx->hwctx; - VulkanFramesPriv *fp = hwfc->internal->priv; + VulkanFramesPriv *fp = hwfc->hwctx; if (fp->modifier_info) { if (fp->modifier_info->pDrmFormatModifiers) @@ -2281,8 +2286,8 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc) { int err; AVVkFrame *f; - AVVulkanFramesContext *hwctx = hwfc->hwctx; - VulkanFramesPriv *fp = hwfc->internal->priv; + VulkanFramesPriv *fp = hwfc->hwctx; + AVVulkanFramesContext *hwctx = &fp->p; VulkanDevicePriv *p = hwfc->device_ctx->hwctx; VkImageUsageFlagBits supported_usage; const struct FFVkFormatEntry *fmt; @@ -2493,7 +2498,7 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f VulkanDevicePriv *p = ctx->hwctx; AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; - VulkanFramesPriv *fp = hwfc->internal->priv; + VulkanFramesPriv *fp = hwfc->hwctx; const AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor *)src->data[0]; VkBindImageMemoryInfo bind_info[AV_DRM_MAX_PLANES]; VkBindImagePlaneMemoryInfo plane_info[AV_DRM_MAX_PLANES]; @@ -3004,7 +3009,7 @@ static int vulkan_transfer_data_from_cuda(AVHWFramesContext *hwfc, CUcontext dummy; AVVkFrame *dst_f; AVVkFrameInternal *dst_int; - VulkanFramesPriv *fp = hwfc->internal->priv; + VulkanFramesPriv *fp = hwfc->hwctx; const int planes = av_pix_fmt_count_planes(hwfc->sw_format); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(hwfc->sw_format); @@ -3146,8 +3151,8 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, VulkanDevicePriv *p = hwfc->device_ctx->hwctx; AVVulkanDeviceContext *hwctx = &p->p; FFVulkanFunctions *vk = &p->vkctx.vkfn; - VulkanFramesPriv *fp = hwfc->internal->priv; - AVVulkanFramesContext *hwfctx = hwfc->hwctx; + VulkanFramesPriv *fp = hwfc->hwctx; + AVVulkanFramesContext *hwfctx = &fp->p; const int planes = av_pix_fmt_count_planes(hwfc->sw_format); VkImageDrmFormatModifierPropertiesEXT drm_mod = { .sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT, @@ -3317,7 +3322,7 @@ static int transfer_image_buf(AVHWFramesContext *hwfc, AVFrame *f, { int err; AVVkFrame *frame = (AVVkFrame *)f->data[0]; - VulkanFramesPriv *fp = hwfc->internal->priv; + VulkanFramesPriv *fp = hwfc->hwctx; VulkanDevicePriv *p = hwfc->device_ctx->hwctx; FFVulkanFunctions *vk = &p->vkctx.vkfn; VkImageMemoryBarrier2 img_bar[AV_NUM_DATA_POINTERS]; @@ -3580,7 +3585,7 @@ static int vulkan_transfer_data_to_cuda(AVHWFramesContext *hwfc, AVFrame *dst, CUcontext dummy; AVVkFrame *dst_f; AVVkFrameInternal *dst_int; - VulkanFramesPriv *fp = hwfc->internal->priv; + VulkanFramesPriv *fp = hwfc->hwctx; const int planes = av_pix_fmt_count_planes(hwfc->sw_format); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(hwfc->sw_format); @@ -3723,8 +3728,7 @@ const HWContextType ff_hwcontext_type_vulkan = { .name = "Vulkan", .device_hwctx_size = sizeof(VulkanDevicePriv), - .frames_hwctx_size = sizeof(AVVulkanFramesContext), - .frames_priv_size = sizeof(VulkanFramesPriv), + .frames_hwctx_size = sizeof(VulkanFramesPriv), .device_init = &vulkan_device_init, .device_uninit = &vulkan_device_uninit, From patchwork Mon Feb 12 00:03:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46205 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402513pzc; Sun, 11 Feb 2024 16:03:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVcXGcg+KKkN8mZ1Bm/uuGYKjby5362JD7SIcxPYyk2LTWDS9D08zzb2koFhR99CU+Hrcw/Ng22YViqTHU5E5gTfRtUBsZu2y9Puw== X-Google-Smtp-Source: AGHT+IEoI7d3i04lYdXvzXiluLSGqFDZ+1c0ryUmUhLS0RHGC9YcsAp6TGnxY3sy+hhhpMhUOBjR X-Received: by 2002:ac2:4c33:0:b0:511:551a:c330 with SMTP id u19-20020ac24c33000000b00511551ac330mr3960408lfq.16.1707696210172; Sun, 11 Feb 2024 16:03:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVyNdaGV7CEymdJODrNSuaLpuQ8fCEF34mzOdRkRe+TT7YV5vpgtNIQsUNGPSVinBtBSug7S/1JX9hox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MMGh+70Xx555iBgMkw3k6mQlEQyEljuw4ytkTOY/20vOd6DMFAsQe4nlGXgEIq/hc0SNiudQqa2JIDjQUnsfpBuFUg294iJKlbaY9hsPNvdcDEdr84qTxul12md7zvAGvgWWtUUpGZvnx9zWeUWDtH+NydBv8zYiRDNol5tZTrlB8SSMetuSOQPARJU71lakXGis059rRzdPcnZE7wuYHj7qZ8Muv3/8b/aUZkQEoW+uHwOaCq9Y/MvpbkPcTc1/+crp5vcMfFxDfYhVp6SsN2+MO40PdhcBNKRojb8GH8DqVzzZA2dINFbG0Lejk6/SK6XpXKpocXga6hpBMl+7Xc/EX2Koih6tnQK3OZCCGJY7MJuJpalp5XNBAFEDBnhTPxJCyRXPkPbtS3piEae42zwToBQ+t5+W2hoXVDU3PVUlyRrCPEk1PRJhwp Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hs38-20020a1709073ea600b00a3ca42032a7si346959ejc.106.2024.02.11.16.03.29; Sun, 11 Feb 2024 16:03:30 -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=WTIkX3KH; 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 CB48A68D1A1; Mon, 12 Feb 2024 02:02:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2051.outbound.protection.outlook.com [40.92.73.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0746B68D179 for ; Mon, 12 Feb 2024 02:02:45 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fX2H8c1dzbQOKzYrdazdvl4PxTJ/zJ+2y9fPhAAkKj4mWyfZP5O8/SvSyiM3lpCt8UYBTzpxEzaI4xKcl98/f+LSZhMAmNdqTjkSevKyyP+KB7T15A+CEC9o4io4kYIFVJPVk1UMOmuWHeWsXIT28enzTNaLB4tThnn05QqOaH3s0qBDjrTNlVHM+HHIgVxn8+Fk/ZXfkTPbRqsXL+y1OdpU9Y+XlKak9ipFEJ081SQbZ4t46wje7G+A4Q8G8kQEhaSGJGnLmX8Bn1DnPd/BpLxAYlltbVpVw5fc+/7HFgAdW+HRi0yuwDITBe2f+8LvrNRg2Eejn6kM+6BVaowmRA== 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=nM8+0l+qLTZdshHnAJ+9Sel/ZeCtTCqf1NgmZM/aH4o=; b=OPO7/HHOYsLBJYLi+V0gfy9BMOjEhQdkHOL0m7Sxahc9T5s9j2wNo18IglA8vdseZpV+uRJcgstHlMRrcfk2zcC+y01jkC2FeEGxqTzx+E46LHBfS723iXz6vfdPWH2a/SZTh8I2iGFg0HPvMoTvnf/HZh42zlc1q+HpX7GqAFrahGDWlkLCzURab0fUsJMlmKu1/Evd9ZNeL9CPRvdaf4njqBZWQH4MkyM+Bv6u6BcJYT2QL3OViekl0eqF1EoQOKJ2MR4ZcSNj5OAwS8cDgPvtmbRy4mzwWionD0zbn0MKGGZc/zfsqmMKzC3ApJbLsKvmHasaGYBO+schwx2WhA== 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=nM8+0l+qLTZdshHnAJ+9Sel/ZeCtTCqf1NgmZM/aH4o=; b=WTIkX3KHxmoDJvnU9JlJRsZVzbLUM2JeJqtj4ZpqvOCZTFzXW0PuTX+IyYhPGlrlrOB8z20ea0yLaaUR4prryLfVOtd/g91G5TQYsQbrOn16Qq+F7nQKvEi6gVRkpdjR1I881yV3onG9EIDMyA3csbogtiQl29k8rW2cP8hVDFXIUgXiwl92ZzwOmzy7sjpVtApfuWwcb3zBOKc/oUOi0pdOccT39a+o2FMj/4Rb4FkkUwsaaV1TVSEI7LBrIezkbKFPEmWAQKtVJF8oWg4ZnXzTRNWwOukXo92CQwZwNXbf60vticdjP6T+yfYciFwmReRM+2oTEwrvl9JQhLatSw== 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:44 +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:44 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:25 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [I4W+tQxnnxdF4acEY5xWCEAdI2NL7C1oWK2xZNYb9Ak=] 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-12-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: 0db76461-aa21-4408-24be-08dc2b5df027 X-MS-Exchange-SLBlob-MailProps: 9IecXKUgicARn8Y3S+OnDYbPol7RUrVJMTWUhJdZ0Yt8VDefcS9j4nCtqyzUZqIz++aqSIoAel5FVkCXIuttnUZPQ88qCNgjfI+zt1s2f+4pMmmSTGaASJTHf8+KA+umyEbBuCuujD6qLwERHWgAnVxj1QU0OKfV53kAwMBngjWXmczJ3pY8hUa+cfJqxM4UUNIWjsjjRJG2KUvHCg1Ctn/T80MvVRTBxSSjiECEWiroIpbZZavCqQCW+5gkQousF7D6tLL/iLc8OFf7sqIIaXFnk8RgM/JDRm2mzOpTKy249GObPi87H4ox+L6wrgT9r9ErW52MZzq0lsbLCg6O0ehhoiHkdhYW2NJ2an97CeU8SK/SGvpwUjA8qXQA61/nG0yHAaAKudvcw4GqruNNHjhCqqqb74hFKxB1+9231pjd4wBvWF0eDomKnh+OEePa4KDLdeXXiLpbikFuIqdnftCVLqUvNXOG8e6GxNsh3x7lhIJcVa/F1JUZIpN7tm6uLV4zkV2k6i+KHPehCJddUVY38PRBksat5LOhexoWWsUnmUyBgf4Dgi6+3B1YKL05933455LoKMmj77estpp43hc0Jb6sqlS6SYOTBqB1yx5mbYyJpLFxGk+WGXI728HoO7YbkFWh9B8nJ+g5HEaSINm4fxqelvX4XXfKYQQamLOLG3ytFerPXKjA8EEPlOyz4qwMyFHfBl8jLGHKikljztm8P0yDAJQ3W6RfT5bRCzmYey2Afyn+tA== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-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ah2Nd0DDCo7ngM/xr0HpJL38QAeeM8GGQKAREYWywGsNHUbKjYFzRJphwqjb+78BZADJmJQlYSDxJ449SNYqlGlRQ/BvfmgvTxUUXpu+GSahHZg37EZx8/Q4uAukNXc8vzfRpxRITUsyyDRO8JdH6WtjhLrlcujbAleuVrfGBfVgBNPELzxVUIkm6dZ977ENRG7Mvg1jFtFIWmJz/91F39bVGz+MN9NxWB7uKr3AbgofaGUoXTcfzLVj3TUQnqmdVsmhiZM3jtZJ7jI7LN2MiqwXIrqYj/+cuttRDrtp6T1mZSnprKjrnM/EUEyOeUFnmmcaeD24woUxZzYkv9r3uaAsoxDIiKRr3PlVH2pWHTeINtWso4U0nXC5Hdg48g1dL5ESMfEgUFF994Vv45JsNyKAl5iHisLViowXkcLqlJOxdenYIrSAJjG1yLAFUCuUZHEri6ADc5o/95IfpnzLlMj1es0MIQ0zvF/yUTEhlvlWKcpYC6YF5/k327Y4ASOpbz8eetASAOlyl0Oj+lywx1qKTvn51Yw8TbgIDk2ar16626+A62xDCvscztks+NaRyJ2EzUT/03/a/3a+Gz3gQdsOOqM7UBxMhPV7n30yvR3eULR2iT6kohJx8KauXN9EreXVksk00MmzTXQ1Bc0sGJ8FAoljD5lSINLrhpo9JtdnFiUK2KUrN+RVgI1WIwPpCUfvra3aXs+QOjDuMK7JyDS/XBhn/fWvBtaV8+5l9O+tUXKQiZkbzmgP3A+W5J3rqQyMwxSXCCYdo3M8zdKySxNsBuJshlk2Zli1I31U5K4mTYeyAM6udy8NPL0PlilwhCLljprAtquLUfoQQwT8iKGK3nwLdx99K4lJCBu+uYfLc9UH7lIlfKA20GADswM0dqOPL4vmT1avshlVrFAEc8FqnL/seA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0db76461-aa21-4408-24be-08dc2b5df027 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:44.3883 (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 13/23] avutil/hwcontext_videotoolbox: Allocate pub and priv frames 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: G2DdJx3B4bt6 This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VTFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_videotoolbox.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index fe469dc161..823cf9a8ee 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -34,6 +34,10 @@ #include "pixdesc.h" typedef struct VTFramesContext { + /** + * The public AVVTFramesContext. See hwcontext_videotoolbox.h for it. + */ + AVVTFramesContext p; CVPixelBufferPoolRef pool; } VTFramesContext; @@ -176,12 +180,12 @@ uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, boo static int vt_pool_alloc(AVHWFramesContext *ctx) { - VTFramesContext *fctx = ctx->internal->priv; + VTFramesContext *fctx = ctx->hwctx; + AVVTFramesContext *hw_ctx = &fctx->p; CVReturn err; CFNumberRef w, h, pixfmt; uint32_t cv_pixfmt; CFMutableDictionaryRef attributes, iosurface_properties; - AVVTFramesContext *hw_ctx = ctx->hwctx; attributes = CFDictionaryCreateMutable( NULL, @@ -237,7 +241,7 @@ static AVBufferRef *vt_pool_alloc_buffer(void *opaque, size_t size) AVBufferRef *buf; CVReturn err; AVHWFramesContext *ctx = opaque; - VTFramesContext *fctx = ctx->internal->priv; + VTFramesContext *fctx = ctx->hwctx; err = CVPixelBufferPoolCreatePixelBuffer( NULL, @@ -260,7 +264,7 @@ static AVBufferRef *vt_pool_alloc_buffer(void *opaque, size_t size) static void vt_frames_uninit(AVHWFramesContext *ctx) { - VTFramesContext *fctx = ctx->internal->priv; + VTFramesContext *fctx = ctx->hwctx; if (fctx->pool) { CVPixelBufferPoolRelease(fctx->pool); fctx->pool = NULL; @@ -763,10 +767,9 @@ const HWContextType ff_hwcontext_type_videotoolbox = { .type = AV_HWDEVICE_TYPE_VIDEOTOOLBOX, .name = "videotoolbox", - .frames_priv_size = sizeof(VTFramesContext), + .frames_hwctx_size = sizeof(VTFramesContext), .device_create = vt_device_create, - .frames_hwctx_size = sizeof(AVVTFramesContext), .frames_init = vt_frames_init, .frames_get_buffer = vt_get_buffer, .frames_get_constraints = vt_frames_get_constraints, From patchwork Mon Feb 12 00:03:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46206 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402580pzc; Sun, 11 Feb 2024 16:03:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV6It8uTGLJlKZF0REaL8nkTUZpw6D8BaOn+h+H5dwqyT0MTYGym5UXjiI7rKPzRE9S4kbc6J6L8CxPN9VQ+VdduNQtZafrnFEGow== X-Google-Smtp-Source: AGHT+IEPKXHfcYuMAfNxsppXg1wU7koeA3CsIUDnq9Iu+ah/Aov3dxFni43KaMOVcNdLv657E9b+ X-Received: by 2002:ac2:47f4:0:b0:511:86ce:3920 with SMTP id b20-20020ac247f4000000b0051186ce3920mr2417646lfp.7.1707696218170; Sun, 11 Feb 2024 16:03:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV5rtD8knjZvRe8aKC+V7LoVKpfXe8Vxbf+CQUsCZY7sRtL2Sut+XFumdtMoB1tUGQpfb5CueKWnKc3H+TFOES7PxAz/5EVSe6g80e0CeUJoAO2W+dIGk2z4FvHhaZFCwhbrpe28YRvsR/Yh2MVpOT148qSt/0ZWGnJiNPmtlUX66I4iVixbnwn7OHQ7FAhIrWTqI0VAY3n3wH8QLt4JCUTiI+GZmhV30mSbYwqvLzIgDwWcfa3cHXIHtRwLrfZh5zJDcN9iYwTu8YqhU5lWXtckjTYMGPC72yXg5sXDi6QCs42ERC80RhnsvCMN3A15HLxAAbxQEAzVDLYJ3Vu4CJn0ZnCMScGH/SQRYIY+/1UnrMrtWzpTKrrtFIrqn32GRK1IWvzgXhYG7kCozTM9ghpX4Qeuwll8ufUECnxoC0e0mOGGxvqdaVXXiCvqL2TX4Z1Ql5tRcTVYugy+OeruXjSEb3dspyYfb0FE+zzW0URTSUBPzizR/t1WUB+jMUzhAgeE+1eYI5ndV9w2KCN4R3pJYAuPjyM51ot7bQ/+/fgrRDJNTYJoOSi1dI+NQ7HTkn9e/hjtD1RR3FnokGK05gzSRae/mZ+0grzdwuStKzTOsRzEIBm3I+3jp5e4Egpzz/2xOQ8YipidXLUMVqhno6HK0VKc5d8yZtIW8+uaxfyctQm8UqmxjZ0IZ4Jdx1pfd3f0nxP7g7c1928v1Dt5XGDI2VMrnoFsTNZ96T1FRh26YqYgUcO4Nym/NW3zrUR2VPFYGXdQwpJcYj8lOYMUPMz70vgdm0dIURztKObJ8GOAEwlc+Km2QKIUTEn7A9LOxAWS3j7Z3ukUomkaef5QOeFUMsH9IbzBa9m++scXXEd7gpd3FGblOR/lKdDplA8W181AbhruAJEYY2TvOrrY382ABeRfHzYtkeu9+Wa9VmSBX+JIX5LBcxwavq3gFVG0diAuc pRKre2wgJtG+psXj7YbaA2+2bDEV7JWQw47D8glXSw1HmCqjl9LvdswaQ/UJrvPLcP55LcukYhWUSYOQENZ+c3/nKjpWRYavcm1txJoJE1Nnmd0afOiR6k/lbQNprS8yQ3eYGlXkcEAWScd5e7Vn5J5SQG3+QzA8gC33z9opMgIkR9ORAxKPbPZfloLTOFQoxYWlj4GjhnUVoE3Yv59Md5NScPYthGeHr6vXTTsJ1auwTK84PgFA8X7eA6tqbgwRdetCnQ+za5CW4HXi6LYf/8b/lw86kjMrsB1twORdSr+HyVTdm8WUxqaUqdTXW284qDZzda9RYISQ15C++YPfKd7ueI5Y1Zr1PYAkuLo1hVMZ1MSep+Tt2y1eREunOMplstq2AofdP/A6KHD1kgY4p4lWQskLf2n00awuDvzMiipUxGUIZWKO69By2N8+Ru1Atq/x1+2EYNvROi5eBa/cV3l6Xj3tg4DICc26YoTlk+jAzbGzmQWz439uErVByukS6lZNPrk5bA0mw/GYDLi7MeRHqOmmD+3d7Srfd35OnzT/cOgBWVOzTr7ECJMJ2r+7GbYZZerxwzroJZ/rwjx41N4SjjboYsPGsEnX/c34DFqtHjptwULRo/rbO7rPMP8JX5 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g12-20020aa7d1cc000000b005617af3bf43si1615467edp.19.2024.02.11.16.03.37; Sun, 11 Feb 2024 16:03:38 -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=fCpkTeFW; 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 F2E9768D178; Mon, 12 Feb 2024 02:02:50 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2045.outbound.protection.outlook.com [40.92.73.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7946168D150 for ; Mon, 12 Feb 2024 02:02:48 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WrSeP+/OcIeXhzkw2Mu1a5n7fGOQb10+KWbAOVyV80x5v46rgyJ2ut7fjBcvy5TsgqT/E+w5dWDAeGMvJb+Jm1V8x5brgvqRVkeZsVCh4MfpCQRZbArLVnzJVgrkZyTIOlt8HLfmnIiESXU04OkwSQSptaI8RYNGyVdOxLxOs8RTzu2/wk2jM1i+Um3kBqnKDqbpkOWgLs906MwgDsH7cD4KrUJyb0xq3E3mXvBEhxzHR+Bd9cZcniC9neEVelstemI7W3zPcbIIfuxL5J2+8jIFT0uAlJqcitcf33rY3D3nbVjKjk5jyz+1wvVmG5QB72wEHKLa1NUWZTZlISFvZw== 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=G4eSMTZKSlFXBZicJmWmg3eJh6TbJDGvAKDw3r1CIVQ=; b=EW7E2LFWL6Gyl2Cs5ayqYJUjC4kdF3Uf8o322NWINJX76FR41ln4T6GVsfuYveLb9HPsUqB2MrIi31oNHmz2sEKFOC31Ww3Z4X6gB9riG4+gBVaof9HnzOe0gVsDXF+q5OlThpt8uW2gQKRlwO2q3Vy9q+26DiX9hz+bmgjgUaCScKqLQxIm00UOqUoj5zkmXrDaLvhC0L0qiuY0xP/sLITIontV7f/M7sAbWKtpxpyzWqYuMjx4vJt3llPweUawl/6E24cgacoru7skblr50HgPJbZLVuGuVFNgyMO94QWxoTJu65fgVqfjfm0w4l/guwQC8clXk9DaEVuPJf0Uuw== 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=G4eSMTZKSlFXBZicJmWmg3eJh6TbJDGvAKDw3r1CIVQ=; b=fCpkTeFWzE/GDfMWHgPpQwxcmwNMv3cvUFt04T2W4jg3hsvtoNfl5jjKsWIJ6lym5Yw8Iz5nlU8kPkscYqOB7gHtvwTFZiUPXApD8KpblsWHoh34FNDdttkKiVqW/4qlf4i1ai4j95pN7D6mxSnpMY0t8T+eMB0p9msdnqP7hVyJhrd3Wj3laiw0ibYoyt3X3oHNAXPzlu4acNZp+4U1xq53Ghdokb7wpRsrBSwuIe9In8zHLO7LEJSvHT4aE0dW00ALW7RdT2Q4nM4iwHXD5RLi7nHNmQt161HRDJMLV7YzmT52YizPhzQLKwWr1NlxGZpb701uziI5bztrx8b84w== 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:46 +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:46 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:26 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [7x9U0U9FCOTB/JzbyuPZNG4Hm4wtGH9YpenpvA0Infg=] 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-13-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: 4d6a39a2-387f-4cd1-7a1c-08dc2b5df1ae X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZMqDtUbVXlqasn6cfMx/BBt5oep8ZNiPVMHpY1yNbAfkVH9PMLikUi2QoeRpSSJKcuWRm8eJ+YL+MhFddrndNFQfFDIH0CoV2dRADxGFyUjouZqPOPTe1YaQY2CNGX8oDgqFxDD5v7aF17LjJMCEJanCtyAkACt28kn1rqvLqfhaUy9D2zBNzwubn8JpBfkggOndPDCIUyQ6cYsS8aznkLZx+PVz0mCkx3sLmoX4w813elknlISfHyz2sXg6EIW9HWxVw5s3AM54umIxkrhZ6U1Zaw8m8TsmPuPgVMT8OiCYymmuMuaFckNgcokbLbCJEPUO7bdhV7YO57G8LOg/EtHo9bnWFBEFg8x+V0dqQkHzNpNnv+ToclkUXMzQxe9LJrUtKz25pnd7Aa1PXBm14kMLy5IDKePN32FHlK/4t9+3BM5IW6CpuN7FHLGogd1/EkOURw+RBcWhVq7dov6is0qBchNXIl+RHKU3gIfnnIyca3kO0EpdqFVFd4CLHJLzr9jBMaKqRZDDHuVkCwSrvwIN9s4evQBSfkyxTo7N92lP59QA/J8A1ThhsrLgkYsJweD21VTIZ0+56O6dJyCId9usf51yN1C404/jgmwsRpwaabwFWS3CRHyirvXisn5XtABXYD+Zb2Ou+fHCenvL3rBSWEkjLu0PP7YuTqbXYTznom6u/t6Y/wphHC4HbXEIUIEUCr8Xu/A3rySzX7v8fjPwIRh7BkLOD9T2uGBxeIGM= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FAWnlw0e3LhkT2/JctukxvZWvt3ZX+RSN6yWZGXv7Gl8Qs6+yfmAuFu9p5q28lGcybKNS2DVDmQSwdITcxVSYN0DteKxXhsLov0OHfTboCOAHPVFuAj92nuGIxWDlJHhHG2AqG+Oipxk4NeqqROCSu3O5FF0zH3AKbyTTZAL4FpX+iP5kCSK0yT+nxDFsYf0uqrEkO6JEKN6a1qIpyjQTDSPhNsHBjn5NDmPHG9wCEvvELm/N4GqavhjMhUGs48KLaZsMIgWWhl0i7DIFciE26wietRQEO2ASnmyVcrUYxo/MVP3bwaa7JnImmz3z+0TkT6RzHfJ6C4SF+rFH8fBoqi+Qp+MUzSFm3KNgaWBi+aOC3ioVrUIEq0+/V59nudUCUNqPQu8NTL8gRE9j97UCdHxaBW8dGBWUtonJi4V26/PdYQQQD5KJGpqrD7Sp8wKYFc3Ikq7LzuINDiltNj8QBajjg3wVgRBpk95cZXLCfRvLBALrIA/cU2a5fTusgA/pUGNP87HPbZgw69SrgFG1i9SPlPS+QxtoAwgF8oRaG6hAP9C3bHcUJBy+gXKSSo1hnxprISwBDlBVSx4uQHnwfQ0xCXAzA/x+2fiaLOz0V0CID4azNJLbO2DzbrQB6ku X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xG/1BHY91UL/b9p8wok2LSmpMaWMtF6aqeDdYWRVDbqjcw8SU+IUFqMw731oHaEfaK9UnRpVhePttHJm6KMsTw1C+wycEALDuUb22TL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IdcklA74dn5Ci1GW6lkar8aj6OJHCn+q1nE4fMqbFIgRAmWon2zblCxZ44WG5/Mp+7RkQTfxxgcqdlWqjrU0ZlcNhvEMQjldcjse8jSeA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d6a39a2-387f-4cd1-7a1c-08dc2b5df1ae 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:46.8003 (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 14/23] avutil/hwcontext_opencl: Allocate pub and priv frames 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: AuAB5QmBsZ1c This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to OpenCLFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_opencl.c | 38 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index 54c050ab40..c5af1aec74 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -138,6 +138,11 @@ typedef struct OpenCLDeviceContext { } OpenCLDeviceContext; typedef struct OpenCLFramesContext { + /** + * The public AVOpenCLFramesContext. See hwcontext_opencl.h for it. + */ + AVOpenCLFramesContext p; + // Command queue used for transfer/mapping operations on this frames // context. If the user supplies one, this is a reference to it. // Otherwise, it is a reference to the default command queue for the @@ -1689,9 +1694,9 @@ fail: static int opencl_frames_init_command_queue(AVHWFramesContext *hwfc) { - AVOpenCLFramesContext *hwctx = hwfc->hwctx; + OpenCLFramesContext *priv = hwfc->hwctx; + AVOpenCLFramesContext *hwctx = &priv->p; OpenCLDeviceContext *devpriv = hwfc->device_ctx->hwctx; - OpenCLFramesContext *priv = hwfc->internal->priv; cl_int cle; priv->command_queue = hwctx->command_queue ? hwctx->command_queue @@ -1721,7 +1726,7 @@ static int opencl_frames_init(AVHWFramesContext *hwfc) static void opencl_frames_uninit(AVHWFramesContext *hwfc) { - OpenCLFramesContext *priv = hwfc->internal->priv; + OpenCLFramesContext *priv = hwfc->hwctx; cl_int cle; #if HAVE_OPENCL_DXVA2 || HAVE_OPENCL_D3D11 @@ -1815,7 +1820,7 @@ static int opencl_wait_events(AVHWFramesContext *hwfc, static int opencl_transfer_data_from(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src) { - OpenCLFramesContext *priv = hwfc->internal->priv; + OpenCLFramesContext *priv = hwfc->hwctx; cl_image_format image_format; cl_image_desc image_desc; cl_int cle; @@ -1870,7 +1875,7 @@ static int opencl_transfer_data_from(AVHWFramesContext *hwfc, static int opencl_transfer_data_to(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src) { - OpenCLFramesContext *priv = hwfc->internal->priv; + OpenCLFramesContext *priv = hwfc->hwctx; cl_image_format image_format; cl_image_desc image_desc; cl_int cle; @@ -1932,7 +1937,7 @@ typedef struct OpenCLMapping { static void opencl_unmap_frame(AVHWFramesContext *hwfc, HWMapDescriptor *hwmap) { - OpenCLFramesContext *priv = hwfc->internal->priv; + OpenCLFramesContext *priv = hwfc->hwctx; OpenCLMapping *map = hwmap->priv; cl_event events[AV_NUM_DATA_POINTERS]; int p, e; @@ -1961,7 +1966,7 @@ static void opencl_unmap_frame(AVHWFramesContext *hwfc, static int opencl_map_frame(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) { - OpenCLFramesContext *priv = hwfc->internal->priv; + OpenCLFramesContext *priv = hwfc->hwctx; cl_map_flags map_flags; cl_image_format image_format; cl_image_desc image_desc; @@ -2217,7 +2222,7 @@ static void opencl_unmap_from_qsv(AVHWFramesContext *dst_fc, { AVOpenCLFrameDescriptor *desc = hwmap->priv; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; - OpenCLFramesContext *frames_priv = dst_fc->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->hwctx; cl_event event; cl_int cle; int p; @@ -2253,7 +2258,7 @@ static int opencl_map_from_qsv(AVHWFramesContext *dst_fc, AVFrame *dst, (AVHWFramesContext*)src->hw_frames_ctx->data; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; AVOpenCLDeviceContext *dst_dev = &device_priv->p; - OpenCLFramesContext *frames_priv = dst_fc->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->hwctx; AVOpenCLFrameDescriptor *desc; VASurfaceID va_surface; cl_mem_flags cl_flags; @@ -2351,7 +2356,7 @@ static void opencl_unmap_from_dxva2(AVHWFramesContext *dst_fc, { AVOpenCLFrameDescriptor *desc = hwmap->priv; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; - OpenCLFramesContext *frames_priv = dst_fc->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->hwctx; cl_event event; cl_int cle; @@ -2376,7 +2381,7 @@ static int opencl_map_from_dxva2(AVHWFramesContext *dst_fc, AVFrame *dst, (AVHWFramesContext*)src->hw_frames_ctx->data; AVDXVA2FramesContext *src_hwctx = src_fc->hwctx; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; - OpenCLFramesContext *frames_priv = dst_fc->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->hwctx; AVOpenCLFrameDescriptor *desc; cl_event event; cl_int cle; @@ -2439,7 +2444,7 @@ static int opencl_frames_derive_from_dxva2(AVHWFramesContext *dst_fc, AVDXVA2FramesContext *src_hwctx = src_fc->hwctx; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; AVOpenCLDeviceContext *dst_dev = &device_priv->p; - OpenCLFramesContext *frames_priv = dst_fc->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->hwctx; cl_mem_flags cl_flags; cl_int cle; int err, i, p, nb_planes; @@ -2516,7 +2521,7 @@ static void opencl_unmap_from_d3d11(AVHWFramesContext *dst_fc, { AVOpenCLFrameDescriptor *desc = hwmap->priv; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; - OpenCLFramesContext *frames_priv = dst_fc->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->hwctx; cl_event event; cl_int cle; @@ -2535,7 +2540,7 @@ static int opencl_map_from_d3d11(AVHWFramesContext *dst_fc, AVFrame *dst, const AVFrame *src, int flags) { OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; - OpenCLFramesContext *frames_priv = dst_fc->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->hwctx; AVOpenCLFrameDescriptor *desc; cl_event event; cl_int cle; @@ -2595,7 +2600,7 @@ static int opencl_frames_derive_from_d3d11(AVHWFramesContext *dst_fc, AVD3D11VAFramesContext *src_hwctx = src_fc->hwctx; OpenCLDeviceContext *device_priv = dst_fc->device_ctx->hwctx; AVOpenCLDeviceContext *dst_dev = &device_priv->p; - OpenCLFramesContext *frames_priv = dst_fc->internal->priv; + OpenCLFramesContext *frames_priv = dst_fc->hwctx; cl_mem_flags cl_flags; cl_int cle; int err, i, p, nb_planes; @@ -2938,8 +2943,7 @@ const HWContextType ff_hwcontext_type_opencl = { .name = "OpenCL", .device_hwctx_size = sizeof(OpenCLDeviceContext), - .frames_hwctx_size = sizeof(AVOpenCLFramesContext), - .frames_priv_size = sizeof(OpenCLFramesContext), + .frames_hwctx_size = sizeof(OpenCLFramesContext), .device_create = &opencl_device_create, .device_derive = &opencl_device_derive, From patchwork Mon Feb 12 00:03:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46193 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402646pzc; Sun, 11 Feb 2024 16:03:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IECtQx1VDSvmB+OsXVDv+0u8WS18wranBlzRlPNATDP4a34hc1HD9MSu2UjXTe14zhbNyfn X-Received: by 2002:a50:fb19:0:b0:55c:d503:764c with SMTP id d25-20020a50fb19000000b0055cd503764cmr3230869edq.22.1707696227000; Sun, 11 Feb 2024 16:03:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVwtlIFLjw+YUSgurB2hAm2DHGYaY6bjDbMsCqCKe1LAP+GfV0DSflPsxC1Zg2EtC2qdtmxNawwtZ44vWrx/WOUlcRt97a5/JtErRBoayDNfwXwc1yhX0fsxv3cuDolZ3kKFbxQTiN0jua+t9g397QlpHPqEZPzvYp1mw6uEU4dpqtNG+cueLeK1RH+wrzsbEdSbki8AjCdynO1bjG9UkposW/rP5jUO+rzmGMuWfi9c/MB0PvIlJD4wgof5nOeOB+6CjfhvwBSGnY9JGFcmu1Lu+tP9hqWUCN6D28a93yjgybY928Gm1V+BJ2Gi4JziMXgk6wQ6Xf4V/WcC6jlnseM1ogNb1AR1Tte07TpDVMW0TZBVPRflxUzcT6lETJoVQXX6LDCwxbpN2XkUatgfbjBlskjbIuqefIKej6C5S7VlWlnUJ3vy/NnojvguvqIWx4uSzz3XdvQ1/JSwIlc/ANEsXNgwLVbUfunaDpAudAObml8c/C5mx7/+ob5s1nAsie8aihZgaUu75C/YMIxo0W5KNFLgHIr3MFOdvmJlt3zTyEEsvOXt1xMeoto3OOt++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org. [79.124.17.100]) by mx.google.com with ESMTP id p7-20020aa7d307000000b00560ebb44462si2278509edq.479.2024.02.11.16.03.46; Sun, 11 Feb 2024 16:03:46 -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=k0SkgjtJ; 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 49D8F68D1C4; Mon, 12 Feb 2024 02:02:52 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2073.outbound.protection.outlook.com [40.92.73.73]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 99BC668D178 for ; Mon, 12 Feb 2024 02:02:50 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZcNQqRs0WTHIAuuS8rcOEI9I4Agou9oxDoeQ5yDdPxDGNui4fTlNLCR7vXP/v6pFrWpBOZq7+YAK+XBUbvtBpOirOanEbaTmOltffxfcEnpOHlgxIiuS1Ma00dtxkcfNbZ1+ntknFo9ik7v2TztCsA5rkNA3cu54Fh8MDkFJCaQBL0WDKHqoP6PcRDdatQ+5K4uW0PWltCIBk2/2oYsLzoK0aHQsjD1u6gKExqhuWEZa+e8oLyq8dWvoqS7xK+EqTVXJmXR1iyBgCaaivlwbt+KdKVOtBKys0bN416j6vcy8pOaPe8CrXFrcRnKFcvIm3eql5Jq/6co1rXcudlahbw== 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=3DiGdtESLSonVLb4p23TRwPq08Z55vS46fkRbNtQ+D8=; b=nYeIYJSykfqcdYZQMQt983MmnexKWDHkUY/cS1tIdGgFDqs9iiC4kZEZUYgXPjVqpAUvxYXPnWJdSYhFV1Nuw9df3nAteQdDhBonXwgln11RGtK5WH7w7XN5/RijeJMBmXPOMcrrGhTgq1GmgWDiZfBqTZrwHHo9O22jamKMgL2NJuthDyk5lwzBcwtxDLMoBJrxiY9MCpKT1YOjFT3oqzRVSuQSQ0hOp/TuazxSWBEwoa30P3pk7L2msjAx0z1DUdUIvmdGv1UbJTLkXWH3Jn8rNyECAXdpWhPuP9OIZhq88zYmLFVg4eltlQpq7NBeM/bFRDeNKT9IHZPUHIMtzw== 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=3DiGdtESLSonVLb4p23TRwPq08Z55vS46fkRbNtQ+D8=; b=k0SkgjtJuJM58rv6qv0ohBneiuLtjn3b4VrcmW+rpNI3mTvpaGIGO/h/2rKG/V/tPKwdToG7ncf4Fes4TKV46BcQ/PNrl9onY+sdATMfMre2nT4ibQ5H6KkUx7glzbLeH6uZOAAI6uYiqHnx2uThHIdaIjeyltdkeDKP1Qh8vS83OyL3UgJ+JGb3vBSny9txlCKkBHaxpu7tJlUF+2sxasWjNdLpLikWcL9jm5vM083lq2E6j0s+SLRbVd0rdhDhrAwqGn/1LrkWVnOEHy1XF8S6xx1yCroefj9fW0p1BwQwQ2ok3Zvoc2wJt9y300jpj3SoqTHHZNzBp+xgDumHNA== 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:49 +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:49 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:27 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [oly+3DAYiqE9gHicNkqkRy+0d3eKfrN/tc/ojij2GDg=] 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-14-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: 52e1687f-f2fd-4144-fa43-08dc2b5df2ee X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZMqDtUbVXlqasn6cfMx/BBt5oep8ZNiPVMHpY1yNbAfkVH9PMLikUi2QoeRpSSJKcuWRm8eJ+YL/zR6gP/xVfwPxXG76RowpMehaA+De6zC2QIMh+hPLrBmxTi8xx2pQvSNt3KthTQVSkTuDPY4/recNlCNWZaRz0javPc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+GV78ljBQqjJveciVn6j2vF0Yp5/2Y6cA5vEuadSckevsZ2qkRM2to5FtKhpSVze+VM+QENMGfOcdc5R5pJyO1z0fxMXkZH+Tb/wrbyRB1Sw8nK8jF+12n7+kxjcMxx0BhPRflPYUAFRLk7kbMjbtrFcKUJwoMtdP/rABSydS8AeTUdoZsxNg/nmiORORHhQdSzwm3gpCnltAQUrJQvdl03KX0F08S/vna4X5dAQLe5lBU69CZEVJtz6kQlGmcI69fHvFOy2UETbHV/Bs/pOl96mOuEmtTGI2pcfc9YeyKPHX8thQ8EigRS+sGoUkHdjir/UX6G62kiZupBFRJt3xONeM2IaJ/J3Y7JG0DxMdFAoKVfa1lGOAYymUQ44IrA3uM3qBGAdBr9k14iB1v1IPmwlqJ8su8s1eNSPDjulcXRSRnjONWd1031QwkKRGbVmz5i4PgvsILZLo6g8/CwFz9imjNQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52e1687f-f2fd-4144-fa43-08dc2b5df2ee 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:48.9255 (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 15/23] avutil/hwcontext_qsv: Allocate pub and priv frames 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: l3VMb2/Mq0MD This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to QSVFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_qsv.c | 46 +++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 99d974f25f..f524a663b1 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -85,6 +85,11 @@ typedef struct QSVDeviceContext { } QSVDeviceContext; typedef struct QSVFramesContext { + /** + * The public AVQSVFramesContext. See hwcontext_qsv.h for it. + */ + AVQSVFramesContext p; + mfxSession session_download; atomic_int session_download_init; mfxSession session_upload; @@ -329,7 +334,7 @@ static int qsv_device_init(AVHWDeviceContext *ctx) static void qsv_frames_uninit(AVHWFramesContext *ctx) { - QSVFramesContext *s = ctx->internal->priv; + QSVFramesContext *s = ctx->hwctx; if (s->session_download) { MFXVideoVPP_Close(s->session_download); @@ -367,8 +372,8 @@ static void qsv_pool_release_dummy(void *opaque, uint8_t *data) static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size) { AVHWFramesContext *ctx = (AVHWFramesContext*)opaque; - QSVFramesContext *s = ctx->internal->priv; - AVQSVFramesContext *hwctx = ctx->hwctx; + QSVFramesContext *s = ctx->hwctx; + AVQSVFramesContext *hwctx = &s->p; if (s->nb_surfaces_used < hwctx->nb_surfaces) { s->nb_surfaces_used++; @@ -381,9 +386,9 @@ static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size) static int qsv_init_child_ctx(AVHWFramesContext *ctx) { - AVQSVFramesContext *hwctx = ctx->hwctx; - QSVFramesContext *s = ctx->internal->priv; QSVDeviceContext *device_priv = ctx->device_ctx->hwctx; + QSVFramesContext *s = ctx->hwctx; + AVQSVFramesContext *hwctx = &s->p; AVBufferRef *child_device_ref = NULL; AVBufferRef *child_frames_ref = NULL; @@ -562,8 +567,8 @@ static int qsv_init_surface(AVHWFramesContext *ctx, mfxFrameSurface1 *surf) static int qsv_init_pool(AVHWFramesContext *ctx, uint32_t fourcc) { - QSVFramesContext *s = ctx->internal->priv; - AVQSVFramesContext *frames_hwctx = ctx->hwctx; + QSVFramesContext *s = ctx->hwctx; + AVQSVFramesContext *frames_hwctx = &s->p; int i, ret = 0; @@ -615,8 +620,8 @@ static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, mfxFrameAllocResponse *resp) { AVHWFramesContext *ctx = pthis; - QSVFramesContext *s = ctx->internal->priv; - AVQSVFramesContext *hwctx = ctx->hwctx; + QSVFramesContext *s = ctx->hwctx; + AVQSVFramesContext *hwctx = &s->p; mfxFrameInfo *i = &req->Info; mfxFrameInfo *i1 = &hwctx->surfaces[0].Info; @@ -1133,7 +1138,7 @@ static int qsv_init_internal_session(AVHWFramesContext *ctx, void **loader = &hwctx->loader; #if QSV_HAVE_OPAQUE - QSVFramesContext *s = ctx->internal->priv; + QSVFramesContext *s = ctx->hwctx; opaque = !!(frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME); #endif @@ -1210,8 +1215,8 @@ fail: static int qsv_frames_init(AVHWFramesContext *ctx) { - QSVFramesContext *s = ctx->internal->priv; - AVQSVFramesContext *frames_hwctx = ctx->hwctx; + QSVFramesContext *s = ctx->hwctx; + AVQSVFramesContext *frames_hwctx = &s->p; int opaque = 0; @@ -1387,7 +1392,7 @@ static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx, static int qsv_map_from(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src, int flags) { - QSVFramesContext *s = ctx->internal->priv; + QSVFramesContext *s = ctx->hwctx; mfxFrameSurface1 *surf = (mfxFrameSurface1*)src->data[3]; AVHWFramesContext *child_frames_ctx; const AVPixFmtDescriptor *desc; @@ -1490,7 +1495,7 @@ fail: static int qsv_transfer_data_child(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { - QSVFramesContext *s = ctx->internal->priv; + QSVFramesContext *s = ctx->hwctx; AVHWFramesContext *child_frames_ctx = (AVHWFramesContext*)s->child_frames_ref->data; int download = !!src->hw_frames_ctx; mfxFrameSurface1 *surf = (mfxFrameSurface1*)(download ? src->data[3] : dst->data[3]); @@ -1592,7 +1597,7 @@ static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface) static int qsv_internal_session_check_init(AVHWFramesContext *ctx, int upload) { - QSVFramesContext *s = ctx->internal->priv; + QSVFramesContext *s = ctx->hwctx; atomic_int *inited = upload ? &s->session_upload_init : &s->session_download_init; mfxSession *session = upload ? &s->session_upload : &s->session_download; int ret = 0; @@ -1619,7 +1624,7 @@ static int qsv_internal_session_check_init(AVHWFramesContext *ctx, int upload) static int qsv_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { - QSVFramesContext *s = ctx->internal->priv; + QSVFramesContext *s = ctx->hwctx; mfxFrameSurface1 out = {{ 0 }}; mfxFrameSurface1 *in = (mfxFrameSurface1*)src->data[3]; @@ -1702,7 +1707,7 @@ static int qsv_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { - QSVFramesContext *s = ctx->internal->priv; + QSVFramesContext *s = ctx->hwctx; mfxFrameSurface1 in = {{ 0 }}; mfxFrameSurface1 *out = (mfxFrameSurface1*)dst->data[3]; mfxFrameInfo tmp_info; @@ -1795,8 +1800,8 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, static int qsv_frames_derive_to(AVHWFramesContext *dst_ctx, AVHWFramesContext *src_ctx, int flags) { - QSVFramesContext *s = dst_ctx->internal->priv; - AVQSVFramesContext *dst_hwctx = dst_ctx->hwctx; + QSVFramesContext *s = dst_ctx->hwctx; + AVQSVFramesContext *dst_hwctx = &s->p; int i; if (src_ctx->initial_pool_size == 0) { @@ -2252,8 +2257,7 @@ const HWContextType ff_hwcontext_type_qsv = { .name = "QSV", .device_hwctx_size = sizeof(QSVDeviceContext), - .frames_hwctx_size = sizeof(AVQSVFramesContext), - .frames_priv_size = sizeof(QSVFramesContext), + .frames_hwctx_size = sizeof(QSVFramesContext), .device_create = qsv_device_create, .device_derive = qsv_device_derive, From patchwork Mon Feb 12 00:03:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46207 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402706pzc; Sun, 11 Feb 2024 16:03:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV1gOtyGwtSidCJZ9i+1kdMj7u5JgvHmUJrBLo3BqZkBGqxAiJ5m5ylPc6ieMVi2rEFs+cTs2IuiCWCOrHMFVJI+Q78DMUFzBmCbQ== X-Google-Smtp-Source: AGHT+IHg6U7+9i71N32xiah1HT9BLDY87pbJ8bWpyLYvIeRDPiD3toweu1bm7NkABLgK4h6NScPi X-Received: by 2002:a05:6402:120a:b0:561:55d1:3709 with SMTP id c10-20020a056402120a00b0056155d13709mr3327064edw.40.1707696236210; Sun, 11 Feb 2024 16:03:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWXGUw+D14YL8tmon7yj+VuAzV6zfTXybfP+u50ABrTw+FPlMec3qxFexXg33E74WnkAUbTf0XfLXVystzDuOQZdVkH0laQnQ87TQze5LD4XdBaXmXh3tGRE6rs27vT6rXgkb+4ZA3zyn5IuG9iA8n+YEjOL+nUW1Bc2MmxW1HfG7aJsRhvsYrUQX5344cnBH5JblsVHCPBjva0frqlDu5zS1U5N3QlJjeLHcMd4bqNGbMaUFFqimKvUzhasKxD/KO3JpbImFT6ViMcrKfR77fUhCVF6CfBFHQjWRA6qvI+9wxGbZaoy4fD3hcW+XBkRkvu9RcHZeb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r6bxBwavwJ0Aq00UJckKh/RoVLTc4QuU7gMaynMB+f5KTLVGCQsBmobQrpMszrT9LyUlXr86NPw/ueIXqupCGsICrv9KuDTF9OKxQxbHza8E+BFpL852vNJslDCbMpa4bBou5nbpJmfXpgwi6bdkGUMC4KtXLEwDGpl5hbRocTK4xAeNWXSTxAYVy2YFF9cDLhHRpB Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a12-20020a50c30c000000b00561bbb13e37si270782edb.684.2024.02.11.16.03.55; Sun, 11 Feb 2024 16:03:56 -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=SMbBMgBy; 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 4B79B68D1D9; Mon, 12 Feb 2024 02:02:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2091.outbound.protection.outlook.com [40.92.73.91]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BB1F868D1CA for ; Mon, 12 Feb 2024 02:02:52 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FGxxnwh/PqLImp7Z+2GaT11kDJKR9GSpf2yfy4gCGCRCjXW1Q2GkEzOCqnb9MolCkh/bLxzHAsYanjn9TunXbF7yDLnEMZo61SuWoC81w71FtEiwHupHrQbsYXwcEb9ouON+UUuIaDJ3yL5aVICzoCTZIC4F/UB6KhIEBm5jVDMrWermQ5B2h+8s34BtgdBzXNdcfO3jyeK0tCWpUqzugUa4V1O8Nll621zT7Fq8X9/kCXXhWWIkhYJDnY4cPxeOEn/VPzIZvSvNJjLUUNcBlSPVoF7vTjvQvU0Jsl6XbYLQAkduOsd8rXu6pa3VoNVpT8uJoInsiV3KbqZEumQKrA== 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=ZHaR3VlnRQ36tLlUSG7a0Oz6AyrYmHSWUSY4lsIHKhw=; b=XlhGsfHoDsslVk6Q2VS8tSs75hOnVRPCaDGlCUB4cVae7yeFLPKU2DMaX1UnxdEpsRCTg4KqjjIcYaYBrMsqkFLb/izdEH/hq22FFPe5c7c2zwV1ycmj4y1BY5PnLpUm31AtA6EDC6IuN8ySZh0pxnYZF4AR6dAC7ybYNerkoZlq2HeXEGJRm8h5lSVdJxw8eUUbyRZyuPw4g0pPv5vJXJvN74GqNzzci+g421z9ELNWdHhmWsQFwE4WUVonwO+KpSOVkbqRufEH1R6tIfpje9XsJ+KWGthFHwXGSsZHimcQ7Jhqto4SVFFiUMCYNGtDFjLRfQHERyDhVN6rTdxtxg== 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=ZHaR3VlnRQ36tLlUSG7a0Oz6AyrYmHSWUSY4lsIHKhw=; b=SMbBMgByCnkFGiigkEb5Eg1ASBrgyjCVfxVxijESzf3WnvfeM4pcBxPQbZDXYCD2Nrtfm67OeF7dKH2Yu+q6Dw/4MwGBeA6kzut+2S5FDn29xKB3O/7sehkHkyWSWTBYPqr55dts343TCeJ6TCAWfGsILNuo4CJEwnL8MEh2t3/OwShUzKgiPQqzXNSzbpQcVQK9A0WiQIbE49Um+j31wt1xqC5HN9qWHgUu+ZRmOoFDz0PoneEKhPhK8xSVMoqJqiUUVji4CivkOkPc1NeR6liW+Nq5MgrDIndxvD94ZC6+KsPIc9rKcHORmaWvP6i1b70eJHIlN+o0/rgBTJ0xRQ== 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:51 +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:51 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:28 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [TB7LZpeojB5rMvL7EHPOiHu5N5zncvUGlq2uWJNGA5E=] 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-15-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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bPAS1dXhYo7i54oWsbd/j/iS+5yC2YLf7v7qvQkyy1dvVBk5wcJEGEgqE44DR9Fwhr9655tVRcHAQNYs8JHmDlGzW30Q1Ph+1H9mR9NSCpQ6WL5APozkaPospbq48Dt2yvH/WVvQ2EH7Bf8s9GEFAOG3/+SqrtBENJFD4c52HR2k6kH9m05rKPYrJf2clZPCVTik9zc3awFqTZQx92W3waJSFcXN09plJM/JDOpUoewe4hOe7HNBXHc2oIUsNxH6oM05v/a7/jp/A7py54algZOpWcByUwbjQiEK5SXiUm8A/wf4m58KGRKXDrN/dckXSj8iwdbbCV3La3DKJvc7TukZBnJI1wFKjfXtEdokl/B03wMSRCZuB8+4fJzVUy3FY2FjkDeMgO1D+d7kmb7qVtFMSPbEWrLnd8fzfIa3IWq8E8IXnG8WboZb3/Ywd7kMK9S/Dai19wpXpkRjOetHLA/LL+ZxlMORHFG91v0uBfShG4AolY7UKCLSafniZ/ia+hH200UlR51MD67rMCig5pxWeuMevyUqdHZajYx9KJEvmLyU67JsH+9+c0QhEhEPSZJTXw+/Zzz4DHdbJ3tKKkGm9EwCSEYcc9BYVqq+4E0XvxJTLGG+AuH/gNUt4UQVb6wxJv5vkYXG8Q0RXkqj1RZv7iU3R+3mbhVkhH+/qTmJGH7jK581vdZ8hRESldOVDNYrH9s8ku8Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee6194b1-1cad-43fc-7c44-08dc2b5df42e 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:51.1050 (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 16/23] avutil/hwcontext_dxva2: Allocate pub and priv frames 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: HvFHogN8B80J This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to DXVA2FramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_dxva2.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index 2c11f151ff..0922776342 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -57,6 +57,11 @@ typedef struct DXVA2Mapping { } DXVA2Mapping; typedef struct DXVA2FramesContext { + /** + * The public AVDXVA2FramesContext. See hwcontext_dxva2.h for it. + */ + AVDXVA2FramesContext p; + IDirect3DSurface9 **surfaces_internal; int nb_surfaces_used; @@ -99,8 +104,8 @@ DEFINE_GUID(video_processor_service, 0xfc51a552, 0xd5e7, 0x11d9, 0xaf, 0x55, 0x0 static void dxva2_frames_uninit(AVHWFramesContext *ctx) { AVDXVA2DeviceContext *device_hwctx = ctx->device_ctx->hwctx; - AVDXVA2FramesContext *frames_hwctx = ctx->hwctx; - DXVA2FramesContext *s = ctx->internal->priv; + DXVA2FramesContext *s = ctx->hwctx; + AVDXVA2FramesContext *frames_hwctx = &s->p; int i; if (frames_hwctx->decoder_to_release) @@ -135,8 +140,8 @@ static void dxva2_pool_release_dummy(void *opaque, uint8_t *data) static AVBufferRef *dxva2_pool_alloc(void *opaque, size_t size) { AVHWFramesContext *ctx = (AVHWFramesContext*)opaque; - DXVA2FramesContext *s = ctx->internal->priv; - AVDXVA2FramesContext *hwctx = ctx->hwctx; + DXVA2FramesContext *s = ctx->hwctx; + AVDXVA2FramesContext *hwctx = &s->p; if (s->nb_surfaces_used < hwctx->nb_surfaces) { s->nb_surfaces_used++; @@ -149,9 +154,9 @@ static AVBufferRef *dxva2_pool_alloc(void *opaque, size_t size) static int dxva2_init_pool(AVHWFramesContext *ctx) { - AVDXVA2FramesContext *frames_hwctx = ctx->hwctx; AVDXVA2DeviceContext *device_hwctx = ctx->device_ctx->hwctx; - DXVA2FramesContext *s = ctx->internal->priv; + DXVA2FramesContext *s = ctx->hwctx; + AVDXVA2FramesContext *frames_hwctx = &s->p; int decode = (frames_hwctx->surface_type == DXVA2_VideoDecoderRenderTarget); int i; @@ -216,8 +221,8 @@ static int dxva2_init_pool(AVHWFramesContext *ctx) static int dxva2_frames_init(AVHWFramesContext *ctx) { - AVDXVA2FramesContext *hwctx = ctx->hwctx; - DXVA2FramesContext *s = ctx->internal->priv; + DXVA2FramesContext *s = ctx->hwctx; + AVDXVA2FramesContext *hwctx = &s->p; int ret; if (hwctx->surface_type != DXVA2_VideoDecoderRenderTarget && @@ -586,8 +591,7 @@ const HWContextType ff_hwcontext_type_dxva2 = { .name = "DXVA2", .device_hwctx_size = sizeof(AVDXVA2DeviceContext), - .frames_hwctx_size = sizeof(AVDXVA2FramesContext), - .frames_priv_size = sizeof(DXVA2FramesContext), + .frames_hwctx_size = sizeof(DXVA2FramesContext), .device_create = dxva2_device_create, .frames_init = dxva2_frames_init, From patchwork Mon Feb 12 00:03:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46208 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402772pzc; Sun, 11 Feb 2024 16:04:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvSpKyo2M+YbEv7T9simfPektBKh9MobFbOu/Md4MEDVWaLUBMyWOCfAwOseEjkC9aaO68 X-Received: by 2002:aa7:da4a:0:b0:561:3880:ab14 with SMTP id w10-20020aa7da4a000000b005613880ab14mr3036630eds.26.1707696244390; Sun, 11 Feb 2024 16:04:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU1B7H820UTgZWm784GvQq43MUjoe9YnmSrNZ8iN72RSmbSuGWpP2qkaOMY/RQDetOQtv8hkzIGCcH3Njq49PdLeAVnie/hJacMJ9VtUZu1CjyAXpLJ2XMm5Vhl9S/rOs8ywokOYhJ8Uqyous/zpCn1m7KnTTd5QCQv37yDKk4qVMV10+xb8NatHmg/E2chTYlDaASIBH42APgBLlA7YtxYstu0uEV/ta+kdLKRcbkthDf9TTofhE4G18Vile7JJer+rCxotuk3JVaEunt1biEoiei8v8q2ThNjmPpotJgHukps+Suu1Itq+8otomSgaW2J9ZLXH3ePjpxqpUXOQWqQ2aPvkVgL0CsGaZjF//SPQAQc1J65zijhM1tqZSCTnPnxUbebTt6FjVVujtFyxqLmK6lGcxf9cDFzi9wWX52aRS8Q29UDgp/gSyyAkhvHUHjYzj4P/UnnbmQwQyilBU52YwSJcIbw2F4STjmrjVS/NYRG5TZPQmHM10OWhK7nVc1D3s+BpzXYzrwi0nXXSCn8y72fVTSDEZ1/hB0kzjPZj1t+F9tdHwHqD2A89NT4s7ZmkY7ngG/+ehghw9Kh9DoBENNJhHMKPGDyWY01yTAO3KB45eoTISVWaTr98AxGkaKaAKXCw2hcFtrrFuMf6hOVPO7AazsctH3PIAg4nLWJKI/cvzd7DwkdtaByjIuT6lCsjEzLPAhiDw5moisxIdHWjOYxZKCnDGMgZ28kzIakDDG1RZr6U8CYVbEFNtQHqyLQNthMD1J/7h14bf5cFwcfBMeWc1xZkiIZeF4n3I3Ek+oLFj3KTkR258JwUoAFiyg+6Sq3Ji2OisnOjq6DC8khraEphIAHlf/1AOue3G3vxSFh1xsZiS6dsNrM6f7V2OIXxlE7R2CUEov83RqVhgTP0RV3C4YwWKI6VPfFOFAyx12oVCzbi/1qRC47tSRuLLc4QS c1QUAj52/JyrE7wF1IHnh9wHAwqJeKX2BmtT1QMWhrY+ApSSIzHrQN+cCa4c3ENs/Lq+37IZCiaUuPYya/StFHOsNqtcKwQSI6OSlbRmk0mHUJxOni+OVHagR2gdp2KXDzEk+H5b7VjyzjroOS2Aw02GcuVc+BFPTJEoS+ExSAiNXD57jEveo5/I3gSwx4EvcBpF17pae6fibrltkbfrZXBoYUsqS+jnEXPeGvhq9n8PyTW9/bhZBRo8y1Smff8srX82tYVftSZJokiMOZZLzqPPdy27silLRf18/0IILn3EOxuVGDk9ylDFT4kRKiYYFHF6eu6ep2xmaoGoCp6IMWD0/HmaKPx6gGGDsov/p4vVB7mQPT0xD+uKyR8SCHfsHc8duHC89DCYnJaVSb9RXKZd/Yp1m1GfCxfTpprQLCLjTX2W+YpqMyNlAZPh3rFjXCp4rgUYxsB2Hemceghr33V7JCHSTMwk4kAv0Ho1hpCiF/MSdQAX2FZ+zd5h1f4XcUOYEs+zp7C9Y2MgO86m81u7GIwM2caAShBrP2EiQ8Xf2vEzOC1pnQU9/PEmUNdXChyroz9qXVKGFlS/iMmiHD3OJAt5+MAhQDPA+38axFgr2FX2x3e+ZN04cCsH5I7TU4 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q15-20020aa7d44f000000b00561282f081dsi2195354edr.451.2024.02.11.16.04.04; Sun, 11 Feb 2024 16:04:04 -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="BFhs9R/X"; 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 4858D68D1DF; Mon, 12 Feb 2024 02:02:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2082.outbound.protection.outlook.com [40.92.73.82]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 96FFB68D127 for ; Mon, 12 Feb 2024 02:02:55 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lTj/fwSc6AEWq0CNFMa/Cfc0g9xWbv24b31lWqn22EHkPimM4HXbEDjdoce4oglqj5OzbZNLKnIlzGcu7bQIber5VEPNJpE7GX5I1L7f6X4socODnVI2EPvUl9THwlziVV6r2u2AJ2oYCy7iq/yn722NrnCo6TP+ZcRqmcnTovuzdoY/6r6Qg93hT/Nh0xKLI3nh3r7gW5k+1UPFAfYuFf7hSLuHR2fdR2Dw8gzq98bgb8PspC2XRD6s8uSqIzuI+3X2QIBhs3mjRwzqCuH4+leWhiBWNGE0MlDZnmNwN9zu6IdSO2yTwUJHJpIcNSFksu2Qf3Q+XEe6+zNL/N4CSw== 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=1TY/aJNw9z2q50gxV//6Oi1EJiAerOHeEo22V1WRCtg=; b=Dppig17bkrBV9scYKGxq3OfvSkgTchjBzg7mslg4eGWKDaN7cuB0QUVKDb55snvcxWXcDNDTGG48QdrKGCF3XLZK4E0GiRW9uwt/MxYCr62Mgo3aCn+Tri7q76z2Oboks75tdFeqOHgLnLitTl2g72vpPcUPd5db/EpwD9B9t3HJLIgT6uZPLSAQLpcJepCwLxnrq0RFiHPALg9hfUzjUsSreWUxSaydRmarmwtxkqIl0ykGSxZDBH5JCSnOE3ZV0rmgnSnxtRAdeX5g5WzAshK4Nb+/KYILT6AWEKzVozixZ5hpDEzQiHj34cD/MPLoPZ55nCLtcQ79tTqS3Saxzg== 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=1TY/aJNw9z2q50gxV//6Oi1EJiAerOHeEo22V1WRCtg=; b=BFhs9R/XaOrygmGrrslG3YM/rpjkMjomt9uvi9ViQzA7G3CQGLieW2RhaWOtesB2wAdBhK9W5fcvn2pInb22X13rtptUZ9eW6F7IWbILfVz9QnHAAKdjWLoUgJrR0aet+gy0DBxH1bbYDAvdb9e3bGB6RPPn+HbELIiI04fPRqyHsO6kc2U62wzDpwPaURkk3MYq89rCT8I+nVsxbSg1wL68rZzy7FWkalLaqupJmEtIhvMZqdsvAjKsBWXFPnekXr9XUYPSOJrkqftGPmCSfL8FbKf879De7x+dWfsrDoFk8CLbU+Jw3Bh58IAR/TBjB0sYtAZfwSum1Bed3WlFlg== 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:53 +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:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:29 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [oi9BII2qrwXanJr8DtpBOXCrVGFHd6uWydjCW1kJw5w=] 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-16-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: e5a2b37f-1845-4343-ee21-08dc2b5df5c1 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZMqDtUbVXlqZQMKXE9EdXxA/Ldx6rDNllWhkGd+xat97ga4OkgBfsk7DvOhoQEGQnTYbZ+0GMmdufQWaOsaSELXeNB1kxlP3aGu6N6SNFCJ5O5BjZTYxVBbaR7NaZ6S2sfTjBwLD5kXydWte22PxCZwCCzU13WOK7KaeXlgtg/3m4KhQLdKyqkMIpxHeeXnwhj0cPDdZ9sKW+cRAHZtfY6wzqKDkUN9tYxjEWoKSQaVeg880FbGSqiAo2wOh4vMvjkznqIUOe0LDpAedWsPVGR4FCUXtdTqtKB8mObZvWORmW5XwZbtuYLAxg3f/sP+qCNxKrZNUB8CQ+si9mXFC26ZvOlpH2CkKTuywEj9oO6t6z53Nv24D2dX+Pvt0oJp7IPJefAFbBg6yVvYY/9Ms+/PjSKqEkvW3M9y+tQB69+cH4rVipMa6OO1MPx32aoMu0pShP0ArZrhVvpKTJt/AtgHjfI/4KqFjj+ZadSsKie1NgD14RKukffjTqudnQbBDqxxOUKnvAH21RgfuNsI+34Jepogg1BSwkzfF5+/iOWj7h2Ym3OJaJznh22cCCn/eN1UDfl7AoSvroVpdGqgQv/vSdVUhzEW+Qfq4RLdDEgh0vir9yZbLkv5X/C3e4rYE9JTKP8pMC1RACJAMo8hW9sSrvhKzeHvCL79vAtoeZLt1WUIc28oP53sUcM2TzfoQ3JX0lJt38thhsgvWJ1/ZCoxil3fnULdD0xBGvo1Wls/A= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D/YW9l2SDCQkwx6PE7jKuYpkCGo+OZZV20gWLjAT13IbKaZIpqNVx9ncPOGtAhfNLfpAyNniA8/jLDmOh/xKz3aQ5ordZneeCWEW1XCiWq47pB4sPVjw5gcp+1mxyvjZ/fYSK1jZm7u0s2Vy9ajK6tKKQVpnstCfmU98ZzOvKw6xrZuIQdDJRPmjGZ+TnWvCZIAiWq11uavrjGnedkwXuBrpivLc+6Hq8780Uc81ebv0+FZ5Q0H81AIzbYhL1FtJwdJVe7wCzjg56m7YaY++Ayy24UVLoA4W23cz1e6RFYGE8NeVOvHdHoi08d89c1JZ0amHbaPIzGzF+rYT8VBTgTU/ba1eTbN/eOGXoFab12kDtkNR6rUv+aJQIouFwbsZbgow/aaZtGg3cE8p29TBFxcFxZjjA/znTtYducLq+SEVK/m9rB8+O8VqQtSxMNn0m3ZICR10VT1A6nH+oQNumz0YK12kayyodhhXQ6KWiToab+Nl8cnGc/Z5vRYO+SsgyTkrMjfZPQ+aSZ3Ie5J2p/5CIJsMOlLxggqueGAOFNnAiDWHMGOAmpcDvWrScqph+sW0T+5Vn2Rh68ZHJfrchme8eU91Py4XpuDG0n0rNaU= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: psktZQHon26xSkKFqehqKe0WY3x3Nz+gyL0paULOSkA7AzJcnst2ncIzc4VjYxRdp4qw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uOLRNo0yNw/ZtP3fMRvPKcr79y1zufRQZm5FNHwUijTeSrvQ/jb0EIOODoXX6lBxL1H93CS/2w+bzs9AWkqJqAwHo4xQW+/uuDLBXoioX+p/xryRZVI7gYoiunQ0eZO5oATA3Ht/sZ/hXJw7PcMhXH1/lefiTfQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5a2b37f-1845-4343-ee21-08dc2b5df5c1 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:53.6508 (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 17/23] avutil/hwcontext_d3d11va: Allocate pub and priv frames 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: JcP0Kcf4nMcI This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to D3D11VAFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_d3d11va.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 2fd3561c88..19fcf37a84 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -72,6 +72,11 @@ static av_cold void load_functions(void) } typedef struct D3D11VAFramesContext { + /** + * The public AVD3D11VAFramesContext. See hwcontext_d3d11va.h for it. + */ + AVD3D11VAFramesContext p; + int nb_surfaces; int nb_surfaces_used; @@ -113,8 +118,8 @@ static void d3d11va_default_unlock(void *ctx) static void d3d11va_frames_uninit(AVHWFramesContext *ctx) { - AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx; - D3D11VAFramesContext *s = ctx->internal->priv; + D3D11VAFramesContext *s = ctx->hwctx; + AVD3D11VAFramesContext *frames_hwctx = &s->p; if (frames_hwctx->texture) ID3D11Texture2D_Release(frames_hwctx->texture); @@ -169,8 +174,8 @@ static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *te { AVBufferRef *buf; AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc)); - D3D11VAFramesContext *s = ctx->internal->priv; - AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx; + D3D11VAFramesContext *s = ctx->hwctx; + AVD3D11VAFramesContext *frames_hwctx = &s->p; if (!desc) { ID3D11Texture2D_Release(tex); return NULL; @@ -206,8 +211,8 @@ static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *te static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx) { - D3D11VAFramesContext *s = ctx->internal->priv; - AVD3D11VAFramesContext *hwctx = ctx->hwctx; + D3D11VAFramesContext *s = ctx->hwctx; + AVD3D11VAFramesContext *hwctx = &s->p; AVD3D11VADeviceContext *device_hwctx = ctx->device_ctx->hwctx; HRESULT hr; ID3D11Texture2D *tex; @@ -235,8 +240,8 @@ static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx) static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size) { AVHWFramesContext *ctx = (AVHWFramesContext*)opaque; - D3D11VAFramesContext *s = ctx->internal->priv; - AVD3D11VAFramesContext *hwctx = ctx->hwctx; + D3D11VAFramesContext *s = ctx->hwctx; + AVD3D11VAFramesContext *hwctx = &s->p; D3D11_TEXTURE2D_DESC texDesc; if (!hwctx->texture) @@ -255,9 +260,9 @@ static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size) static int d3d11va_frames_init(AVHWFramesContext *ctx) { - AVD3D11VAFramesContext *hwctx = ctx->hwctx; AVD3D11VADeviceContext *device_hwctx = ctx->device_ctx->hwctx; - D3D11VAFramesContext *s = ctx->internal->priv; + D3D11VAFramesContext *s = ctx->hwctx; + AVD3D11VAFramesContext *hwctx = &s->p; int i; HRESULT hr; @@ -345,7 +350,7 @@ static int d3d11va_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats) { - D3D11VAFramesContext *s = ctx->internal->priv; + D3D11VAFramesContext *s = ctx->hwctx; enum AVPixelFormat *fmts; fmts = av_malloc_array(2, sizeof(*fmts)); @@ -367,7 +372,7 @@ static int d3d11va_transfer_get_formats(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; + D3D11VAFramesContext *s = ctx->hwctx; HRESULT hr; D3D11_TEXTURE2D_DESC texDesc = { .Width = ctx->width, @@ -407,7 +412,7 @@ static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { AVD3D11VADeviceContext *device_hwctx = ctx->device_ctx->hwctx; - D3D11VAFramesContext *s = ctx->internal->priv; + D3D11VAFramesContext *s = ctx->hwctx; int download = src->format == AV_PIX_FMT_D3D11; const AVFrame *frame = download ? src : dst; const AVFrame *other = download ? dst : src; @@ -696,8 +701,7 @@ const HWContextType ff_hwcontext_type_d3d11va = { .name = "D3D11VA", .device_hwctx_size = sizeof(AVD3D11VADeviceContext), - .frames_hwctx_size = sizeof(AVD3D11VAFramesContext), - .frames_priv_size = sizeof(D3D11VAFramesContext), + .frames_hwctx_size = sizeof(D3D11VAFramesContext), .device_create = d3d11va_device_create, .device_init = d3d11va_device_init, From patchwork Mon Feb 12 00:03:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46209 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402845pzc; Sun, 11 Feb 2024 16:04:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUYEspxP2k3MJTjr2yYS6pH8CaWHoHI4YOInNcH5u02zcKJrS+fpotbSuvIpQzub9whPnVtlAjT6huIAij36Hr8qUy3RZqCPLU0BQ== X-Google-Smtp-Source: AGHT+IG2E+7/I/ILlgEzWRSkDHT4tFB1XKgpTYPCF7rguqVWpob4JWfUH2+w+3FBxItsES8uKKpG X-Received: by 2002:a17:906:6808:b0:a37:2932:df1 with SMTP id k8-20020a170906680800b00a3729320df1mr3250529ejr.29.1707696252808; Sun, 11 Feb 2024 16:04:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX0npuYkPYeKgUCOOVKx7exwbSDtOsJXc9LO4e2c2merlwb1DD390K7IBm/M1tNCPNzCwfYKLEmDsVBViiC0YRu+hLLwTieE+gm4nfhGYFgQrfGkpSArvyOj5rfUPNI1HFO+p+CN4bbA/gW0zbk7l56gJehTLfla3IVXjXNVqRqAeuTmPpgBpMGzCVKlF+CCzhko9uyWcikA2Y+gplVyePnYRvITv+xdNAGxSpV0Xpn7MYRRbh6c2brIvjCG32qKZI5xmng5iskidd/53fcaK+C+kUjrgbmlKD8RjTPa7AG7eAeoCLu6cNJvUQCx/Ot33q1Ye3dMDkXAUFbhDLjdc5Zck5d+IvZPR7sx8uFad9N/26RQtwUBNmBeGGXAEIvj56kLKfQGaDFJ1vGRP/OIMrBBi4ayVG6xLJKxwxCM0w8D9aWX8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BOecFMaA4dHM/wigDSFKGxwAg6sPM1/7amRKL5yeUdzByb93H9pM3/wXRy4AQHbvAtMri31ebgsGv2lt11Hxpq3+Iw2bshP7In6TjUItHk= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id wr15-20020a170907700f00b00a388c7ea180si3232784ejb.604.2024.02.11.16.04.12; Sun, 11 Feb 2024 16:04:12 -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=WTVXU652; 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 41A1468D1E4; Mon, 12 Feb 2024 02:03:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2089.outbound.protection.outlook.com [40.92.73.89]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 36B7E68D1DD for ; Mon, 12 Feb 2024 02:02:57 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K3vgGyGTsT2JTgN3e8hZ0B57XRRcP2bRPvo7GAXs36cf7C/VWUmncWjtCzEtCiUOrXeQKRgnd6209Pfm4i6U9n9Ujc9fj56/aPFHtzAdQQTTmUMQkl7ML8z4RekdvhMo2ji4NiCR/gmd64CRYsGiRq3zmDrH/Ei0TXJEzVJj07Ju8L8nskS4XTMTjO6ir1QUaYFC53s7n6tqyRNdNEkxq/vrG1JP5caVY8veLnoIav9BL6WCa+t5KrC3kaskqa3vlLcK/URo7LNPgJ95auteLGJr5dfxMl0zHI3X+aj35QAW7PAA2/lrE2/56aoJW/HB5aAWzeUdJRPyvhzeOr35jg== 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=4ns/3etvEEZ3rHV/wxt5SZyAgaySK5CqC8kpKid8iT8=; b=F0/DcLgc9Q2F25/gmwfB7lBuUTVoic8uT4d3BBq54TxZV9xWlB4ZU2muEz7kSgd37lqHH2hyKHTbchOYB/33qKkl86w9OcLWsErqcFpYqfXK1zCJN/98KGi2I0HimfNfKRuEK3Q0dARyOx+EcUucM7BtxHHrW938xxUAFHEpoxefX54aW58f6hgN7kQuHkUjdzcnYpD53udEbgMhWIEDH6s8V4Mw2nT8G/E1EMmXgaTkiPmQKLTtEnOGXbksR33svR47UWNPqms2iAUC//dtQEG7HtmvSrRkPjqwt5aBYOhffX9iEdHUb2XKzQT2QcPDxrVtdV9YxCzUoHzE8tdodA== 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=4ns/3etvEEZ3rHV/wxt5SZyAgaySK5CqC8kpKid8iT8=; b=WTVXU652gPntfYYSsidr3u0h/FHbc0Kar2Xy8B108kQolNcYTKqNaLNsnVERo1z3JX7u8YV7zfHrzPoRT8bhwbHD63Cg97Ks+cJyYpDiIQD4bYElfHr6q0wbMlkY56rPVI0K9ayIapgm1/F3lmfbnxmyMF/kAfQ88D0/D7dnW1KLz84H7YrVYdIgCsrWy88aGyp85RWUlUM5RYJSYBBYzi/qwR7au6MYayBDjBaEBBUQk/M/fTpN/yM4yYybVlGzr+gsIsNdyNwtafzJXYPaRXFWRHcRcq8D5zIF7uqopfZYMfxJ48uFIBDhU+x5zniZeo+Hk94Zoyhup93iF2mHUQ== 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:56 +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:55 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:30 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [w4OHW85xVrqerOa1oQ93qRi9kOSVIzKT] 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-17-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: 8588da8e-5bde-4799-8695-08dc2b5df718 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZMqDtUbVXlqZQMKXE9EdXxA/Ldx6rDNllWhk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2GVgQzTa6vmT31df49ORtaSH3dF3rvvbyAbxkhEgxINfFnxm42YWSlrNH3VhkR4AThWipEatZa+XaYieFL2W2UpGlYgtjAhJFW3rvAY5eAwbTToXyHNeCsd5jEGxOrE5kLzKmwJR2xkmmwYqvS3MFSwGjy1Bi+khmcBx1qoRpNSY93n4zoBwVGqUTHxONeHVkWIqvSWeIm3hsa7DuwU/aEiMmd2gyG9uO95V3ppC/Hb/BvEEvt8NlBwN6zT70Md/gKGMOpKKu9qIe31zH/vmknD38A8R9v1u6d8nfbioNsnhF+XCkK572fB3d77/izkngtGZsABF90jlVequbRxDM94eVerokmvYLrrX2F4YnsLxYj0sMYN7pGqSr4fHGzzhcfGj0Z2M3qrJcSnOb9/i7VYKc8ahm6HfHzbTqlq/1g+lM2wdNkfr7+1OaPF1Kvz5j0/mRLRVTu2P1hPcrWHaRw26uKJVWjDk4RkyHJjglyt64LG33zjmGI8qx9a/XJdstX5GonEjKsq/poZmLLiskiwxs1rU96Svui8aS0bYD580MOT7rlW35ochPtIdSp2PF0Y6VHTwWnY2tFa/2lbxIbg8nlB5Kw5VJsl0sw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8588da8e-5bde-4799-8695-08dc2b5df718 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:55.9096 (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 18/23] avutil/hwcontext_d3d12va: Allocate pub and priv frames 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: 4DH5qLxNxw+g This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to D3D12VAFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_d3d12va.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libavutil/hwcontext_d3d12va.c b/libavutil/hwcontext_d3d12va.c index 6b4cd22899..16c07868f3 100644 --- a/libavutil/hwcontext_d3d12va.c +++ b/libavutil/hwcontext_d3d12va.c @@ -36,6 +36,11 @@ typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY2)(UINT Flags, REFIID riid, void **ppFactory); typedef struct D3D12VAFramesContext { + /** + * The public AVD3D12VAFramesContext. See hwcontext_d3d12va.h for it. + */ + AVD3D12VAFramesContext p; + ID3D12Resource *staging_download_buffer; ID3D12Resource *staging_upload_buffer; ID3D12CommandQueue *command_queue; @@ -101,7 +106,7 @@ static int d3d12va_create_staging_buffer_resource(AVHWFramesContext *ctx, D3D12_ ID3D12Resource **ppResource, int download) { AVD3D12VADeviceContext *device_hwctx = ctx->device_ctx->hwctx; - D3D12VAFramesContext *s = ctx->internal->priv; + D3D12VAFramesContext *s = ctx->hwctx; D3D12_HEAP_PROPERTIES props = { .Type = download ? D3D12_HEAP_TYPE_READBACK : D3D12_HEAP_TYPE_UPLOAD }; D3D12_RESOURCE_DESC desc = { .Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, @@ -128,8 +133,8 @@ static int d3d12va_create_staging_buffer_resource(AVHWFramesContext *ctx, D3D12_ static int d3d12va_create_helper_objects(AVHWFramesContext *ctx) { AVD3D12VADeviceContext *device_hwctx = ctx->device_ctx->hwctx; - AVD3D12VAFramesContext *frames_hwctx = ctx->hwctx; - D3D12VAFramesContext *s = ctx->internal->priv; + D3D12VAFramesContext *s = ctx->hwctx; + AVD3D12VAFramesContext *frames_hwctx = &s->p; D3D12_COMMAND_QUEUE_DESC queue_desc = { .Type = D3D12_COMMAND_LIST_TYPE_COPY, @@ -168,7 +173,7 @@ fail: static void d3d12va_frames_uninit(AVHWFramesContext *ctx) { - D3D12VAFramesContext *s = ctx->internal->priv; + D3D12VAFramesContext *s = ctx->hwctx; D3D12_OBJECT_RELEASE(s->sync_ctx.fence); if (s->sync_ctx.event) @@ -345,8 +350,8 @@ static int d3d12va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { AVD3D12VADeviceContext *hwctx = ctx->device_ctx->hwctx; - AVD3D12VAFramesContext *frames_hwctx = ctx->hwctx; - D3D12VAFramesContext *s = ctx->internal->priv; + D3D12VAFramesContext *s = ctx->hwctx; + AVD3D12VAFramesContext *frames_hwctx = &s->p; int ret; int download = src->format == AV_PIX_FMT_D3D12; @@ -675,8 +680,7 @@ const HWContextType ff_hwcontext_type_d3d12va = { .name = "D3D12VA", .device_hwctx_size = sizeof(D3D12VADevicePriv), - .frames_hwctx_size = sizeof(AVD3D12VAFramesContext), - .frames_priv_size = sizeof(D3D12VAFramesContext), + .frames_hwctx_size = sizeof(D3D12VAFramesContext), .device_create = d3d12va_device_create, .device_init = d3d12va_device_init, From patchwork Mon Feb 12 00:03:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46210 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402882pzc; Sun, 11 Feb 2024 16:04:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8UhiP6JLfpoPkbpFiVmF2JH69MbT1LXX4eufuCXuwWtZpUPA4yTaqutEMQQcLeaMTRbML X-Received: by 2002:a17:906:d8b8:b0:a37:e5fd:94ee with SMTP id qc24-20020a170906d8b800b00a37e5fd94eemr4024827ejb.72.1707696260620; Sun, 11 Feb 2024 16:04:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUbdfv8Uf/P289UeYro8pNubNbC6WePlrDtIJG51XWQdFgCaLsikvnqB4WEeS8ItHR4rtTeC3RGdwE27IUH8HC9vdEeGQfuTRA68nlK+1vatCZtMLvRkpVbHyH4NBZCZApdgvmMj3NrzxXlLmh8+x8SgPfqpFOGr+YAwVggYV41/h3jNI7w8sEK7QKsO806UfUGoefvqOc9yxHdwqg+K8Usiv02fQbAhiIYZr/HsqMiqjcqzHpGEmZ8MkxMstht+K1rjqlSLviGLrmsS92YmF1S2pdyjKoGRAClgXxlhB0reRM+HD8WAuGbiB3dJVEPb6YEnNRsbTu5e8YWRWHRcOB3hVVygNVElenRgrKN1u1Txlu6jCE5NRFxyA/zbwxkl77U+TPA8oj1sked4k9ZpzlxbBfsDFE0IXR+HM0z5dy1yju+tgmj3+gbCpzndGeeqXH3TtVLLw6b5QWMQZ+uOjtujzdmh0gwntEw5/ZBCBsY2Hr8gPJ8l4nzwm7RROEShJgtyqN+3mMWgM6tWKO0hM23GNfqDt/tWdDJGNVoR6v493PheuZ1I9h4UQoTp56c9QrgY6wzidQ2D3krySmDj8jkrY2cpSzp4oSZOMPniv/uvGQpbFrNE6+4nc4Q0edLPGBSUoA+rbByppGQ0zMr9WCy9XJnsVk1OfLq6/e9g22TBBx0gwFcfJNc1zOMfeME7uYfp2xMb6EbF/uOcyjVVJRGAnkkBybtXFDpjwJIn2tQZka+w3ftBrhMY+MbiunZ7Mscu1OrfOvumZ52vomq2XOrrrWCqzz35XP2DHp91xzNcJClDTTL91iz1pkWsN+SouOddHTS6LoJZCXXMrkWgo+jWeZAp7P0riv0SNqv1q0l3SabDOegMtO5VqMQYbnfhG9qD3gSJSqX8VDOrxDhCvt+rIkyl2BcwVZAyNiTgeHDS+GRCqiMKaA5PFZbqGU/LhC1CK Dzpj9DsrAv8y1gtsSmlD1Bg2lE5j9dwIKUYjt8wjfwsbwmeuqXgBRNpZxSEv6w286o+X5SYg/t482PjwQO+f9rmkUGuKTm2s3FlqwkYJ09MJaLWQNdxeZr1lGHnwJ7DeASmOcv7JBiCcUKWSyWl1+tBRNDBF/RdhlJVZDmTtxxWojgzM32WgBluvGCtWQ5Gw3AvZpMl4WAiWe+ZpeJUmVZpq8a+6Yx7UrKh3Zi6HrPClpoccHO0hjRDcZh9O2hc5SYh2SRL5BlKaKD5kZLnQBjNtf68ag6hqYfrEedzY2PcNekvcZthBcLZlwC9WIPSpiU/ygwBUOxYAzEDuFcuOYUIfgozbIeSwjkfOvGRvYUzp/er7fNGfWxy0f7MVTR5J5Fc+Xf72kLGXqlr50zTPTsk34SzlGsV2dcIpmETko07w2CNRjc2G8kNrjwuUGM8adOzWoeudwTY/G8kOpKSjE7DH70N9oZ8h+AQw7Srma9wbNwop9o6P79LxbS0mq7dEPBhFYYEV0dpWrTu6B8ysZY8rOvxW0qQcoJIEPNMGbu7U04uErXQ/erxFvgaY0EQeVbEOMuCF/mAfk7WNe8aceJabC19FCuvhdJOfGm0J9milkNO0GqrYk2BG+tJ1HE/+6CSF/t Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i23-20020a1709061cd700b00a387d9e1672si3271386ejh.1034.2024.02.11.16.04.20; Sun, 11 Feb 2024 16:04:20 -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=taxaVQmq; 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 4EB7768D17B; Mon, 12 Feb 2024 02:03:03 +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-am7eur03olkn2073.outbound.protection.outlook.com [40.92.59.73]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 352BA68D13C for ; Mon, 12 Feb 2024 02:03:01 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cu6Xc2UQyV0BE024LrN1y5lCzx5fjm1X/llEw8sbWk5PrYTbDazFO8wTuhQAqeSqbo6KW34QqOHBwyhl9iLG4xA2hFrZQ4iKGsCmI+PN71BlUrQi5egsY9iD0PyKvKxUw/PocYqKdcBxsEQo0c3RrVwE3hpEeyXNuUJ+QUUn/fmMaHfWNzSoc7DtHSUwkVjHqdkHatzx8hrcZU3rjIDK0ZnWt/Z1dkPxl6BwrH1tGnWh0KJlpu7ufQZid3hguKytdgU+OtyISank5EmB3ybfN4hLmWxLBG/KreULI3fsAho9NLVDnkoTNZKLDtsYX35Ty7NsuoLzJ6QFPPoe1vRMYg== 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=iToTBIjDpN4j6r67gPWxmw4VtxRS0qMTMp5mCkXhGGg=; b=MYj+AUIiEDlZRWUouzFPKXg2NKxXrepB6wmEhT+YlmD2tzJ5XYJBHNweOGq+sJEro6TvNVS2ZAKt9cWvAOY9OxoOph4Nh/S9PfkvXOCpLSJL+5pOvU97cXmoGwJOqz4Ljesaf20XaRblDNoBun75ObVdAa37DQDIiUq04BNk09G5sr3ct8i6Dzji8+6jrewW7TjME6XEaRRyiSKY+4pFg2hcWU7JtuPMu7ZApDnsDFUVCbf/dpUhPa+CmoFWdfguSbwfYabjYhGMrXsFcDCNHLX2Mxw61FJGo+xjgbg0FIiNTXB2VJbgxvoX+Ju9hOIFyE2INlX9UC81YSTYzYIwBA== 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=iToTBIjDpN4j6r67gPWxmw4VtxRS0qMTMp5mCkXhGGg=; b=taxaVQmqz9xlzV8HOtOFLAHduGCNHm7b645pv2bI+e3BWwIy/BItyDk0GCZfx7T2w3bdQfLp81LzEmCgQvobKxnH1W33+Hlds6ex0JdbmSMPSq5S9Mkw3/sg+R21O+rXws+KvVjn7gDe7wmMWf9WIiTi+5j74ck1+pg4dp45Saw/azZ/Z2JnM9E051yiPmzgCklHZfYTRkwFZqaCf6u5siSRww0SSbwt2CQA6W8Pr9FQLS6Tp7+MulUopCjccF7bU3/xVOpqyysYG38/wLAB/hyKbPf0o9tBgnNqQJ2wSJ9anrzghycLMsc9sYrTh/Y9xZzsVeDwWMUSU6eeosauPA== 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:03:00 +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:03:00 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:31 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [WurHxVrz2VRT0qaI8tQaKnNrjZXz60Z+] 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-18-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: f50cc4e4-6e3d-48b2-37fa-08dc2b5df9ba X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZk/oamKGTKMyYHJ1AalAZlI72EHq9XkyAA+iTRsd+7iBDp9uAcQFc3WR9Ou4noAnEQhQNs2fiTwxYXhdA5o9vJakrx7XTxj2bD++SCw8L7ybRyejUUk4MU3BPkaZC2DR0Y5pHHxNoblg4U3IxMzmvofjuQtm0ECVFQoWVmVFC2ut7VPTRF2JOiiRHGFhjKAAnyqeYtmL1PEiIRAX0BpT5kwa0rUv6NcKqgaHWFzeqU0dQP4H9ccrN841rehRiKreVkmXAlirstGIqDldBFa+UCT1PK2t7WlhFS9SY+vo4NBnWvCqk6wKmvLFWFBffUqB5b9RSdWTs5kChZ6TH7hI6Mhbpp2UWTt7SiU00jAxAoVKpKLE82N8xMwLBRFq+3hAUGUnhJaMntHx5+x/YF+KR/gWgP373njvO9L4AdlErG6lielwyTgyhRW582vawaeXq8abxaM2NQh9gINGrsCwz3trq9bOxHuRYlUpPQ7X1HTWUW7TSx+y5vCYSE3L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E7lfRtziw7zJ3veqChyaoHdcb1XUKzw6FAtLGZUr0P5Y1IeVY+b+6gUmfwc4P2kR5C6Gxgk8/BskPUDCShKDjdROjBujusNtOReSHdL2B9xEF5zOaW6qrhG4du/8G/iabMYWBI6/eOQ5oLINxXiBHQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f50cc4e4-6e3d-48b2-37fa-08dc2b5df9ba 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:03:00.3749 (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 19/23] avutil/hwcontext: Clarify documentation of AVHWFramesContext.hwctx 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: VBCC+Uz0wrGv Correct the names of the format-specific headers (not hwframe_*.h) and clarify that the user shall ignore this field if there is no public context associated with it. In particular, this allows to use this field for the private context alone if there is no public context. This can't break conforming API users, because they always have to live with the possibility that a new public context has been introduced. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h index d91391294b..091bceb2f9 100644 --- a/libavutil/hwcontext.h +++ b/libavutil/hwcontext.h @@ -145,9 +145,12 @@ typedef struct AVHWFramesContext { * The format-specific data, allocated and freed automatically along with * this context. * - * Should be cast by the user to the format-specific context defined in the - * corresponding header (hwframe_*.h) and filled as described in the - * documentation before calling av_hwframe_ctx_init(). + * The user shall ignore this field if the corresponding format-specific + * header (hwcontext_*.h) does not define a context to be used as + * AVHWFramesContext.hwctx. + * + * Otherwise, it should be cast by the user to said context and filled + * as described in the documentation before calling av_hwframe_ctx_init(). * * After any frames using this context are created, the contents of this * struct should not be modified by the caller. From patchwork Mon Feb 12 00:03:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46211 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp402940pzc; Sun, 11 Feb 2024 16:04:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXDHWTknnk/fSQi+MqCHlWyOfPYL2yt3Rh4U5EZYbc7O9GJfcKDW2VTG6XPnLVUeyd+7mZRbcFoLWwGXOgQEKsP7bRT1Xlz2DRPlQ== X-Google-Smtp-Source: AGHT+IHBerpcB9QCsPKnzlEZa42UgNSSPkAEGb1wQ3qBVGx88nojq/u7yyxNyDeLz+ElJnSYMQic X-Received: by 2002:a05:6402:28c9:b0:560:5c7b:ba5 with SMTP id ef9-20020a05640228c900b005605c7b0ba5mr7170404edb.19.1707696268712; Sun, 11 Feb 2024 16:04:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX5S3oycq4JGcF1QVAoBmeNcaa6AG5FTXliJ3aGFGggkw6BAj+OolMp5GLR/ppr4ScbXDPPbWwMV25tAlgpnsr77pPCGX1WLOpqSgePqosTjmwq8si41s24WZ+34JIUzU/UenT4DD1GEfOrvmAMmLTrXyUyG7NEEKFA574GXPZupGUg1rkpm6g9dWCxtYkquoCTUp7c4ldGY2zGLHdcXEtds5DhXy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ra/mANI1qU/tFZHW7sZOy/ARf0LLVA/2VTJ/8rSsNtFlmRvo5vmOYYhliP91G1JUk3tpoKnf5uQzf2A1KJ38QnI9cCOuhIUswWrXb91JbzwuKnTamIdGfRzm5owniT/0mBgAySRjH29wWSDQH06FkofDJXwKh63j2lcYA9jX89VX392U+Rwuoxm7ThdGWV3er1QCiroHlSZVU2XziWnekhph5meYxIvGCUWY/q+xocdD2FwdmYvROnIU70iZK32RBu/te8PRmu8WrdNWvyfAAzYpHHhrBvRqAK4a1FpS7ZPZasmpyNlRW7y Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l6-20020aa7c3c6000000b00560a6810a7csi2283238edr.274.2024.02.11.16.04.28; Sun, 11 Feb 2024 16:04:28 -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=S4vitqDs; 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 34A5F68D1F0; Mon, 12 Feb 2024 02:03:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02olkn2041.outbound.protection.outlook.com [40.92.48.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1FFED68D1E6 for ; Mon, 12 Feb 2024 02:03:05 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KDlrS+fW0asZ7grvLDJD4fpTXatGRwDu+ot8kznc9y1YyztXxzUpxKKan8Jt3H5DaimD3sDWw4uxLP9kOYFIthXMhY8ZQLsXrH9y9QIPEuyLJmGubG0r9JuvPX4c/Awp7w6hoWukpwRfCste1NxfqQlfoah71jposfz8R9i5XBgx/0uA2c4fl6bAQ2CzfIM3gHR9h6etSgoIUe0/KTJzkjtMl6+ra3Mf51ez8+jjrXjTsGsFfIxm8yPY6KyYc4rna+HKhlF4GcbjbQDKhvPrk82jC/rxavcn/myMPUHf2OqLk3W6x6IRnmR4zLL8cYYqlW/uz2rNuAVa/zw4MEoI2w== 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=rSDbADQ+x4Ua6AjR1K6U5XS8wt1fzbsEsysjxs06Fzs=; b=NgoVy7QGzI5rZg5lWGMCeud4Kp1xEQ9GHVux8CUofHudug4GY0PN7SCOAfKUTjLvZMLWmgjRhXh8bTWhBrodaFcB/FtRfc+nJDgNG6jK89akOkrIpjiVS+mzBHfRtUK9acr0+6d+ZUy2lPwVprlQP9uK7dN5vwMGAruWnVN7cJQNv7HYAhJWRNQE2Ejr5DxiESFilZSHlIxygF1qFZeuQgh61/dJUbiqNfhgF4h4JX0nSsaqzQBCpV4qkk12h+lTjy9hO+eBGyw1GsjAIUfwyeA1B7dm1eCeWksBdr8aUl8yR50c59ktsyonxb+PuvMJyeYe3nZxUJfpRSG4gGNlXw== 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=rSDbADQ+x4Ua6AjR1K6U5XS8wt1fzbsEsysjxs06Fzs=; b=S4vitqDsTf+h82lBQFQ8HzmCdwPHu+SowQoPs8HSqvUXjPiSRbPVGRm4skfNDc6Ax8/WP6zJ6CYvoeHdz2I3T1syQiCsB8dPoCo2E+SzeiUMNjWrjFg1JP147hqHhodAXKLpzgv1adeAuUio0QtdF6wmg8INKC20XwOskiUa+CQo3peYVQds0PuDeu6aCgLCUISHzCw8ODCgvBY/Sk8s0KE0d0M2sAtL7xVE3q5UObbnzFQl1O2i6tX9nb9YsOA5UgpgcEFB//DqpkRFbU3/Yn2NKxUtsKpTgj5T7qFmh54u4apkcEoR6n5ex4F/VCAPT1eGq0vdQCBJbGkOzP6bxw== Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) by AS8P250MB0072.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:374::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.33; Mon, 12 Feb 2024 00:03:04 +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:03:04 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:32 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [ShE8ZOlJfG53klv7Qf9vR6jOa8BdDtWY] 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-19-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0P250MB0747:EE_|AS8P250MB0072:EE_ X-MS-Office365-Filtering-Correlation-Id: 2632451d-460d-45c9-cd6f-08dc2b5dfc07 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZ/hXIzXv47qP7/JaOlNiD3qEwQaUzyLAkaAIUaJsMqfm8yBcqROnorWF6YfXQwwRlXqWU7ESqZlrvUQ83qNj5hrqGw7W/CTCAplTbGHz5h1wl6oH5Ciq1vFUhlvs2vy2k19aVT5MmLj6RCmE0gcc+xAi+iYAEi3t+C/8EBY2PmRZD4EYBmkGAaKdfo4jPy1DGAu+DyY8uL+LG84nvk8IJimzZTXRzAU8wvtoSPRHfA2zzzriFxRGMICqyFRXHrRsYSqolbWKXlTMfnQRHiR3IoZkfVDjZNLg19wOojSr7x3hgwgGPnGwSNgXwkeNgscwNtqQhaszT2iKiJbM4FQcGGvAhuem+Dl+k0NW3Jah8pEmsYygd/UQ+66J8UFx7jUgwl9P9mnZpzAyk35WN4csgULhXoNfWmaRsJ0KJ3bd4Qf7v43c6rkTfnHDlf1JRU8js92dBPrvtGP2iiF+4fww44Uk36/sIH2X3c0Jk6K2RPNZRLJJtZGvN7v/tbwCtlVs2kFbvBOQ4+KwA4MqErz3cydseimJ1lFnJrl7i6yOXXCHrtU52jRdAL90la2dzv4AQ2dt4+Cw+SQSUEwhvq3rRNET0DtxPdmT5Fj/N6acGnDV1UUlnbBX8chaBGgn9hYvmD5Nyk6baUKLEvgkpIIDFzxAjtaR3yow+YsXgxVA/5nWykFq6yIVNSx1g07lcRJfaShOnmeqm5p1X5zU8qpQw05QKJSfOf/FKaIbIHcSP6I0= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tc05R9bKjZwAOWsLJyv1ffsCIiD1SvjJG2uz1+9eD53vI4OtE8d6zTVjzleD/EE9PtDGv+Anxx4ogKrTRcyQpk2WStWK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czaUpc8nZBy3wFFIKm0lebntD9jedUEJmhy1q7LDyvGBcUDezlFjblXj3W7oEAQrqA3S0oxlYtS1BRrtFt1+im/HGsd14xJv5aShXfMOUa0cLkut5sOs60ImzX53pJhOSMSMd5A2IzNTy4Dgn4N62642BLrVqCm1az6XFbu5sIxJqetkSSD/2uwA83WMkcQSD6JDrwAtCJXmHG9w+aI2OGR5YJzfjeoGhhhiW2wCGA0SThAJfqK69vWhfx34ybtq7KRnfP6BmmsLDT6wEEGr3g+gRulrkMi6zvQmSoS1aS5BKADG7gKBoi1jaMcqu3MnKxkwtj7td/ditiXkcOyc4Gwc1MfRVWBiYlvkaiLbziNGFKQqu16VedvJeTiwKAzNaRa0P7jH9Ku0IgbmN8L2jRATGROF8HDaAij/tW6yYF2vIDBZUv+NPhNCwGtJHCtNHPGJFeg7ONkg0dFS5wsWRWOa2k8RSH3JKrmixmAydZkDnO33Z31INXjpqOpOUyN8bLAYJeONZdqaVCHoiQqkND2sjQA69QVxFfbWObuGsQw6jHFoveWmYp7NnTc3BRmHqz5cw11Ep5z9Q875SERz+4ti851qIke2EBbLTo7KmXMzJp2veCt8c222aZSTm9DOpkuGfy5CHjwYEgMzNXe+ea3Y1wec7T+QeoZkgRGkaFtxzD0sa+eAVW7KZtMzHbkA2DEQXgbLr/32VqqX/jTZo3F9MKmxQfddnWoMNsXW/cr2ZlgTfyLWPn3NZBe4rCC/MNRfkTrmM05dFvtzr3m7hTK9xyaSXHQQyO0bNjFcZqBjrJhp7pX7gBKSIcpCQob6sFg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2632451d-460d-45c9-cd6f-08dc2b5dfc07 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:03:04.1896 (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: AS8P250MB0072 Subject: [FFmpeg-devel] [PATCH 20/23] avutil/hwcontext_vdpau: Don't use AVHWFramesInternal.priv 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: R7DUdoIqnG31 Use AVHWFramesContext.hwctx instead. This simplifies access to VDPAUFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_vdpau.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c index 016300db1e..0a1a33f8b1 100644 --- a/libavutil/hwcontext_vdpau.c +++ b/libavutil/hwcontext_vdpau.c @@ -233,7 +233,7 @@ static void vdpau_buffer_free(void *opaque, uint8_t *data) static AVBufferRef *vdpau_pool_alloc(void *opaque, size_t size) { AVHWFramesContext *ctx = opaque; - VDPAUFramesContext *priv = ctx->internal->priv; + VDPAUFramesContext *priv = ctx->hwctx; VDPAUDeviceContext *device_priv = ctx->device_ctx->hwctx; AVVDPAUDeviceContext *device_hwctx = &device_priv->p; @@ -261,7 +261,7 @@ static AVBufferRef *vdpau_pool_alloc(void *opaque, size_t size) static int vdpau_frames_init(AVHWFramesContext *ctx) { VDPAUDeviceContext *device_priv = ctx->device_ctx->hwctx; - VDPAUFramesContext *priv = ctx->internal->priv; + VDPAUFramesContext *priv = ctx->hwctx; int i; @@ -311,7 +311,7 @@ static int vdpau_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats) { - VDPAUFramesContext *priv = ctx->internal->priv; + VDPAUFramesContext *priv = ctx->hwctx; enum AVPixelFormat *fmts; @@ -334,7 +334,7 @@ static int vdpau_transfer_get_formats(AVHWFramesContext *ctx, static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { - VDPAUFramesContext *priv = ctx->internal->priv; + VDPAUFramesContext *priv = ctx->hwctx; VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)src->data[3]; void *data[3]; @@ -392,7 +392,7 @@ static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { - VDPAUFramesContext *priv = ctx->internal->priv; + VDPAUFramesContext *priv = ctx->hwctx; VdpVideoSurface surf = (VdpVideoSurface)(uintptr_t)dst->data[3]; const void *data[3]; @@ -514,7 +514,7 @@ const HWContextType ff_hwcontext_type_vdpau = { .name = "VDPAU", .device_hwctx_size = sizeof(VDPAUDeviceContext), - .frames_priv_size = sizeof(VDPAUFramesContext), + .frames_hwctx_size = sizeof(VDPAUFramesContext), #if HAVE_VDPAU_X11 .device_create = vdpau_device_create, From patchwork Mon Feb 12 00:03:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46212 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp403012pzc; Sun, 11 Feb 2024 16:04:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUvg8dLL+0SHznZJEdeyCaTimDW+GTLbxx/ef1WDdkBqZCjDXzwoiV7/vu+iUYRT/CO8O1F3/4GSLyXFudVwDL19tlqBVA4FN5ofA== X-Google-Smtp-Source: AGHT+IHviZ3Huh14z2BevNFOhZiKRRWxRUHC648e0DWCejT7vU65/TaTX+h8K4w7C+1DcxrdCzFo X-Received: by 2002:a05:6512:ba2:b0:511:7aa7:197b with SMTP id b34-20020a0565120ba200b005117aa7197bmr4393083lfv.60.1707696277761; Sun, 11 Feb 2024 16:04:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWU1AadiHTgEdImYDym1qE/N4QFCmlpCsl7uXdY6viBspaoQ1T/d+tr2fckKgqOF6nQrAz8Vxhjyf0PVjQsxv4vwu9y5mvWNMxcKf/DjPz3mDDHA3HtkMcjBtjbADdzu0IbfNTW2sgLYGllaykjX9l3uLwrTgRPjTSihpsxzDcaj7aXcNTFF+r39jQ5XVXhHizPCp8YFxwb2DpOKsxeV8u///kLEW+IJiGHkYDe4wD0nRuaZJevDlETLR7y3jCtnSOJmmps4eBDqz1LieiBZnkpaCHRNJuSVl5HIp3IalLcqdvPS1bOVIGoZzTrxzjycDNXi89I1yLWX9U6ycr8vOFI2u1AP5cbail5JRl6Yznn9ZppGUlxdY6CiuqNRh9ON6zzlRQ3bX1xuvI54/zonmvtvMGa/pDSBDBdY8GzrR4K6XOXOcBOKWTqQL/VISwfXLlkFzpjZt1mf4Rknv6m7Z38vXRD06b4ggDit4RPnob0EhYr8iwbL4AGKkHJhl90UEBKm/+NsuBlDNmIYUHsPtsVjKuDEJX6mdW6UqyQqD2FXqXIMkN+yy3T8179KxmOUrfmx3VCOpG0rpx7ltSgec1USU20ku+//Nw5REkhHy5N7whY6WxKF2YOpyyRkRETu/JzPS7KcVYN8ZHOJXAsS1ZR6+Xt30bfKUSMbu0pdJIW6ZiL83p3kcZirn9xLunRec/YMNXwDrFwa81hQdxk7uADmBxMFrBiTfKS3rdTmKQ/7ceNvrErppAkeZ3/FGZQV2kMeQi8TBlShH11Zs6URq9GKDCab7cTqE4NCSC9tA/Eq8CyYSrkxqhbIpoWhiAN+/b+yM5crCaEdxXD1IC3dzXZsyGJ7XQWymLDa54088AeRbWY2i3eUTIgrHqiDyiCYc4vc34yiLERYi+RioCDOYdPQyzYWBwDz08mnEjJDayRjpujwA7TqTE6bUItK9HADR4vDX ke8Ef8l8LX0vc01mjRBhd44NJmD0VVeEMLN4bFMv9JRw2LkqQWtSqvyyMHRLjo6SQnvMVUdF173bJGS/JMIlBCcibREbKoXyAjLQeCmaYszXo/A3oRHcoZYkvWVwDM97Q71b3viyOd25qBlYDip2ZvezLQNsoHdfNzNLJ2vne0rHYWp38VJhTAbqXLZ2E2Gw2ugKAGcU8lsP7zWyK7sjpW8NQPQboNh8ePwl2xeiOCO1Wd4J+ECoUdUi1dGpRjp07GAv2logi5EPhpQNL2kiTXyiWnkLBxfDtrkZhK+De6E4nCyPyPFh/MCdINyAzrDUY6X+Kxm/qtxC/8ZaloG+CsgYswg0u+l3FaQryZp9TsnrYvbrdaCm3sfZV/wn0Xa77MrZoCyf0qw6Sopq/nehaKv4tYdVDIEZK25NFMaT0VvJQD8togUlGNnszltwvCSaLaqSJne4arG36P1ZRY8BU+M7HNcLYfgTMv8V1O0P3h5msW5c2cLPKPzsmvN53NVkjM9fNZrwbDnrtpe817DXbc3uM1iIA2r7SkbsFApPgMWluCp0+qblu0FIg5PbOXpaINSC1TKec/m1+fdkplurdE2FlcsgN5LDZ0ObFa2HrF/ykDXAEpeu08PmZRWwWihnVs Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id uz28-20020a170907119c00b00a384f559179si3314481ejb.399.2024.02.11.16.04.37; Sun, 11 Feb 2024 16:04:37 -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=qEJLHiNp; 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 45DDB68D139; Mon, 12 Feb 2024 02:03:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02olkn2106.outbound.protection.outlook.com [40.92.48.106]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A008768D1ED for ; Mon, 12 Feb 2024 02:03:07 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e3vXmm0Tu/lnLFYXOmN5AlDgWhLx+WDwo/fYwoU3T/SBASRuKgo2ONdhH3HlkfAKNCm1xuDTMoHT7Pokf/ZGntIOZyUVHbkEFw+0DxJyTv801WoJ6cAgQmnBEq+MF6qmL8F65z8F4SfbQESWogICthbol8kvUNCS6HBJgbxgTB8uWHn8aH7MuxvxKIyQcZ87hn9PqQPN85rAJGyJIerM9xk64bKn4Pc9cn6kKQ0a8akaPmE2+bQznp24lulO0s/4Bovy8tWBx+oH7IT/Fr5oUCrpq3+B7iBJ21r8/TuidwX9tCQP18ss8VkWUDN2iiydWRSEfiL2fti1C4OAuo6dnA== 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=ed8YwzMHW2mwaG1sEMFkIH5xCOrurDXPDmoUO15mHcI=; b=ia+b5felHPv4kfRaoXlq7Sw6qRofHyJzdkJA5YKkc3QnWdVmdN0JRIsRpSowRimEzVxZti7bZtdbi8uSCVlsWePPWTtiXtkJr9Gu9HQ3vJ2uQ237e4t6zyJAN7CVtCP955rA/6LAxSFXs9+dMXyiSJQiBmc9YmuMiJuBsQ15+lK41fn+xlGZTzgJxZkODD/xDONwqAp1C+fEF8yYBVoBvZZKlmbUeAjDATyfDP6W/J+elWFIivBVzFUcvddUuXuUZZkOQ4YnQVBt6uq6YZeED1MqZqn1QsTeoVMa8NZibxgbOHEIs46fCf+9IelK7IUfATmU3znrpiF5DNf95eZ6bA== 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=ed8YwzMHW2mwaG1sEMFkIH5xCOrurDXPDmoUO15mHcI=; b=qEJLHiNplBymZWNa0lHN7r0thCdN8nSEOZ/5AprHXTe1kJ2DQOpxbgDipcxWvXDwdGYQcLrWGlWKqgeoGWRcBYWB9TFHuszqI/7ts2fsenUkIRa9UjBbQzvgX9OpJecY/FeZdb3H/IHnvw/YypAl5qmkymvYaPCoLAG1spSeW2AqUAPZKeG08GBJU0lXHevyqiLDFtUp19ZhihiRAysUtZRL2+RY7jKodTkFmTBVHK9WN6bSDkXb+KmhFGYJ7xJnIFNGViEbFfW/dh7H4SKXfoXwOBU3CA/PRuPY/oh9nTg5QqtsxEv6Nw/6ubt4oAhc0yVkZtRjqtRuGcjCIeUPlg== Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) by AS8P250MB0072.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:374::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.33; Mon, 12 Feb 2024 00:03:06 +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:03:06 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:33 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [1WfbckYZNiL2xrI2kmQtkz00f+oUhkSW] 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-20-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0P250MB0747:EE_|AS8P250MB0072:EE_ X-MS-Office365-Filtering-Correlation-Id: e7c30343-d061-4103-c664-08dc2b5dfd49 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZ/hXIzXv47qP7/JaOlNiD3qEwQaUzyLAkaAIUaJsMqfm8yBcqROnorWF6YfXQwwRlXqWU7ESqZlqzUGOrQqgmJTEwPw721HlEJstv9XdXTKmpLREDlkivdZ2dZZbxxyLVoZ8zPXSzFR9bz6XtBOjLaoBIdmjVJH+FHXTua0HI5/HphvewDA0aSB3nphRjyIUxglWFrOKzi/Uc9N79i4PMILip6sIR1tF5t+HPoklrDtwAQdpAHrgdlCvZCbjpswIhtPbQ0VTgX82uACwjlRmhfjXyJk53UxjSkXR6WgbhdZ2miIonI2DAquSUW3pcpcqcb7cNthPhEsfGgotoY3nus4VYPJZ4STSSQoiJRE+MXUvF7r6/i5hCx63WpNiFEup+pBb2hUT5eFE4b3T21ziegZyWehnfyTEdxemoIRCVexyPWrlJWYkr/Uy/PWOQfgAQSnIRjQYXcTW1Re7Jb5u4e9tPO65zXbWWQ2dxZXPrcgeztIzwtGcUxzUH4/02B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1yDqCuOoD7MLFnfQRUoeCZIX2h1T/YUTl9o5RInVt8fAJr5rX22ToqTgIEBmwpXpuZHEATYc1WbV3p3ZDoyBpFgFpAUtTBiDe4QLmNM6qprZdTHVGF6o76Ev1uUqh/C1Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7c30343-d061-4103-c664-08dc2b5dfd49 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:03:06.2835 (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: AS8P250MB0072 Subject: [FFmpeg-devel] [PATCH 21/23] avutil/hwcontext_cuda: Don't use AVHWFramesInternal.priv 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: OiYAD81Zdcm3 Use AVHWFramesContext.hwctx instead. This simplifies accesses to VDPAUFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_cuda.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c index 0312d3b9d7..1c61b36d69 100644 --- a/libavutil/hwcontext_cuda.c +++ b/libavutil/hwcontext_cuda.c @@ -130,7 +130,7 @@ static int cuda_frames_init(AVHWFramesContext *ctx) { AVHWDeviceContext *device_ctx = ctx->device_ctx; AVCUDADeviceContext *hwctx = device_ctx->hwctx; - CUDAFramesContext *priv = ctx->internal->priv; + CUDAFramesContext *priv = ctx->hwctx; CudaFunctions *cu = hwctx->internal->cuda_dl; int err, i; @@ -175,7 +175,7 @@ static int cuda_frames_init(AVHWFramesContext *ctx) static int cuda_get_buffer(AVHWFramesContext *ctx, AVFrame *frame) { - CUDAFramesContext *priv = ctx->internal->priv; + CUDAFramesContext *priv = ctx->hwctx; int res; frame->buf[0] = av_buffer_pool_get(ctx->pool); @@ -223,7 +223,7 @@ static int cuda_transfer_get_formats(AVHWFramesContext *ctx, static int cuda_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src) { - CUDAFramesContext *priv = ctx->internal->priv; + CUDAFramesContext *priv = ctx->hwctx; AVHWDeviceContext *device_ctx = ctx->device_ctx; AVCUDADeviceContext *hwctx = device_ctx->hwctx; CudaFunctions *cu = hwctx->internal->cuda_dl; @@ -563,7 +563,7 @@ const HWContextType ff_hwcontext_type_cuda = { .name = "CUDA", .device_hwctx_size = sizeof(AVCUDADeviceContext), - .frames_priv_size = sizeof(CUDAFramesContext), + .frames_hwctx_size = sizeof(CUDAFramesContext), .device_create = cuda_device_create, .device_derive = cuda_device_derive, From patchwork Mon Feb 12 00:03:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46197 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp403073pzc; Sun, 11 Feb 2024 16:04:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGHcYqwdFafFZarBXbEqrznu9eBpNd2f794wbdkIqhhDxgEx7rOixnG7fk/h6eRP5CjSLl X-Received: by 2002:a17:906:594d:b0:a3c:b36d:dffb with SMTP id g13-20020a170906594d00b00a3cb36ddffbmr229893ejr.16.1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47mktTWyJ1CrEjXJrCTlUHeZJpIBa5wpGv/xK01bxXAVgfAEs0DSTnv2vIOX89L2GuNYbvrhXqEIo94Fj9o9EOai7P2aNPlBK7hXWHo2BI3IiiEoNfWQHuGt2jMdSbd6K1uSbkLGUKCjsGI/gWWrs+aCmglKoSeryvUV22m8F4SM8z7bGytjIbSmlmx+X/nV6Jv8VHFSE8r5LNDnJymA+g6ABW+TqYCWdd6jurjp/dAvkRFG1JeuoiE56YS6ZiS9FbBeLdbSyQSCNyuiHwtKmrcxgy3c9KKxQq6CCcx5WeRFf8hLccfaKq68RNBoUpMwm9y4YjtUG9FV6QjnaByl9jafqdc4DsgIjZNOPg06Zh5ydoBq6AEmgQePYFrJNSh361qGOebRVL31Tsl8tdhDv8edL8XuxFCkG9zx6YocSU3XCmWBvoiDUXiPotHBVvf6mZEfwSKiReiSsYUoO7rOZBDDXQDLLBJcifpF+mR4uXpN1SCc1tBQHCSh8ootAVMZai2jQb2AEV4R1lVFkqgFh9PynMGXj+3j8LPxQYrX+k+Y6mwk2fJd9kcvYC14OThk= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id se27-20020a170906ce5b00b00a37ce4b247csi3191445ejb.972.2024.02.11.16.04.45; Sun, 11 Feb 2024 16:04:46 -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=QsHbaw+K; 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 7416968D1FB; Mon, 12 Feb 2024 02:03:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02olkn2013.outbound.protection.outlook.com [40.92.48.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 34EC668D13E for ; Mon, 12 Feb 2024 02:03:11 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gmi1f/DLr0uV3EcSoB5ksclgHDHw5oQQasW8HoOG5djPHyI0jegBMIzcoK3wK8ohj4qUerz2qM8xL9VGF8Lp9GHRWvn7/fjUV0W+5yLXqlHxd4iuycKHZH9btsA92oc5YYDOcEW+uzCmCR84u4p2tnkhC10HNTfPgi0uGveMaWxISB7o/7u9bSr9WukR6bf9poFE0eyFk/I72T5Wkj95SSXhYTLRnhAGTX1NhYcBXL2F9/K7+z/EAo5jqwrEf3VBUiNzW1T0zvagvJMCBRVb/ClYXFLaqXPo3szYCpb3EbhvL32+LVeSyqM+CtMvoo/zW2cOr6liydpZlRBHreYTQQ== 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=f6V4DIdb8kl1ltj+w7wyPZo7QW0n92QXai9oPT8SyM0=; b=Hd7haY8wL1n9CYGPUehWcfpITH2T/T+4t0kZQ/iui0XftghHB9JzXWZjrDagdPi2WBB2Bk/VI5QWoWPG71Bso0Vl4mYtRZdJW+JS1LkHAA0clcvKT+rAJP68N3NVEcdYJvbIF35y/ESGu7m4L/22ffs2ZKxvtzRIZfmLawqSsk3IkNUb5soXJ9MUSoIU+CEwuyPFJS24GYt8XhyAhlfQe1azSiSkOtLWosu+9CKiN3hu+n93t4UwC+jYP7tVk/HHvBMvSHo+DLocs+gYE+0t4Bo/MCNJN0j77ewLdxERcQlK2NwNGEUVWXd/Rg8qi8Plkl9BxdHQKdhuasW57emD/Q== 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=f6V4DIdb8kl1ltj+w7wyPZo7QW0n92QXai9oPT8SyM0=; b=QsHbaw+Kq4/ukdbcNRtQmF5yaNOgv9d9kBq8Zwc+E9hghZvYXBimNXP417J6rO2w+K99p426JhBiTwEjmDfftXfX7AYTEIp3+5aaOCE917wburTd6KJ9MWdd9siwcZt/9im926pIdeNrv6Zj5hI+pOS0fyiZ9p6k3SeCIHqGStsgRwQs95+QPyB5UsSJtxJqXDRV4vfprnbGrczkwIrmKqTWwp0JvuzpG6rVVAL84XTx2rkJF8CUKSkSU1Fbz6/r8mA1HktszuWBv5NXIVInoJGfH6S1Sd4PwpGumznJePT4lSj0sBNUXcMCIMOiM8J/M6dfiH7cNCWxjNqVQNbO6Q== Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) by AS8P250MB0072.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:374::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.33; Mon, 12 Feb 2024 00:03:10 +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:03:10 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:34 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [6Ou53NEOHui6mmJ3t1PDPjrF4kD0Uug+] 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-21-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0P250MB0747:EE_|AS8P250MB0072:EE_ X-MS-Office365-Filtering-Correlation-Id: 95489ec3-df5c-4770-c982-08dc2b5dffca X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnqwZHg0HfSFdl5Zlrnc8YAZgiJEyuS5ooFoH6u9+AGQxAOvR7dtsgostQTgrax9OjBFAMXZTTqXuvpxbK6LBxdt/A4tgELY198H9Mau4rUJvQ/yRuNvb+z7fGiGBrwzdv7nQGl08k7RAzpF3vz1+WhNCE5neFWbWwzElvjWYg44DyGtKImtCSMYYj6u0ywNbzdsr+3PDBhqPFO+NKlvyaubxVc6M7fQIENsg3lVu3LOcYE7CnI9WwyEQYRb04c80vIZWALNWLXMcyVD3ykCGpXnQZi+Fuw0dd70Ce8dmY1E2i37bGJNLqv334N9PdNR4cYAMQ7rwlsg0eeNYSrNFVizdCLpqDu/GFT0/yG/XiU7mwsmK+78W+PLLnhV1BlIUphWKermbLdaI0A97OYV23aBuC+/Nz3Ow85V2BQhkM5m+TWDhW7+bYBtk1pvUDiehC22NznK/kcIcHfQSlL587GeOXTzNhHKMOPX/jKP4xKqi437N1L+NY0it953W3tVZ68a7g50tRF0stDGGqtKKEZSfZfnuTbav3mljIJ/WNeWiMm3+wMHm1FCbnkVWZkervSeX/2pwV7xs8pe+ofKZMOtyQR/j2Z2JQlJ9K0iTnteEf1awlI9yfY/3WboUuWwnKqXrZ9tAsMrT/fA9L+KSPn7IOrnbssXTNEXBnbwbdAb6MYjPMBLgMOrjum4ZiUfTysTpVQ/EELnVorXt88SSBcAfohQz8RPA4ykK7pD1Eeq67y9/aBp9U4J5xTbpy5uKl8= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QCP/3aqDIfEl9sa8SndcdnhnJWPYSeI1i6nBLsBL8eYurKSHb6kWswzY/B47tGjTG27pPKYZbuz4Q9HerRP46z5QilAcEB3kXBqX0e5z1OSTmXA8SC+JjhZ75XUKM7Olyp57hi2abFwLTgbv0GIwmYloyIyHCjOSOdKJ1uZoKR4eSywAQ4KjfrwW/zP4Mni66DWfNuXxrKMRuXVrmjqQdqPAlS3gK2wqZdp32GWxtUISR/OSgQsAfJ2I59F+i/kBVklFDsfbYOvkrEuMJS6D7Wz4k14TD4SBpnoW9li4AHjnxofxYrSGCfLZdGAjUKoqVECPRcGcJJH/+QdD/AiBSF2HIffPmF682Vc1EBIqGLMNbjMBpgJm4J4IMxUQqgYfW7n2YHKgnWPlE0aeu/QeukTvdZWIad9aW9VXAFtXeFfXCJyTda4aTLnlLxDyqvIL721T3/mddzuVWLwXpnGs5hs7gfPPog71Uf0xeD0vHa5rthijJYXRrjuW3ZIs+RfzM0NckA8dmF8P/YmENVAmaSN0JdpWvrC9BY3GFHn9X0MbWotfLMTryO3/4a6VKvDghG1peTTeMM+VrbJKmLcCp0wPfH4Ts0JvS4mt3/9IxLKg3cdPPzz5v/X1PQ6Kv4WU X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jEqSgLi+ZwBnqtEdyOLKUtGkDbyG1Zb1f4PVjA8faX820zm770LjOVwZvTpHcOSOt5RtBCztHlBb0c2oqOe0dzBHplJ7wMAnIJebnZ0boyt3ZTSgoh2nL+0bdbdL+XC/o+r2hEGQZB71NNvFFK4dVRXrwMY/FttKgt/fxng+SfA+jvPoWMTJOE+oSz5622333ZZlbEtP9k3MVTc+eo4G+3vFzZ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VtIQesA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95489ec3-df5c-4770-c982-08dc2b5dffca 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:03:10.4952 (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: AS8P250MB0072 Subject: [FFmpeg-devel] [PATCH 22/23] avutil/hwcontext_internal: Remove unused AVHWFramesInternal.priv 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: ZSQpx7q+HDlW It is no longer used by any hwcontext, as they all allocate their private data together with their public data and access it via AVHWFramesContext.hwctx. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext.c | 9 --------- libavutil/hwcontext_internal.h | 6 ------ 2 files changed, 15 deletions(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index c962c19f3e..8ecefd2bc4 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -248,7 +248,6 @@ static void hwframe_ctx_free(void *opaque, uint8_t *data) av_buffer_unref(&ctx->device_ref); av_freep(&ctx->hwctx); - av_freep(&ctx->internal->priv); av_freep(&ctx->internal); av_freep(&ctx); } @@ -268,12 +267,6 @@ AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in) if (!ctx->internal) goto fail; - if (hw_type->frames_priv_size) { - ctx->internal->priv = av_mallocz(hw_type->frames_priv_size); - if (!ctx->internal->priv) - goto fail; - } - if (hw_type->frames_hwctx_size) { ctx->hwctx = av_mallocz(hw_type->frames_hwctx_size); if (!ctx->hwctx) @@ -302,8 +295,6 @@ AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in) fail: av_buffer_unref(&device_ref); - if (ctx->internal) - av_freep(&ctx->internal->priv); av_freep(&ctx->internal); av_freep(&ctx->hwctx); av_freep(&ctx); diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h index 3745867283..1476def1d7 100644 --- a/libavutil/hwcontext_internal.h +++ b/libavutil/hwcontext_internal.h @@ -53,11 +53,6 @@ typedef struct HWContextType { * i.e. AVHWFramesContext.hwctx */ size_t frames_hwctx_size; - /** - * size of the private data, i.e. - * AVHWFramesInternal.priv - */ - size_t frames_priv_size; int (*device_create)(AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags); @@ -97,7 +92,6 @@ typedef struct HWContextType { struct AVHWFramesInternal { const HWContextType *hw_type; - void *priv; AVBufferPool *pool_internal; From patchwork Mon Feb 12 00:03:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46213 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp403136pzc; Sun, 11 Feb 2024 16:04:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV4SAR66d8D9UYudD01DMyh/qlQ2JVf1JU5aX/MHwvnqhscaWJMeQ5oG7XBqaujAJKpCM9RkDn3piHMgOoOAaMvCDK5q/vDDajW5g== X-Google-Smtp-Source: AGHT+IGEt08z/aegaWf3BvG52/bRlGyb36yUiDyI0ZUmvhsapp20LOib+3C/lPdkLPFZKseBjMvK X-Received: by 2002:a05:6402:5d90:b0:561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q1rJ eAfgTEqjqpiwKEK+6k5L8M1E0FrCXy7RzSMk2L5q3fDWWwh2NB4wUn7d//T4v0g8Xl23pL3vcLE5S40wckq3Tn4qtT4z2DJlROWSqxw3sftA9eSyTFJqCiDq0VQxTef2vrxVcryNNBLBnmXba/e935JZ9xCFElCjc/fXLxjWnzDwb8KhHgniSsm5skPTbjkHz8BDKe90mMI9DPL5pJZfcI/omxqskg7hGHoqaAMScEAuGe2ATFoBE2K9EUZ3fRvRzZoy3sxBbKC1iYtVX842jeOVmEQ/u5Ixdjdk+ov1HFMRlIM4WLv0iD/ug2Gr0bdJCbBkMT9B4dd+TNb6vdqZ4uQYYsrC7MVMmdX4JJVfh4FYQmfNLYDgSGmGhKvSqsXs+dJydr4ExRGH+vwhPYtIyjnElqFxShFzxubqkU2/qVbsga2G4DTnfwBbSUP8g0qY3hV0txNEFDT/IfXg2xj5njBDelk1Zm8pNi9raR6FW8Wp1b/bmCXLB/5XeSLZcnjGfK8QaC0/ECRmAMeiOGj+93WjYzA2ujGTDGf98pw2dDoUgn/A1JYziGtWEMCuS7wbRfs5yTsWb+DxNmXp94CGJp0Llp9obx+YCYiP/Uj+/c3LPLsfRerWOkbw5Vua4= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e24-20020a50d4d8000000b0056001f8ca6dsi2190791edj.483.2024.02.11.16.04.54; Sun, 11 Feb 2024 16:04:55 -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=VreIRljJ; 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 9001768D135; Mon, 12 Feb 2024 02:03:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02olkn2037.outbound.protection.outlook.com [40.92.48.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3A87068D206 for ; Mon, 12 Feb 2024 02:03:14 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LhdNRQFaiJ1tR+pE5u5/jkSv/d2QyGY+riEpgxdXsmp0wwBaP3N1MT+8hFtEuKVGxS4jlkOPduQqDZes6LHY2e0XcGKTDkWC19NUcnN0gRx7sQ43+7czC32XgBxdpl9AnCwzu+5tmc789c/Aj763jMCYXWhgp0+9wwoaroQ2gUALbsWBJD4tGUzCzpo8WmaplfCimXE/sTfV9Ui+NnASUD/v72EUd/LuAJSJSkLqIs6UjdVjKywUu0pT1ulGx1KvU3haXpglB4Zt9g+sp0zgJdiephMoewh1LICXWrecVrrZatSmBNhtLKkgLmocfrad+DRdQpWOSkg5+XikLTRUfw== 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=PtZGCpmuYVEr8vaqgAlrXQ3UYwZecVzoAf/Z8RA8riQ=; b=kCzj0gdwd8p95cqRQLXv7+wM0aslw1t0tSZE8WBK+ZP30qxt3l1r/YT8MMJ7aDtseYBU9D+uXQ04b1e9g3y6jVVkMMrH78Y9eWheoVVvsp+om6Ly+rQd2fw+j0eYzS6LlcBYrv9w3pWoXKYzkqrkyfvX1g2kqApmW9+dGaj/4GcwnN6FSPvzL6FyMF4Qkh3CH+ITro0BQosvxpGks675A4iGDf/+rlDhuXMR2fO+qiC8QPow+1gNXOlsPA0hEKOvmqFawfbfjYizZF+3uy1Z2yISOHiKA2lTTON7bhDIhWGn9w5pT2QkFoLbLW2aLvdgPHS7V2YdJPGPTwbHE0HqPg== 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=PtZGCpmuYVEr8vaqgAlrXQ3UYwZecVzoAf/Z8RA8riQ=; b=VreIRljJnHZ7lYLcATDj7TSH3tME0QsgDgLqz6yY0EeWxWGuYcdpjBBCmM8lCPo9Nwxl7n0wPUtWK3teZQshjlvX1GJT2aeTMq4Jbk5B2vlr6YG7cZhiQ249QJh0stRWRUd87ivDJbI9MWJJZKH3qyWbkBSpxCDYw0C/jDECatOaVdKsSOjAgdFnneP17E94QIyXvrmfzkbQeVVG+ocT9g+s92+rGu4J3+RuZoWUhzjCR2i6i9MydpWLh0Mz4ph0ggdePm3eIqeSZjtkFzacdhAl10FPhwteGGRo5rhYfUhVnq85rgZr1H8DV3E1HChPg1X5qlB4rvGrePXXPU/R0g== Received: from DU0P250MB0747.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3cb::16) by AS8P250MB0072.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:374::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.33; Mon, 12 Feb 2024 00:03:13 +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:03:12 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Feb 2024 01:03:35 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [wcDlR91VaUrX5UurVfzZqySmEbeYVKef] 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-22-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0P250MB0747:EE_|AS8P250MB0072:EE_ X-MS-Office365-Filtering-Correlation-Id: c4cf74d0-dbb3-4ed8-5428-08dc2b5e00b1 X-MS-Exchange-SLBlob-MailProps: YfhX3sd/0TUSvyb7a5WmOzXakAQ9VWBaq6RCic1ZT+Xgu7pr9Hda4E7yW9zCXrKE+7DoqddqPMbMykPMyuZ2rsXr8HpYVv207sdBJIEM2ekZt10zbg1qru7xtDAgb1szjXgKKPWUYYSelZ5cE1lLbhB1nkgdDGX1rpJOOdBpvEgn/GGsVIGwVH9kqUD4hDb5+xpUj2yr7tqQ9AWr5Hb5mUnY36D8eI+LZZ4ysqAEDPSQw7sdgxMvlTEQknUG8UW5wYKa4HxdDblnmBHDuljhjz1DqOgc9zr3vTcOt2Jcv3fRuYHSnqqe9r+lnMwQylvr29dWaxjfGwKIrHD0Pwg6w4Bw1iS8nkBE9b+0vWuQEFmZB9MVzp7yBM9+3aXFEV3ZzAKj/fs6spk+XsJ71e5Agb6zMCpBqYh3ObmorkwaCb+Uln3tjQLdSc6eZ2rAhEzdyBvPCX/MyauABcdEej8cAvrmoOwcBTNABFcSEiJo3QY6fhzQLImGE4SnBeByVJICSDinZJh165sVjCG2tfll2b3TkgQm+/JskXhnv9RDUNQkR8n2QF07lJZSqBbqhdE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Rt/QKY4+vd7Dx644cf6q1TER8KcBS8MN/IRm4PoxhQEDasLxAYDLF7dPlcWWbQIFo6R7w0TJ6uQZin/PWGCL/dplpvu5BlYzUJxj6MbfshoEtLIN9XQtTweUpZBnwvtA9NyhTZeBhvajIQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4cf74d0-dbb3-4ed8-5428-08dc2b5e00b1 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:03:12.0968 (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: AS8P250MB0072 Subject: [FFmpeg-devel] [PATCH 23/23] avutil/hwcontext: Allocate AVHWFramesCtx jointly with its internals 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: p6DrnhHxVOyn This is possible because the lifetime of these structures coincide. It has the advantage of allowing to remove AVHWFramesInternal from the public header; given that AVHWFramesInternal.priv is no more, most accesses to AVHWFramesInternal are no more; indeed, the only field accessed of it outside of hwcontext.c is the internal frame pool, making this commit very simple. Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext.c | 158 ++++++++++++++--------------- libavutil/hwcontext.h | 8 -- libavutil/hwcontext_cuda.c | 5 +- libavutil/hwcontext_d3d11va.c | 7 +- libavutil/hwcontext_d3d12va.c | 4 +- libavutil/hwcontext_dxva2.c | 7 +- libavutil/hwcontext_internal.h | 14 ++- libavutil/hwcontext_opencl.c | 4 +- libavutil/hwcontext_qsv.c | 6 +- libavutil/hwcontext_vaapi.c | 6 +- libavutil/hwcontext_vdpau.c | 7 +- libavutil/hwcontext_videotoolbox.c | 4 +- libavutil/hwcontext_vulkan.c | 8 +- 13 files changed, 121 insertions(+), 117 deletions(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 8ecefd2bc4..a0192f4fa9 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -232,23 +232,23 @@ static const AVClass hwframe_ctx_class = { static void hwframe_ctx_free(void *opaque, uint8_t *data) { - AVHWFramesContext *ctx = (AVHWFramesContext*)data; + FFHWFramesContext *ctxi = (FFHWFramesContext*)data; + AVHWFramesContext *ctx = &ctxi->p; - if (ctx->internal->pool_internal) - av_buffer_pool_uninit(&ctx->internal->pool_internal); + if (ctxi->pool_internal) + av_buffer_pool_uninit(&ctxi->pool_internal); - if (ctx->internal->hw_type->frames_uninit) - ctx->internal->hw_type->frames_uninit(ctx); + if (ctxi->hw_type->frames_uninit) + ctxi->hw_type->frames_uninit(ctx); if (ctx->free) ctx->free(ctx); - av_buffer_unref(&ctx->internal->source_frames); + av_buffer_unref(&ctxi->source_frames); av_buffer_unref(&ctx->device_ref); av_freep(&ctx->hwctx); - av_freep(&ctx->internal); av_freep(&ctx); } @@ -256,16 +256,14 @@ AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in) { FFHWDeviceContext *device_ctx = (FFHWDeviceContext*)device_ref_in->data; const HWContextType *hw_type = device_ctx->hw_type; + FFHWFramesContext *ctxi; AVHWFramesContext *ctx; AVBufferRef *buf, *device_ref = NULL; - ctx = av_mallocz(sizeof(*ctx)); - if (!ctx) + ctxi = av_mallocz(sizeof(*ctxi)); + if (!ctxi) return NULL; - - ctx->internal = av_mallocz(sizeof(*ctx->internal)); - if (!ctx->internal) - goto fail; + ctx = &ctxi->p; if (hw_type->frames_hwctx_size) { ctx->hwctx = av_mallocz(hw_type->frames_hwctx_size); @@ -289,13 +287,12 @@ AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in) ctx->format = AV_PIX_FMT_NONE; ctx->sw_format = AV_PIX_FMT_NONE; - ctx->internal->hw_type = hw_type; + ctxi->hw_type = hw_type; return buf; fail: av_buffer_unref(&device_ref); - av_freep(&ctx->internal); av_freep(&ctx->hwctx); av_freep(&ctx); return NULL; @@ -331,24 +328,25 @@ fail: int av_hwframe_ctx_init(AVBufferRef *ref) { - AVHWFramesContext *ctx = (AVHWFramesContext*)ref->data; + FFHWFramesContext *ctxi = (FFHWFramesContext*)ref->data; + AVHWFramesContext *ctx = &ctxi->p; const enum AVPixelFormat *pix_fmt; int ret; - if (ctx->internal->source_frames) { + if (ctxi->source_frames) { /* A derived frame context is already initialised. */ return 0; } /* validate the pixel format */ - for (pix_fmt = ctx->internal->hw_type->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++) { + for (pix_fmt = ctxi->hw_type->pix_fmts; *pix_fmt != AV_PIX_FMT_NONE; pix_fmt++) { if (*pix_fmt == ctx->format) break; } if (*pix_fmt == AV_PIX_FMT_NONE) { av_log(ctx, AV_LOG_ERROR, "The hardware pixel format '%s' is not supported by the device type '%s'\n", - av_get_pix_fmt_name(ctx->format), ctx->internal->hw_type->name); + av_get_pix_fmt_name(ctx->format), ctxi->hw_type->name); return AVERROR(ENOSYS); } @@ -358,14 +356,14 @@ int av_hwframe_ctx_init(AVBufferRef *ref) return ret; /* format-specific init */ - if (ctx->internal->hw_type->frames_init) { - ret = ctx->internal->hw_type->frames_init(ctx); + if (ctxi->hw_type->frames_init) { + ret = ctxi->hw_type->frames_init(ctx); if (ret < 0) goto fail; } - if (ctx->internal->pool_internal && !ctx->pool) - ctx->pool = ctx->internal->pool_internal; + if (ctxi->pool_internal && !ctx->pool) + ctx->pool = ctxi->pool_internal; /* preallocate the frames in the pool, if requested */ if (ctx->initial_pool_size > 0) { @@ -376,8 +374,8 @@ int av_hwframe_ctx_init(AVBufferRef *ref) return 0; fail: - if (ctx->internal->hw_type->frames_uninit) - ctx->internal->hw_type->frames_uninit(ctx); + if (ctxi->hw_type->frames_uninit) + ctxi->hw_type->frames_uninit(ctx); return ret; } @@ -385,12 +383,12 @@ int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ref, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats, int flags) { - AVHWFramesContext *ctx = (AVHWFramesContext*)hwframe_ref->data; + FFHWFramesContext *ctxi = (FFHWFramesContext*)hwframe_ref->data; - if (!ctx->internal->hw_type->transfer_get_formats) + if (!ctxi->hw_type->transfer_get_formats) return AVERROR(ENOSYS); - return ctx->internal->hw_type->transfer_get_formats(ctx, dir, formats); + return ctxi->hw_type->transfer_get_formats(&ctxi->p, dir, formats); } static int transfer_data_alloc(AVFrame *dst, const AVFrame *src, int flags) @@ -445,7 +443,6 @@ fail: int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags) { - AVHWFramesContext *ctx; int ret; if (!dst->buf[0]) @@ -458,41 +455,41 @@ int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags) * the specific combination of hardware. */ if (src->hw_frames_ctx && dst->hw_frames_ctx) { - AVHWFramesContext *src_ctx = - (AVHWFramesContext*)src->hw_frames_ctx->data; - AVHWFramesContext *dst_ctx = - (AVHWFramesContext*)dst->hw_frames_ctx->data; + FFHWFramesContext *src_ctx = + (FFHWFramesContext*)src->hw_frames_ctx->data; + FFHWFramesContext *dst_ctx = + (FFHWFramesContext*)dst->hw_frames_ctx->data; - if (src_ctx->internal->source_frames) { + if (src_ctx->source_frames) { av_log(src_ctx, AV_LOG_ERROR, "A device with a derived frame context cannot be used as " "the source of a HW -> HW transfer."); return AVERROR(ENOSYS); } - if (dst_ctx->internal->source_frames) { + if (dst_ctx->source_frames) { av_log(src_ctx, AV_LOG_ERROR, "A device with a derived frame context cannot be used as " "the destination of a HW -> HW transfer."); return AVERROR(ENOSYS); } - ret = src_ctx->internal->hw_type->transfer_data_from(src_ctx, dst, src); + ret = src_ctx->hw_type->transfer_data_from(&src_ctx->p, dst, src); if (ret == AVERROR(ENOSYS)) - ret = dst_ctx->internal->hw_type->transfer_data_to(dst_ctx, dst, src); + ret = dst_ctx->hw_type->transfer_data_to(&dst_ctx->p, dst, src); if (ret < 0) return ret; } else { if (src->hw_frames_ctx) { - ctx = (AVHWFramesContext*)src->hw_frames_ctx->data; + FFHWFramesContext *ctx = (FFHWFramesContext*)src->hw_frames_ctx->data; - ret = ctx->internal->hw_type->transfer_data_from(ctx, dst, src); + ret = ctx->hw_type->transfer_data_from(&ctx->p, dst, src); if (ret < 0) return ret; } else if (dst->hw_frames_ctx) { - ctx = (AVHWFramesContext*)dst->hw_frames_ctx->data; + FFHWFramesContext *ctx = (FFHWFramesContext*)dst->hw_frames_ctx->data; - ret = ctx->internal->hw_type->transfer_data_to(ctx, dst, src); + ret = ctx->hw_type->transfer_data_to(&ctx->p, dst, src); if (ret < 0) return ret; } else { @@ -504,10 +501,11 @@ int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags) int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags) { - AVHWFramesContext *ctx = (AVHWFramesContext*)hwframe_ref->data; + FFHWFramesContext *ctxi = (FFHWFramesContext*)hwframe_ref->data; + AVHWFramesContext *ctx = &ctxi->p; int ret; - if (ctx->internal->source_frames) { + if (ctxi->source_frames) { // This is a derived frame context, so we allocate in the source // and map the frame immediately. AVFrame *src_frame; @@ -521,7 +519,7 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags) if (!src_frame) return AVERROR(ENOMEM); - ret = av_hwframe_get_buffer(ctx->internal->source_frames, + ret = av_hwframe_get_buffer(ctxi->source_frames, src_frame, 0); if (ret < 0) { av_frame_free(&src_frame); @@ -529,7 +527,7 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags) } ret = av_hwframe_map(frame, src_frame, - ctx->internal->source_allocation_map_flags); + ctxi->source_allocation_map_flags); if (ret) { av_log(ctx, AV_LOG_ERROR, "Failed to map frame into derived " "frame context: %d.\n", ret); @@ -544,7 +542,7 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags) return 0; } - if (!ctx->internal->hw_type->frames_get_buffer) + if (!ctxi->hw_type->frames_get_buffer) return AVERROR(ENOSYS); if (!ctx->pool) @@ -554,7 +552,7 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags) if (!frame->hw_frames_ctx) return AVERROR(ENOMEM); - ret = ctx->internal->hw_type->frames_get_buffer(ctx, frame); + ret = ctxi->hw_type->frames_get_buffer(ctx, frame); if (ret < 0) { av_buffer_unref(&frame->hw_frames_ctx); return ret; @@ -792,19 +790,18 @@ int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags) { AVBufferRef *orig_dst_frames = dst->hw_frames_ctx; enum AVPixelFormat orig_dst_fmt = dst->format; - AVHWFramesContext *src_frames, *dst_frames; HWMapDescriptor *hwmap; int ret; if (src->hw_frames_ctx && dst->hw_frames_ctx) { - src_frames = (AVHWFramesContext*)src->hw_frames_ctx->data; - dst_frames = (AVHWFramesContext*)dst->hw_frames_ctx->data; + FFHWFramesContext *src_frames = (FFHWFramesContext*)src->hw_frames_ctx->data; + FFHWFramesContext *dst_frames = (FFHWFramesContext*)dst->hw_frames_ctx->data; if ((src_frames == dst_frames && - src->format == dst_frames->sw_format && - dst->format == dst_frames->format) || - (src_frames->internal->source_frames && - src_frames->internal->source_frames->data == + src->format == dst_frames->p.sw_format && + dst->format == dst_frames->p.format) || + (src_frames->source_frames && + src_frames->source_frames->data == (uint8_t*)dst_frames)) { // This is an unmap operation. We don't need to directly // do anything here other than fill in the original frame, @@ -821,12 +818,12 @@ int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags) } if (src->hw_frames_ctx) { - src_frames = (AVHWFramesContext*)src->hw_frames_ctx->data; + FFHWFramesContext *src_frames = (FFHWFramesContext*)src->hw_frames_ctx->data; - if (src_frames->format == src->format && - src_frames->internal->hw_type->map_from) { - ret = src_frames->internal->hw_type->map_from(src_frames, - dst, src, flags); + if (src_frames->p.format == src->format && + src_frames->hw_type->map_from) { + ret = src_frames->hw_type->map_from(&src_frames->p, + dst, src, flags); if (ret >= 0) return ret; else if (ret != AVERROR(ENOSYS)) @@ -835,12 +832,12 @@ int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags) } if (dst->hw_frames_ctx) { - dst_frames = (AVHWFramesContext*)dst->hw_frames_ctx->data; + FFHWFramesContext *dst_frames = (FFHWFramesContext*)dst->hw_frames_ctx->data; - if (dst_frames->format == dst->format && - dst_frames->internal->hw_type->map_to) { - ret = dst_frames->internal->hw_type->map_to(dst_frames, - dst, src, flags); + if (dst_frames->p.format == dst->format && + dst_frames->hw_type->map_to) { + ret = dst_frames->hw_type->map_to(&dst_frames->p, + dst, src, flags); if (ret >= 0) return ret; else if (ret != AVERROR(ENOSYS)) @@ -874,21 +871,21 @@ int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx, int flags) { AVBufferRef *dst_ref = NULL; - AVHWFramesContext *dst = NULL; - AVHWFramesContext *src = (AVHWFramesContext*)source_frame_ctx->data; + FFHWFramesContext *dsti = NULL; + FFHWFramesContext *srci = (FFHWFramesContext*)source_frame_ctx->data; + AVHWFramesContext *dst, *src = &srci->p; int ret; - if (src->internal->source_frames) { + if (srci->source_frames) { AVHWFramesContext *src_src = - (AVHWFramesContext*)src->internal->source_frames->data; + (AVHWFramesContext*)srci->source_frames->data; AVHWDeviceContext *dst_dev = (AVHWDeviceContext*)derived_device_ctx->data; if (src_src->device_ctx == dst_dev) { // This is actually an unmapping, so we just return a // reference to the source frame context. - *derived_frame_ctx = - av_buffer_ref(src->internal->source_frames); + *derived_frame_ctx = av_buffer_ref(srci->source_frames); if (!*derived_frame_ctx) { ret = AVERROR(ENOMEM); goto fail; @@ -903,31 +900,32 @@ int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx, goto fail; } - dst = (AVHWFramesContext*)dst_ref->data; + dsti = (FFHWFramesContext*)dst_ref->data; + dst = &dsti->p; dst->format = format; dst->sw_format = src->sw_format; dst->width = src->width; dst->height = src->height; - dst->internal->source_frames = av_buffer_ref(source_frame_ctx); - if (!dst->internal->source_frames) { + dsti->source_frames = av_buffer_ref(source_frame_ctx); + if (!dsti->source_frames) { ret = AVERROR(ENOMEM); goto fail; } - dst->internal->source_allocation_map_flags = + dsti->source_allocation_map_flags = flags & (AV_HWFRAME_MAP_READ | AV_HWFRAME_MAP_WRITE | AV_HWFRAME_MAP_OVERWRITE | AV_HWFRAME_MAP_DIRECT); ret = AVERROR(ENOSYS); - if (src->internal->hw_type->frames_derive_from) - ret = src->internal->hw_type->frames_derive_from(dst, src, flags); + if (srci->hw_type->frames_derive_from) + ret = srci->hw_type->frames_derive_from(dst, src, flags); if (ret == AVERROR(ENOSYS) && - dst->internal->hw_type->frames_derive_to) - ret = dst->internal->hw_type->frames_derive_to(dst, src, flags); + dsti->hw_type->frames_derive_to) + ret = dsti->hw_type->frames_derive_to(dst, src, flags); if (ret == AVERROR(ENOSYS)) ret = 0; if (ret) @@ -937,8 +935,8 @@ int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx, return 0; fail: - if (dst) - av_buffer_unref(&dst->internal->source_frames); + if (dsti) + av_buffer_unref(&dsti->source_frames); av_buffer_unref(&dst_ref); return ret; } diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h index 091bceb2f9..bac30debae 100644 --- a/libavutil/hwcontext.h +++ b/libavutil/hwcontext.h @@ -102,8 +102,6 @@ typedef struct AVHWDeviceContext { void *user_opaque; } AVHWDeviceContext; -typedef struct AVHWFramesInternal AVHWFramesInternal; - /** * This struct describes a set or pool of "hardware" frames (i.e. those with * data not located in normal system memory). All the frames in the pool are @@ -120,12 +118,6 @@ typedef struct AVHWFramesContext { */ const AVClass *av_class; - /** - * Private data used internally by libavutil. Must not be accessed in any - * way by the caller. - */ - AVHWFramesInternal *internal; - /** * A reference to the parent AVHWDeviceContext. This reference is owned and * managed by the enclosing AVHWFramesContext, but the caller may derive diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c index 1c61b36d69..b430b42f62 100644 --- a/libavutil/hwcontext_cuda.c +++ b/libavutil/hwcontext_cuda.c @@ -165,8 +165,9 @@ static int cuda_frames_init(AVHWFramesContext *ctx) if (size < 0) return size; - ctx->internal->pool_internal = av_buffer_pool_init2(size, ctx, cuda_pool_alloc, NULL); - if (!ctx->internal->pool_internal) + ffhwframesctx(ctx)->pool_internal = + av_buffer_pool_init2(size, ctx, cuda_pool_alloc, NULL); + if (!ffhwframesctx(ctx)->pool_internal) return AVERROR(ENOMEM); } diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 19fcf37a84..24b3546e7b 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -319,9 +319,10 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) return AVERROR(ENOMEM); s->nb_surfaces = ctx->initial_pool_size; - ctx->internal->pool_internal = av_buffer_pool_init2(sizeof(AVD3D11FrameDescriptor), - ctx, d3d11va_pool_alloc, NULL); - if (!ctx->internal->pool_internal) + ffhwframesctx(ctx)->pool_internal = + av_buffer_pool_init2(sizeof(AVD3D11FrameDescriptor), + ctx, d3d11va_pool_alloc, NULL); + if (!ffhwframesctx(ctx)->pool_internal) return AVERROR(ENOMEM); return 0; diff --git a/libavutil/hwcontext_d3d12va.c b/libavutil/hwcontext_d3d12va.c index 16c07868f3..353807359b 100644 --- a/libavutil/hwcontext_d3d12va.c +++ b/libavutil/hwcontext_d3d12va.c @@ -297,10 +297,10 @@ static int d3d12va_frames_init(AVHWFramesContext *ctx) return AVERROR(EINVAL); } - ctx->internal->pool_internal = av_buffer_pool_init2(sizeof(AVD3D12VAFrame), + ffhwframesctx(ctx)->pool_internal = av_buffer_pool_init2(sizeof(AVD3D12VAFrame), ctx, d3d12va_pool_alloc, NULL); - if (!ctx->internal->pool_internal) + if (!ffhwframesctx(ctx)->pool_internal) return AVERROR(ENOMEM); return 0; diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index 0922776342..77f34919a8 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -208,9 +208,10 @@ static int dxva2_init_pool(AVHWFramesContext *ctx) return AVERROR_UNKNOWN; } - ctx->internal->pool_internal = av_buffer_pool_init2(sizeof(*s->surfaces_internal), - ctx, dxva2_pool_alloc, NULL); - if (!ctx->internal->pool_internal) + ffhwframesctx(ctx)->pool_internal = + av_buffer_pool_init2(sizeof(*s->surfaces_internal), + ctx, dxva2_pool_alloc, NULL); + if (!ffhwframesctx(ctx)->pool_internal) return AVERROR(ENOMEM); frames_hwctx->surfaces = s->surfaces_internal; diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h index 1476def1d7..e32b786238 100644 --- a/libavutil/hwcontext_internal.h +++ b/libavutil/hwcontext_internal.h @@ -90,7 +90,12 @@ typedef struct HWContextType { AVHWFramesContext *src_ctx, int flags); } HWContextType; -struct AVHWFramesInternal { +typedef struct FFHWFramesContext { + /** + * The public AVHWFramesContext. See hwcontext.h for it. + */ + AVHWFramesContext p; + const HWContextType *hw_type; AVBufferPool *pool_internal; @@ -105,7 +110,12 @@ struct AVHWFramesInternal { * frame context when trying to allocate in the derived context. */ int source_allocation_map_flags; -}; +} FFHWFramesContext; + +static inline FFHWFramesContext *ffhwframesctx(AVHWFramesContext *ctx) +{ + return (FFHWFramesContext*)ctx; +} typedef struct HWMapDescriptor { /** diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index c5af1aec74..b449c5c31b 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -1714,10 +1714,10 @@ static int opencl_frames_init_command_queue(AVHWFramesContext *hwfc) static int opencl_frames_init(AVHWFramesContext *hwfc) { if (!hwfc->pool) { - hwfc->internal->pool_internal = + ffhwframesctx(hwfc)->pool_internal = av_buffer_pool_init2(sizeof(cl_mem), hwfc, &opencl_pool_alloc, NULL); - if (!hwfc->internal->pool_internal) + if (!ffhwframesctx(hwfc)->pool_internal) return AVERROR(ENOMEM); } diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index f524a663b1..378cd5e826 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -605,9 +605,9 @@ static int qsv_init_pool(AVHWFramesContext *ctx, uint32_t fourcc) return ret; #endif - ctx->internal->pool_internal = av_buffer_pool_init2(sizeof(mfxFrameSurface1), - ctx, qsv_pool_alloc, NULL); - if (!ctx->internal->pool_internal) + ffhwframesctx(ctx)->pool_internal = av_buffer_pool_init2(sizeof(mfxFrameSurface1), + ctx, qsv_pool_alloc, NULL); + if (!ffhwframesctx(ctx)->pool_internal) return AVERROR(ENOMEM); frames_hwctx->surfaces = s->surfaces_internal; diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 2c75f5f5b1..56d03aa4cd 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -633,10 +633,10 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc) avfc->surface_ids = NULL; } - hwfc->internal->pool_internal = + ffhwframesctx(hwfc)->pool_internal = av_buffer_pool_init2(sizeof(VASurfaceID), hwfc, &vaapi_pool_alloc, NULL); - if (!hwfc->internal->pool_internal) { + if (!ffhwframesctx(hwfc)->pool_internal) { av_log(hwfc, AV_LOG_ERROR, "Failed to create VAAPI surface pool.\n"); err = AVERROR(ENOMEM); goto fail; @@ -654,7 +654,7 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc) goto fail; } } else { - test_surface = av_buffer_pool_get(hwfc->internal->pool_internal); + test_surface = av_buffer_pool_get(ffhwframesctx(hwfc)->pool_internal); if (!test_surface) { av_log(hwfc, AV_LOG_ERROR, "Unable to allocate a surface from " "internal buffer pool.\n"); diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c index 0a1a33f8b1..081b863e0c 100644 --- a/libavutil/hwcontext_vdpau.c +++ b/libavutil/hwcontext_vdpau.c @@ -281,9 +281,10 @@ static int vdpau_frames_init(AVHWFramesContext *ctx) } if (!ctx->pool) { - ctx->internal->pool_internal = av_buffer_pool_init2(sizeof(VdpVideoSurface), ctx, - vdpau_pool_alloc, NULL); - if (!ctx->internal->pool_internal) + ffhwframesctx(ctx)->pool_internal = + av_buffer_pool_init2(sizeof(VdpVideoSurface), ctx, + vdpau_pool_alloc, NULL); + if (!ffhwframesctx(ctx)->pool_internal) return AVERROR(ENOMEM); } diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index 823cf9a8ee..9f82b104c3 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -286,9 +286,9 @@ static int vt_frames_init(AVHWFramesContext *ctx) } if (!ctx->pool) { - ctx->internal->pool_internal = av_buffer_pool_init2( + ffhwframesctx(ctx)->pool_internal = av_buffer_pool_init2( sizeof(CVPixelBufferRef), ctx, vt_pool_alloc_buffer, NULL); - if (!ctx->internal->pool_internal) + if (!ffhwframesctx(ctx)->pool_internal) return AVERROR(ENOMEM); } diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 449a6a2fef..f6ecdcbfda 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -2399,10 +2399,10 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc) /* If user did not specify a pool, hwfc->pool will be set to the internal one * in hwcontext.c just after this gets called */ if (!hwfc->pool) { - hwfc->internal->pool_internal = av_buffer_pool_init2(sizeof(AVVkFrame), - hwfc, vulkan_pool_alloc, - NULL); - if (!hwfc->internal->pool_internal) + ffhwframesctx(hwfc)->pool_internal = av_buffer_pool_init2(sizeof(AVVkFrame), + hwfc, vulkan_pool_alloc, + NULL); + if (!ffhwframesctx(hwfc)->pool_internal) return AVERROR(ENOMEM); } From patchwork Tue Feb 13 12:23:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46235 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp1256124pzc; Tue, 13 Feb 2024 04:21:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjZHsDj01tS7fqj5uzEy6VWPNQRZLwoq2KYdAWboF7oGVZjLLNRT1/4ukPcKi16ERvfUzk X-Received: by 2002:aa7:d8ce:0:b0:560:e6b1:f73 with SMTP id k14-20020aa7d8ce000000b00560e6b10f73mr7503878eds.16.1707826884105; Tue, 13 Feb 2024 04:21:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXb/e+JlcprwmlY40t6GpDmIpt233T5tBRRfaC7qWESNCt796Ez1pUUpSp1lMbkuaR760RVE6ToRfL413FAv5ojjRvLSVIlbigLdk3ppfMcOcV2PTmWxXQMAeE91A7ooRe6993B1E055niVyWSAMfB3CJKYgAWnwoZhsSRMR1oK0TMhZyyMDyoA4hXE8Fz+FytVEH0JHMDMmJ0UhVa1rZr+LCR0t9doJCjF2qY3WU54eYa/1b3fvfHqL5adr173KvuoHtV+hudc/VrAWlmDWfpNNKN69USvHz1X2pYTpOiFChHewC2gM0CGaFuk4bvbxYXEfBuQHfjMNz67qU44wEkIZeGdbrZUfpVzrLuVcjhE1/BpBo5bqOs+NjyjkLEujxl3AopsPprJMSt0B7pesRkDmspZYPnoMsvnI5Io99XJ/u0zagdgaceT+PTQLYbaUQMrwZx+OzeC9zZIL5HXsBzq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NEv0pz5vmWPuqi9fWVcRdVGAaPF0oJ0oC1hOl6qQ9iOrNg= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id en20-20020a056402529400b0055cf49783e6si3783938edb.520.2024.02.13.04.21.23; Tue, 13 Feb 2024 04:21:24 -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=E2JRwnYz; 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 DC4F668CA86; Tue, 13 Feb 2024 14:21:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2049.outbound.protection.outlook.com [40.92.66.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 12FCD68CA86 for ; Tue, 13 Feb 2024 14:21:14 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ivPXFCt+oTIz8KMEm+Zw3V4PNn5CGpXIVKU7PiL3fpxVjs/es17U4ZMgmK6lZt5fM3G0hYg5OUNxvhj/Vh8CsdgCCKQGT1NoMKyqyY/enwyn+6kFnzOX/r+FFexozC+Pqo+LRN37td5274sQachFqky6XblQyL5hACrYR4fbAYUOYA+fOZqZLhiwweSOILWsgG6mZGgIkSn4+ADFy0ONNpdDzEdI+rpS+eT8mX9pc7msG0ZWGAiXPgobokkba5RD5AhaN5cWX6WFpPIJ5F3ddgYrnlMIvruWDe86Rz2KaAFgezNlfj/0UcVhan7A2UzRh+dpTKs5cy+g/5G35fSUug== 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=xtLPXL/FNCeAOfxZoNtm8WhBB5ODFbDUowA01GeAmeU=; b=YMzUkm7RyxljYTLu+O3Ssuwb7vQ6VjFdI9ri2BdJecjWmsIQYoak3QkrOvk6kaw5V1mshD1we2GNP4pfuRmsTdotDzRBnhXMjMratMm302H3DkLXf3C+dinauXLkM/G/Ccj57JMXQjV8/huJm82+pFNct+AhIKOhECk5R0DgwZnjIqJModbqq282KbsXBycA44y2lfHXix0UEY/dL7y0D3M5/Lj+iJuPQ98XDB8LEjVOIUBNTZGBYcHhW0qAg0aVm8msmc7xxTjKm9udRkgvt/5zF/l6z3Vn80DvEuVxXIvVdV+FuFrDez4+mlCJjmb6S9ecN/HidgYx45T7cFPGvQ== 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=xtLPXL/FNCeAOfxZoNtm8WhBB5ODFbDUowA01GeAmeU=; b=E2JRwnYz8XPQsoCG/+xbzE/5yi2CpaA8qbQA5NuyjsI1fKPhS6iLyKaRcyYAMU27k+DpSv7mFEq18zQkAZcmUQ+dq+f2uLL3ocCRDOjHRuHQDoRupoOY+kIDSyvlqsuGxO/YktdxgyB/URTDWo4XI5t4PebNr2GVQnASrJpXcBUmkZIXnl+p8xyjshYBRbDVMMo6zwP5hF6FfuDDtZMEeLis05DBM4hXyKpgBJ1L/ia4uILU/ZXWcb0tB8NEBBcXvEpPMmRYm6GiyRIfGMYD+uIlG1OB8sKgbACgB22rsGClOlIbQxSuI60jV18M5nyzbLO6Nu6kA4SvaJLDCgeVog== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AS8P250MB0266.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:37d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.35; Tue, 13 Feb 2024 12:21:11 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7270.036; Tue, 13 Feb 2024 12:21:11 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Feb 2024 13:23:01 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [7V2bgBZjn47gVwNoGkbl3fE7K7WyfePSxXfVS2uFjWo=] X-ClientProxiedBy: FR0P281CA0010.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::15) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240213122301.247941-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AS8P250MB0266:EE_ X-MS-Office365-Filtering-Correlation-Id: 69612481-94cb-4887-d3b3-08dc2c8e4388 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ltbqGwoL+8Khluzak0VM+fAZ3hMBJNMO+3nBhSgKtGSwLC0m8pVaQm/89CQnAuXG9n6MDUnW/VI+lbmVgcXai+s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zQE/q3oNB4zgpGywqg9h9uLVo6yMm0ZnNRCPd8UL671yeUvcj6U9Speou8+L59EfUGNG6jr9Jn8ewdeOwimM6BsNg6ThX6mG7KvXJpS9Ju8sIYRHiKMXXHhtXaRjV6bHY0HwVZts45BZYrB7qj/2tIYsPCfoh6Uld0Lxw1e2p1x0llkIuwRyXgoD9z4isT1y+JwNXWZdjQMjUj1c6N1NZyU98D1YxI0YzknlXMpsqUXVB8gFd/eSLtJiQmDkijAPSCAzDAxLOMrc3YzJ070nE7LrzF0F7bpOSrRrOYL/C2qEOj8dI2tW1hKVTJ7zByulhkaO+LV8dBzfvByZvKAWyoCmEUoUOd70iEGluWbV8U3B7D+RMsel8BFttmoTOTn4Czny7rrWs1GQUfUnpdztoUzY3mDsCm53XGXyvBSoYzrUPs+vnVjZV3eCVDhzETjhXnGiqGb1s9uT4XiUHh9P9S++XGxpxD/6PXU2GJyd5DKJXFSKtkTWlBeY5i2myAykt7HNiviMiB1naiSdCJXq2d4MtFIPqIFlez04eucoKkEkNCAcLZ6IKBkZgqu+pirF9aniA6Lf9+Myf8axp+qqa77k4u4StCWyvib/fCcChvoDVmTc9wpn1URCPECMg/xlEYRZxQFcSlGS8J6OQq5hsQPWE38DuAQ2WsOEiDMzyoLygMupaqUK5Hrh/jxNf4OZ81CWcFac+WJ32kTO2fIxxmm2t4ME5K68rrv6byAnR6s55WHfNdQXE5BbzVjmONElpRUei3AwrBTWkCrz4CQYSd8kBbzsguKnbyUETw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69612481-94cb-4887-d3b3-08dc2c8e4388 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 12:21:11.1573 (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: AS8P250MB0266 Subject: [FFmpeg-devel] [PATCH 24/24] avutil/hwcontext_cuda: Allocate public and internal device ctx jointly 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: AEHPbhd/O8f8 Signed-off-by: Andreas Rheinhardt --- libavutil/hwcontext_cuda.c | 43 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c index b430b42f62..3de3847399 100644 --- a/libavutil/hwcontext_cuda.c +++ b/libavutil/hwcontext_cuda.c @@ -35,6 +35,11 @@ typedef struct CUDAFramesContext { int tex_alignment; } CUDAFramesContext; +typedef struct CUDADeviceContext { + AVCUDADeviceContext p; + AVCUDADeviceContextInternal internal; +} CUDADeviceContext; + static const enum AVPixelFormat supported_formats[] = { AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, @@ -283,39 +288,35 @@ exit: static void cuda_device_uninit(AVHWDeviceContext *device_ctx) { - AVCUDADeviceContext *hwctx = device_ctx->hwctx; + CUDADeviceContext *hwctx = device_ctx->hwctx; - if (hwctx->internal) { - CudaFunctions *cu = hwctx->internal->cuda_dl; + if (hwctx->p.internal) { + CudaFunctions *cu = hwctx->internal.cuda_dl; - if (hwctx->internal->is_allocated && hwctx->cuda_ctx) { - if (hwctx->internal->flags & AV_CUDA_USE_PRIMARY_CONTEXT) - CHECK_CU(cu->cuDevicePrimaryCtxRelease(hwctx->internal->cuda_device)); - else if (!(hwctx->internal->flags & AV_CUDA_USE_CURRENT_CONTEXT)) - CHECK_CU(cu->cuCtxDestroy(hwctx->cuda_ctx)); + if (hwctx->internal.is_allocated && hwctx->p.cuda_ctx) { + if (hwctx->internal.flags & AV_CUDA_USE_PRIMARY_CONTEXT) + CHECK_CU(cu->cuDevicePrimaryCtxRelease(hwctx->internal.cuda_device)); + else if (!(hwctx->internal.flags & AV_CUDA_USE_CURRENT_CONTEXT)) + CHECK_CU(cu->cuCtxDestroy(hwctx->p.cuda_ctx)); - hwctx->cuda_ctx = NULL; + hwctx->p.cuda_ctx = NULL; } - cuda_free_functions(&hwctx->internal->cuda_dl); + cuda_free_functions(&hwctx->internal.cuda_dl); + memset(&hwctx->internal, 0, sizeof(hwctx->internal)); + hwctx->p.internal = NULL; } - - av_freep(&hwctx->internal); } static int cuda_device_init(AVHWDeviceContext *ctx) { - AVCUDADeviceContext *hwctx = ctx->hwctx; + CUDADeviceContext *hwctx = ctx->hwctx; int ret; - if (!hwctx->internal) { - hwctx->internal = av_mallocz(sizeof(*hwctx->internal)); - if (!hwctx->internal) - return AVERROR(ENOMEM); - } + hwctx->p.internal = &hwctx->internal; - if (!hwctx->internal->cuda_dl) { - ret = cuda_load_functions(&hwctx->internal->cuda_dl, ctx); + if (!hwctx->internal.cuda_dl) { + ret = cuda_load_functions(&hwctx->internal.cuda_dl, ctx); if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Could not dynamically load CUDA\n"); goto error; @@ -563,7 +564,7 @@ const HWContextType ff_hwcontext_type_cuda = { .type = AV_HWDEVICE_TYPE_CUDA, .name = "CUDA", - .device_hwctx_size = sizeof(AVCUDADeviceContext), + .device_hwctx_size = sizeof(CUDADeviceContext), .frames_hwctx_size = sizeof(CUDAFramesContext), .device_create = cuda_device_create,