mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
lcd/fb: sim used wd timer to process loop event
used wdt thread to process event Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
This commit is contained in:
@@ -454,6 +454,12 @@ config SIM_X11NOSHM
|
||||
---help---
|
||||
Don't use shared memory with the X11 graphics device emulation.
|
||||
|
||||
config SIM_X11UPDATE_INTERVAL
|
||||
int "X11 update interval in ms"
|
||||
default 16
|
||||
---help---
|
||||
X11 update sleep time
|
||||
|
||||
menu "Window Configuration"
|
||||
|
||||
config SIM_FBHEIGHT
|
||||
|
||||
@@ -432,31 +432,25 @@ static int sim_setpower(struct fb_vtable_s *vtable, int power)
|
||||
* Name: sim_x11loop
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
void sim_x11loop(void)
|
||||
{
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
static clock_t last;
|
||||
clock_t now = clock_systime_ticks();
|
||||
union fb_paninfo_u info;
|
||||
|
||||
if (now - last >= MSEC2TICK(16))
|
||||
fb_notify_vsync(&g_fbobject);
|
||||
if (fb_paninfo_count(&g_fbobject, FB_NO_OVERLAY) > 1)
|
||||
{
|
||||
last = now;
|
||||
fb_notify_vsync(&g_fbobject);
|
||||
if (fb_paninfo_count(&g_fbobject, FB_NO_OVERLAY) > 1)
|
||||
{
|
||||
fb_remove_paninfo(&g_fbobject, FB_NO_OVERLAY);
|
||||
}
|
||||
|
||||
if (fb_peek_paninfo(&g_fbobject, &info, FB_NO_OVERLAY) == OK)
|
||||
{
|
||||
sim_x11setoffset(info.planeinfo.yoffset * info.planeinfo.stride);
|
||||
}
|
||||
|
||||
sim_x11update();
|
||||
fb_remove_paninfo(&g_fbobject, FB_NO_OVERLAY);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fb_peek_paninfo(&g_fbobject, &info, FB_NO_OVERLAY) == OK)
|
||||
{
|
||||
sim_x11setoffset(info.planeinfo.yoffset * info.planeinfo.stride);
|
||||
}
|
||||
|
||||
sim_x11update();
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbinitialize
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#define SIM_X11EVENT_PERIOD MSEC2TICK(CONFIG_SIM_X11EVENT_INTERVAL)
|
||||
#define SIM_X11UPDATE_PERIOD MSEC2TICK(CONFIG_SIM_X11UPDATE_INTERVAL)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@@ -54,6 +55,10 @@
|
||||
static struct wdog_s g_x11event_wdog; /* Watchdog for event loop */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
static struct wdog_s g_x11update_wdog; /* Watchdog for update loop */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@@ -92,6 +97,23 @@ static void sim_x11event_interrupt(wdparm_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_x11update_interrupt
|
||||
*
|
||||
* Description:
|
||||
* interrupts event process function
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
static void sim_x11update_interrupt(wdparm_t arg)
|
||||
{
|
||||
sim_x11loop();
|
||||
wd_start_next((FAR struct wdog_s *)arg, SIM_X11UPDATE_PERIOD,
|
||||
sim_x11update_interrupt, arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_init_smartfs
|
||||
*
|
||||
@@ -202,10 +224,6 @@ static int sim_loop_task(int argc, char **argv)
|
||||
|
||||
sched_lock();
|
||||
|
||||
#if defined(CONFIG_SIM_LCDDRIVER) || defined(CONFIG_SIM_FRAMEBUFFER)
|
||||
sim_x11loop();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SIM_NETDEV
|
||||
/* Run the network if enabled */
|
||||
|
||||
@@ -355,6 +373,11 @@ void up_initialize(void)
|
||||
(wdparm_t)&g_x11event_wdog);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
wd_start(&g_x11update_wdog, 0, sim_x11update_interrupt,
|
||||
(wdparm_t)&g_x11update_wdog);
|
||||
#endif
|
||||
|
||||
kthread_create("loop_task", CONFIG_SIM_LOOPTASK_PRIORITY,
|
||||
CONFIG_DEFAULT_TASK_STACKSIZE,
|
||||
sim_loop_task, NULL);
|
||||
|
||||
@@ -468,27 +468,20 @@ static int sim_closewindow(struct lcd_dev_s *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_x11loop
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
void sim_x11loop(void)
|
||||
{
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
static clock_t last;
|
||||
clock_t now = clock_systime_ticks();
|
||||
|
||||
if (now - last >= MSEC2TICK(16))
|
||||
{
|
||||
sim_x11update();
|
||||
last = now;
|
||||
}
|
||||
#endif
|
||||
sim_x11update();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_lcd_initialize
|
||||
|
||||
Reference in New Issue
Block a user