Project

General

Profile

[i9100][Replicant 4.2] Allowing video recording with Wolfgang's patch

Added by Grim Kriegor over 7 years ago

Gentlemen, hello!
First of, allow me to thank the developers and the community for maintaining such a fundamental project afloat and to wish best of luck for the future. A fully free mobile system should be one of the most important free software projects at this time, and for that it should have all the support and manpower it requires.

I'm in the process of getting rid of my ugly Qualcomm powered pocket spy backstabber, replacing it with one or two i9100 devices running Replicant. However one of the features I cannot part with is video recording.
I am somewhat aware of the dangers of tainting the system with even more non-free blobs and considering the possibility of dedicating one of the devices to video recording alone, limiting any possible compromises.
While it pains me to ask you for help regarding proprietary poison, I figured this is the best place to get some guidance regarding the task at hand.

Last month I came across a chain of emails called "[Replicant] [PATCH] make video recording working again" which included a few diffs which did enable a few encoders and decoders, between other things, allowing for video recording.
http://lists.osuosl.org/pipermail/replicant/Week-of-Mon-20151207/000904.html

I've applied the changes to "replicant-4.2/device/samsung/galaxys2-common/{BoardCommonConfig.mk,common.mk,configs/media_profiles.xml}", rebuilt Replicant and installed it. I was still unable to record, even though the logs seemed to show the software was calling one of the encoders enabled by the patch.
http://pastebin.com/PAyQYrzE

Figuring the system was still missing something, I tried installing MFC_FW.BIN the hardware media encoding/decoding firmware which produced a different kind of error while recording. The video file was created, the timer of the camera was counting, but no video was being generated and the preview was stuck in the last image the camera captured before starting recording. The logs show "Timed out waiting for incoming camera video frames" and the video produced was always a 40byte .mp4 file.
http://pastebin.com/D2tn5eSb

Surely I must have missed something, maybe some userspace component, or maybe I'm using an improper patch or applying it to the wrong files.
Thought it would be a good idea to request your knowledge before starting to taint the system with unnecessary non-free blobs.
Thank you for your time, and keep up the awesome work. :)

PS: Video recording was tested with both the stock camera software and OpenCamera. The logs pertain to the stock camera software.


Replies (3)

RE: [i9100][Replicant 4.2] Allowing video recording with Wolfgang's patch - Added by Grim Kriegor over 7 years ago

Quick update.

I was using the proprietary CM camera drivers, Dllud suggested trying the patch with MFC_FW.BIN and that did the trick, at least for the stock camera software, OpenCamera however gets stuck in the last image the camera captured before starting recording and while attempting to stop the recording it hangs and holds the camera hardware until reboot.
Also, without those camera drivers scanning QR codes is impossible, what a pickle :D.

Thank you for your time, any feedback or sharing of experiences is welcome.

RE: [i9100][Replicant 4.2] Allowing video recording with Wolfgang's patch - Added by Grim Kriegor over 7 years ago

Did some testing, thought it would be a good idea to share the results here.

                            | Stock Camera Photo | Stock Camera Video | OpenCamera photo | OpenCamera Video | Barcode Scanner  | OBSqr  
------------------------------------------------------------------------------------------------------------------------------------
Replicant                              ✔                Nothing               ✔           Failed to record      Fireflies      Nothing 
Replicant + Proprietary Blobs          ✔                Nothing               ✔           Failed to record          ✔             ✔    
Replicant Patched                      ✔                Nothing               ✔           Failed to record      Fireflies      Nothing 
^ + MFC Firmware                       ✔                   ✔                  ✔                Hangs            Fireflies      Nothing 
^ + EGL, Mali and Gralloc              ✔                   ✔                  ✔                Hangs            Fireflies      Nothing 
^ + Camera drivers                     ✔                 Hangs                ✔                Hangs                ✔             ✔    

The first row refers to a clean Replicant 4.2 built from source, similar to the one available for download.

Replicant + Proprietary Blobs include all these drivers:

system
├── cameradata
│   ├── datapattern_420sp.yuv
│   └── datapattern_front_420sp.yuv
└── lib
    ├── egl
    │   ├── egl.cfg
    │   ├── egl.cfg.old
    │   ├── libEGL_mali.so
    │   ├── libGLESv1_CM_mali.so
    │   └── libGLESv2_mali.so
    ├── hw
    │   ├── camera.smdk4210.so
    │   ├── gps.exynos4.so
    │   └── gralloc.exynos4.so
    ├── libMali.so
    ├── libsecril-client.so
    └── libUMP.so

and firmware:

vendor
└── firmware
    ├── bcm4330B1.hcd
    ├── bcm4330B1_murata.hcd
    ├── bcm4330B1_semcosh.hcd
    ├── bcmdhd_apsta.bin
    ├── bcmdhd.cal
    ├── bcmdhd_mfg.bin
    ├── bcmdhd_p2p.bin
    ├── bcmdhd_sta.bin
    ├── mfc_fw.bin
    ├── nvram_mfg.txt
    ├── nvram_mfg.txt_murata
    ├── nvram_net.txt
    └── nvram_net.txt_murata

Replicant Patched is Replicant 4.2 with Wolfgang's patch (linked above).

And the entries bellow are incremental driver and firmware additions to that patched version.

Successful video recording was first observed when adding the MFC Firmware to Replicant Patched, but that makes scanning QR codes impossible.

Thank you for your time, I know this isn't a critical issue, but its something I must pursue, even if blindly, to be able to fully ditch the other evil device.

PS: Fireflies means the software lights up all over the screen, as if sensing a QR code that never "materializes"

RE: [i9100][Replicant 4.2] Allowing video recording with Wolfgang's patch - Added by Grim Kriegor over 7 years ago

Good evening gentlemen.

To conclude this saga, id like to leave here the solution I found, for reference in case some of you are attempting the same.

In order to get the QR scanner to work, I just had to change the camera preview from rgb565 to yuv420sp. Unfortunately this change creates a dependency for non-free drivers, such as EGL, Gralloc and Mali.

diff --git a/camera/smdk4210_camera.c b/camera/smdk4210_camera.c
index 052371c..2b30bc7 100644
--- a/camera/smdk4210_camera.c
+++ b/camera/smdk4210_camera.c
@@ -61,7 +61,7 @@ struct smdk4210_camera_preset smdk4210_camera_presets_galaxys2[] = {
             .preview_size_values = "800x480,720x480,640x480,320x240,176x144",
             .preview_size = "640x480",
             .preview_format_values = "yuv420sp,yuv420p,rgb565",
-            .preview_format = "rgb565",
+            .preview_format = "yuv420sp",
             .preview_frame_rate_values = "30,25,20,15,10,7",
             .preview_frame_rate = 30,
             .preview_fps_range_values = "(7000,30000)",
@@ -130,7 +130,7 @@ struct smdk4210_camera_preset smdk4210_camera_presets_galaxys2[] = {
             .preview_size_values = "640x480,352x288,320x240,176x144",
             .preview_size = "640x480",
             .preview_format_values = "yuv420sp,yuv420p,rgb565",
-            .preview_format = "rgb565",
+            .preview_format = "yuv420sp",
             .preview_frame_rate_values = "30,25,20,15,10,7",
             .preview_frame_rate = 30,
             .preview_fps_range_values = "(7000,30000)",

Keep up the amazing work, and then again forgive me for posting about corrupting Replicant with non-free components.

    (1-3/3)