2 * Copyright 2016 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC0ALLOCATOR_H
18 #define ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC0ALLOCATOR_H
20 #include <android/hardware/graphics/allocator/2.0/IAllocator.h>
21 #include <android/hardware/graphics/mapper/2.0/IMapper.h>
22 #include <hardware/gralloc.h>
29 namespace implementation {
31 using android::hardware::graphics::mapper::V2_0::IMapper;
32 using android::hardware::graphics::mapper::V2_0::BufferDescriptor;
33 using android::hardware::graphics::mapper::V2_0::Error;
35 class Gralloc0Allocator : public IAllocator {
37 Gralloc0Allocator(const hw_module_t* module);
38 virtual ~Gralloc0Allocator();
40 // IAllocator interface
41 Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
42 Return<void> allocate(const BufferDescriptor& descriptor, uint32_t count,
43 allocate_cb hidl_cb) override;
46 Error allocateOne(const IMapper::BufferDescriptorInfo& info,
47 buffer_handle_t* outBuffer, uint32_t* outStride);
49 alloc_device_t* mDevice;
52 } // namespace implementation
54 } // namespace allocator
55 } // namespace graphics
56 } // namespace hardware
57 } // namespace android
59 #endif // ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC0ALLOCATOR_H