application:
Approximate process: open, create session, send request, get captureresult
CameraManager, get system service CameraService, open camera:
1) openCamera: Open the camera
to obtain camera information: ICameraService.getCameraInfo
instantiates a CameraDeviceImpl
through the connectDevice method of ICameraService. The parameters include CameraDevice.StateCallback, which is passed into CameraService
to obtain ICameraDeviceUser. The proxy
application returns CameraDeviceImpl to the App through the callback, and the application side opens the camera The process is complete.
2) createCaptureSession: Create a Session
to configure the data stream through the configureStreamsChecked method and
instantiate a CameraCaptureImpl object
3) createCaptureRequest: Create a request
through the CreateDefaultRequest() method of ICameraDeviceUser to create a default CameraMetadataNative
and instantiate a CaptureRequest.Builder object
to pass cameraMetaDataNative into it
to complete the default Request creation
4) setRepeatingCapture: set to Repeating
CameraDeviceImpI object will contain CameraCaptureSession.CaptureCallback object
5) capture: send
the submitcaptureRequest of request ICameraDeviceUser
6) onCaptureProcessed: parse the results back and post-process
ICameraDeviceCallback's onResultReceived method to return the PartialMetaData data back to
CameraCaptureSession.CaptureCallback's onCaputreProgressed method back to the app
7) onCaptureCompleted: parse the results back and post-process
ICameraDeviceCallback's onResultReceived The method returns the MetaData data back to
the onCaputreProgressed method of CameraCaptureSession.CaptureCallback and returns it to the app.
8) onImageAvailable: At this point, the image data can be read out for processing.
The image data is cached through the BufferQueue method, and the queueBuffer method is used to enqueue the image cache and notify Consume in consumption.
The APP side can use the onImageAvailable method of ImageReader to notify ImageReader to read and process
CameraService
AIDL:
ICameraService: Mainly realized through CameraService, open Camera device, obtain the number of cameras supported by the system, add flash monitoring ,
etc.
Mainly for camera device operations, switch devices, send requests, stream distribution, etc.
ICameraDeviceCallback: implemented by CameraDeviceCallback, mainly provides callbacks for Metadata and imagedata, and error notifications, etc.
CameraService:
mCameraProviderManager《-ProviderInfo《-DeviceInfo3
CameraDeviceClient:
mDevice<-Camera3Device<-RequestThread
mFrameProcessor<-frameProcessorBase
CameraService start:
main_cameraserver start: instantiate method to instantiate,
enumerate ProviderManger
new object and initialize
Initialization includes: getService to obtain ICameraProvider agent; instantiate ProviderInfo object and initialize it, add container to manage
ProviderInfo initialization: save ICameraProvider variable, realize ICameraProviderCallback interface and so on, mainly to
obtain ICameraDevice through ICameraProvider, and then instantiate CameraInfo3 object
so that CameraService can manage all CameraProvider and CameraDevice
CameraService is a system service that starts when the system starts. After startup, it will wait for the relevant requests of the APP to be processed. The processing process is to interact with the application process.
Including: get camera properties, open camera, configure data flow, process image request, receive image result
Camera HAL:
HIDL: It mainly provides some interfaces used by CameraService, and the Camerahal framework is responsible for implementing these interfaces.
ICameraProvider and related Callback
ICameraDevice and related Callback
ICameraDeviceSession
Implementation of HAL:
Qcom and Rockchip implement the
framework of ComX-CHI
Main directory structure:
CamX:
core: the core implementation module contains the hal directory inside, realizes the hal3 interface, and chi is responsible for interacting with CHI
csl: responsible for CamX and driver communication module
hwl : a node with independent computing power, managed by csl
swl: a node that needs to rely on cpu to achieve
CHI-cdk:
chioveride: Implementation of CHI. Responsible for interacting with CamX and implementing CHI’s overall framework and business logic
bin: platform-related configuration
actuator: focus module
ois
flash:
eeprom: external storage
fd
topology: usecase
node: node
module for user-defined functions: configuration files for different sensors
tunnig:
sensor: sensor's private information and register configuration
Realize user scenario requirements.
usecase-"feature -"session -"pipeline -"Node (port, link, sink)
Features include: HDR, CFA, JPEG, ASD, ZSL, MFNR, SuperNight, MultiFrame, MFSR, etc.
The startup process of Camx-Chi:
HwEnvironment
CSLModeManager
SettingsManager
Open com.qti.chi.override.so
dlsym or chi_hal_override_entry through dlopen and enter the entry.