mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
VNC: Add framework to support a framebuffer driver interface
This commit is contained in:
@@ -12,4 +12,20 @@ menuconfig VNCSERVER
|
|||||||
|
|
||||||
if VNCSERVER
|
if VNCSERVER
|
||||||
|
|
||||||
|
config VNCSERVER_NDISPLAYS
|
||||||
|
int "Number of displays"
|
||||||
|
default 1
|
||||||
|
range 1 99
|
||||||
|
---help---
|
||||||
|
Specifies the number of RFB displays supported by the server.
|
||||||
|
Normally this should be one.
|
||||||
|
|
||||||
|
config VNCSERVER_PRIO
|
||||||
|
int "VNC server thread priority"
|
||||||
|
default 100
|
||||||
|
|
||||||
|
config VNCSERVER_STACKSIZE
|
||||||
|
int "VNC server stack size"
|
||||||
|
default 2048
|
||||||
|
|
||||||
endif # VNCSERVER
|
endif # VNCSERVER
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
ifeq ($(CONFIG_VNCSERVER),y)
|
ifeq ($(CONFIG_VNCSERVER),y)
|
||||||
|
|
||||||
CSRCS += vnc_server.c vnc_session.c
|
CSRCS += vnc_server.c vnc_session.c vnc_fbdev.c
|
||||||
|
|
||||||
DEPPATH += --dep-path vnc/server
|
DEPPATH += --dep-path vnc/server
|
||||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/vnc/server}
|
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/vnc/server}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,16 @@
|
|||||||
|
|
||||||
#include "vnc_server.h"
|
#include "vnc_server.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Given a display number as an index, the following array can be used to
|
||||||
|
* look-up the session structure for that display.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static FAR struct vnc_session_s *g_vnc_sessions[RFB_MAX_DISPLAYS];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pubic Functions
|
* Pubic Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -95,6 +105,8 @@ int vnc_server(int argc, FAR char *argv[])
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_vnc_sessions[display] = session;
|
||||||
|
|
||||||
/* Loop... handling each each VNC client connection to this display. Only
|
/* Loop... handling each each VNC client connection to this display. Only
|
||||||
* a single client is allowed for each display.
|
* a single client is allowed for each display.
|
||||||
*/
|
*/
|
||||||
@@ -120,3 +132,34 @@ int vnc_server(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
return EXIT_FAILURE; /* We won't get here */
|
return EXIT_FAILURE; /* We won't get here */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: vnc_find_session
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the session structure associated with this display.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* display - The display number of interest.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Returns the instance of the session structure allocated by
|
||||||
|
* vnc_create_session() for this display. NULL will be returned if the
|
||||||
|
* server has not yet been started or if the display number is out of
|
||||||
|
* range.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
FAR struct vnc_session_s *vnc_find_session(int display)
|
||||||
|
{
|
||||||
|
FAR struct vnc_session_s *session = NULL;
|
||||||
|
|
||||||
|
DEBUGASSERT(display >= 0 && display < RFB_MAX_DISPLAYS);
|
||||||
|
|
||||||
|
if (display >= 0 && display < RFB_MAX_DISPLAYS)
|
||||||
|
{
|
||||||
|
session = &g_vnc_sessions[display];
|
||||||
|
}
|
||||||
|
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|||||||
@@ -52,11 +52,24 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/* Configuration */
|
||||||
|
|
||||||
|
#ifndef CONFIG_VNCSERVER_NDISPLAYS
|
||||||
|
# define CONFIG_VNCSERVER_NDISPLAYS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_VNCSERVER_PRIO
|
||||||
|
# define CONFIG_VNCSERVER_PRIO 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_VNCSERVER_STACKSIZE
|
||||||
|
# define CONFIG_VNCSERVER_STACKSIZE 2048
|
||||||
|
#endif
|
||||||
|
|
||||||
/* RFB Port Number */
|
/* RFB Port Number */
|
||||||
|
|
||||||
#define RFB_PORT_BASE 5900
|
#define RFB_PORT_BASE 5900
|
||||||
#define RFB_MAX_DISPLAYS 100
|
#define RFB_MAX_DISPLAYS CONFIG_VNCSERVER_NDISPLAYS
|
||||||
#define RFB_DISPLAY_PORT(d) (RFB_PORT_BASE + (d))
|
#define RFB_DISPLAY_PORT(d) (RFB_PORT_BASE + (d))
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -99,6 +112,30 @@ struct vnc_session_s
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: vnc_server
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* The VNC server daemon. This daemon is implemented as a kernel thread.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* Standard kernel thread arguments (all ignored)
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* This function does not return.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int vnc_server(int argc, FAR char *argv[]);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: vnc_connect
|
* Name: vnc_connect
|
||||||
*
|
*
|
||||||
@@ -170,4 +207,28 @@ void vnc_release_session(FAR struct vnc_session_s *session);
|
|||||||
|
|
||||||
int vnc_session(FAR struct vnc_session_s *session);
|
int vnc_session(FAR struct vnc_session_s *session);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: vnc_find_session
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the session structure associated with this display.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* display - The display number of interest.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Returns the instance of the session structure allocated by
|
||||||
|
* vnc_create_session() for this display. NULL will be returned if the
|
||||||
|
* server has not yet been started or if the display number is out of
|
||||||
|
* range.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
FAR struct vnc_session_s *vnc_find_session(int display);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __GRAPHICS_VNC_SERVER_VNC_SERVER_H */
|
#endif /* __GRAPHICS_VNC_SERVER_VNC_SERVER_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user