sim/fb: remove the lpwork in fb & lcd, merge to looper task
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
e6b37f2b2d
commit
886df37569
@ -127,8 +127,6 @@ static const struct fb_planeinfo_s g_planeinfo =
|
||||
.bpp = CONFIG_SIM_FBBPP,
|
||||
};
|
||||
#else
|
||||
static struct work_s g_updatework;
|
||||
|
||||
/* This structure describes the single, X11 color plane */
|
||||
|
||||
static struct fb_planeinfo_s g_planeinfo;
|
||||
@ -150,7 +148,7 @@ static struct fb_cursorsize_s g_csize;
|
||||
* in this simple framebuffer simulation.
|
||||
*/
|
||||
|
||||
struct fb_vtable_s g_fbobject =
|
||||
static struct fb_vtable_s g_fbobject =
|
||||
{
|
||||
.getvideoinfo = sim_getvideoinfo,
|
||||
.getplaneinfo = sim_getplaneinfo,
|
||||
@ -334,23 +332,32 @@ static int sim_setcursor(struct fb_vtable_s *vtable,
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_updatework
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
static void sim_updatework(void *arg)
|
||||
{
|
||||
work_queue(LPWORK, &g_updatework, sim_updatework, NULL, MSEC2TICK(33));
|
||||
sim_x11update();
|
||||
fb_pollnotify(&g_fbobject);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sim_x11loop
|
||||
****************************************************************************/
|
||||
|
||||
void sim_x11loop(void)
|
||||
{
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
if (g_planeinfo.fbmem != NULL)
|
||||
{
|
||||
static clock_t last;
|
||||
clock_t now = clock_systime_ticks();
|
||||
|
||||
if (now - last >= MSEC2TICK(16))
|
||||
{
|
||||
sim_x11update();
|
||||
fb_pollnotify(&g_fbobject);
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbinitialize
|
||||
*
|
||||
@ -373,12 +380,8 @@ int up_fbinitialize(int display)
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
ret = sim_x11initialize(CONFIG_SIM_FBWIDTH, CONFIG_SIM_FBHEIGHT,
|
||||
&g_planeinfo.fbmem, &g_planeinfo.fblen,
|
||||
&g_planeinfo.bpp, &g_planeinfo.stride);
|
||||
if (ret == OK)
|
||||
{
|
||||
work_queue(LPWORK, &g_updatework, sim_updatework, NULL, MSEC2TICK(33));
|
||||
}
|
||||
&g_planeinfo.fbmem, &g_planeinfo.fblen,
|
||||
&g_planeinfo.bpp, &g_planeinfo.stride);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
@ -173,6 +173,10 @@ static int sim_loop_task(int argc, char **argv)
|
||||
sim_x11events();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SIM_LCDDRIVER) || defined(CONFIG_SIM_FRAMEBUFFER)
|
||||
sim_x11loop();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SIM_NETDEV
|
||||
/* Run the network if enabled */
|
||||
|
||||
|
@ -241,6 +241,12 @@ void sim_x11events(void);
|
||||
void sim_buttonevent(int x, int y, int buttons);
|
||||
#endif
|
||||
|
||||
/* sim_framebuffer.c sim_lcd.c **********************************************/
|
||||
|
||||
#if defined(CONFIG_SIM_LCDDRIVER) || defined(CONFIG_SIM_FRAMEBUFFER)
|
||||
void sim_x11loop(void);
|
||||
#endif
|
||||
|
||||
/* sim_ajoystick.c **********************************************************/
|
||||
|
||||
#ifdef CONFIG_SIM_AJOYSTICK
|
||||
|
@ -157,8 +157,6 @@ static uint8_t g_runbuffer[FB_STRIDE];
|
||||
#else
|
||||
static size_t g_fblen;
|
||||
static unsigned short g_stride;
|
||||
|
||||
static struct work_s g_updatework;
|
||||
#endif
|
||||
|
||||
/* This structure describes the overall LCD video controller */
|
||||
@ -432,13 +430,22 @@ static int sim_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
|
||||
* Name: sim_updatework
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
static void sim_updatework(void *arg)
|
||||
void sim_x11loop(void)
|
||||
{
|
||||
work_queue(LPWORK, &g_updatework, sim_updatework, NULL, MSEC2TICK(33));
|
||||
sim_x11update();
|
||||
}
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
if (g_planeinfo.buffer != NULL)
|
||||
{
|
||||
static clock_t last;
|
||||
clock_t now = clock_systime_ticks();
|
||||
|
||||
if (now - last >= MSEC2TICK(16))
|
||||
{
|
||||
sim_x11update();
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@ -462,14 +469,8 @@ int board_lcd_initialize(void)
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
ret = sim_x11initialize(CONFIG_SIM_FBWIDTH, CONFIG_SIM_FBHEIGHT,
|
||||
(void**)&g_planeinfo.buffer, &g_fblen,
|
||||
&g_planeinfo.bpp, &g_stride);
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
work_queue(LPWORK, &g_updatework, sim_updatework, NULL, MSEC2TICK(33));
|
||||
}
|
||||
|
||||
(void**)&g_planeinfo.buffer, &g_fblen,
|
||||
&g_planeinfo.bpp, &g_stride);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user