sim/configs/fb: Add a configuration for non-graphical testing of the frambuffer character driver using apps/example/fb

drivers/video/fb.c and include/nuttx/video.fb.h:  Some improvements and fixes from early testing sith the sim/fb cnofiguration.
This commit is contained in:
Gregory Nutt 2017-09-12 09:48:47 -06:00
parent 7846381e09
commit 107866c00e
7 changed files with 163 additions and 19 deletions

View File

@ -44,7 +44,10 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/nx/nx.h>
#include <nuttx/nx/nxglib.h>
#include <nuttx/video/fb.h>
#include "up_internal.h"
/****************************************************************************
@ -423,3 +426,24 @@ void up_fbuninitialize(int display)
{
}
/****************************************************************************
* Name: nx_notify_rectangle
*
* Description:
* Must be provided if CONFIG_NX_UPDATE is enabled
*
* Input Parameters:
* display - In the case of hardware with multiple displays, this
* specifies the display. Normally this is zero.
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_NX_UPDATE
void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
FAR const struct nxgl_rect_s *rect)
{
}
#endif

View File

@ -481,6 +481,11 @@ cxxtest
postpone running C++ static initializers until NuttX has been
initialized.
fb
A simple configuration used for some basic (non-graphic) debug of the
framebuffer character drivers using apps/examples/fb.
ipforward
This is an NSH configuration that includes a simple test of the NuttX

30
configs/sim/fb/defconfig Normal file
View File

@ -0,0 +1,30 @@
# CONFIG_NX_DISABLE_8BPP is not set
# CONFIG_NX_PACKEDMSFIRST is not set
CONFIG_ARCH_BOARD_SIM=y
CONFIG_ARCH_BOARD="sim"
CONFIG_ARCH_SIM=y
CONFIG_ARCH="sim"
CONFIG_BOARD_INITIALIZE=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_ENVIRON=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_DISABLE_POLL=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_EXAMPLES_FB=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_MAX_TASKS=16
CONFIG_NX_KBD=y
CONFIG_NX_UPDATE=y
CONFIG_NX_XYINPUT_MOUSE=y
CONFIG_NX=y
CONFIG_NXFONT_SANS23X27=y
CONFIG_PTHREAD_STACK_DEFAULT=8192
CONFIG_SDCLONE_DISABLE=y
CONFIG_SIM_FRAMEBUFFER=y
CONFIG_START_DAY=28
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2008
CONFIG_USER_ENTRYPOINT="fb_main"
CONFIG_USERMAIN_STACKSIZE=4096
CONFIG_VIDEO_DEVICES=y
CONFIG_VIDEO_FB=y

View File

@ -46,6 +46,7 @@
#include <nuttx/board.h>
#include <nuttx/clock.h>
#include <nuttx/video/fb.h>
#include <nuttx/timers/oneshot.h>
#include <nuttx/wireless/pktradio.h>
#include <nuttx/wireless/ieee802154/ieee802154_loopback.h>
@ -57,6 +58,29 @@
int trv_mount_world(int minor, FAR const char *mountpoint);
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
#define NEED_FRAMEBUFFER 1
/* If we are using the X11 touchscreen simulation, then the frame buffer
* initialization happens in board_tsc_setup. Otherwise, we will need to
* do that here.
*/
#if defined(CONFIG_SIM_X11FB) && defined(CONFIG_SIM_TOUCHSCREEN)
# undef NEED_FRAMEBUFFER
#endif
/* Currently the only case we need to initialize the framebuffer here is
* when we are testing the framebuffer character driver.
*/
#ifndef CONFIG_VIDEO_FB
# undef NEED_FRAMEBUFFER
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -74,9 +98,7 @@ int sim_bringup(void)
#ifdef CONFIG_ONESHOT
FAR struct oneshot_lowerhalf_s *oneshot;
#endif
#if defined(CONFIG_FS_PROCFS) || defined(CONFIG_ONESHOT)
int ret;
#endif
#ifdef CONFIG_LIB_ZONEINFO_ROMFS
/* Mount the TZ database */
@ -96,7 +118,7 @@ int sim_bringup(void)
oneshot = oneshot_initialize(0, 0);
if (oneshot == NULL)
{
_err("ERROR: oneshot_initialize faile\n");
syslog(LOG_ERR, "ERROR: oneshot_initialize faile\n");
}
else
{
@ -111,8 +133,8 @@ int sim_bringup(void)
ret = oneshot_register("/dev/oneshot", oneshot);
if (ret < 0)
{
_err("ERROR: Failed to register oneshot at /dev/oneshot: %d\n",
ret);
syslog(LOG_ERR, "ERROR: Failed to register oneshot at /dev/oneshot: %d\n",
ret);
}
#endif
}
@ -136,8 +158,18 @@ int sim_bringup(void)
ret = mount(NULL, SIM_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
if (ret < 0)
{
_err("ERROR: Failed to mount procfs at %s: %d\n",
SIM_PROCFS_MOUNTPOINT, ret);
syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n",
SIM_PROCFS_MOUNTPOINT, ret);
}
#endif
#ifdef NEED_FRAMEBUFFER
/* Initialize and register the simulated framebuffer driver */
ret = fb_register(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
}
#endif
@ -147,7 +179,7 @@ int sim_bringup(void)
ret = ieee8021514_loopback();
if (ret < 0)
{
_err("ERROR: ieee8021514_loopback() failed: %d\n", ret);
syslog(LOG_ERR, "ERROR: ieee8021514_loopback() failed: %d\n", ret);
}
#endif
@ -157,9 +189,10 @@ int sim_bringup(void)
ret = pktradio_loopback();
if (ret < 0)
{
_err("ERROR: pktradio_loopback() failed: %d\n", ret);
syslog(LOG_ERR, "ERROR: pktradio_loopback() failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK;
}

View File

@ -81,10 +81,6 @@ struct sim_touchscreen_s
static struct sim_touchscreen_s g_simtc;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -1,5 +1,6 @@
/****************************************************************************
* graphis/fb/fb.c
* graphics/fb/fb.c
* Framebuffer character driver
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -451,9 +452,18 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
* Name: fb_register
*
* Description:
* Register the framebuffer device at /dev/fbN-M where N is the display
* number and M is the display plane for displays with multiple color
* planes.
* 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 multile 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 supports multile
* 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
@ -464,8 +474,10 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
int fb_register(int display, int plane)
{
FAR struct fb_chardev_s *fb;
struct fb_videoinfo_s vinfo;
struct fb_planeinfo_s pinfo;
char devname[16];
int nplanes;
int ret;
/* Allocate a framebuffer state instance */
@ -497,6 +509,17 @@ int fb_register(int display, int plane)
/* Initialize the frame buffer instance. */
DEBUGASSERT(fb->vtable->getvideoinfo != NULL);
ret = fb->vtable->getvideoinfo(fb->vtable, &vinfo);
if (ret < 0)
{
gerr("ERROR: getvideoinfo() failed: %d\n", ret);
goto errout_with_fb;
}
nplanes = vinfo.nplanes;
DEBUGASSERT(vinfo.nplanes > 0 && (unsigned)plane < vinfo.nplanes);
DEBUGASSERT(fb->vtable->getplaneinfo != NULL);
ret = fb->vtable->getplaneinfo(fb->vtable, plane, &pinfo);
if (ret < 0)
@ -511,7 +534,15 @@ int fb_register(int display, int plane)
/* Register the framebuffer device */
(void)snprintf(devname, 16, "/dev/fb%d-%d", display, plane);
if (nplanes < 2)
{
(void)snprintf(devname, 16, "/dev/fb%d", display);
}
else
{
(void)snprintf(devname, 16, "/dev/fb%d-%d", display, plane);
}
ret = register_driver(devname, &fb_fops, 0666, (FAR void *)fb);
if (ret < 0)
{

View File

@ -178,7 +178,7 @@
#define FB_FMT_CXY1 60 /* BPP=12 */
#define FB_FMT_CXY2 61 /* BPP=16 */
#define FB_ISYUVPLANAR(f) ((f) >= FB_FMT_AYUV) && (f) <= FB_FMT_YUVP)
#define FB_ISYUVPLANAR(f) (((f) >= FB_FMT_AYUV) && (f) <= FB_FMT_YUVP)
#define FB_ISYUV(f) (FB_ISYUVPACKED(f) || FB_ISYUVPLANAR(f))
/* Hardware cursor control **************************************************/
@ -447,6 +447,31 @@ FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane);
void up_fbuninitialize(int display);
/****************************************************************************
* 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 multile 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 supports multile
* 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);
#undef EXTERN
#ifdef __cplusplus
}