xref: /aosp_15_r20/hardware/interfaces/camera/provider/2.6/ICameraProvider.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2020 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport @2.5::ICameraProvider;
20*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::Status;
21*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::StreamConfiguration;
22*4d7e907cSAndroid Build Coastguard Worker
23*4d7e907cSAndroid Build Coastguard Worker/**
24*4d7e907cSAndroid Build Coastguard Worker * Camera provider HAL
25*4d7e907cSAndroid Build Coastguard Worker *
26*4d7e907cSAndroid Build Coastguard Worker * @2.6::adds support for the getConcurrentStreamingCameraIds() and
27*4d7e907cSAndroid Build Coastguard Worker * isConcurrentStreamCombinationSupported()
28*4d7e907cSAndroid Build Coastguard Worker * @2.6::ICameraProviderCallback to receive physical camera availability
29*4d7e907cSAndroid Build Coastguard Worker * callbacks for logical multi-cameras.
30*4d7e907cSAndroid Build Coastguard Worker */
31*4d7e907cSAndroid Build Coastguard Workerinterface ICameraProvider extends @2.5::ICameraProvider {
32*4d7e907cSAndroid Build Coastguard Worker    /**
33*4d7e907cSAndroid Build Coastguard Worker     * getConcurrentStreamingCameraIds
34*4d7e907cSAndroid Build Coastguard Worker     *
35*4d7e907cSAndroid Build Coastguard Worker     * Get a vector of combinations of camera device ids that are able to
36*4d7e907cSAndroid Build Coastguard Worker     * configure streams concurrently. Each camera device advertised in a
37*4d7e907cSAndroid Build Coastguard Worker     * combination MUST at the very least support the following streams while
38*4d7e907cSAndroid Build Coastguard Worker     * streaming concurrently with the other camera ids in the combination.
39*4d7e907cSAndroid Build Coastguard Worker     *
40*4d7e907cSAndroid Build Coastguard Worker     *       Target 1                  Target 2
41*4d7e907cSAndroid Build Coastguard Worker     * -----------------------------------------------------
42*4d7e907cSAndroid Build Coastguard Worker     * | Type         |   Size   |   Type       |   Size   |
43*4d7e907cSAndroid Build Coastguard Worker     * -----------------------------------------------------
44*4d7e907cSAndroid Build Coastguard Worker     * | YUV          |  s1440p  |                         |
45*4d7e907cSAndroid Build Coastguard Worker     * -----------------------------------------------------
46*4d7e907cSAndroid Build Coastguard Worker     * | JPEG         |  s1440p  |                         |
47*4d7e907cSAndroid Build Coastguard Worker     * -----------------------------------------------------
48*4d7e907cSAndroid Build Coastguard Worker     * | PRIV         |  s1440p  |                         |
49*4d7e907cSAndroid Build Coastguard Worker     * -----------------------------------------------------
50*4d7e907cSAndroid Build Coastguard Worker     * | YUV / PRIV   |  s720p   |  YUV / PRIV   | s1440p  |
51*4d7e907cSAndroid Build Coastguard Worker     * -----------------------------------------------------
52*4d7e907cSAndroid Build Coastguard Worker     * | YUV / PRIV   |  s720p   |  JPEG         | s1440p  |
53*4d7e907cSAndroid Build Coastguard Worker     * -----------------------------------------------------
54*4d7e907cSAndroid Build Coastguard Worker     *
55*4d7e907cSAndroid Build Coastguard Worker     * where:
56*4d7e907cSAndroid Build Coastguard Worker     * s720p - min (max output resolution for the given format, 1280 X 720)
57*4d7e907cSAndroid Build Coastguard Worker     * s1440p - min (max output resolution for the given format, 1920 X 1440)
58*4d7e907cSAndroid Build Coastguard Worker     *
59*4d7e907cSAndroid Build Coastguard Worker     * If a device has MONOCHROME capability (device's capabilities include
60*4d7e907cSAndroid Build Coastguard Worker     * ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME) and therefore supports Y8
61*4d7e907cSAndroid Build Coastguard Worker     * outputs, stream combinations mentioned above, where YUV is substituted by
62*4d7e907cSAndroid Build Coastguard Worker     * Y8 must be also supported.
63*4d7e907cSAndroid Build Coastguard Worker     *
64*4d7e907cSAndroid Build Coastguard Worker     * Devices whose capabilities do not include
65*4d7e907cSAndroid Build Coastguard Worker     * ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE, must support
66*4d7e907cSAndroid Build Coastguard Worker     * at least a single Y16 stream, Dataspace::DEPTH with sVGA resolution,
67*4d7e907cSAndroid Build Coastguard Worker     * during concurrent operation.
68*4d7e907cSAndroid Build Coastguard Worker     * Where sVGA -  min (max output resolution for the given format, 640 X 480)
69*4d7e907cSAndroid Build Coastguard Worker     *
70*4d7e907cSAndroid Build Coastguard Worker     * The camera framework must call this method whenever it gets a
71*4d7e907cSAndroid Build Coastguard Worker     * cameraDeviceStatusChange callback adding a new camera device or removing
72*4d7e907cSAndroid Build Coastguard Worker     * a camera device known to it. This is so that the camera framework can get new combinations
73*4d7e907cSAndroid Build Coastguard Worker     * of camera ids that can stream concurrently, that might have potentially appeared.
74*4d7e907cSAndroid Build Coastguard Worker     *
75*4d7e907cSAndroid Build Coastguard Worker     * For each combination (and their subsets) of camera device ids returned by
76*4d7e907cSAndroid Build Coastguard Worker     * getConcurrentStreamingCameraIds(): If only the mandatory combinations can
77*4d7e907cSAndroid Build Coastguard Worker     * be supported concurrently by each device, then the resource costs must
78*4d7e907cSAndroid Build Coastguard Worker     * sum up to > 100 for the concurrent set, to ensure arbitration between
79*4d7e907cSAndroid Build Coastguard Worker     * camera applications work as expected. Only if resources are sufficient
80*4d7e907cSAndroid Build Coastguard Worker     * to run a set of cameras at full capability (maximally
81*4d7e907cSAndroid Build Coastguard Worker     * resource-consuming framerate and stream size settings available in the
82*4d7e907cSAndroid Build Coastguard Worker     * configuration settings exposed through camera metadata), should the sum
83*4d7e907cSAndroid Build Coastguard Worker     * of resource costs for the combination be <= 100.
84*4d7e907cSAndroid Build Coastguard Worker     *
85*4d7e907cSAndroid Build Coastguard Worker     * For guaranteed concurrent camera operation, the camera framework must call
86*4d7e907cSAndroid Build Coastguard Worker     * ICameraDevice.open() on all devices (intended for concurrent operation), before configuring
87*4d7e907cSAndroid Build Coastguard Worker     * any streams on them. This gives the camera HAL process an opportunity to potentially
88*4d7e907cSAndroid Build Coastguard Worker     * distribute hardware resources better before stream configuration.
89*4d7e907cSAndroid Build Coastguard Worker     *
90*4d7e907cSAndroid Build Coastguard Worker     * Due to potential hardware constraints around internal switching of physical camera devices,
91*4d7e907cSAndroid Build Coastguard Worker     * a device's complete ZOOM_RATIO_RANGE(if supported), may not apply during concurrent
92*4d7e907cSAndroid Build Coastguard Worker     * operation. If ZOOM_RATIO is supported, camera HALs must ensure ZOOM_RATIO_RANGE of
93*4d7e907cSAndroid Build Coastguard Worker     * [1.0, ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM] is supported by that device, during
94*4d7e907cSAndroid Build Coastguard Worker     * concurrent operation.
95*4d7e907cSAndroid Build Coastguard Worker     *
96*4d7e907cSAndroid Build Coastguard Worker     * @return status Status code for the operation
97*4d7e907cSAndroid Build Coastguard Worker     * @return cameraIds a list of camera id combinations that support
98*4d7e907cSAndroid Build Coastguard Worker     *         concurrent stream configurations with the minimum guarantees
99*4d7e907cSAndroid Build Coastguard Worker     *         specified.
100*4d7e907cSAndroid Build Coastguard Worker     */
101*4d7e907cSAndroid Build Coastguard Worker    getConcurrentStreamingCameraIds() generates (Status status, vec<vec<string>> cameraIds);
102*4d7e907cSAndroid Build Coastguard Worker
103*4d7e907cSAndroid Build Coastguard Worker    /**
104*4d7e907cSAndroid Build Coastguard Worker     * isConcurrentStreamCombinationSupported:
105*4d7e907cSAndroid Build Coastguard Worker     *
106*4d7e907cSAndroid Build Coastguard Worker     * Check for device support of specific camera stream combinations while
107*4d7e907cSAndroid Build Coastguard Worker     * streaming concurrently with other devices.
108*4d7e907cSAndroid Build Coastguard Worker     *
109*4d7e907cSAndroid Build Coastguard Worker     * The per device streamList must contain at least one output-capable stream, and may
110*4d7e907cSAndroid Build Coastguard Worker     * not contain more than one input-capable stream.
111*4d7e907cSAndroid Build Coastguard Worker     * In contrast to regular stream configuration the framework does not create
112*4d7e907cSAndroid Build Coastguard Worker     * or initialize any actual streams. This means that Hal must not use or
113*4d7e907cSAndroid Build Coastguard Worker     * consider the stream "id" value.
114*4d7e907cSAndroid Build Coastguard Worker     *
115*4d7e907cSAndroid Build Coastguard Worker     * ------------------------------------------------------------------------
116*4d7e907cSAndroid Build Coastguard Worker     *
117*4d7e907cSAndroid Build Coastguard Worker     * Preconditions:
118*4d7e907cSAndroid Build Coastguard Worker     *
119*4d7e907cSAndroid Build Coastguard Worker     * The framework can call this method at any time before, during and
120*4d7e907cSAndroid Build Coastguard Worker     * after active session configuration per device. This means that calls must not
121*4d7e907cSAndroid Build Coastguard Worker     * impact the performance of pending camera requests in any way. In
122*4d7e907cSAndroid Build Coastguard Worker     * particular there must not be any glitches or delays during normal
123*4d7e907cSAndroid Build Coastguard Worker     * camera streaming.
124*4d7e907cSAndroid Build Coastguard Worker     *
125*4d7e907cSAndroid Build Coastguard Worker     * The framework must not call this method with any combination of camera
126*4d7e907cSAndroid Build Coastguard Worker     * ids that is not a subset of the camera ids advertised by getConcurrentStreamingCameraIds of
127*4d7e907cSAndroid Build Coastguard Worker     * the same provider.
128*4d7e907cSAndroid Build Coastguard Worker     *
129*4d7e907cSAndroid Build Coastguard Worker     * Performance requirements:
130*4d7e907cSAndroid Build Coastguard Worker     * This call is expected to be significantly faster than stream
131*4d7e907cSAndroid Build Coastguard Worker     * configuration. In general HW and SW camera settings must not be
132*4d7e907cSAndroid Build Coastguard Worker     * changed and there must not be a user-visible impact on camera performance.
133*4d7e907cSAndroid Build Coastguard Worker     *
134*4d7e907cSAndroid Build Coastguard Worker     * @param configs a vector of camera ids and their corresponding stream
135*4d7e907cSAndroid Build Coastguard Worker     *                configurations that need to be queried for support.
136*4d7e907cSAndroid Build Coastguard Worker     *
137*4d7e907cSAndroid Build Coastguard Worker     * @return status Status code for the operation, one of:
138*4d7e907cSAndroid Build Coastguard Worker     *     OK:
139*4d7e907cSAndroid Build Coastguard Worker     *          On successful stream combination query.
140*4d7e907cSAndroid Build Coastguard Worker     *     METHOD_NOT_SUPPORTED:
141*4d7e907cSAndroid Build Coastguard Worker     *          The camera provider does not support stream combination query.
142*4d7e907cSAndroid Build Coastguard Worker     *     INTERNAL_ERROR:
143*4d7e907cSAndroid Build Coastguard Worker     *          The stream combination query cannot complete due to internal
144*4d7e907cSAndroid Build Coastguard Worker     *          error.
145*4d7e907cSAndroid Build Coastguard Worker     * @return true in case the stream combination is supported, false otherwise.
146*4d7e907cSAndroid Build Coastguard Worker     *
147*4d7e907cSAndroid Build Coastguard Worker     *
148*4d7e907cSAndroid Build Coastguard Worker     */
149*4d7e907cSAndroid Build Coastguard Worker    isConcurrentStreamCombinationSupported(vec<CameraIdAndStreamCombination> configs)
150*4d7e907cSAndroid Build Coastguard Worker        generates (Status status, bool queryStatus);
151*4d7e907cSAndroid Build Coastguard Worker};
152