diff --git a/Documentation/NXGraphicsSubsystem.html b/Documentation/NXGraphicsSubsystem.html
index 324664ce7d9..57c24097e1e 100644
--- a/Documentation/NXGraphicsSubsystem.html
+++ b/Documentation/NXGraphicsSubsystem.html
@@ -12,7 +12,7 @@
NX Graphics Subsystem
- Last Updated: April 15, 2018
+ Last Updated: March 10, 2019
@@ -956,7 +956,7 @@ struct nx_callback_s
#include <nuttx/nx/nx.h>
-int nxmu_start(void);
+int nxmu_start(int display, int plane);
Description:
@@ -964,7 +964,12 @@ int nxmu_start(void);
Input Parameters:
- None
+
+ display
+ - The display number to be served by this new NXMU instance.
+
plane
+ - The plane number to use to get information about the display geometry and color format.
+
Returned Value:
diff --git a/configs/boardctl.c b/configs/boardctl.c
index 76308fd981a..04fa98a0a11 100644
--- a/configs/boardctl.c
+++ b/configs/boardctl.c
@@ -412,14 +412,20 @@ int boardctl(unsigned int cmd, uintptr_t arg)
#ifdef CONFIG_NX
/* CMD: BOARDIOC_NX_START
* DESCRIPTION: Start the NX servier
- * ARG: None
+ * ARG: Integer display number to be served by this NXMU
+ ( instance.
* CONFIGURATION: CONFIG_NX
* DEPENDENCIES: Base graphics logic provides nxmu_start()
*/
case BOARDIOC_NX_START:
{
- ret = nxmu_start();
+ /* REVISIT: Plane number is forced to zero. On multiplanar
+ * displays there may be multiple planes. Only one is supported
+ * here.
+ */
+
+ ret = nxmu_start((int)arg, 0);
}
break;
#endif
diff --git a/graphics/Kconfig b/graphics/Kconfig
index 5f3094678e6..cbb3fc9ac59 100644
--- a/graphics/Kconfig
+++ b/graphics/Kconfig
@@ -23,9 +23,19 @@ config NX_LCDDRIVER
this this option is provide to select, instead, the LCD driver interface
defined in include/nuttx/lcd/lcd.h.
+config NX_NDISPLAYS
+ int "Maximum number of displays supported"
+ default 1
+ range 1 9
+ ---help---
+ The maximum number of displays that can be supported by the NX server.
+ Normally this takes the value one but may be increased to support systems
+ with multiple displays.
+
config NX_NPLANES
int "Number of Color Planes"
default 1
+ range 1 8
---help---
Some YUV color formats requires support for multiple planes, one for
each color component. Unless you have such special hardware (and
@@ -422,22 +432,6 @@ config NXSTART_DEVNO
---help---
LCD device number (in case there are more than one LCDs connected).
Default: 0
-
-config NXSTART_DISPLAYNO
- int "Display Number"
- default 0
- depends on !NX_LCDDRIVER && !NXSTART_EXTERNINIT
- ---help---
- Framebuffer display number (in case there are more than one framebuffers).
- Default: 0
-
-config NXSTART_VPLANE
- int "Plane Number"
- default 0
- depends on !NX_LCDDRIVER && !NXSTART_EXTERNINIT
- ---help---
- Only a single video plane is supported. Default: 0
-
source "graphics/vnc/Kconfig"
endif # NX
diff --git a/graphics/nxmu/nxmu_start.c b/graphics/nxmu/nxmu_start.c
index 22eaffb0cd9..a1fd1e7ec62 100644
--- a/graphics/nxmu/nxmu_start.c
+++ b/graphics/nxmu/nxmu_start.c
@@ -42,6 +42,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -58,7 +59,7 @@
* Private Data
****************************************************************************/
-static bool g_nxserver_started;
+static bool g_nxserver_started[CONFIG_NX_NDISPLAYS];
/****************************************************************************
* Private Functions
@@ -83,15 +84,23 @@ static bool g_nxserver_started;
static int nx_server(int argc, char *argv[])
{
FAR NX_DRIVERTYPE *dev;
+ int display;
+ int plane;
int ret;
+ /* Get display parameters from the command line */
+
+ display = atoi(argv[1]);
+ plane = atoi(argv[2]);
+
#if defined(CONFIG_NXSTART_EXTERNINIT)
/* Use external graphics driver initialization */
dev = board_graphics_setup(CONFIG_NXSTART_DEVNO);
if (!dev)
{
- gerr("ERROR: board_graphics_setup failed, devno=%d\n", CONFIG_NXSTART_DEVNO);
+ gerr("ERROR: board_graphics_setup failed, devno=%d\n",
+ CONFIG_NXSTART_DEVNO);
return EXIT_FAILURE;
}
@@ -117,24 +126,24 @@ static int nx_server(int argc, char *argv[])
/* Turn the LCD on at 75% power */
- (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
+ (void)dev->setpower(dev, ((3 * CONFIG_LCD_MAXPOWER + 3) / 4));
#else /* CONFIG_NX_LCDDRIVER */
/* Initialize the frame buffer device.
* REVISIT: display == 0 is assumed.
*/
- ret = up_fbinitialize(CONFIG_NXSTART_DISPLAYNO);
+ ret = up_fbinitialize(display);
if (ret < 0)
{
gerr("ERROR: up_fbinitialize failed: %d\n", ret);
return EXIT_FAILURE;
}
- dev = up_fbgetvplane(CONFIG_NXSTART_DISPLAYNO, CONFIG_NXSTART_VPLANE);
+ dev = up_fbgetvplane(display, plane);
if (!dev)
{
- gerr("ERROR: up_fbgetvplane failed, vplane=%d\n", CONFIG_NXSTART_VPLANE);
+ gerr("ERROR: up_fbgetvplane failed, vplane=%d\n", plane);
return EXIT_FAILURE;
}
@@ -164,7 +173,8 @@ static int nx_server(int argc, char *argv[])
* boardctl() interface with the BOARDIOC_NX_START command.
*
* Input Parameters:
- * None
+ * display - Display number served by this NXMU instance.
+ * plane - Plane number to use for display info
*
* Returned Value:
* Zero (OK) is returned on success. This indicates that the NX server
@@ -176,19 +186,33 @@ static int nx_server(int argc, char *argv[])
*
****************************************************************************/
-int nxmu_start(void)
+int nxmu_start(int display, int plane)
{
+ DEBUGASSERT((unsigned)display < CONFIG_NX_NDISPLAYS &&
+ (unsigned)plane < CONFIG_NX_NPLANES);
+
/* Do nothing is the server has already been started */
- if (!g_nxserver_started)
+ if (!g_nxserver_started[display])
{
+ FAR char display_str[8];
+ FAR char plane_str[8];
+ FAR char * const argv[3] =
+ {
+ (FAR char * const)display_str,
+ (FAR char * const)plane_str,
+ NULL
+ };
pid_t server;
/* Start the server kernel thread */
+ snprintf(display_str, 8, "%d", display);
+ snprintf(plane_str, 8, "%d", plane);
+
ginfo("Starting server task\n");
server = kthread_create("NX Server", CONFIG_NXSTART_SERVERPRIO,
- CONFIG_NXSTART_SERVERSTACK, nx_server, NULL);
+ CONFIG_NXSTART_SERVERSTACK, nx_server, argv);
if (server < 0)
{
gerr("ERROR: Failed to create nx_server kernel thread: %d\n",
@@ -196,7 +220,7 @@ int nxmu_start(void)
return (int)server;
}
- g_nxserver_started = true;
+ g_nxserver_started[display] = true;
/* Wait a bit to make sure that the server get started. NOTE that
* this operation cannot be done from the IDLE thread!
diff --git a/include/nuttx/nx/nxmu.h b/include/nuttx/nx/nxmu.h
index c4c808e9f6a..4f82cefeb73 100644
--- a/include/nuttx/nx/nxmu.h
+++ b/include/nuttx/nx/nxmu.h
@@ -480,7 +480,8 @@ extern "C"
* boardctl() interface with the BOARDIOC_NX_START command.
*
* Input Parameters:
- * None
+ * display - Display number served by this NXMU instance.
+ * plane - Plane number to use for display info
*
* Returned Value:
* Zero (OK) is returned on success. This indicates that the NX server
@@ -492,7 +493,7 @@ extern "C"
*
****************************************************************************/
-int nxmu_start(void);
+int nxmu_start(int display, int plane);
/****************************************************************************
* Name: nxfe_constructwindow
diff --git a/include/sys/boardctl.h b/include/sys/boardctl.h
index 81fe5434590..1abc5f54a38 100644
--- a/include/sys/boardctl.h
+++ b/include/sys/boardctl.h
@@ -115,7 +115,7 @@
*
* CMD: BOARDIOC_NX_START
* DESCRIPTION: Start the NX server
- * ARG: None
+ * ARG: Integer display number to be served by this NXMU instance.
* CONFIGURATION: CONFIG_NX
* DEPENDENCIES: Base graphics logic provides nxmu_start()
*
diff --git a/tools/nxstyle.c b/tools/nxstyle.c
index 127adb8a1f3..edc6037d627 100644
--- a/tools/nxstyle.c
+++ b/tools/nxstyle.c
@@ -250,7 +250,7 @@ int main(int argc, char **argv, char **envp)
if (line[n] != '}' /* && line[n] != '#' */)
{
fprintf(stderr,
- "Missing blank line after comment line. Found at line %d\n",
+ "Missing blank line after comment found at line %d\n",
comment_lineno);
}
}
@@ -691,7 +691,7 @@ int main(int argc, char **argv, char **envp)
else if (line[n + 1] == '/')
{
- fprintf(stderr, "C++ style comment on at %d:%d\n",
+ fprintf(stderr, "C++ style comment at %d:%d\n",
lineno, n);
n++;
continue;