VNC: Add hooks to receive updates when the display is modified

This commit is contained in:
Gregory Nutt
2016-04-17 12:26:03 -06:00
parent 0de102706e
commit 1214f99c25
4 changed files with 110 additions and 2 deletions
+52 -1
View File
@@ -406,7 +406,7 @@ int up_fbinitialize(int 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);
argv[0] = str;
@@ -513,3 +513,54 @@ void up_fbuninitialize(int display)
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