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