redroid-doc icon indicating copy to clipboard operation
redroid-doc copied to clipboard

add emulator camera support on redroid-11

Open llzz9595 opened this issue 4 years ago • 10 comments

我添加了goldfish相关模块如下,但我发现android11 goldfish camera模块上不会生成camera.goldfish.so,camera依然无法起效。

PRODUCT_SOONG_NAMESPACES += external/mesa3d device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl
PRODUCT_PACKAGES += \
    hwcomposer.redroid \
    gralloc.gbm \
    gralloc.redroid \
    libEGL_angle \
    libGLESv1_CM_angle \
    libGLESv2_angle \
    vulkan.pastel \
    libGLES_mesa \
    vulkan.radv \
    ipconfigstore \
    camera.goldfish \
    camera.goldfish.jpeg \
    camera.ranchu \
    camera.ranchu.jpeg \
PRODUCT_PROPERTY_OVERRIDES += \
    ro.kernel.qemu=1 \
    ro.hardware=redroid \
    ro.sf.lcd_density=320 \
    persist.sys.fuse=1 \

# Phone App required
PRODUCT_PACKAGES += \
    rild

# WiFi required by SystemUI
PRODUCT_PACKAGES += \
    [email protected]

PRODUCT_COPY_FILES += \
    frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \


# required HIDL
PRODUCT_PACKAGES += \
    audio.r_submix.default \
    android.hardware.audio.service \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \

PRODUCT_COPY_FILES += \
    device/generic/goldfish/camera/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
    device/generic/goldfish/camera/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_telephony.xml \
    frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
    frameworks/av/media/libeffects/data/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml \
    device/generic/goldfish/audio/policy/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
    device/generic/goldfish/audio/policy/primary_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/primary_audio_policy_configuration.xml \
    frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
    frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
    frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
    frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \
    $(LOCAL_PATH)/gpu_config.sh:$(TARGET_COPY_OUT_VENDOR)/bin/gpu_config.sh \
    $(LOCAL_PATH)/init.redroid.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.redroid.rc \
    frameworks/native/data/etc/android.hardware.camera.ar.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.ar.xml \
    frameworks/native/data/etc/android.hardware.camera.autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.autofocus.xml \
    frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
    device/generic/goldfish/camera/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
    device/generic/goldfish/camera/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \

docker容器报错: Could not get passthrough implementation for [email protected]::ICameraProvider/legacy/0.

llzz9595 avatar Oct 25 '21 09:10 llzz9595

try to set ro.hardware.camera=goldfish or ro.hardware.camera=ranchu

zhouziyang avatar Oct 25 '21 09:10 zhouziyang

camera is running! cameraserver 64 1 0 09:30:52 136:0 00:00:00 [email protected] cameraserver 234 1 0 09:30:54 136:0 00:00:00 cameraserver u0_a118 9007 232 1 09:54:00 136:0 00:00:00 com.android.example.camera2.basic

but the docker has some error like this : 10-25 09:51:12.551 734 1205 E AHardwareBuffer: GraphicBuffer(w=4, h=4, lc=1) failed (Out of memory), handle=0x0

camera still not working

llzz9595 avatar Oct 25 '21 09:10 llzz9595

personally, I tested on redroid-9, but redroid-11 should work out of the box. I will look into this soon. you may try some running under software rendering docker run ... redroid.gpu.mode=guest

zhouziyang avatar Oct 25 '21 10:10 zhouziyang

10-25 11:04:53.930 1833 1833 V CAM_CameraController: Closing camera 10-25 11:04:53.931 1833 1862 W CAM2PORT_AndCamAgntImp: Releasing camera without any camera opened. 10-25 11:04:53.932 1833 1833 W CAM_Camera2OneCamMgr: No back-facing camera found. 10-25 11:04:53.932 1833 1833 W CAM_Camera2OneCamMgr: No external camera found. 10-25 11:04:53.932 1833 1833 W CAM_Camera2OneCamMgr: No front-facing camera found. 10-25 11:04:53.932 1833 1833 W CAM_Camera2OneCamMgr: No external camera found.

llzz9595 avatar Oct 25 '21 11:10 llzz9595

personally, I tested on redroid-9, but redroid-11 should work out of the box. I will look into this soon. you may try some running under software rendering docker run ... redroid.gpu.mode=guest

It ran some error like this when i opened camera:

W ServiceManager: Permission failure: android.permission.SYSTEM_CAMERA from uid=10119 pid=23846

llzz9595 avatar Oct 26 '21 10:10 llzz9595

Work?

y-shevchenko avatar Nov 01 '21 06:11 y-shevchenko

for goldfish / ranchu emulator camera, need create a camera service to feed metadata / video stream; and change qemupipe to some other IPC mechanism (socket etc,)

zhouziyang avatar Nov 04 '21 06:11 zhouziyang

Is there an easy way to connect camera emulator to v4l2 (/dev/video0)? As I understand goldfish is an emulator and included in redroid-11, right?

vanokh avatar Dec 27 '21 14:12 vanokh

redroid is a totally different solution compared with goldfish emulator. redroid is a pure container solution, and can access all devices in Host directly. Well, Camera is not emulated in redroid, but feasible. The goldfish camera Hal and v4l2 Hal in AOSP codebase are good samples.

Sent from my iPhone

On Dec 27, 2021, at 11:22 PM, vanokh @.***> wrote:



Is there an easy way to connect camera emulator to v4l2 (/dev/video0)? As I understand goldfish is an emulator and included in redroid-11, right?

— Reply to this email directly, view it on GitHubhttps://github.com/remote-android/redroid-doc/issues/52#issuecomment-1001597839, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAP5VMSHUJAWLBAGPOMOYBLUTB2XDANCNFSM5GUYRQPQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were assigned.Message ID: @.***>

zhouziyang avatar Dec 27 '21 15:12 zhouziyang

personally, I tested on redroid-9, but redroid-11 should work out of the box. I will look into this soon. you may try some running under software rendering docker run ... redroid.gpu.mode=guest

It ran some error like this when i opened camera:

W ServiceManager: Permission failure: android.permission.SYSTEM_CAMERA from uid=10119 pid=23846

@llzz9595 did you resolved this error? i'm facing the same thing

ArtBreguez avatar Jun 24 '22 18:06 ArtBreguez