With OMX it was pretty simple: Create a dispmanx layer, create a video_render and point that to this layer. The layer could then be dynamically placed on displays, different layers and the alpha/rotation/source/dest/etc could be updated.
With DRM it seems I now have to create a DRM backed FB object (using drmModeAddFB2), feed that into the ril component. Once that produces a new output video frame I then use drmModeSetPlane to place that. I'm not sure how that then decides which dispmanx layer gets used. I observe that calling drmModeSetPlane the first time creates a new dispmanx layer on layer 1. Is there any way to change which layer is used using DRM? Maybe using DRM properties but haven't been able to find any documentation on how that's supposed to work from userland.
Similarly I'm not sure how rotating a video works now. This code seems to use the MMAL_DISPLAYREGION_T parameter for that (which looks familar to how OMX worked), but I'm not sure if that's the correct approach and that doesn't seem DRM related at all as I then have to feed the decoded MMAL buffers into video_render instead. So how can I rotate videos, set their alpha and other properties?
How is screen tearing prevented if I use drmModeSetPlane? Or is that deferred until a drmModePageFlip is issued and thus magically solved?
It seems there is only a limited number of DRM planes available. So I have to be careful mapping multiple MMAL pipelines to one plane each. Is that correct? Previously I think I could create any number of dispmanx layers until the GPU melted. Now it seems there are 6 planes in total. Or is there a way to raise this limit?
I've tried to run two videos, got two different planes and now the second plane is on the secondary display for some reason despite specifying the same CRTC id in the two drmModeSetPlane calls. See the following output:
Code: Select all
root@raspberrypi:~# vcgencmd dispmanx_list display:2 format:ARGB8888 transform:0 layer:-127 1920x1080 src:0,0,1920,1080 dst:0,0,1920,1080 cost:1156 lbm:0 display:2 format:YUV420 transform:0 layer:1 640x360 src:0,0,640,360 dst:0,0,960,540 cost:713 lbm:10240 display:7 format:XRGB8888 transform:0 layer:-127 1920x1080 src:0,0,1920,1080 dst:0,0,1920,1080 cost:1156 lbm:0 display:7 format:YUV420 transform:0 layer:2 640x360 src:0,0,640,360 dst:960,540,960,540 cost:713 lbm:10240 root@raspberrypi:~# cat /sys/kernel/debug/dri/1/state # slightly cut for brevity plane: plane-1 crtc=crtc-0 fb=117 allocated by = ib-thpool refcount=2 format=YU12 little-endian (0x32315559) modifier=0x0 size=640x360 ... crtc-pos=960x540+0+0 src-pos=640.000000x360.000000+0.000000+0.000000 rotation=1 normalized-zpos=1 color-encoding=ITU-R BT.601 YCbCr color-range=YCbCr limited range <snip> plane: plane-4 crtc=crtc-0 fb=125 allocated by = ib-thpool refcount=2 format=YU12 little-endian (0x32315559) modifier=0x0 size=640x360 ... crtc-pos=960x540+960+540 src-pos=640.000000x360.000000+0.000000+0.000000 rotation=1 normalized-zpos=2 color-encoding=ITU-R BT.601 YCbCr color-range=YCbCr limited range