-
Notifications
You must be signed in to change notification settings - Fork 7
Open Test Thread #14
Comments
Is there an option to force |
FFMPEG_RKMPP_PIXFMT=DRMPRIME env value |
HEVC/VP9/AV1 10-bit to H264/HEVC 8bit transcoding can cause system crashes. Sometimes I have to cut the power to reset.
Also it seems the post RGA
|
Can you try without forcing drmprime? You actaully dont neee to drm prime, softframes are 0 copy. Scaling is only possible yuv420/422 p/sp planes, but i noticed when the outputframe is drmprime i dont check it correctly. Ill fix that... |
After removing the env, here comes the rga3 alignment issue or maybe the DMA32 buffer issue on my 16GB RAM board.
And for the HEVC 8-bit 1080p input + post RGA downscaling to 720p.
|
Ok ill give it a look in detail tonight |
the 2nd issue is quite weird.
the hstride is given 2304 here, and this is received from mpp directly. for this NV12 frame it should be Update:
|
Thx for the update. With the fixes:
|
this should all work, however i switched to librga and it is being a bi**h, i am working on it. |
ah one question, which player are you testing the drmprime output? is it kodi or something else? |
I can't figure out why librga exists independently of mpp. This resulted in developers having to maintain compatibility between them. sw frames seem to work fine in the encoder. Video quality looks better than AMD graphics cards, albeit slower. I've been using the command line to test the encoder. Kodi might be a good option for testing ffmpeg as a library. Or refer to some tools of the author of rpi-ffmpeg such as https://github.com/jc-kynesim/hello_drmprime. |
all of the issues you reported today and yesterday including the one i thought mpp related should be fixed in 1d57c70 There is something fishy with mpp to my understanding however this was not the root cause of the issue. About Sw frames, even when so-called non-drmprime planes are decoded with rkmpp_decoder they are still hardware planes most of the time, simply mmapped to drm device. Especially when the NV12 plane is used, there is no copy at all. So i would call them hybrid and in the transcoding scenarios they are mainly NV12, so hardware frames mapped to AVFrame. It is kinda tricky but this the actual reason why i started this fork in the first place. In short, when transcoding forcing DRMPRIME does not make any difference in terms of performance, you can also verify this with the throughput and resource usage. This is the reason i did not test those parts with transcoding with DRMPRIME forced, so thanks for that :), lots of issues were found and fixed (hopefully). i had tested drmprime only when getting kmsgrab input with drmprime bgr0 frames. |
Overall works great after the latest changes, with some exceptions.
It seems that my experience with desktop GPUs doesn't fully apply to Arm/Rockchip. As you said, forcing DRMPRIME does not improve performance. I also couldn't find any encoder preset to trade off between speed and quality. So the claimed encoding speed of 8k30 cannot be equivalent to single 4k120 or 1080p480. Maybe in parallel encoding it will work. As for the HEVC encoder of rk3588, it doesn't support NV15 input, which means it cannot encode Main 10 profile/10-bit video, maybe they will add it in the next generation of HW. But for now it's best to remove it so as not to confuse users. |
thanks for the detailed feedback, all is fixed at latest: cf6e176, about profile 8.5: my understanding of this is that, only way to trade of speed is to reduce the input size. I think there is a constant pixel per cycle process rate. but i am also not sure, i have not yet benchmarked the encoder performance. And the best way to do it would be to first compare with mpi_enc_test things that come default with mpp. open question: do you know any way to produce NV24, YUV444P, NV16, YUV422P, BGR24, YUYV422, UYVY422, BGRA, BGR0, NV12, YUV420P formatted DRM PRIME frames with ffmpeg so that i can push them to encoder. currently i can only test NV12, NV16, YUV420P (rkmpp_decoder) & BGR0 (kmsgrab) drm prime frames and rest is not tested due to lack of input. |
alright, I checked out your git, I did modify the configure line a little from your wiki however:
I used that configure line because i also used it for jjm2473's fork of rkmpp enabled ffmpeg, so i have a comparison. the build went on clean, no errors from the first try on, however a warning during linking. After build it complained about missing libavdevice.so.60 on first try(ffmpeg --encoder) - I found it in the libavdevice subfolder of your git pull. After that it comlained about all the rest of the common libs being missing one by one. simple guess would be that I didnt install ffmpeg. after adjusting my LD_LIBRARY_PATH for testing ffmpeg loads. so far so good. ffmpeg -encoders | grep rk lists the h264, hevc and vp8 encoders Now lets give it a try - the goal is to trancsode. and i get a segfault. same goes when trying to encode to h264 EDIT: I tried a clean build with the configure line from the git repos wiki, but i also keep getting segfault when trying to transcode a video, doesnt matter whether i transcode to h264 or hevc. Input in all cases has been h264 full hd As for the linker warning, this is what i get: Tiny attachment: I had installed a current mpp, however that got installed into /usr/local/lib and the system mpp was used instead. turns out your ffmpeg isnt compatible with the mpp that comes from radxas repo. a simple override using LD_LIBRARY_PATH fixed that issue, and the segfault is gone. Might be worth adding that to the wiki. |
Tuned the statement in the wiki explicitly
|
This might require extra effort in libavutil/hwcontext_drm. Currently it is only a skeleton and does not contain a frame allocator unlike other hwcontexts. I remember someone have a patch for this and put it somewhere. Once complete, the command line should look like this:
The ideal situation is that we can have a separate |
amazing, that helps alot |
hmm on a second review i am not so sure about this: This patch gets the hstride from the the linesize of the picture descriptor, however to my experience and testing, ffmpeg and drm do not always have same defintiion hstride and plane count. ie: for ffmpeg AV_PIX_FMT_BGR0 is 1 plane format with but for drm it is I have learned this by testing kmsgrab drmplane formar bgr0 Line 356 in cf6e176
May be it is better to look at libdrm in detail how the size and strides and planes are defined. Update: After carefull examination, the hstride multiplier is based on the char_per_block definition rather than the plane size. so this |
ok i was confusing with plane count and char_per_block |
quick question - the -level option for the hevc encoder, is that like the presets from x265? if so, is lower level slower preset, aka better quality? sorry to bother in here, but i couldnt find anything about this on the web |
Nope. It refers to coding constraints. There's no x265 CRF equivalent. |
mean while one interesting feature could be this so called "split mode" to reduce the latency on live streaming apps. Any experience on it? Does it really make sense? |
Sounds like it should help moonlight. Btw have you figured out the patch yet? |
ah i see, yeah actually this cloud gaming thing is quite popular and hip lately, so latency could be a thing. I can not work on the patch, i will when i go to home in the evening, |
The original author left a little flaw. This should save you some time. 0001-lavu-hwcontext_drm-Add-internal-frame-allocation.patch FFmpeg cli works as expected but there are some issues with certain formats.
|
So, thanks a lot for the patch... After several fixes, NV12, NV16, NV24, BGR24, YUYV422, YVY422, BGRA, YUV420P, YUV422P, YUV444P are not giving red channels, considering those are yuv formats, it is obviously something wrong with the source not the encoder. dont knwo what currently. BGR0 also does not work, i see that the size of the DRM plane is 3/4 of what it is supposed to be, i think thats because last X or 0, part of the plane is not allocated to save space, but this is not ok for the MPP, if you give such strides with less the size, mpp will try to read non existent last quarter of the plane where there was suppossed to be bunch of 0s, buth it will segfault and crash the kernel. I dont know which one to blame but, considering kmsgrab is also giving full size plane with with bgr0 format, it seems like something with this generated drm primes is wrong. But i could already test planar planes and bgr0 from other sources, so i think these test planes with this new patch is giving good enough coverage. |
so another issue - the build generally works fine, however I noticed when converting DVD Source material(I tried one source with a 352x576 SAR 24:11 and another 720x576 source) ffmpeg complains about duplicating frames. Sample out:
this happens regardless of whether I try the iso image as source or the individual VOB files. The resulting file is a stuttering output that plays a couple frames, then hangs for a fraction of a second and then continues playing. line used in above example was: this works fine in software on my desktop computer(I need to encode to h264 in both cases, your ffmpeg on rock 5 or my ffmpeg on desktop, for some reason when i choose hevc i get a non-playing video on this second video i tried and vlc claims its an mpeg-2 source stream, but that might be a bug upstream the ffmpeg pipe) |
Command lines like this can turn off the blue led. But AFAIK the green led on 5B cannot be controlled by software. |
v10+panthor-v3+32b+g310+egl15+afrc+afbc tested both above branches from boris's mesa, but gnome/gdm crashes at start. i also had to patch to compile it properly. diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 6c8ea71..51c111e 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -227,7 +227,7 @@
/* for EGL_EXT_surface_compression */
EGLBoolean (*QuerySupportedCompressionRatesEXT)(_EGLDisplay *disp,
_EGLConfig *config,
- const EGLint *attr_list,
+ const EGLAttrib *attr_list,
EGLint *rates,
EGLint rate_size,
EGLint *num_rates); otherwise does not compile and complains about long to int pointer mismatch
|
but the good news is kmscube is working, so i can use mpv to render directly over gbm. I think thats good enough for me to start working on poring mpp. below are the PKGBUILDs in case of an interest https://github.com/7Ji-PKGBUILDs/linux-panthor/blob/master/PKGBUILD and finally
|
|
That’s awesome 👏 One day we should package it as a DKMS. I don't know if mpp has a hard requirement for their custom dma-buf-heaps driver. Currently in 6.1 bsp this driver is broken, and the android ion driver has been removed by upstream linux, so the only available mem allocator is drm. I experimented with the 6.1 bsp kernel, and with some fixes, it already has a high degree of completion. Backporting the panthor to it is also valuable. Yesterday I also encountered a system freeze in 6.7-rc1 caused by the hdmi screen being turned off. |
it works!! :) (you need to get latest, i pushed some dts fixes.)
|
but my panthor is completely broken. |
I am not sure it is easy, because mpp is using alot of extra exported symbols from iommu_rockchip and someother variants of rockchip drivers. This should never be allowed in mainline. One option would be to use existing kernel interfaces to do similar operations but i am not that good at kernel development. I think the reason for mpp doing this is that, since it is controlled by user space sometimes it needs to reset itself and some other systems like mmu. You can see those operation in the history log, where i have cherry picked some commits from vendor kernel.
I do not guess so, i think drm device is just a wrapper around dma_buf_heap device, so drm device should be ok.
Should be, because mainline is not the best when it comes to opp_select, pvtm, especially on the clock driver. The clock driver was very different than the vendor, i am not sure it is better or worse but the commit history was even completely different. Some notes: Next target woudl be poritng RGA and i guess/hope it would be easier than mpp. But you know, nothing is easy with RGA. |
@nyanmisaka @hbiyik can you guys please enlighten me about what's going on with panthor? Is it better than panfork? How is it related to panfrost? :) I understand you are doing something important for Rock 5. Will it equally work for Orange Pi 5? |
Do you mean adding these mpp related code prevents panthor from running?
Indeed. We shouldn't waste time on DKMS at this early stage.
Mainline is not mature in frequency scaling, even though collabora has a custom cpufreq driver. An example is that the lowest CPU freq in bsp can be reduced to 400Mhz versus 800Mhz in mainline. |
Panthor is still in WIP and may take a few months to complete. We are trying it to prepare for transplanting MPP and RGA to mainline. JM: job manager based scheduling kernel mode: (linux kernel)
user mode: (mesa)
These efforts are not made for a specific board, but for all rk3588 based platforms. |
nyanmisaka/linux-rockchip@7e91bfc It seems the PCIe ASPM is controlled by setting |
@nyanmisaka i enabled the ASPM but this thing is still hover 45~55 +-5C. I think this HW is designed to run hot, i also scrapped it from a dead laptop, and it (the NVME) was half burned anyways, so it is ok let it burn i dont care :)
This i do not know, but i dont expect so, therefore i will wait a stable panthor to work on to troubleshoot efficiently, but it seems that it is not too hard to port mpp ot rga to mainline. |
Just a heads up: kodi seems to be broken (horizontal lines/tear when scrolling) after this pull request: xbmc/xbmc#23921 Can someone confirm? |
@kyak i will check can you send a screenshot for me to compare. Actually this pr in kodi was supposed to nake thinfs faster, i was following it. |
Not sure how to make screenshot (technically). But this problem is not screenshotable anyway. Tearing and lines happen when scrolling, then it's back to normal. |
@kyak fixed in panfork, 7Ji-PKGBUILDs/mesa-panfork-git@bc05b90, i think answers why we are trying panthor :) panfork is good, but people pissed off its developer, and he is no longer maintaining it. |
Thanks a lot! I confirm that the problem is fixed. |
branch no longer exists, can you possibly post patches and/or repush this branch? I'm interested in headless decodes and want to play around with this. |
@hbiyik i'm getting black screen on all videos with There has been your recent commit to the master branch. Maybe it also needs to go to |
Yeah i know the reason why, ill push a fix tonight, but you can better switch to ffmpeg-rockchip |
Should I switch to |
I've tried |
U should use direct rendering to plane but those also require some kernel and kodi patches |
Indeed, cherry-picking 65f9032 on top of |
I use direct rendering to plane, but kernel is |
Yep that was the fix |
@hbiyik what is the recommended combination of ffmpeg, kodi and kernel packages for Orange Pi 5+ right now? I'm currently at It feels like I'm missing a chance to provide feedback to you while you are playing around with kernels and ffmpeg. I'm staying with something obsolete and irrelevant. Please suggest what users need to do so that developers have the best feedback possible. |
thanks for bringing this up, definetely use https://github.com/nyanmisaka/ffmpeg-rockchip may this is the last message in this repo and i will make it read only. I will also add a message to the repo frontpage why you should not use this anymore. Please also have a look at https://github.com/hbiyik/ffmpeg-rockchip/wiki/Rendering 7ji repo, agr, arch, debian based things are all moving to the ffmpeg-rockchip and i will be contributing there. As always feeedback makes the project stronger, and always well come. See you on the other repo. |
@avafinger
A lot has been added specially hevc and vp8 encoders with scaling support:
https://github.com/hbiyik/FFmpeg/wiki
should be stable to test if you are interested.
The text was updated successfully, but these errors were encountered: