1 /**
2  * @file lv_display_private.h
3  *
4  */
5 
6 #ifndef LV_DISPLAY_PRIVATE_H
7 #define LV_DISPLAY_PRIVATE_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../misc/lv_types.h"
17 #include "../core/lv_obj.h"
18 #include "../draw/lv_draw.h"
19 #include "lv_display.h"
20 
21 #if LV_USE_SYSMON
22 #include "../others/sysmon/lv_sysmon_private.h"
23 #endif
24 
25 /*********************
26  *      DEFINES
27  *********************/
28 #ifndef LV_INV_BUF_SIZE
29 #define LV_INV_BUF_SIZE 32 /**< Buffer size for invalid areas */
30 #endif
31 
32 /**********************
33  *      TYPEDEFS
34  **********************/
35 
36 struct _lv_display_t {
37 
38     /*---------------------
39      * Resolution
40      *--------------------*/
41 
42     /** Horizontal resolution.*/
43     int32_t hor_res;
44 
45     /** Vertical resolution.*/
46     int32_t ver_res;
47 
48     /** Horizontal resolution of the full / physical display. Set to -1 for fullscreen mode.*/
49     int32_t physical_hor_res;
50 
51     /** Vertical resolution of the full / physical display. Set to -1 for fullscreen mode.*/
52     int32_t physical_ver_res;
53 
54     /** Horizontal offset from the full / physical display. Set to 0 for fullscreen mode.*/
55     int32_t offset_x;
56 
57     /** Vertical offset from the full / physical display. Set to 0 for fullscreen mode.*/
58     int32_t offset_y;
59 
60     /** DPI (dot per inch) of the display. Default value is `LV_DPI_DEF`.*/
61     uint32_t dpi;
62 
63     /*---------------------
64      * Buffering
65      *--------------------*/
66     lv_draw_buf_t * buf_1;
67     lv_draw_buf_t * buf_2;
68 
69     /** Internal, used by the library*/
70     lv_draw_buf_t * buf_act;
71 
72     /** MANDATORY: Write the internal buffer (draw_buf) to the display. 'lv_display_flush_ready()' has to be
73      * called when finished*/
74     lv_display_flush_cb_t flush_cb;
75 
76     /**
77      * Used to wait while flushing is ready.
78      * It can do any complex logic to wait, including semaphores, mutexes, polling flags, etc.
79      * If not set `flushing` flag is used which can be cleared with `lv_display_flush_ready()` */
80     lv_display_flush_wait_cb_t flush_wait_cb;
81 
82     /** 1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ
83      * Read-Modify-Write issue might occur) */
84     volatile int flushing;
85 
86     /** 1: It was the last chunk to flush. (It can't be a bit field because when it's cleared
87      * from IRQ Read-Modify-Write issue might occur) */
88     volatile int flushing_last;
89     volatile uint32_t last_area         : 1; /**< 1: last area is being rendered */
90     volatile uint32_t last_part         : 1; /**< 1: last part of the current area is being rendered */
91 
92     lv_display_render_mode_t render_mode;
93     uint32_t antialiasing : 1;       /**< 1: anti-aliasing is enabled on this display.*/
94     uint32_t tile_cnt     : 8;       /**< Divide the display buffer into these number of tiles */
95 
96 
97     /** 1: The current screen rendering is in progress*/
98     uint32_t rendering_in_progress : 1;
99 
100     lv_color_format_t   color_format;
101 
102     /** Invalidated (marked to redraw) areas*/
103     lv_area_t inv_areas[LV_INV_BUF_SIZE];
104     uint8_t inv_area_joined[LV_INV_BUF_SIZE];
105     uint32_t inv_p;
106     int32_t inv_en_cnt;
107 
108     /** Double buffer sync areas (redrawn during last refresh) */
109     lv_ll_t sync_areas;
110 
111     lv_draw_buf_t _static_buf1; /**< Used when user pass in a raw buffer as display draw buffer */
112     lv_draw_buf_t _static_buf2;
113     /*---------------------
114      * Layer
115      *--------------------*/
116     lv_layer_t * layer_head;
117     void (*layer_init)(lv_display_t * disp, lv_layer_t * layer);
118     void (*layer_deinit)(lv_display_t * disp, lv_layer_t * layer);
119 
120     /*---------------------
121      * Screens
122      *--------------------*/
123 
124     /** Screens of the display*/
125     lv_obj_t ** screens;    /**< Array of screen objects.*/
126     lv_obj_t * sys_layer;   /**< @see lv_display_get_layer_sys*/
127     lv_obj_t * top_layer;   /**< @see lv_display_get_layer_top*/
128     lv_obj_t * act_scr;     /**< Currently active screen on this display*/
129     lv_obj_t * bottom_layer;/**< @see lv_display_get_layer_bottom*/
130     lv_obj_t * prev_scr;    /**< Previous screen. Used during screen animations*/
131     lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_screen_load_anim*/
132     uint32_t screen_cnt;
133     uint8_t draw_prev_over_act  : 1;/** 1: Draw previous screen over active screen*/
134     uint8_t del_prev  : 1;  /** 1: Automatically delete the previous screen when the screen load animation is ready*/
135 
136     /*---------------------
137      * Others
138      *--------------------*/
139 
140     void * driver_data; /**< Custom user data*/
141 
142     void * user_data; /**< Custom user data*/
143 
144     lv_event_list_t event_list;
145 
146     uint32_t rotation  : 3; /**< Element of  lv_display_rotation_t*/
147 
148     lv_theme_t * theme;     /**< The theme assigned to the screen*/
149 
150     /** A timer which periodically checks the dirty areas and refreshes them*/
151     lv_timer_t * refr_timer;
152 
153     /*Miscellaneous data*/
154     uint32_t last_activity_time;        /**< Last time when there was activity on this display*/
155 
156     /** The area being refreshed*/
157     lv_area_t refreshed_area;
158 
159 #if LV_USE_PERF_MONITOR
160     lv_obj_t * perf_label;
161     lv_sysmon_backend_data_t perf_sysmon_backend;
162     lv_sysmon_perf_info_t perf_sysmon_info;
163 #endif
164 
165 #if LV_USE_MEM_MONITOR
166     lv_obj_t * mem_label;
167 #endif
168 
169 };
170 
171 /**********************
172  * GLOBAL PROTOTYPES
173  **********************/
174 
175 /**********************
176  *      MACROS
177  **********************/
178 
179 #ifdef __cplusplus
180 } /*extern "C"*/
181 #endif
182 
183 #endif /*LV_DISPLAY_PRIVATE_H*/
184