Skip to content

Commit

Permalink
video/vnc: add vnc_fb_register
Browse files Browse the repository at this point in the history
To optimize the initialization of vnc, change it to vnc_fb_register.

Signed-off-by: jianglianfang <[email protected]>
  • Loading branch information
jianglianfang authored and xiaoxiang781216 committed Apr 12, 2024
1 parent 82acf6e commit 62a4799
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 183 deletions.
12 changes: 12 additions & 0 deletions boards/arm/samv7/samv71-xult/src/sam_bringup.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
# include <nuttx/leds/userled.h>
#endif

#ifdef CONFIG_VNCSERVER
# include <nuttx/video/vnc.h>
#endif

#if defined(HAVE_RTC_DSXXXX) || defined(HAVE_RTC_PCF85263)
# include <nuttx/clock.h>
# include <nuttx/i2c/i2c_master.h>
Expand Down Expand Up @@ -562,11 +566,19 @@ int sam_bringup(void)
#ifdef CONFIG_VIDEO_FB
/* Initialize and register the LCD framebuffer driver */

# ifdef CONFIG_VNCSERVER
ret = vnc_fb_register(0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: vnc_fb_register() failed: %d\n", ret);
}
# else
ret = fb_register(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
}
# endif
#endif

/* If we got here then perhaps not all initialization was successful, but
Expand Down
12 changes: 12 additions & 0 deletions boards/sim/sim/sim/src/sim_bringup.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
#include <nuttx/lcd/lcd_dev.h>
#endif

#ifdef CONFIG_VNCSERVER
# include <nuttx/video/vnc.h>
#endif

#if defined(CONFIG_INPUT_BUTTONS_LOWER) && defined(CONFIG_SIM_BUTTONS)
#include <nuttx/input/buttons.h>
#endif
Expand Down Expand Up @@ -288,11 +292,19 @@ int sim_bringup(void)
#ifdef CONFIG_VIDEO_FB
/* Initialize and register the simulated framebuffer driver */

# ifdef CONFIG_VNCSERVER
ret = vnc_fb_register(0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: vnc_fb_register() failed: %d\n", ret);
}
# else
ret = fb_register(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
}
# endif
#endif

#ifdef CONFIG_SIM_CAMERA
Expand Down
48 changes: 0 additions & 48 deletions drivers/video/fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,51 +1610,3 @@ int fb_register_device(int display, int plane,
kmm_free(fb);
return ret;
}

/****************************************************************************
* Name: fb_register
*
* Description:
* Register the framebuffer character device at /dev/fbN where N is the
* display number if the devices supports only a single plane. If the
* hardware supports multiple color planes, then the device will be
* registered at /dev/fbN.M where N is the again display number but M
* is the display plane.
*
* Input Parameters:
* display - The display number for the case of boards supporting multiple
* displays or for hardware that supports multiple
* layers (each layer is consider a display). Typically zero.
* plane - Identifies the color plane on hardware that supports separate
* framebuffer "planes" for each color component.
*
* Returned Value:
* Zero (OK) is returned success; a negated errno value is returned on any
* failure.
*
****************************************************************************/

int fb_register(int display, int plane)
{
FAR struct fb_vtable_s *vtable;
int ret;

/* Initialize the frame buffer device. */

ret = up_fbinitialize(display);
if (ret < 0)
{
gerr("ERROR: up_fbinitialize() failed for display %d: %d\n",
display, ret);
return ret;
}

vtable = up_fbgetvplane(display, plane);
if (vtable == NULL)
{
gerr("ERROR: up_fbgetvplane() failed, vplane=%d\n", plane);
return -EINVAL;
}

return fb_register_device(display, plane, vtable);
}
Loading

0 comments on commit 62a4799

Please sign in to comment.