1 /*
2  * Copyright (C) 2020 Arm Limited. All rights reserved.
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 ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V4_x_GRALLOC_H
18 #define ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V4_x_GRALLOC_H
19 
20 #include "gralloc_allocator_hidl_header.h"
21 #include "core/mali_gralloc_bufferdescriptor.h"
22 
23 namespace arm
24 {
25 namespace allocator
26 {
27 using android::hardware::graphics::mapper::V4_0::BufferDescriptor;
28 using android::hardware::Return;
29 using android::hardware::hidl_handle;
30 
31 class GrallocAllocator : public IAllocator
32 {
33 public:
34 	/**
35 	 * IAllocator constructor. All the state information required for the Gralloc
36 	 * private module is populated in its default constructor. Gralloc 4.0 specific
37 	 * state information can be populated here.
38 	 */
39 	GrallocAllocator();
40 
41 	/**
42 	 * IAllocator destructor. All the resources acquired for Gralloc private module
43 	 * are released
44 	 */
45 	virtual ~GrallocAllocator();
46 
47 	/* Override IAllocator 4.0 interface */
48 	Return<void> allocate(const BufferDescriptor &descriptor, uint32_t count, allocate_cb hidl_cb) override;
49 };
50 
51 } // namespace allocator
52 } // namespace arm
53 
54 #endif // ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V4_x_GRALLOC_H
55