xref: /aosp_15_r20/hardware/interfaces/graphics/allocator/2.0/utils/hal/include/allocator-hal/2.0/AllocatorHal.h (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1 /*
2  * Copyright 2018 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 #pragma once
18 
19 #include <string>
20 #include <vector>
21 
22 #include <android/hardware/graphics/allocator/2.0/IAllocator.h>
23 #include <android/hardware/graphics/mapper/2.0/IMapper.h>
24 
25 namespace android {
26 namespace hardware {
27 namespace graphics {
28 namespace allocator {
29 namespace V2_0 {
30 namespace hal {
31 
32 using mapper::V2_0::BufferDescriptor;
33 using mapper::V2_0::Error;
34 
35 class AllocatorHal {
36    public:
37     virtual ~AllocatorHal() = default;
38 
39     // dump the debug information
40     virtual std::string dumpDebugInfo() = 0;
41 
42     // allocate buffers
43     virtual Error allocateBuffers(const BufferDescriptor& descriptor, uint32_t count,
44                                   uint32_t* outStride,
45                                   std::vector<const native_handle_t*>* outBuffers) = 0;
46 
47     // free buffers
48     virtual void freeBuffers(const std::vector<const native_handle_t*>& buffers) = 0;
49 };
50 
51 }  // namespace hal
52 }  // namespace V2_0
53 }  // namespace allocator
54 }  // namespace graphics
55 }  // namespace hardware
56 }  // namespace android
57