From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BCE5440AF6 for ; Fri, 6 May 2022 05:50:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6D6C268B2C7; Fri, 6 May 2022 08:50:54 +0300 (EEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12olkn2023.outbound.protection.outlook.com [40.92.23.23]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 616BD68B28B for ; Fri, 6 May 2022 08:50:47 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nQ0vi5vEnFHmjjripsyq7VQL4HhITx1jvgc6LP59eN2vQJLfDpGIdnp+cqfsbkGoHCEJFQRFGerHe6P7vQ+mOhZ4OfyyhgdIv9wBr37UozRTDwhufBCUaFttX7R0h228kHeNjqTlwh8ZgZNNxcenB2bNJb/yfb1FU/HcM3f03PssqH4TWFOlrSLuMpUq3yReVVHNULvQPT2JEr0Td58uAp1AeveYGEqdiSas705d9ZeKNOzjEbSGnts3ke+zZZay6dA2wRM0ibIj+e8dZG+J6YysV92Be6Si8Av7ec7ygtECvCXx2BRiMWw07desJrmC+TDUVeajPG2GWqfhgvXwsw== 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=XvanhOzRtcrQgIiOuE/dRrHqK9v8ZwR/Mwr7g7084nU=; b=ebWhJjpnzOIPTIyRPglMaiv+P8eGglNh2V+VtTmiLox05F76LJi6av7FY81/EaDvyzlq1Uy5tPXQD4/UjWmq4qed+lyNDahTLfKuldURZ4DJmgRmxk+D+a5uHU8tDut8H4F+PgdFUDTd9KUKUQkGT5PhPJ+ki6lJwgNZDNOiGxXmBpBSDwteY9m0RcWodRxSElXnTAdZ2W84rgOX34t4PKbl6dz3nPnnaEUJuXb5zdaAU7zBSkBnyuwhPIrYu9KhLfICBN29YLJFOhe4rnbSnJKolMwqU9qInsQRnnmmgJHUDOk3XtAEVM0MGvpyXriBXxa+Ii0nOoOf0VkLRJg2DA== 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=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XvanhOzRtcrQgIiOuE/dRrHqK9v8ZwR/Mwr7g7084nU=; b=itaWrM0wtpu5TJxCfTyaohjTTEQnDMz6SQBBUt8poOGUskLKxRz4sKyJM8yAa0+SaXDFwwTgOC3Nm2hv2yJRg+4JN26REBUONQiSS6PsR81SxXD7OL6XCOZGYRqNxe0PJuElcG3HGHplyfcPoq64Lj0RuO3QuJlhknyQ7wYLfrsJf0iJOksY3zFWi8uZfojhL7c7t2jfp/cSDoOZhct4/CWIlp7n6N7KdSHIfY4U8u3HagVGMlSWC58s4xywtQw3b++Juwch5wgE4d2oX5pAEeQ1cK89I5fUB+LYtQXqPjwTHsBP/0tq7pFqpJVZRPBO9v6jmVmn8Rie4OmgK1/YGw== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by DM8P223MB0271.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13; Fri, 6 May 2022 05:50:43 +0000 Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::7472:6f83:eeb:45e3]) by DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::7472:6f83:eeb:45e3%9]) with mapi id 15.20.5206.027; Fri, 6 May 2022 05:50:43 +0000 From: Soft Works To: FFmpeg development discussions and patches Thread-Topic: [FFmpeg-devel] [PATCH v2 1/5] avutil/hwcontext_d3d11va: fix the uninitialized texture bindflag Thread-Index: AQHYW7ZG7PhAR+3Ey0KAzg+WBYVY360HcgaAgAEHemCAAPMjgIAAAdfQgAC/84CAAAFkAIAA6O6ggAT674CAAPvAcIAAT/+AgAABUyA= Date: Fri, 6 May 2022 05:50:43 +0000 Message-ID: References: <20220429104505.1747-1-tong1.wu@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-tmn: [z4hCz5rt/z/jNg+hwzAZD9StyEdPkW0t] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5cef0022-d515-4e2b-2da9-08da2f245c1e x-ms-traffictypediagnostic: DM8P223MB0271:EE_ x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nxrGNXrmgCdlSsvFUsphKIxCENlzxN/gVFDITrCpvCyQCDs/ylNScu+t60oRmQ7tcYHcrrPhHZQkAt7M38iRsfa9hYcfbakdAMWwlTcAui4DOO1P4JGiypELNn9FXbebviC4m/VTlFh+e0n0NAOJH3FXHGp5ARSWktivD3lkEV8BQtgbCE+zuowvxTbA1IrVkK6KWaiFn+aNWTSGuIWLGuEWT/Og9bEDILVOfMpNviW5D0bGbJE4WSZCBYENk/dlaPle9L73VceEwjOwuRuwYYZbnWyj02ScqVyk1zu+AXVqtSWKcXj9RrK+BiznGqZGiAenM3ZL3TRWJA/tSMa7ic1CI9DYBxYdaRBAArZL6NvagLiPKwbRF0iDOrZa3fV2LNYqLMara+UdWPRhrYJ3EiK11gIqKbonOomWGAlfHcAmOe4dkI9LQcjzvAXM0END+kWfauTjJ3/mNz8moQi7oV64yC+VQ/eqJlypuXtxhXGP0r79/7dhV5uznnAHMTS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XljeWxmc3JN?= =?utf-8?B?SUlJQ2xBWE81VVRRZWdRVVJTUXhIMkV1R0Rzb3ZQdWNUWC93ODN2ZHpsZ04r?= =?utf-8?B?VWxSMUZsWERYaThlZDYzSEtidFhvSWRqQTVYRmZJQWNIdi9mMGtSVWpDU1Ur?= =?utf-8?B?TE9vcnZDd1cyelo0aHY0UlBxQmNWYU51dzF3MDVrSkhkdXExNmlIZlUvQXFO?= =?utf-8?B?V1luYXdndE9DdEUvZGpzVERGSUVkQ0RjbGNBK003ZW5XNFZOSjNRdDJtTUVN?= =?utf-8?B?b3RCYmRmUzFkK1M2eEhYRWowRC9jUW50Q0VBRkRxbDdwUnJkK0JLOCtrcXVa?= =?utf-8?Q?tVnQO7/kqPM=3D?= MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-1ff67.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 5cef0022-d515-4e2b-2da9-08da2f245c1e X-MS-Exchange-CrossTenant-originalarrivaltime: 06 May 2022 05:50:43.7000 (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: DM8P223MB0271 Subject: Re: [FFmpeg-devel] [PATCH v2 1/5] avutil/hwcontext_d3d11va: fix the uninitialized texture bindflag 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > -----Original Message----- > From: ffmpeg-devel On Behalf Of > Hendrik Leppkes > Sent: Friday, May 6, 2022 7:38 AM > To: FFmpeg development discussions and patches devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v2 1/5] avutil/hwcontext_d3d11va: > fix the uninitialized texture bindflag > > On Fri, May 6, 2022 at 3:11 AM Soft Works > wrote: > > > > > > > > > -----Original Message----- > > > From: ffmpeg-devel On Behalf Of > Wu, > > > Tong1 > > > Sent: Thursday, May 5, 2022 11:50 AM > > > To: FFmpeg development discussions and patches > > devel@ffmpeg.org> > > > Subject: Re: [FFmpeg-devel] [PATCH v2 1/5] > avutil/hwcontext_d3d11va: > > > fix the uninitialized texture bindflag > > > > > > > > -----Original Message----- > > > > > From: ffmpeg-devel On Behalf > Of > > > > > Hendrik Leppkes > > > > > Sent: Sunday, May 1, 2022 5:54 PM > > > > > To: FFmpeg development discussions and patches > > > > devel@ffmpeg.org> > > > > > Subject: Re: [FFmpeg-devel] [PATCH v2 1/5] > > > avutil/hwcontext_d3d11va: > > > > > fix the uninitialized texture bindflag > > > > > > > > > > On Sun, May 1, 2022 at 5:48 PM Hendrik Leppkes > > > > > > > > wrote: > > > > > > > > > > > > On Sun, May 1, 2022 at 7:09 AM Soft Works > > > > > > > > wrote: > > > > > > > I think that's what Hendrik wanted to point out as far as > I > > > > > understood. > > > > > > > > > > > > > > > > > > > Basically, I want explicit behavior, not implicit defaults. > > > Anytime > > > > > a > > > > > > hwcontext is created, something should tell it what its > going to > > > be > > > > > > used for, so we can determine which flags make sense (or > > > ideally, it > > > > > > should just specify the flags). > > > > > > > > > > > > This patch creates an implicit default for one use-case, is > this > > > > > going > > > > > > to work with all others? No, of course not, because it has > to > > > know > > > > > > what flags to set. Thats why explicitly setting those flags > is > > > > > > important, instead of just fixing one implicit case. > > > > > > > > I said I agree with you - basically, just that we need to > > > differentiate between > > > > the use case: > > > > > > > > 1. Use via API > > > > => No defaults should be applied, caller is responsible for > > > specifying > > > > the flags > > > > > > > > 2. Use via ffmpeg cli > > > > => Applying the render target flag would be safe here. > > > > We could require this to set via parameter, but there > won't > > > ever > > > > be a case to specify something different than the render > > > target flag > > > > > > > > Why? Let's look at the possible flags: > > > > > > > > D3D11_BIND_DECODER > > > > In all decoding cases, this flag is set explicitly, so it > overrides > > > any default we > > > > would set > > > > > > > > D3D11_BIND_VIDEO_ENCODER > > > > Set explicitly when required, so it overrides any default we > would > > > set > > > > > > > > D3D11_BIND_RENDER_TARGET > > > > All other cases require this flag (e.g. video processing) > > > > > > > > No Flag > > > > Dead end, texture would be unusable for any kind of video > processing > > > > > > > > > > > > > On that note, the example commandline it fixes just does > hwupload > > > and > > > > > nothing else - does that even require render target to be > flagged? > > > > > From what I can tell it uses a simple > > > > > ID3D11DeviceContext::CopySubresourceRegion to copy from the > > > staging > > > > > texture, which should not require any particular bind flags. > Bind > > > > > Flags in turn would then depend on what you are actually > trying to > > > do > > > > > with the texture (shader input, etc), in this example... > nothing? > > > > > > > > We are still in the context of ffmpeg cli - you know that there > are > > > no shaders > > > > or 3d operations and no etc. > > > > > > > > But at this point, you can derive to another context or you can > > > hwmap. > > > > For all of those things, you need D3D11_BIND_RENDER_TARGET. > > > > > > > > > > > > Summary > > > > > > > > As mentioned I see two possibilities: > > > > > > > > 1. Use D3D11_BIND_RENDER_TARGET as a default when used in > context of > > > > ffmpeg cli, otherwise no default flags > > > > > > > > 2. Require a device initialization parameter in the command line > > > > (but it would always be about setting the render target flag > > > > and there's no case where you would NOT want to set it) > > > > > > > > > > Thanks for the possible solutions for this issue. The No.1 seems > more > > > reasonable because > > > No.2 just seems more unnecessary. But I will still need to find a > > > better place to set the flag. > > > > I would favor #1 as well. > > > > Regarding "better place to set the flag": > > > > The BindFlag needs to be set when initializing a FRAMES context. > > But at this point, there's no way to determine whether the code is > running > > in an ffmpeg cli process or used by an API consumer. > > > > But there would be an opportunity to convey this information on > > device init. The device (D3D11VA) could then set an internal flag > > from device init and use this on frames init to determine which > default > > to use for the BindFlags value. > > > > Remains the question how ffmpeg cli can convey this information to > > the device (for use during device init). > > > > What I thought would be to have ffmpeg.c (or rather ffmpeg_hw.c) > > to ALWAYS (for all hwaccels) add an entry to the options dictionary, > > something like "cli" or similar. > > This would avoid introducing a "special-case" mechanism just for > > this case (=> by making it a common behavior). > > > > There are other cases where this might be useful in order to > > discriminate API usage from cli usage. > > > > But let's see what the others think first.. > > > > Think of the CLI applications as an API user, and design for that, > because thats really what they are, and thats how you actually end up > with a good API that covers more cases. > If special CLI logic is needed, it should be in the CLI applications, > and not in the libraries. > > - Hendrik Thanks. When I translate that, it would be a BindFlags entry in the options dictionary, which any API user _could_ set and which ffmpeg cli _does_ set in ffmpeg_hw.c (to render target). The D3D11VA hw context stores this on device init and uses it as a default in frames init. The default of the default is 0 of course. Does that sound ok to you? Kind regards, softworkz _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".