1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef HARDWARE_GOOGLE_CAMERA_HAL_UTILS_HAL_BUFFER_ALLOCATOR_H 18 #define HARDWARE_GOOGLE_CAMERA_HAL_UTILS_HAL_BUFFER_ALLOCATOR_H 19 20 #include "hal_types.h" 21 22 #include <hardware/gralloc1.h> 23 #include <utils/Errors.h> 24 #include <vector> 25 26 namespace android { 27 namespace google_camera_hal { 28 29 // IHalBufferAllocator defines an interface for HAL to allocate HW accessible 30 // buffers 31 class IHalBufferAllocator { 32 public: ~IHalBufferAllocator()33 virtual ~IHalBufferAllocator(){}; 34 35 // Allocate buffers and return buffer via buffers. 36 // The buffers is owned by caller 37 virtual status_t AllocateBuffers(const HalBufferDescriptor& buffer_descriptor, 38 std::vector<buffer_handle_t>* buffers) = 0; 39 40 // free the list of buffers 41 virtual void FreeBuffers(std::vector<buffer_handle_t>* buffers) = 0; 42 }; 43 44 } // namespace google_camera_hal 45 } // namespace android 46 47 #endif // HARDWARE_GOOGLE_CAMERA_HAL_UTILS_HAL_BUFFER_ALLOCATOR_H 48