v20 DXVA2 improvements (HW video decoding) - Merged into master
#16
2022-02-21 10:37:06.768 T:3040     INFO <general>: Checking resolution 16
2022-02-21 10:37:06.784 T:10700 WARNING <general>: CActiveAE::ActiveAE::CActiveAE::StateMachine - signal: 0 from port: OutputControlPort not handled for state: 7
2022-02-21 10:37:06.934 T:3040     INFO <general>: DX:Big GrineviceResources::CheckNV12SharedTexturesSupport: extended NV12 shared textures is supported
2022-02-21 10:37:06.934 T:3040     INFO <general>: DX:Big GrineviceResources::CreateDeviceResources: device is created on adapter 'NVIDIA GeForce GTX 1050' with D3D_FEATURE_LEVEL_12_1
2022-02-21 10:37:06.934 T:3040     INFO <general>: DX:Big GrineviceResources::GetVideoDriverVersion: video driver version is NVIDIA 511.79 (30.0.15.1179)
2022-02-21 10:37:06.934 T:3040     INFO <general>: DX:Big GrineviceResources::CheckDXVA2SharedDecoderSurfaces: DXVA2 shared decoder surfaces is supported
2022-02-21 10:37:06.942 T:3040     INFO <general>: DX:Big GrineviceResources::ResizeBuffers: 10 bit swapchain is used with 6 flip discard buffers and SDR output
2022-02-21 10:37:06.994 T:3040     INFO <general>: RetroPlayer[PROCESS]: Registering process control for Windows
2022-02-21 10:37:06.995 T:3040     INFO <general>: RetroPlayer[RENDER]: Registering renderer factory for DirectX
Reply
#17
@jogal 
Did setup a Win10-21H2 installation with the newest AMD Radeon drivers v22.2.2 (Windows Driver Store Version v30.0.14029.1011) and re-tested a clean portable installation of "(nightly) KodiSetup-20220124-e60e5c24-master-x64.exe", but sadly that doesn't really change anything = it is still not usable. Guess I'm out of luck here. (Debug Log)

Looks like ciukacz's Vega (GCN 5.1, DirectX 12.1) based graphics (Ryzen 4650G) is capable of using this feature, but not my Polaris/Lexa-based RX550 (GCN 4.0, DirectX 12.0). Sad
Reply
#18
Yes, seems this feature is supported only from Vega 2 (GCN 5.0, DirectX 12.1).

We can use DirectX feature level 12.1 condition to discriminate this and disable in "old" AMD hardware.  All recent AMD graphics based on GCN 5.0 or newer supports DirectX 12.1 on Windows 10.

With this, on old AMD HW it would work fine (same as before).
Reply
#19
(2022-02-21, 02:26)ciukacz Wrote: works good with 4650g, driver 21.10.4 and 21h2.
the only error that i see is "chosen scaling method 1 is not supported by renderer" on a clean, portable install using build from 1st post.

That error/warning is because DXVA is not the default scaling method.  Default is bilinear or something that can not be used when is used DXVA.   This is only cosmetic issue as DXVA scaling is used anyway when DXVA is enabled/used. (recommended)

If you want get rid-off this message, on video settings (contextual menu during playback) set default scaling method to DXVA and apply for all media.
Reply
#20
The workaround for AMD Polaris (or any GCN < 5.0) is already merged in master branch.
Reply
#21
(2022-01-24, 11:49)jogal Wrote: Performance comparison playing 4K video:

Before:
Image 

After:
Image


Note that the dedicated GPU memory drops from 1.1 GB to 659 MB
hi, what is this tool.I searched for it without success.
thanks
Reply
#22
Process Explorer
https://docs.microsoft.com/en-us/sysinte...s-explorer
Reply
#23
thank you
Reply
#24
(2022-02-24, 16:48)jogal Wrote: Default is bilinear or something that can not be used when is used DXVA.   This is only cosmetic issue as DXVA scaling is used anyway when DXVA is enabled/used. (recommended)

Let me get this clear.

You are saying that, when using DXVA decoding, DXVA scaling is automatically used? So not the scalers listed here https://kodi.wiki/view/Video_playback#Video_Settings ?

And what type of scaling does DXVA use?

I had been asking about this years ago already.
For troubleshooting and bug reporting please make sure you read this first (usually it's enough to follow instructions in the second post).
Reply
#25
Yes, when using DXVA2 video decoding is also used DXVA scaling because it performs better and has more quality than, bilinear, bicubic, Lanczos, etc.
 
(2022-05-21, 18:42)ashlar Wrote: And what type of scaling does DXVA use?

Depends on hardware implementation/video drivers. Every time you update the video drivers you can "potentially" be improving the scaling method.
Reply
#26
(2022-05-21, 22:37)jogal Wrote: Yes, when using DXVA2 video decoding is also used DXVA scaling because it performs better and has more quality than, bilinear, bicubic, Lanczos, etc.
 
(2022-05-21, 18:42)ashlar Wrote: And what type of scaling does DXVA use?

Depends on hardware implementation/video drivers. Every time you update the video drivers you can "potentially" be improving the scaling method.

Hmmm... I just launched a local install of Kodi 20 I have on this machine for testing purposes. Played a movie, went into video options. DXVA scaling was not selected (DXVA2 hardware acceleration is active in settings).

And so, once more, I don't understand how this is handled by the code.

If DXVA2 hardware acceleration is active you state that DXVA scaling is used. Does this mean it's forced or not? If I want to select a pixel shader algorithm (say Lanczos 3) can I do it?

Because if I cannot do it, the option should not be available (it generates confusion, obviously).

If I can do it, I would need to understand what scaling algorithms DXVA uses on different cards. As far as I remember, there was pretty much zero development from GPU makers on this front (except on Nvidia Shield with AI upscaling, but that's not Windows and unavailable, as far as I'm aware, on Windows).

I could provide screens, in case what I'm describing is not clear enough.
For troubleshooting and bug reporting please make sure you read this first (usually it's enough to follow instructions in the second post).
Reply
#27
(2022-05-22, 14:15)ashlar Wrote: Does this mean it's forced or not?

Yes is forced.

Each rendering method supports only certain scaling methods. This is by design (and always has been, nothing to do with v20).

From memory:

Software only supports bilinear.

Pixel shaders supports bilinear, bicubic, Lanczos, Spline36, etc. (because these are implemented by shaders)

DXVA only supports "DXVA scaling" as it's implemented by graphics hardware.

for the same reason Pixel Shaders render does not support DXVA scaling....


1. I think we all agree that it is better to use DXVA2 to decode the video (better performance and same quality).
2. The video data is already in the graphics card, so it is better to use DXVA as the rendering method to avoid GPU --> CPU --> GPU copy operations (move data unnecessarily).
3. If scaling is needed, DXVA scaling is used (since it is the only possible with DXVA).

But DXVA is not always used, that is, a H264 10 bit 4:4:4 video may not be able to be decoded with DXVA2, so FFmpeg (SW) is used and then the best path is:

FFmpeg --> Pixel Shaders --> Pixel shaders scaler

In general when the render method is set to Auto (default) DXVA is used but only if DXVA2 is also enabled and can be used to decode the current video. It also depends on what version of DirectX you are using supports.

We always try to choose the most optimal path and "impossible" paths are not chosen.


Optimal paths are only:

Video File ---> DXVA2 ---> DXVA render ---> DXVA scaler ---> Screen

Video File --> FFmpeg --> Pixel Shaders --> Pixel shaders scaler ---> Screen


If DXVA2 is enabled and render method set to "Auto detect" these two paths are chosen automatically depending on the video played and the capabilities of the system.

(usually on modern systems is always DXVA2 - DXVA path except for very exotic video codecs)
Reply
#28
(2022-05-23, 15:22)jogal Wrote: Optimal paths are only:

Video File ---> DXVA2 ---> DXVA render ---> DXVA scaler ---> Screen

Video File --> FFmpeg --> Pixel Shaders --> Pixel shaders scaler ---> Screen


If DXVA2 is enabled and render method set to "Auto detect" these two paths are chosen automatically depending on the video played and the capabilities of the system.

(usually on modern systems is always DXVA2 - DXVA path except for very exotic video codecs)

Ok, but what's the behavior if, instead of Auto, one has selected Lanczos3 and applied that to all Media? What I see is DXVA2 hardware decoding is still used and if I open the video settings I see Lanczos3 being selected. Does that mean it's not being used in reality? Sounds like a bug, in that case. I don't think it's unreasonable to expect the menus to portray what's actually happening. Which in that case should be DXVA2 deconding, rendering and scaling.

BUT

I don't know what to make of the information I find here: https://kodi.wiki/view/Archive:XBMC_v13_...s_Specific

I remembered that a long time ago HQ scalers were optimized for DXVA. As such... might it be that they're actually used, if selected, instead of the automatic DXVA scaler?

https://forum.kodi.tv/showthread.php?tid=77111
https://github.com/xbmc/xbmc/pull/838

Further confirmation: https://forum.kodi.tv/showthread.php?tid...pid1505654

During playback, click the "film roll" icon and select in "Video scaling method" option. Lanczos, Spline and Bicubic should be available for DXVA decoded material also.
For troubleshooting and bug reporting please make sure you read this first (usually it's enough to follow instructions in the second post).
Reply
#29
My understanding is that software decode can also supply the DXVA renderer, hence the HQ scalers can be used.
Reply
#30
Yes is true: all these scaling methods can be used with DXVA:

c++:
if (method == VS_SCALINGMETHOD_CUBIC_MITCHELL ||
method == VS_SCALINGMETHOD_LANCZOS2 ||
method == VS_SCALINGMETHOD_SPLINE36_FAST ||
method == VS_SCALINGMETHOD_LANCZOS3_FAST ||
method == VS_SCALINGMETHOD_SPLINE36 ||
method == VS_SCALINGMETHOD_LANCZOS3)

The log message "chosen scaling method 1 is not supported by renderer" is only when default scaling method is BILINEAR (that is default setting in Kodi fresh install).  Then fallbacks to DXVA.

That's all right  Blush


P.S. my personal preference is to use DXVA scaling anyway
Reply

Logout Mark Read Team Forum Stats Members Help
DXVA2 improvements (HW video decoding) - Merged into master0