VNC: Add hooks to receive updates when the display is modified
This commit is contained in:
parent
0de102706e
commit
1214f99c25
@ -8,6 +8,7 @@ menuconfig VNCSERVER
|
|||||||
default n
|
default n
|
||||||
depends on NET_TCP && !NX_LCDDRIVER && EXPERIMENTAL
|
depends on NET_TCP && !NX_LCDDRIVER && EXPERIMENTAL
|
||||||
select NET_TCP_READAHEAD
|
select NET_TCP_READAHEAD
|
||||||
|
select NX_UPDATE
|
||||||
---help---
|
---help---
|
||||||
Enable support for a VNC Remote Frame Buffer (RFB) server.
|
Enable support for a VNC Remote Frame Buffer (RFB) server.
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ int up_fbinitialize(int display)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
gvdbg("Starting the VNC server for display %d\n", display);
|
gvdbg("Starting the VNC server for display %d\n", display);
|
||||||
DEBUGASSERT(display >= 8 && display < RFB_MAX_DISPLAYS);
|
DEBUGASSERT(display >= 0 && display < RFB_MAX_DISPLAYS);
|
||||||
|
|
||||||
(void)itoa(display, str, 10);
|
(void)itoa(display, str, 10);
|
||||||
argv[0] = str;
|
argv[0] = str;
|
||||||
@ -513,3 +513,54 @@ void up_fbuninitialize(int display)
|
|||||||
UNUSED(fbinfo);
|
UNUSED(fbinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nx_notify_rectangle
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* When CONFIG_NX_UPDATE=y, then the graphics system will callout to
|
||||||
|
* inform some external module that the display has been updated. This
|
||||||
|
* would be useful in a couple for cases.
|
||||||
|
*
|
||||||
|
* - When a serial LCD is used, but a framebuffer is used to access the
|
||||||
|
* LCD. In this case, the update callout can be used to refresh the
|
||||||
|
* affected region of the display.
|
||||||
|
*
|
||||||
|
* - When VNC is enabled. This is case, this callout is necessary to
|
||||||
|
* update the remote frame buffer to match the local framebuffer.
|
||||||
|
*
|
||||||
|
* When this feature is enabled, some external logic must provide this
|
||||||
|
* interface. This is the function that will handle the notification. It
|
||||||
|
* receives the rectangular region that was updated on the provided plane.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
|
||||||
|
FAR const struct nxgl_rect_s *rect)
|
||||||
|
{
|
||||||
|
FAR struct vnc_session_s *session;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
DEBUGASSERT(pinfo != NULL && rect != NULL);
|
||||||
|
|
||||||
|
/* Recover the session informatin from the display number in the planeinfo
|
||||||
|
* structure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DEBUGASSERT(pinfo->display >= 0 && pinfo->display < RFB_MAX_DISPLAYS);
|
||||||
|
session = vnc_find_session(pinfo->display);
|
||||||
|
|
||||||
|
/* Verify that the session is still valid */
|
||||||
|
|
||||||
|
if (session != NULL && session->state == VNCSERVER_RUNNING)
|
||||||
|
{
|
||||||
|
/* Queue the rectangular update */
|
||||||
|
|
||||||
|
ret = vnc_update_rectangle(session, rect);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
gdbg("ERROR: vnc_update_rectangle failed: %d\n", ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -56,6 +56,14 @@
|
|||||||
|
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
|
|
||||||
|
#ifndef CONFIG_NET_TCP_READAHEAD
|
||||||
|
# error CONFIG_NET_TCP_READAHEAD must be set to use VNC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_NX_UPDATE
|
||||||
|
# error CONFIG_NX_UPDATE must be set to use VNC
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(CONFIG_VNCSERVER_PROTO3p3) && !defined(CONFIG_VNCSERVER_PROTO3p8)
|
#if !defined(CONFIG_VNCSERVER_PROTO3p3) && !defined(CONFIG_VNCSERVER_PROTO3p8)
|
||||||
# error No VNC protocol selected
|
# error No VNC protocol selected
|
||||||
#endif
|
#endif
|
||||||
@ -268,6 +276,25 @@ int vnc_start_updater(FAR struct vnc_session_s *session);
|
|||||||
|
|
||||||
int vnc_stop_updater(FAR struct vnc_session_s *session);
|
int vnc_stop_updater(FAR struct vnc_session_s *session);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: vnc_update_rectangle
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Queue an update of the specified rectangular region on the display.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* session - An instance of the session structure.
|
||||||
|
* rect - The rectanglular region to be updated.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||||
|
FAR const struct nxgl_rect_s *rect);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: vnc_receiver
|
* Name: vnc_receiver
|
||||||
*
|
*
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "vnc_server.h"
|
#include "vnc_server.h"
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ static FAR void *vnc_updater(FAR void *arg)
|
|||||||
#warning Missing logic
|
#warning Missing logic
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -169,3 +170,31 @@ int vnc_stop_updater(FAR struct vnc_session_s *session)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: vnc_update_rectangle
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Queue an update of the specified rectangular region on the display.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* session - An instance of the session structure.
|
||||||
|
* rect - The rectanglular region to be updated.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||||
|
FAR const struct nxgl_rect_s *rect)
|
||||||
|
{
|
||||||
|
/* Make sure that the rectangle has a area */
|
||||||
|
|
||||||
|
if (!nxgl_nullrect(rect))
|
||||||
|
{
|
||||||
|
#warning Missing logic
|
||||||
|
}
|
||||||
|
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user