blob: 5cfe3c52501f92ad4f3501217e3e8aeb86df7db8
1 | #ifndef FRAMEBUFFER_API_H_ |
2 | #define FRAMEBUFFER_API_H_ |
3 | |
4 | #include <hardware/hardware.h> |
5 | |
6 | struct private_handle_t; |
7 | struct private_module_t; |
8 | |
9 | enum { |
10 | GLES_COMPOSE_MODE = 0, |
11 | DIRECT_COMPOSE_MODE = 1, |
12 | GE2D_COMPOSE_MODE = 2, |
13 | }; |
14 | |
15 | enum { |
16 | OSD_BLANK_OP_BIT = 0x00000001, |
17 | }; |
18 | |
19 | typedef struct framebuffer_info_t{ |
20 | // gralloc module. |
21 | private_module_t *grallocModule; |
22 | |
23 | buffer_handle_t currentBuffer; |
24 | |
25 | //set by device. |
26 | int displayType; |
27 | int fbIdx; |
28 | |
29 | //information get from osd |
30 | struct fb_var_screeninfo info;//need to fbpost |
31 | struct fb_fix_screeninfo finfo; |
32 | |
33 | int fd;//for fbpost use |
34 | int fbSize; |
35 | |
36 | float xdpi; |
37 | float ydpi; |
38 | float fps; |
39 | int flipFlags; |
40 | |
41 | // GE2D composer mode used only. |
42 | int yOffset; |
43 | }framebuffer_info_t; |
44 | |
45 | typedef struct hwc_fb_sync_request_t{ |
46 | #if PLATFORM_SDK_VERSION < 26 |
47 | int magic; |
48 | int len; |
49 | #endif |
50 | unsigned int xoffset; |
51 | unsigned int yoffset; |
52 | int in_fen_fd; |
53 | int out_fen_fd; |
54 | int width; |
55 | int height; |
56 | int format; |
57 | int shared_fd; |
58 | unsigned int op; |
59 | unsigned int type; /*direct render or ge2d*/ |
60 | unsigned int dst_x; |
61 | unsigned int dst_y; |
62 | unsigned int dst_w; |
63 | unsigned int dst_h; |
64 | int byte_stride; |
65 | int stride; |
66 | unsigned int reserve; |
67 | } hwc_fb_sync_request_t; |
68 | |
69 | // Initialize the framebuffer (must keep module lock before calling |
70 | int init_frame_buffer_locked(struct framebuffer_info_t* info); |
71 | |
72 | #ifndef SINGLE_EXTERNAL_DISPLAY_USE_FB1 |
73 | int init_cursor_buffer_locked(struct framebuffer_info_t* info); |
74 | int update_cursor_buffer_locked(struct framebuffer_info_t* cbinfo, int xres, int yres); |
75 | #endif |
76 | |
77 | int fb_post_locked(struct framebuffer_info_t* fbinfo,buffer_handle_t buffer); |
78 | int fb_post_with_fence_locked( |
79 | struct framebuffer_info_t* fbinfo, |
80 | buffer_handle_t hnd, |
81 | int in_fence); |
82 | int hwc_fb_post_with_fence_locked( |
83 | struct framebuffer_info_t* fbinfo, |
84 | struct hwc_fb_sync_request_t* sync_req, |
85 | buffer_handle_t hnd); |
86 | #if PLATFORM_SDK_VERSION < 26 |
87 | int hwc_old_fb_post_with_fence_locked( |
88 | struct framebuffer_info_t* fbinfo, |
89 | struct hwc_fb_sync_request_t* fb_sync_req, |
90 | buffer_handle_t hnd); |
91 | int hwc_new_fb_post_with_fence_locked( |
92 | struct framebuffer_info_t* fbinfo, |
93 | struct hwc_fb_sync_request_t* sync_req, |
94 | buffer_handle_t hnd); |
95 | #endif |
96 | int getOsdIdx(int display_type); |
97 | int bits_per_pixel(); |
98 | |
99 | //for egl to get framebuffer count |
100 | extern unsigned int get_num_fb_buffers(); |
101 | extern bool osd_afbcd_enable(); |
102 | |
103 | #endif |
104 |