rockchip-linux / mpp

Media Process Platform (MPP) module
531 stars 161 forks source link

How to request stride alignment when decoding #507

Open hbiyik opened 8 months ago

hbiyik commented 8 months ago

When drm prime frames are imported with EGL, mesa expects 64 byte aligned frames, if not EGL does not import.

I am working around it by processing the decoded frames with RGA to 64 byte aligned strides but thats kind of non optimal.

Instead, is it possible to request from mpp a custom (ie: 64) byte alignment of strides when decoding?

Reference: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19620

kyak commented 6 months ago

It would be great to hear from develovers on this issue.

HermanChen commented 6 months ago

Yes, 64 align is ok for mpp. But for some resolution like 4096 width the hardware performance is lower then expected. So we use 256 odd align to keep the performace. Need a global option?

HermanChen commented 6 months ago

Yes, 64 align is ok for mpp. But for some resolution like 4096 width the hardware performance is lower then expected. So we use 256 odd align to keep the performace. Need a global option?

hbiyik commented 6 months ago

256 align is also fine, the problem is when it is not 64 aligned, ie 16 or 32. So may be instead of requesting alignment, it is also feasible to bump the minimum alignment to 64.

Just like @nyanmisaka s patch for h264 and av1, but for all decoders.

https://github.com/nyanmisaka/ffmpeg-rockchip/issues/39#issuecomment-2000446151

hbiyik commented 6 months ago

Because not for vallhall but for <v10 mali gpus, 64 is the minium alignment requirement to import to gpu

nyanmisaka commented 6 months ago

Yes, 64 align is ok for mpp. But for some resolution like 4096 width the hardware performance is lower then expected. So we use 256 odd align to keep the performace. Need a global option?

Yes. We need an option to override the MPP built-in hal_hor_align() func. 256 odd multiple alignment already ensures that it is 64-aligned, so VP9 and HEVC are not affected by this problem. But codecs such as H264, AV1 and MPEG1/2/4 require this.

Not only does Mali GPU require 64-aligned when importing textures through EGL, but also using RGA3 (RK3588) only supports 64-aligned for 10-bit formats such as NV15 and NV20. (decoder/nv15 -> rga3 -> nv12 -> encoder)