<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0mm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:11.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt'>Thank you for reply!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>This has been an ongoing discussion on libcamera email dev list.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>I have created a fork from the main libcamera repo and will start merging my changes and tests as I go.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><a href="https://github.com/RadicalES/libcamera">https://github.com/RadicalES/libcamera</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>As I feel this is the master repo and there are plenty of other floating versions, but merely sub repos.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Main issue is I don’t know how to compile and replace a running copy of the relevant libcamera .so’s, since system/vendor files get signed in Android OS during a build.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Change, rebuild, reflash and test takes like 5-10mins.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Some smaller code issues caused problems, but main problem was this: <a href="https://github.com/RadicalES/libcamera/blob/master/src/android/mm/generic_frame_buffer_allocator.cpp">https://github.com/RadicalES/libcamera/blob/master/src/android/mm/generic_frame_buffer_allocator.cpp</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Since I know nothing about libcamera, it was really tedious debugging to figure that out.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>I could not get hw_get_module to work under AOS 14.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>The hardwareModule pointer was always invalid.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>GRALLOC is not really the way to allocate graphics buffers under Android as I found out.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>And I moved to LibUI, which adds extra layers ontop of GRALLOC.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>This was really the main issue and fixed the problem right away.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>I had to update and add a few more header files to satisfy working with LibUI.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Next up was to get it to work properly, it kept calling into the stub function.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>And the trick was to add a Linker Flag to libui in the meson.build.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>The are other smaller problems, like contiguous buffers testing on different FDs and different planes, but these I simply hacked for now, as others did as well.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>My code merge started at: <a href="https://github.com/raspberry-vanilla/android_external_libcamera">https://github.com/raspberry-vanilla/android_external_libcamera</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Which gave a good working copy of the OS.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Then got some code from main libcamera repo.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>And more from <a href="https://gitlab.baylibre.com/baylibre/ti/android/aosp/external/libcamera">https://gitlab.baylibre.com/baylibre/ti/android/aosp/external/libcamera</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>And from yours <a href="https://github.com/raspberrypi/libcamera">https://github.com/raspberrypi/libcamera</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>And a lot of debugging output.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>I have added a few relevant debug traces to <a href="https://github.com/RadicalES/libcamera/tree/master/reports">https://github.com/RadicalES/libcamera/tree/master/reports</a> for documentational purposes.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Currently I’m on the last issue, <a href="https://github.com/RadicalES/libcamera/blob/master/reports/debug5_thread_issue.txt">https://github.com/RadicalES/libcamera/blob/master/reports/debug5_thread_issue.txt</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Which I have narrowed down to PostProcessorJpeg::process, and that is where I ended yesterday.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>So, the last hurdle seems to be a problem converting the buffer to a JPEG if I understand it correctly.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>I must still test and verify the code from my repo, as I did not really expect to get pulled in this deep into the code and changed were done in place.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>And working my way back to see what changes are really needed to fix the various problems.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Cheers<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'>Jan<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0mm 0mm 0mm 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0mm 0mm 0mm'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> naushir <notifications@github.com> <br><b>Sent:</b> Friday, June 14, 2024 10:12 AM<br><b>To:</b> raspberrypi/libcamera <libcamera@noreply.github.com><br><b>Cc:</b> Jan Zwiegers <jan@radicalsystems.co.za>; Author <author@noreply.github.com><br><b>Subject:</b> Re: [raspberrypi/libcamera] Android preview streaming and image capture does not work (Issue #144)<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p>Looking at the logs, it feels like there's possibly a permissions issue, maybe the user does not have access to /dev/media* or the gralloc allocator device nodes? I'm afraid I really can't help more as I know next to nothing about the Android system environment you are running under :(<o:p></o:p></p><p style='-webkit-text-size-adjust:none'><span style='color:#666666'>—<br>Reply to this email directly, </span><a href="https://github.com/raspberrypi/libcamera/issues/144#issuecomment-2167492122">view it on GitHub</a><span style='color:#666666'>, or </span><a href="https://github.com/notifications/unsubscribe-auth/ABQHOUBD6UB5EZ7OK75ICX3ZHKQTNAVCNFSM6AAAAABJD5QRBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRXGQ4TEMJSGI">unsubscribe</a><span style='color:#666666'>.<br>You are receiving this because you authored the thread.<span style='border:solid windowtext 1.0pt;padding:0mm'><img border=0 width=1 height=1 style='width:.0104in;height:.0104in' id="Picture_x0020_1" src="cid:~WRD0005.jpg" alt="Image removed by sender."></span></span><span style='font-size:1.0pt;color:#666666'>Message ID: <raspberrypi/libcamera/issues/144/2167492122@github.com></span><span style='color:#666666'><o:p></o:p></span></p></div></div></body></html>