1 /*
2  * Copyright (C) 2017-2018 ARM Limited. All rights reserved.
3  *
4  * Copyright (C) 2008 The Android Open Source Project
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_x_GRALLOC_H
20 #define ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_x_GRALLOC_H
21 
22 #if HIDL_ALLOCATOR_VERSION_SCALED == 200
23 #include <android/hardware/graphics/allocator/2.0/IAllocator.h>
24 #endif
25 
26 #include "mali_gralloc_module.h"
27 #include "mali_gralloc_bufferdescriptor.h"
28 
29 namespace android {
30 namespace hardware {
31 namespace graphics {
32 namespace allocator {
33 namespace HIDL_IALLOCATOR_NAMESPACE {
34 namespace implementation {
35 
36 using android::hardware::graphics::mapper::V2_0::BufferDescriptor;
37 using android::hardware::graphics::mapper::V2_0::Error;
38 
39 class GrallocAllocator : public IAllocator
40 {
41 public:
42 	GrallocAllocator();
43 	virtual ~GrallocAllocator();
44 
45 	/* Override IAllocator interface */
46 	Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
47 	Return<void> allocate(const BufferDescriptor& descriptor, uint32_t count,
48 	                      allocate_cb hidl_cb) override;
49 private:
50 	struct private_module_t privateModule;
51 };
52 
53 extern "C" IAllocator* HIDL_FETCH_IAllocator(const char* name);
54 
55 } // namespace implementation
56 } // namespace HIDL_IALLOCATOR_NAMESPACE
57 } // namespace allocator
58 } // namespace graphics
59 } // namespace hardware
60 } // namespace android
61 
62 #endif // ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_x_GRALLOC_H
63