Hi, everyone.
I am developing an OS based on Raspberry PI.
Now I am writing a payload part to it, where OS communicates with VC to get the camera working.
I have implemented VCHIQ, and in general MMAL requests.
I have read some amount of info available on MMAL / Camera, like this for example:
https://picamera.readthedocs.io/en/rele ... a-hardware
https://picamera.readthedocs.io/en/rele ... -mmal-tour
Also I am looking at RaspiVid code and heavily trying to copy it.
https://github.com/raspberrypi/userland.git
And finally I am looking at
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
Lot's of info.
I have found combination of actions and MMAL API calls to get the camera working without connecting it anywhere.
Like I can read out raw pixels from all 3 camera ports - preview, video and still.
However the more complex chaining of "nodes" with connections still quite hard to grasp and this just does not work.
I could have copied the whole raspi vid examle, but its huge and of course there might be errors in my coping. Besides to understand how to work with this I first tried the basics:
Example:
I want to use "ril.camera" and "ril.video_splitter"
1. For "ril.camera" I configure "video" port to format 320x240 OPAQUE Y420.
2. For "ril.video_splitter" I :
2.1 configure "input port" by copying "video" port format
2.2 configure "output port 0" by copying "video" port format, then reconfigure to 320x240 RGB24 zero_copy
2.3 configure "output port 1" by copying "video" port format
3. Then I "connect" video port to splitter input port - for this step I only make sure that formats returned by PORT_INFO_GET are more or less the same for both connection ends
4. Then I provide buffers to splitter "output port 0" according to recommended/minimal buffer info in results of mmal request PORT_INFO_GET for this port
5. Then I enable ONLY the splitter's "output port 0" and expect to see buffer callbacks from VC.
This does not work and I need some help to firgure out why.
Some of the issue that I observed in the process:
- In some cases for splitter output port, configured as zero copy RGB24 after setting configuration and receiving back PORT_INFO_GET - i see recommented buffers number set to 0, while minimum number is 1 and in both cases bytesize is ok for 320x240x24. So for allocating the buffers I use min(recommended.num, minimum.num). But 0 looks like some error state right?
- Always I see that after I have set the proper format - PORT_INFO_GET shows that port already uses 1 buffer of proper length? How is that possible? I did not provide anything yet.
- For the connection part I also tried providing buffers to video and input ports. It's someting like 10x128 buffers. But after PORT_INFO_GET input port still shows that it uses 1. And looks like I can not provide those buffers to videoport because later I receive 10 errors with code 3 in event_to_host_cb.
- In any case I can not enable video port, when it is connected to input port, only the output port of a splitter , the other output port of a splitter is left unconnected to any buffers or callbacks and has default OPAQUE format.
Please advise on that.
I am developing an OS based on Raspberry PI.
Now I am writing a payload part to it, where OS communicates with VC to get the camera working.
I have implemented VCHIQ, and in general MMAL requests.
I have read some amount of info available on MMAL / Camera, like this for example:
https://picamera.readthedocs.io/en/rele ... a-hardware
https://picamera.readthedocs.io/en/rele ... -mmal-tour
Also I am looking at RaspiVid code and heavily trying to copy it.
https://github.com/raspberrypi/userland.git
And finally I am looking at
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
Lot's of info.
I have found combination of actions and MMAL API calls to get the camera working without connecting it anywhere.
Like I can read out raw pixels from all 3 camera ports - preview, video and still.
However the more complex chaining of "nodes" with connections still quite hard to grasp and this just does not work.
I could have copied the whole raspi vid examle, but its huge and of course there might be errors in my coping. Besides to understand how to work with this I first tried the basics:
Example:
I want to use "ril.camera" and "ril.video_splitter"
1. For "ril.camera" I configure "video" port to format 320x240 OPAQUE Y420.
2. For "ril.video_splitter" I :
2.1 configure "input port" by copying "video" port format
2.2 configure "output port 0" by copying "video" port format, then reconfigure to 320x240 RGB24 zero_copy
2.3 configure "output port 1" by copying "video" port format
3. Then I "connect" video port to splitter input port - for this step I only make sure that formats returned by PORT_INFO_GET are more or less the same for both connection ends
4. Then I provide buffers to splitter "output port 0" according to recommended/minimal buffer info in results of mmal request PORT_INFO_GET for this port
5. Then I enable ONLY the splitter's "output port 0" and expect to see buffer callbacks from VC.
This does not work and I need some help to firgure out why.
Some of the issue that I observed in the process:
- In some cases for splitter output port, configured as zero copy RGB24 after setting configuration and receiving back PORT_INFO_GET - i see recommented buffers number set to 0, while minimum number is 1 and in both cases bytesize is ok for 320x240x24. So for allocating the buffers I use min(recommended.num, minimum.num). But 0 looks like some error state right?
- Always I see that after I have set the proper format - PORT_INFO_GET shows that port already uses 1 buffer of proper length? How is that possible? I did not provide anything yet.
- For the connection part I also tried providing buffers to video and input ports. It's someting like 10x128 buffers. But after PORT_INFO_GET input port still shows that it uses 1. And looks like I can not provide those buffers to videoport because later I receive 10 errors with code 3 in event_to_host_cb.
- In any case I can not enable video port, when it is connected to input port, only the output port of a splitter , the other output port of a splitter is left unconnected to any buffers or callbacks and has default OPAQUE format.
Please advise on that.
Statistics: Posted by valc — Wed May 01, 2024 5:36 am — Replies 0 — Views 6