summaryrefslogtreecommitdiff
path: root/gralloc4/src/aidl/GrallocAllocator.h
blob: 91655a7f071a547f14d5ac1e2e5a815d9213de1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <aidl/android/hardware/graphics/allocator/AllocationResult.h>
#include <aidl/android/hardware/graphics/allocator/BnAllocator.h>
#include <aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.h>
#include <aidlcommonsupport/NativeHandle.h>

#include <cstdint>
#include <string>
#include <vector>

namespace pixel {
namespace allocator {

namespace AidlAllocator = aidl::android::hardware::graphics::allocator;

class GrallocAllocator : public AidlAllocator::BnAllocator {
public:
    GrallocAllocator();

    ~GrallocAllocator();

    virtual ndk::ScopedAStatus allocate(const std::vector<uint8_t>& descriptor, int32_t count,
                                        AidlAllocator::AllocationResult* result) override;

    virtual ndk::ScopedAStatus allocate2(const AidlAllocator::BufferDescriptorInfo& descriptor,
                                         int32_t count,
                                         AidlAllocator::AllocationResult* result) override;

    virtual ndk::ScopedAStatus isSupported(const AidlAllocator::BufferDescriptorInfo& descriptor,
                                           bool* result) override;

    virtual ndk::ScopedAStatus getIMapperLibrarySuffix(std::string* result) override;

    virtual binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
};

} // namespace allocator
} // namespace pixel