@@ -41,12 +41,12 @@ struct nu_vpost
4141 IRQn_Type irqn ;
4242 E_SYS_IPRST rstidx ;
4343 E_SYS_IPCLK clkidx ;
44+ uint32_t last_commit ;
4445 struct rt_device_graphic_info info ;
4546};
4647typedef struct nu_vpost * nu_vpost_t ;
4748
4849static volatile uint32_t g_u32VSyncBlank = 0 ;
49- static volatile uint32_t g_u32VSyncLastCommit = 0 ;
5050static struct rt_completion vsync_wq ;
5151
5252static struct nu_vpost nu_fbdev [eVpost_Cnt ] =
@@ -87,7 +87,7 @@ static rt_err_t vpost_layer_open(rt_device_t dev, rt_uint16_t oflag)
8787 /* Set scale to 1:1 */
8888 vpostOSDScalingCtrl (1 , 0 , 0 );
8989
90- #if (LCM_USING_BPP == 4 )
90+ #if (BSP_LCD_BPP == 32 )
9191 vpostOSDSetColMask (0xff , 0xff , 0xff );
9292#else
9393 vpostOSDSetColMask (0x1f , 0x3f , 0x1f );
@@ -163,7 +163,7 @@ static rt_err_t vpost_layer_control(rt_device_t dev, int cmd, void *args)
163163 {
164164 uint8_t * pu8BufPtr = (uint8_t * )args ;
165165
166- g_u32VSyncLastCommit = g_u32VSyncBlank ;
166+ psVpost -> last_commit = g_u32VSyncBlank ;
167167
168168 /* Pan display */
169169 switch (psVpost -> layer )
@@ -191,9 +191,9 @@ static rt_err_t vpost_layer_control(rt_device_t dev, int cmd, void *args)
191191 case RTGRAPHIC_CTRL_WAIT_VSYNC :
192192 {
193193 if (args != RT_NULL )
194- g_u32VSyncLastCommit = g_u32VSyncBlank + 1 ;
194+ psVpost -> last_commit = g_u32VSyncBlank + 1 ;
195195
196- if (g_u32VSyncLastCommit >= g_u32VSyncBlank )
196+ if (psVpost -> last_commit >= g_u32VSyncBlank )
197197 {
198198 rt_completion_init (& vsync_wq );
199199 rt_completion_wait (& vsync_wq , RT_TICK_PER_SECOND / 60 );
@@ -287,9 +287,9 @@ int rt_hw_vpost_init(void)
287287 rt_memset ((void * )& psVpost -> info , 0 , sizeof (struct rt_device_graphic_info ));
288288
289289 /* Register VPOST information */
290- psVpost -> info .bits_per_pixel = LCM_USING_BPP * 8 ;
291- psVpost -> info .pixel_format = (LCM_USING_BPP == 4 ) ? RTGRAPHIC_PIXEL_FORMAT_ARGB888 : RTGRAPHIC_PIXEL_FORMAT_RGB565 ;
292- psVpost -> info .pitch = psVpostLcmInst -> u32DevWidth * LCM_USING_BPP ;
290+ psVpost -> info .bits_per_pixel = BSP_LCD_BPP ;
291+ psVpost -> info .pixel_format = (BSP_LCD_BPP == 32 ) ? RTGRAPHIC_PIXEL_FORMAT_ARGB888 : RTGRAPHIC_PIXEL_FORMAT_RGB565 ;
292+ psVpost -> info .pitch = psVpostLcmInst -> u32DevWidth * ( BSP_LCD_BPP / 8 ) ;
293293 psVpost -> info .width = psVpostLcmInst -> u32DevWidth ;
294294 psVpost -> info .height = psVpostLcmInst -> u32DevHeight ;
295295
@@ -298,7 +298,7 @@ int rt_hw_vpost_init(void)
298298 /* Note: before get pointer of frame buffer, must set display color depth first */
299299 if (psVpost -> layer == eVpost_LCD )
300300 {
301- #if (LCM_USING_BPP == 4 )
301+ #if (BSP_LCD_BPP == 32 )
302302 vpostSetVASrc (VA_SRC_RGB888 );
303303#else
304304 vpostSetVASrc (VA_SRC_RGB565 );
@@ -310,7 +310,7 @@ int rt_hw_vpost_init(void)
310310 {
311311 vpostOSDSetWindow (0 , 0 , psVpost -> info .width , psVpost -> info .height );
312312
313- #if (LCM_USING_BPP == 4 )
313+ #if (BSP_LCD_BPP == 32 )
314314 vpostSetOSDSrc (OSD_SRC_RGB888 );
315315#else
316316 vpostSetOSDSrc (OSD_SRC_RGB565 );
0 commit comments