kaikeraut
Posts: 30
Joined: Tue Apr 29, 2014 8:18 am

Raspberry pi Gingerbread Camera HAL implementation

Wed Jul 30, 2014 11:24 am

Hi
I am trying to implement own Camera HAL for the Raspberry Pi,
some what i progressed but stucked now. here is the progress details.

- Implemented HAL layer to communicate with cameraService and build libcamera.so
- In HAL function used MMAL function directly to use the camera.

->>> StartPreview function code snippet
* Created camera component (took help from RaspiStill.c).
-- created MMAL_COMPONENT_DEFAULT_CAMERA component
-- set format for output[0] port
-- created a pool and queue
-- enabled preview port with callback
-- camera component enable
* get buffer from pool
* sending the buffer got from above step to preview port

>> Then getting the buffer from the preview queue which is actually put by the preview call back function.
>> In Preview callback function mmal_queue_put(preview_queue, buffer)


Now here problem is that, preview callback function is not getting called.
I don't know what else i missed. help required..
Thanks

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7135
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspberry pi Gingerbread Camera HAL implementation

Wed Jul 30, 2014 4:46 pm

- Enable MMAL logging by rebuilding userland repo having edited interface/mmal/core/mmal_logging.c to set the log level to VCOS_LOG_TRACE.
- Add your own logging to confirm that you really are sending buffers to the GPU. If no buffers have been sent then none can be returned. From the code you sent me by private mail, your buffer handling thread looked dubious and had almost no logging in there.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

kaikeraut
Posts: 30
Joined: Tue Apr 29, 2014 8:18 am

Re: Raspberry pi Gingerbread Camera HAL implementation

Thu Jul 31, 2014 5:16 am

6by9 wrote:- Enable MMAL logging by rebuilding userland repo having edited interface/mmal/core/mmal_logging.c to set the log level to VCOS_LOG_TRACE.
- Add your own logging to confirm that you really are sending buffers to the GPU. If no buffers have been sent then none can be returned. From the code you sent me by private mail, your buffer handling thread looked dubious and had almost no logging in there.
How can i confirm that i am surely sending buffers to the GPU, what are the files in which i should put extra logs.
MMAL codes looks tough to go through, but still i am putting logs and trying to understand and get it done.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7135
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspberry pi Gingerbread Camera HAL implementation

Thu Jul 31, 2014 10:31 am

kaikeraut wrote:How can i confirm that i am surely sending buffers to the GPU, what are the files in which i should put extra logs.
MMAL codes looks tough to go through, but still i am putting logs and trying to understand and get it done.
Add logging to YOUR code either side of the mmal_port_buffer_send call, and I'd suggest you log the buffer pointer and return code too.
Your code looked so dodgy (spinning in a fairly tight loop) that I would not like to guarantee that it has called mmal_port_buffer_send. And check out semaphores so that your thread only runs when it needs to rather than spinning.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”