1 #pragma once 2 3 #include <aidl/android/hardware/graphics/allocator/AllocationResult.h> 4 #include <aidl/android/hardware/graphics/allocator/BnAllocator.h> 5 #include <aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.h> 6 #include <aidlcommonsupport/NativeHandle.h> 7 8 #include <cstdint> 9 #include <string> 10 #include <vector> 11 12 namespace pixel { 13 namespace allocator { 14 15 namespace AidlAllocator = aidl::android::hardware::graphics::allocator; 16 17 class GrallocAllocator : public AidlAllocator::BnAllocator { 18 public: 19 GrallocAllocator(); 20 21 ~GrallocAllocator(); 22 23 virtual ndk::ScopedAStatus allocate(const std::vector<uint8_t>& descriptor, int32_t count, 24 AidlAllocator::AllocationResult* result) override; 25 26 virtual ndk::ScopedAStatus allocate2(const AidlAllocator::BufferDescriptorInfo& descriptor, 27 int32_t count, 28 AidlAllocator::AllocationResult* result) override; 29 30 virtual ndk::ScopedAStatus isSupported(const AidlAllocator::BufferDescriptorInfo& descriptor, 31 bool* result) override; 32 33 virtual ndk::ScopedAStatus getIMapperLibrarySuffix(std::string* result) override; 34 35 virtual binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; 36 }; 37 38 } // namespace allocator 39 } // namespace pixel 40