aboutsummaryrefslogtreecommitdiff
path: root/MediaTek/gralloc_extra/include/ui/GraphicBufferExtra.h
blob: 112bb37360038464041f1cd7b0f3e5ca52fc3798 (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
50
#ifndef MTK_GRALLOC_EXTRA_GRAPHIC_BUFFER_EXTRA_H
#define MTK_GRALLOC_EXTRA_GRAPHIC_BUFFER_EXTRA_H

#include <stdint.h>
#include <sys/types.h>

#include <system/window.h>

#include <utils/Singleton.h>
#include <utils/RefBase.h>

#include <hardware/gralloc_extra.h>

namespace android {
// ---------------------------------------------------------------------------
class GraphicBuffer;

class GraphicBufferExtra : public Singleton<GraphicBufferExtra>
{
public:
    static inline GraphicBufferExtra& get() { return getInstance(); }

    int query(buffer_handle_t handle, GRALLOC_EXTRA_ATTRIBUTE_QUERY attribute, void *out_pointer);

    int perform(buffer_handle_t handle, GRALLOC_EXTRA_ATTRIBUTE_PERFORM attribute, void *in_pointer);

    /** Deprecated methods
     * please use query/perform instead of using the following get/set methods.
     */
    int getIonFd(buffer_handle_t handle, int *idx, int *num);
    int getBufInfo(buffer_handle_t handle, gralloc_buffer_info_t* bufInfo);
    int getSecureBuffer(buffer_handle_t handle, int *type, int *hBuffer);
    int setBufParameter(buffer_handle_t handle, int mask, int value);
    int getMVA(buffer_handle_t handle, int32_t *mvaddr);
    int setBufInfo(buffer_handle_t handle, const char * str);

    ~GraphicBufferExtra();

private:
    friend class Singleton<GraphicBufferExtra>;

    GraphicBufferExtra();

    extra_device_t *mExtraDev;
};

// ---------------------------------------------------------------------------
}; // namespace android

#endif // MTK_GRALLOC_EXTRA_GRAPHIC_BUFFER_EXTRA_H