1 /* 2 * Copyright 2016 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 ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC0ALLOCATOR_H 18 #define ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC0ALLOCATOR_H 19 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> 23 24 namespace android { 25 namespace hardware { 26 namespace graphics { 27 namespace allocator { 28 namespace V2_0 { 29 namespace implementation { 30 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; 34 35 class Gralloc0Allocator : public IAllocator { 36 public: 37 Gralloc0Allocator(const hw_module_t* module); 38 virtual ~Gralloc0Allocator(); 39 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; 44 45 private: 46 Error allocateOne(const IMapper::BufferDescriptorInfo& info, 47 buffer_handle_t* outBuffer, uint32_t* outStride); 48 49 alloc_device_t* mDevice; 50 }; 51 52 } // namespace implementation 53 } // namespace V2_0 54 } // namespace allocator 55 } // namespace graphics 56 } // namespace hardware 57 } // namespace android 58 59 #endif // ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC0ALLOCATOR_H 60