Difference between revisions of "PinePhone Pro/IMX258 Camera Debugging"

Jump to navigation Jump to search
(→‎Megi saves the day: Fix ffmpeg command for front camera example)
(explain better how one figures out what function is responsible for frame completion notification)
Line 121: Line 121:
=== If i2c works, what doesn't? ===
=== If i2c works, what doesn't? ===


Our program that asks for a video frame is still hung! We ask the camera to start streaming frames, it presumably does, but the v4l2 stack never tells us a frame has finished. Doing some digging in the v4l2 stack (and the rkisp1 driver), we find out that rkisp1 is notified about frame status via interrupts.
Our program that asks for a video frame is still hung! We ask the camera to start streaming frames, it presumably does, but the v4l2 stack never tells us a frame has finished. Doing some digging in the v4l2 stack (and the rkisp1 driver), we find out that rkisp1 is notified about frame status via interrupts. We figure this out by manually backtracking through the code to see when <code>vb2_buffer_done</code>, the function in the vb2 API to call when a frame is finished, would be called. In the rkisp1 code, <code>vb2_buffer_done</code> is only called from <code>rkisp1_handle_buffer</code> which is only called from <code>rkisp1_capture_isr</code>, which (for the PPP's rk3399 SoC) is only called from <code>rkisp1_isr</code>, which is an interrupt handler. We know that it's an interrupt handler from the name (<code>_isr</code>), but also because it gets passed (indirectly) to <code>devm_request_irq</code> by way of being the <code>.isr</code> field of <code>rk3399_isp_isrs</code>.


Perhaps the hardware is never actually emitting the interrupt that signals a frame being finished. Indeed, grepping our FTrace log shows that <code>rkisp1_isr</code> is never called. A quick look at <code>/proc/interrupts</code> shows that '''the only interrupt associated with the isp has never triggered''' (0 count on every CPU):
Perhaps the hardware is never actually emitting the interrupt that signals a frame being finished. Indeed, grepping our FTrace log shows that <code>rkisp1_isr</code> is never called. A quick look at <code>/proc/interrupts</code> shows that '''the only interrupt associated with the isp has never triggered''' (0 count on every CPU):