xref: /aosp_15_r20/hardware/interfaces/camera/device/3.5/ICameraDeviceCallback.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2018 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 @3.2::StreamBuffer;
20*4d7e907cSAndroid Build Coastguard Workerimport @3.4::ICameraDeviceCallback;
21*4d7e907cSAndroid Build Coastguard Worker
22*4d7e907cSAndroid Build Coastguard Worker/**
23*4d7e907cSAndroid Build Coastguard Worker * Callback methods for the HAL to call into the framework.
24*4d7e907cSAndroid Build Coastguard Worker */
25*4d7e907cSAndroid Build Coastguard Workerinterface ICameraDeviceCallback extends @3.4::ICameraDeviceCallback {
26*4d7e907cSAndroid Build Coastguard Worker
27*4d7e907cSAndroid Build Coastguard Worker    /**
28*4d7e907cSAndroid Build Coastguard Worker     * requestStreamBuffers:
29*4d7e907cSAndroid Build Coastguard Worker     *
30*4d7e907cSAndroid Build Coastguard Worker     * Synchronous callback for HAL to ask for output buffers from camera service.
31*4d7e907cSAndroid Build Coastguard Worker     *
32*4d7e907cSAndroid Build Coastguard Worker     * This call may be serialized in camera service so it is strongly
33*4d7e907cSAndroid Build Coastguard Worker     * recommended to only call this method from one thread.
34*4d7e907cSAndroid Build Coastguard Worker     *
35*4d7e907cSAndroid Build Coastguard Worker     * When camera device advertises
36*4d7e907cSAndroid Build Coastguard Worker     * (CameraMetadataEnumAndroidInfoSupportedBufferManagementVersion ==
37*4d7e907cSAndroid Build Coastguard Worker     * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5), HAL
38*4d7e907cSAndroid Build Coastguard Worker     * can use this method to request buffers from camera service.
39*4d7e907cSAndroid Build Coastguard Worker     *
40*4d7e907cSAndroid Build Coastguard Worker     * @return status Status code for the operation, one of:
41*4d7e907cSAndroid Build Coastguard Worker     *     OK: all requested buffers are returned
42*4d7e907cSAndroid Build Coastguard Worker     *     FAILED_PARTIAL: some streams failed while some succeeds. Check
43*4d7e907cSAndroid Build Coastguard Worker     *             individual StreamBufferRet for details.
44*4d7e907cSAndroid Build Coastguard Worker     *     FAILED_CONFIGURING: the request failed because camera servicve is
45*4d7e907cSAndroid Build Coastguard Worker     *             performing configureStreams and no buffers are returned.
46*4d7e907cSAndroid Build Coastguard Worker     *     FAILED_UNKNOWN: the request failed for unknown reason and no buffers
47*4d7e907cSAndroid Build Coastguard Worker     *             are returned.
48*4d7e907cSAndroid Build Coastguard Worker     *
49*4d7e907cSAndroid Build Coastguard Worker     * Performance requirements:
50*4d7e907cSAndroid Build Coastguard Worker     * This is a blocking call that takes more time with more buffers requested.
51*4d7e907cSAndroid Build Coastguard Worker     * HAL must not request large amount of buffers on a latency critical code
52*4d7e907cSAndroid Build Coastguard Worker     * path. It is highly recommended to use a dedicated thread to perform
53*4d7e907cSAndroid Build Coastguard Worker     * all requestStreamBuffers calls, and adjust the thread priority and/or
54*4d7e907cSAndroid Build Coastguard Worker     * timing of making the call in order for buffers to arrive before HAL is
55*4d7e907cSAndroid Build Coastguard Worker     * ready to fill the buffer.
56*4d7e907cSAndroid Build Coastguard Worker     */
57*4d7e907cSAndroid Build Coastguard Worker    requestStreamBuffers(vec<BufferRequest> bufReqs)
58*4d7e907cSAndroid Build Coastguard Worker            generates (BufferRequestStatus st, vec<StreamBufferRet> buffers);
59*4d7e907cSAndroid Build Coastguard Worker
60*4d7e907cSAndroid Build Coastguard Worker    /**
61*4d7e907cSAndroid Build Coastguard Worker     * returnStreamBuffers:
62*4d7e907cSAndroid Build Coastguard Worker     *
63*4d7e907cSAndroid Build Coastguard Worker     * Synchronous callback for HAL to return output buffers to camera service.
64*4d7e907cSAndroid Build Coastguard Worker     *
65*4d7e907cSAndroid Build Coastguard Worker     * If this method is called during a configureStreams call, it must be blocked
66*4d7e907cSAndroid Build Coastguard Worker     * until camera service finishes the ongoing configureStreams call.
67*4d7e907cSAndroid Build Coastguard Worker     */
68*4d7e907cSAndroid Build Coastguard Worker    returnStreamBuffers(vec<StreamBuffer> buffers);
69*4d7e907cSAndroid Build Coastguard Worker
70*4d7e907cSAndroid Build Coastguard Worker};
71