Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDVDVideoCodecDRMPRIME: software decoding #17724

Merged
merged 3 commits into from May 23, 2020

Conversation

lrusak
Copy link
Contributor

@lrusak lrusak commented Apr 21, 2020

This has been in the works for some time but has finally been made possible because of #17688

This allows CDVDVideoCodecDRMPRIME to do sw decoding into dma-bufs. This is equivalent to the functionality that the RPi platform has where it can sw decode directly into mmal buffers.

Currently this only supports AV_PIX_FMT_YUV420 as rendering other formats is more difficult (especially on embedded hardware). Mesa has native support to render this format into EGL (using shaders) so we can allow that easily. Other sw decoded pixel formats such as AV_PIX_FMT_YUV420P10 do not have a mesa EGL equivalent. Typically this is because interleaved formats are much better suited for importing into the GPU such as NV12 or P010.

I've tested this on various hw such as Amd, Intel, Amlogic (odroid-c2). The odroid-c2 is the only platform that supports YUV420 (YU12) int the drm plane so that is the only platform I have tested this with using direct-to-plane rendering and it seems to be fine for 1080P H264.

I also added a setting switch to enable/disable hw decoding methods when using CDVDVideoCodecDRMPRIME so this can be tested easily. This will probably need to be expanded in the future to enable/disable specific codec like we have currently for VAAPI.

Also be aware that this only works with the udmabuf and dma-heap CBufferObject types so if you want to test you will need one of those methods available on your platform.

Copy link
Contributor

@jernejsk jernejsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Allwinner H6 board. Works great. LGTM.

@popcornmix
Copy link
Member

Working on Pi too.

@lrusak
Copy link
Contributor Author

lrusak commented May 22, 2020

@jernejsk @popcornmix thanks for the review, Can you verify that the setting to disable hw decoding for DRM PRIME actually acts like it should? After that we can shove this in 👍

@jernejsk
Copy link
Contributor

Not sure if "Allow hardware acceleration with DRM PRIME" works correctly. In both cases (that option enabled and disabled) I get "ff-vp9-drm_prime (SW)" when pressing "o".

@popcornmix
Copy link
Member

I think (as root):

echo "cma:*" > /sys/kernel/debug/tracing/set_event
# [play video]
cat /sys/kernel/debug/tracing

should show frame sized allocations and frees when software decoding is using dma-heap.
Note: even when not being used I think you see some size=1 allocations.

@jernejsk
Copy link
Contributor

Log: http://ix.io/2mZS So, even if aforementioned option is disabled, DMA buffers are used.

@jernejsk
Copy link
Contributor

Eh, sorry, disregard my comment. I thought settings are the other way around. Yeah, settings work fine. GTG

@popcornmix
Copy link
Member

Pretty sure the switch worked as expected when I tested it on Pi.

@lrusak lrusak force-pushed the drm-prime-sw-buffer-object-pr-2 branch from 385a690 to 2b66f3e Compare May 22, 2020 23:45
@lrusak lrusak merged commit edea4bc into xbmc:master May 23, 2020
Maven85 pushed a commit to Maven85/kodi that referenced this pull request May 25, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Jun 15, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 3, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 4, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 4, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 5, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 5, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 6, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 6, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 6, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 7, 2020
…pr-2

CDVDVideoCodecDRMPRIME: software decoding
@lrusak lrusak deleted the drm-prime-sw-buffer-object-pr-2 branch February 11, 2022 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants