diff --git a/Documentation/reference/user/13_boardctl.rst b/Documentation/reference/user/13_boardctl.rst index 2195db22834..71811c8782b 100644 --- a/Documentation/reference/user/13_boardctl.rst +++ b/Documentation/reference/user/13_boardctl.rst @@ -208,7 +208,7 @@ Graphics :configuration: CONFIG_VNCSERVER - :dependencies: VNC server provides :c:func:`vnc_default_fbinitialize`. + :dependencies: VNC server provides :c:func:`nx_vnc_fbinitialize`. .. c:macro:: BOARDIOC_NXTERM diff --git a/boards/boardctl.c b/boards/boardctl.c index 78d96e82941..6ace288ac65 100644 --- a/boards/boardctl.c +++ b/boards/boardctl.c @@ -657,7 +657,7 @@ int boardctl(unsigned int cmd, uintptr_t arg) * ARG: A reference readable instance of struct * boardioc_vncstart_s * CONFIGURATION: CONFIG_VNCSERVER - * DEPENDENCIES: VNC server provides vnc_default_fbinitialize() + * DEPENDENCIES: VNC server provides nx_vnc_fbinitialize() */ case BOARDIOC_VNC_START: @@ -673,7 +673,7 @@ int boardctl(unsigned int cmd, uintptr_t arg) { /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(vnc->display, vnc->handle); + ret = nx_vnc_fbinitialize(vnc->display, vnc->handle); } } break; diff --git a/graphics/vnc/client/Kconfig b/graphics/vnc/client/Kconfig index 212cb5cce8e..fd8ece4edae 100644 --- a/graphics/vnc/client/Kconfig +++ b/graphics/vnc/client/Kconfig @@ -6,7 +6,7 @@ menuconfig VNCCLIENT bool "VNC client" default n - depends on NET_TCP && !NX_LCDDRIVER && !VNC_SERVER && EXPERIMENTAL + depends on NET_TCP && !VNC_SERVER && EXPERIMENTAL ---help--- Enable support for a VNC Remote Frame Buffer (RFB) client diff --git a/graphics/vnc/server/Kconfig b/graphics/vnc/server/Kconfig index 70146a34cf2..878ff13127b 100644 --- a/graphics/vnc/server/Kconfig +++ b/graphics/vnc/server/Kconfig @@ -6,7 +6,7 @@ menuconfig VNCSERVER bool "VNC server" default n - depends on NET_TCP && !NX_LCDDRIVER + depends on NET_TCP select FB_UPDATE ---help--- Enable support for a VNC Remote Frame Buffer (RFB) server. diff --git a/graphics/vnc/server/Make.defs b/graphics/vnc/server/Make.defs index e3359f19fd9..4fbcf5fd873 100644 --- a/graphics/vnc/server/Make.defs +++ b/graphics/vnc/server/Make.defs @@ -21,11 +21,7 @@ ifeq ($(CONFIG_VNCSERVER),y) CSRCS += vnc_server.c vnc_negotiate.c vnc_updater.c vnc_receiver.c -CSRCS += vnc_raw.c vnc_rre.c vnc_color.c vnc_fbdev.c - -ifeq ($(CONFIG_NX_KBD),y) -CSRCS += vnc_keymap.c -endif +CSRCS += vnc_raw.c vnc_rre.c vnc_color.c vnc_fbdev.c vnc_keymap.c DEPPATH += --dep-path vnc/server CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)/graphics/vnc/server} diff --git a/graphics/vnc/server/vnc_color.c b/graphics/vnc/server/vnc_color.c index 5757e293d6e..7edb0b6550f 100644 --- a/graphics/vnc/server/vnc_color.c +++ b/graphics/vnc/server/vnc_color.c @@ -275,15 +275,15 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb) ****************************************************************************/ int vnc_colors(FAR struct vnc_session_s *session, - FAR struct nxgl_rect_s *rect, + FAR struct fb_area_s *rect, unsigned int maxcolors, FAR lfb_color_t *colors) { FAR const lfb_color_t *rowstart; FAR const lfb_color_t *pixptr; lfb_color_t pixel; - nxgl_coord_t x; - nxgl_coord_t y; + fb_coord_t x; + fb_coord_t y; int ncolors = 0; int pixndx; int maxndx; @@ -299,17 +299,17 @@ int vnc_colors(FAR struct vnc_session_s *session, /* Pointer to the first pixel in the first row in the local framebuffer */ rowstart = (FAR lfb_color_t *) - (session->fb + RFB_STRIDE * rect->pt1.y + - RFB_BYTESPERPIXEL * rect->pt1.x); + (session->fb + RFB_STRIDE * rect->y + + RFB_BYTESPERPIXEL * rect->x); /* Loop for each row in the rectangle */ - for (y = rect->pt1.y; y <= rect->pt2.y; y++) + for (y = 0; y < rect->h; y++) { /* Loop for each column in the row */ pixptr = rowstart; - for (x = rect->pt1.x; x <= rect->pt2.x; x++) + for (x = 0; x < rect->w; x++) { /* Compare this pix to all of the others we have seen */ diff --git a/graphics/vnc/server/vnc_fbdev.c b/graphics/vnc/server/vnc_fbdev.c index 90715620525..14e81b9ff0d 100644 --- a/graphics/vnc/server/vnc_fbdev.c +++ b/graphics/vnc/server/vnc_fbdev.c @@ -418,7 +418,6 @@ static int up_updateearea(FAR struct fb_vtable_s *vtable, { FAR struct vnc_fbinfo_s *fbinfo = (FAR struct vnc_fbinfo_s *)vtable; FAR struct vnc_session_s *session; - struct nxgl_rect_s rect; int ret = OK; DEBUGASSERT(fbinfo != NULL && area != NULL); @@ -436,8 +435,7 @@ static int up_updateearea(FAR struct fb_vtable_s *vtable, { /* Queue the rectangular update */ - nxgl_area2rect(&rect, area); - ret = vnc_update_rectangle(session, &rect, true); + ret = vnc_update_rectangle(session, area, true); if (ret < 0) { gerr("ERROR: vnc_update_rectangle failed: %d\n", ret); @@ -733,8 +731,6 @@ int up_fbinitialize(int display) * called, however, keyboard/mouse inputs from the remote VNC client will * be lost. By calling vnc_fbinitialize(), you can provide callout * functions that can be received by logic higher in the architecture. - * These higher level callouts can then call nx_kbdin() or nx_mousein() on - * behalf of the VNC server. * * Input Parameters: * display - In the case of hardware with multiple displays, this diff --git a/graphics/vnc/server/vnc_keymap.c b/graphics/vnc/server/vnc_keymap.c index 0271bdfb771..4d889b91ee7 100644 --- a/graphics/vnc/server/vnc_keymap.c +++ b/graphics/vnc/server/vnc_keymap.c @@ -34,15 +34,12 @@ #define XK_LATIN1 1 #define XK_XKB_KEYS 1 -#include #include #include #include #include "vnc_server.h" -#ifdef CONFIG_NX_KBD - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -611,30 +608,3 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym, } #endif } - -/**************************************************************************** - * Name: vnc_kbdout - * - * Description: - * This is the default keyboard callout function. - * This is simply wrappers around nx_kdbout(), respectively. - * When configured using vnc_fbinitialize(), the 'arg' must be the correct - * NXHANDLE value. - * - * Input Parameters: - * arg - The NXHANDLE from the NX graphics subsystem - * nch - Number of characters - * ch - An array of input characters. - * - * Returned Value: - * None - * - ****************************************************************************/ - -void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch) -{ - DEBUGASSERT(arg != NULL); - nx_kbdin((NXHANDLE)arg, nch, ch); -} - -#endif /* CONFIG_NX_KBD */ diff --git a/graphics/vnc/server/vnc_raw.c b/graphics/vnc/server/vnc_raw.c index af8002e730d..70d6622228f 100644 --- a/graphics/vnc/server/vnc_raw.c +++ b/graphics/vnc/server/vnc_raw.c @@ -71,16 +71,16 @@ ****************************************************************************/ static size_t vnc_copy8(FAR struct vnc_session_s *session, - nxgl_coord_t row, nxgl_coord_t col, - nxgl_coord_t height, nxgl_coord_t width, + fb_coord_t row, fb_coord_t col, + fb_coord_t height, fb_coord_t width, vnc_convert8_t convert) { FAR struct rfb_framebufferupdate_s *update; FAR const lfb_color_t *srcleft; FAR const lfb_color_t *src; FAR uint8_t *dest; - nxgl_coord_t x; - nxgl_coord_t y; + fb_coord_t x; + fb_coord_t y; /* Destination rectangle start address */ @@ -129,8 +129,8 @@ static size_t vnc_copy8(FAR struct vnc_session_s *session, ****************************************************************************/ static size_t vnc_copy16(FAR struct vnc_session_s *session, - nxgl_coord_t row, nxgl_coord_t col, - nxgl_coord_t height, nxgl_coord_t width, + fb_coord_t row, fb_coord_t col, + fb_coord_t height, fb_coord_t width, vnc_convert16_t convert) { FAR struct rfb_framebufferupdate_s *update; @@ -138,8 +138,8 @@ static size_t vnc_copy16(FAR struct vnc_session_s *session, FAR const lfb_color_t *src; FAR uint8_t *dest; uint16_t pixel; - nxgl_coord_t x; - nxgl_coord_t y; + fb_coord_t x; + fb_coord_t y; bool bigendian; /* Destination rectangle start address */ @@ -201,16 +201,16 @@ static size_t vnc_copy16(FAR struct vnc_session_s *session, ****************************************************************************/ static size_t vnc_copy32(FAR struct vnc_session_s *session, - nxgl_coord_t row, nxgl_coord_t col, - nxgl_coord_t height, nxgl_coord_t width, + fb_coord_t row, fb_coord_t col, + fb_coord_t height, fb_coord_t width, vnc_convert32_t convert) { FAR struct rfb_framebufferupdate_s *update; FAR const lfb_color_t *srcleft; FAR const lfb_color_t *src; FAR uint8_t *dest; - nxgl_coord_t x; - nxgl_coord_t y; + fb_coord_t x; + fb_coord_t y; uint32_t pixel; bool bigendian; @@ -275,20 +275,20 @@ static size_t vnc_copy32(FAR struct vnc_session_s *session, * ****************************************************************************/ -int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) +int vnc_raw(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect) { FAR struct rfb_framebufferupdate_s *update; FAR const uint8_t *src; - nxgl_coord_t srcwidth; - nxgl_coord_t srcheight; - nxgl_coord_t destwidth; - nxgl_coord_t destheight; - nxgl_coord_t deststride; - nxgl_coord_t updwidth; - nxgl_coord_t updheight; - nxgl_coord_t width; - nxgl_coord_t x; - nxgl_coord_t y; + fb_coord_t srcwidth; + fb_coord_t srcheight; + fb_coord_t destwidth; + fb_coord_t destheight; + fb_coord_t deststride; + fb_coord_t updwidth; + fb_coord_t updheight; + fb_coord_t width; + fb_coord_t x; + fb_coord_t y; unsigned int bytesperpixel; unsigned int maxwidth; size_t size; @@ -345,11 +345,8 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) * In that case, we will have to emit multiple rectangles. */ - DEBUGASSERT(rect->pt1.x <= rect->pt2.x); - srcwidth = rect->pt2.x - rect->pt1.x + 1; - - DEBUGASSERT(rect->pt1.y <= rect->pt2.y); - srcheight = rect->pt2.y - rect->pt1.y + 1; + srcwidth = rect->w; + srcheight = rect->h; deststride = srcwidth * bytesperpixel; if (deststride > maxwidth) @@ -385,7 +382,7 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) * asynchronously. */ - for (y = rect->pt1.y; + for (y = rect->y; srcheight > 0 && colorfmt == session->colorfmt; srcheight -= updheight, y += updheight) { @@ -410,7 +407,7 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) * changes asynchronously. */ - for (width = srcwidth, x = rect->pt1.x; + for (width = srcwidth, x = rect->x; width > 0 && colorfmt == session->colorfmt; width -= updwidth, x += updwidth) { diff --git a/graphics/vnc/server/vnc_receiver.c b/graphics/vnc/server/vnc_receiver.c index d8986e6214f..580386e7b81 100644 --- a/graphics/vnc/server/vnc_receiver.c +++ b/graphics/vnc/server/vnc_receiver.c @@ -51,8 +51,7 @@ #include #include #include -#include -#include +#include #include "vnc_server.h" @@ -266,7 +265,7 @@ int vnc_receiver(FAR struct vnc_session_s *session) case RFB_FBUPDATEREQ_MSG: /* FramebufferUpdateRequest */ { FAR struct rfb_fbupdatereq_s *update; - struct nxgl_rect_s rect; + struct fb_area_s rect; ginfo("Received FramebufferUpdateRequest\n"); @@ -287,10 +286,10 @@ int vnc_receiver(FAR struct vnc_session_s *session) update = (FAR struct rfb_fbupdatereq_s *)session->inbuf; - rect.pt1.x = rfb_getbe16(update->xpos); - rect.pt1.y = rfb_getbe16(update->ypos); - rect.pt2.x = rect.pt1.x + rfb_getbe16(update->width); - rect.pt2.y = rect.pt1.y + rfb_getbe16(update->height); + rect.x = rfb_getbe16(update->xpos); + rect.y = rfb_getbe16(update->ypos); + rect.w = rfb_getbe16(update->width); + rect.h = rfb_getbe16(update->height); ret = vnc_update_rectangle(session, &rect, false); if (ret < 0) @@ -330,10 +329,9 @@ int vnc_receiver(FAR struct vnc_session_s *session) case RFB_POINTEREVENT_MSG: /* PointerEvent */ { -#ifdef CONFIG_NX_XYINPUT FAR struct rfb_pointerevent_s *event; uint8_t buttons; -#endif + ginfo("Received PointerEvent\n"); /* Read the rest of the PointerEvent message */ @@ -346,10 +344,6 @@ int vnc_receiver(FAR struct vnc_session_s *session) gerr("ERROR: Failed to read PointerEvent message: %d\n", ret); } -#ifdef CONFIG_NX_XYINPUT - - /* REVISIT: How will be get the NX handle? */ - else if (session->mouseout != NULL) { event = (FAR struct rfb_pointerevent_s *)session->inbuf; @@ -362,25 +356,24 @@ int vnc_receiver(FAR struct vnc_session_s *session) buttons = 0; if ((event->buttons & (1 << 0)) != 0) { - buttons |= NX_MOUSE_LEFTBUTTON; + buttons |= MOUSE_BUTTON_1; } if ((event->buttons & (1 << 1)) != 0) { - buttons |= NX_MOUSE_CENTERBUTTON; + buttons |= MOUSE_BUTTON_2; } if ((event->buttons & (1 << 2)) != 0) { - buttons |= NX_MOUSE_RIGHTBUTTON; + buttons |= MOUSE_BUTTON_3; } session->mouseout(session->arg, - (nxgl_coord_t)rfb_getbe16(event->xpos), - (nxgl_coord_t)rfb_getbe16(event->ypos), + (fb_coord_t)rfb_getbe16(event->xpos), + (fb_coord_t)rfb_getbe16(event->ypos), buttons); } -#endif } break; @@ -483,31 +476,3 @@ int vnc_client_encodings(FAR struct vnc_session_s *session, session->change = true; return OK; } - -/**************************************************************************** - * Name: vnc_mouse - * - * Description: - * This is the default keyboard/mouse callout function. This is simply a - * wrapper around nx_mousein(). When - * configured using vnc_fbinitialize(), the 'arg' must be the correct - * NXHANDLE value. - * - * Input Parameters: - * See vnc_mouseout_t and vnc_kbdout_t typde definitions above. These - * callouts have arguments that match the inputs to nx_kbdin() and - * nx_mousein() (if arg is really of type NXHANDLE). - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_NX_XYINPUT -void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y, - uint8_t buttons) -{ - DEBUGASSERT(arg != NULL); - nx_mousein((NXHANDLE)arg, x, y, buttons); -} -#endif diff --git a/graphics/vnc/server/vnc_rre.c b/graphics/vnc/server/vnc_rre.c index 7fd07ecfc1e..384bbb21b6c 100644 --- a/graphics/vnc/server/vnc_rre.c +++ b/graphics/vnc/server/vnc_rre.c @@ -92,74 +92,48 @@ struct rre_encode32_s ssize_t vnc_rre8(FAR struct vnc_session_s *session, FAR struct rre_encode8_s *dest, - FAR struct nxgl_rect_s *rect, + FAR struct fb_area_s *rect, uint8_t bgcolor) { - nxgl_coord_t width; - nxgl_coord_t height; - rfb_putbe32(dest->hdr.nsubrects, 1); dest->hdr.pixel = bgcolor; - dest->rect.pixel = bgcolor; - rfb_putbe16(dest->rect.xpos, rect->pt1.x); - rfb_putbe16(dest->rect.ypos, rect->pt1.y); - - width = rect->pt2.x - rect->pt1.x + 1; - height = rect->pt2.y - rect->pt1.y + 1; - - rfb_putbe16(dest->rect.width, width); - rfb_putbe16(dest->rect.height, height); + rfb_putbe16(dest->rect.xpos, rect->x); + rfb_putbe16(dest->rect.ypos, rect->y); + rfb_putbe16(dest->rect.width, rect->w); + rfb_putbe16(dest->rect.height, rect->h); return sizeof(struct rre_encode8_s); } ssize_t vnc_rre16(FAR struct vnc_session_s *session, FAR struct rre_encode16_s *dest, - FAR struct nxgl_rect_s *rect, + FAR struct fb_area_s *rect, uint16_t bgcolor) { - nxgl_coord_t width; - nxgl_coord_t height; - rfb_putbe32(dest->hdr.nsubrects, 1); rfb_putbe16(dest->hdr.pixel, bgcolor); - rfb_putbe16(dest->rect.pixel, bgcolor); - rfb_putbe16(dest->rect.xpos, rect->pt1.x); - rfb_putbe16(dest->rect.xpos, rect->pt1.x); - rfb_putbe16(dest->rect.ypos, rect->pt1.y); - - width = rect->pt2.x - rect->pt1.x + 1; - height = rect->pt2.y - rect->pt1.y + 1; - - rfb_putbe16(dest->rect.width, width); - rfb_putbe16(dest->rect.height, height); + rfb_putbe16(dest->rect.xpos, rect->x); + rfb_putbe16(dest->rect.ypos, rect->y); + rfb_putbe16(dest->rect.width, rect->w); + rfb_putbe16(dest->rect.height, rect->h); return sizeof(struct rre_encode16_s); } ssize_t vnc_rre32(FAR struct vnc_session_s *session, FAR struct rre_encode32_s *dest, - FAR struct nxgl_rect_s *rect, + FAR struct fb_area_s *rect, uint32_t bgcolor) { - nxgl_coord_t width; - nxgl_coord_t height; - rfb_putbe32(dest->hdr.nsubrects, 1); rfb_putbe32(dest->hdr.pixel, bgcolor); - rfb_putbe32(dest->rect.pixel, bgcolor); - rfb_putbe16(dest->rect.xpos, rect->pt1.x); - rfb_putbe16(dest->rect.xpos, rect->pt1.x); - rfb_putbe16(dest->rect.ypos, rect->pt1.y); - - width = rect->pt2.x - rect->pt1.x + 1; - height = rect->pt2.y - rect->pt1.y + 1; - - rfb_putbe16(dest->rect.width, width); - rfb_putbe16(dest->rect.height, height); + rfb_putbe16(dest->rect.xpos, rect->x); + rfb_putbe16(dest->rect.ypos, rect->y); + rfb_putbe16(dest->rect.width, rect->w); + rfb_putbe16(dest->rect.height, rect->h); return sizeof(struct rre_encode32_s); } @@ -189,13 +163,11 @@ ssize_t vnc_rre32(FAR struct vnc_session_s *session, * ****************************************************************************/ -int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) +int vnc_rre(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect) { FAR struct rfb_framebufferupdate_s *rre; FAR struct rfb_rectangle_s *rrect; lfb_color_t bgcolor; - nxgl_coord_t width; - nxgl_coord_t height; size_t nbytes; ssize_t nsent; int ret; @@ -209,9 +181,6 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) ret = vnc_colors(session, rect, 1, &bgcolor); if (ret == 1) { - width = rect->pt2.x - rect->pt1.x + 1; - height = rect->pt2.y - rect->pt1.y + 1; - /* Format the FrameBuffer Update with a single RRE encoded * rectangle. */ @@ -223,10 +192,10 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) rfb_putbe16(rre->nrect, 1); rrect = (FAR struct rfb_rectangle_s *)&rre->rect; - rfb_putbe16(rrect->xpos, rect->pt1.x); - rfb_putbe16(rrect->ypos, rect->pt1.y); - rfb_putbe16(rrect->width, width); - rfb_putbe16(rrect->height, height); + rfb_putbe16(rrect->xpos, rect->x); + rfb_putbe16(rrect->ypos, rect->y); + rfb_putbe16(rrect->width, rect->w); + rfb_putbe16(rrect->height, rect->h); rfb_putbe32(rrect->encoding, RFB_ENCODING_RRE); /* The sub-rectangle encoding depends of the remote pixel width */ @@ -292,7 +261,7 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect) DEBUGASSERT(nsent == nbytes); updinfo("Sent {(%d, %d),(%d, %d)}\n", - rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y); + rect->x, rect->y, rect->w, rect->h); return nbytes; } diff --git a/graphics/vnc/server/vnc_server.h b/graphics/vnc/server/vnc_server.h index 7ce0ffd6def..2f9ea96939c 100644 --- a/graphics/vnc/server/vnc_server.h +++ b/graphics/vnc/server/vnc_server.h @@ -34,8 +34,6 @@ #include #include #include -#include -#include #include #include @@ -196,7 +194,7 @@ struct vnc_fbupdate_s { FAR struct vnc_fbupdate_s *flink; bool whupd; /* True: whole screen update */ - struct nxgl_rect_s rect; /* The enqueued update rectangle */ + struct fb_area_s rect; /* The enqueued update rectangle */ }; struct vnc_session_s @@ -424,7 +422,7 @@ int vnc_stop_updater(FAR struct vnc_session_s *session); ****************************************************************************/ int vnc_update_rectangle(FAR struct vnc_session_s *session, - FAR const struct nxgl_rect_s *rect, + FAR const struct fb_area_s *rect, bool change); /**************************************************************************** @@ -464,7 +462,7 @@ int vnc_receiver(FAR struct vnc_session_s *session); * ****************************************************************************/ -int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect); +int vnc_rre(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect); /**************************************************************************** * Name: vnc_raw @@ -484,7 +482,7 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect); * ****************************************************************************/ -int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect); +int vnc_raw(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect); /**************************************************************************** * Name: vnc_key_map @@ -503,10 +501,8 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect); * ****************************************************************************/ -#ifdef CONFIG_NX_KBD void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym, bool keydown); -#endif /**************************************************************************** * Name: vnc_convert_rgbNN @@ -556,7 +552,7 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb); ****************************************************************************/ int vnc_colors(FAR struct vnc_session_s *session, - FAR struct nxgl_rect_s *rect, + FAR struct fb_area_s *rect, unsigned int maxcolors, FAR lfb_color_t *colors); #undef EXTERN diff --git a/graphics/vnc/server/vnc_updater.c b/graphics/vnc/server/vnc_updater.c index 9d3fe273b82..f2a7958c527 100644 --- a/graphics/vnc/server/vnc_updater.c +++ b/graphics/vnc/server/vnc_updater.c @@ -67,16 +67,9 @@ static sem_t g_errsem = SEM_INITIALIZER(1); /* A rectangle represent the entire local framebuffer */ -static const struct nxgl_rect_s g_wholescreen = +static const struct fb_area_s g_wholescreen = { - { - 0, - 0 - }, - { - CONFIG_VNCSERVER_SCREENWIDTH - 1, - CONFIG_VNCSERVER_SCREENHEIGHT - 1 - } + 0, 0, CONFIG_VNCSERVER_SCREENWIDTH, CONFIG_VNCSERVER_SCREENHEIGHT }; /**************************************************************************** @@ -379,8 +372,8 @@ static FAR void *vnc_updater(FAR void *arg) DEBUGASSERT(srcrect != NULL); updinfo("Dequeued {(%d, %d),(%d, %d)}\n", - srcrect->rect.pt1.x, srcrect->rect.pt1.y, - srcrect->rect.pt2.x, srcrect->rect.pt2.y); + srcrect->rect.x, srcrect->rect.y, + srcrect->rect.w, srcrect->rect.h); /* Attempt to use RRE encoding */ @@ -536,26 +529,45 @@ int vnc_stop_updater(FAR struct vnc_session_s *session) ****************************************************************************/ int vnc_update_rectangle(FAR struct vnc_session_s *session, - FAR const struct nxgl_rect_s *rect, bool change) + FAR const struct fb_area_s *rect, bool change) { FAR struct vnc_fbupdate_s *update; - struct nxgl_rect_s intersection; + struct fb_area_s intersection; bool whupd; + intersection.x = rect->x; + intersection.y = rect->y; + /* Clip rectangle to the screen dimensions */ - nxgl_rectintersect(&intersection, rect, &g_wholescreen); + if (rect->w < g_wholescreen.w) + { + intersection.w = rect->w; + } + else + { + intersection.w = g_wholescreen.w; + } - /* Make sure that the clipped rectangle has a area */ + if (rect->h < g_wholescreen.h) + { + intersection.h = rect->h; + } + else + { + intersection.h = g_wholescreen.h; + } - if (!nxgl_nullrect(&intersection)) + /* Make sure that the clipped rectangle has an area */ + + if (intersection.w && intersection.h) { /* Check for a whole screen update. The RealVNC client sends a lot * of these (especially when it is confused) */ whupd = (memcmp(&intersection, &g_wholescreen, - sizeof(struct nxgl_rect_s)) == 0); + sizeof(struct fb_area_s)) == 0); /* Ignore any client update requests if there have been no changes to * the framebuffer since the last whole screen update. @@ -621,15 +633,15 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session, /* Copy the clipped rectangle into the update structure */ update->whupd = whupd; - nxgl_rectcopy(&update->rect, &intersection); + memcpy(&update->rect, &intersection, sizeof(intersection)); /* Add the update to the end of the update queue. */ vnc_add_queue(session, update); updinfo("Queued {(%d, %d),(%d, %d)}\n", - intersection.pt1.x, intersection.pt1.y, - intersection.pt2.x, intersection.pt2.y); + intersection.x, intersection.y, + intersection.w, intersection.h); } sched_unlock(); diff --git a/include/nuttx/nx/nx.h b/include/nuttx/nx/nx.h index b30bfdf2fb1..2a242ed94d9 100644 --- a/include/nuttx/nx/nx.h +++ b/include/nuttx/nx/nx.h @@ -31,6 +31,7 @@ #include #include +#include /**************************************************************************** * Pre-processor Definitions @@ -258,6 +259,49 @@ extern "C" * Public Function Prototypes ****************************************************************************/ +/**************************************************************************** + * Name: nx_vnc_fbinitialize + * + * Description: + * This is just a wrapper around vnc_fbinitialize() that will establish + * the default mouse and keyboard callout functions. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * handle - And instance of NXHANDLE returned from initialization of the + * NX graphics system for that display. + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. + * + ****************************************************************************/ + +/* int nx_vnc_fbinitialize(int display, NXHANDLE handle); */ + +#if defined(CONFIG_NX_KBD) && defined(CONFIG_NX_XYINPUT) + +# define nx_vnc_fbinitialize(d,h) \ + vnc_fbinitialize((d), nx_kbdin, nx_mousein, (FAR void *)(h)) + +#elif defined(CONFIG_NX_KBD) + +# define nx_vnc_fbinitialize(d,h) \ + vnc_fbinitialize((d), nx_kbdin, NULL, (FAR void *)(h)) + +#elif defined(CONFIG_NX_XYINPUT) + +# define nx_vnc_fbinitialize(d,h) \ + vnc_fbinitialize((d), NULL, nx_mousein, (FAR void *)(h)) + +#else + +# define nx_vnc_fbinitialize(d,h) \ + vnc_fbinitialize((d), NULL, NULL, NULL) + +#endif + /**************************************************************************** * Name: nx_runinstance (and nx_run macro) * diff --git a/include/nuttx/video/vnc.h b/include/nuttx/video/vnc.h index 6761a072019..94111c32331 100644 --- a/include/nuttx/video/vnc.h +++ b/include/nuttx/video/vnc.h @@ -29,8 +29,6 @@ #include -#include - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -41,10 +39,10 @@ * the inputs to nx_kbdin() and nx_mousein(). */ -typedef CODE void (*vnc_mouseout_t)(FAR void *arg, nxgl_coord_t x, - nxgl_coord_t y, uint8_t buttons); -typedef CODE void (*vnc_kbdout_t)(FAR void *arg, uint8_t nch, - FAR const uint8_t *ch); +typedef CODE int (*vnc_mouseout_t)(FAR void *arg, int16_t x, + int16_t y, uint8_t buttons); +typedef CODE int (*vnc_kbdout_t)(FAR void *arg, uint8_t nch, + FAR const uint8_t *ch); /**************************************************************************** * Public Function Prototypes @@ -93,7 +91,7 @@ extern "C" * These higher level callouts can then call nx_kbdin() or nx_mousein() on * behalf of the VNC server. * - * See also vnc_default_fbinitialize() below. + * See also nx_vnc_fbinitialize() in include/nuttx/nx/nx.h. * * Input Parameters: * display - In the case of hardware with multiple displays, this @@ -116,79 +114,6 @@ extern "C" int vnc_fbinitialize(int display, vnc_kbdout_t kbdout, vnc_mouseout_t mouseout, FAR void *arg); -/**************************************************************************** - * Name: vnc_mouse and vnc_kbdout - * - * Description: - * These are the default keyboard/mouse callout functions. They are - * simply wrappers around nx_mousein() and nx_kdbout(), respectively. When - * configured using vnc_fbinitialize(), the 'arg' must be the correct - * NXHANDLE value. - * - * See also vnc_default_fbinitialize() below. - * - * Input Parameters: - * See vnc_mouseout_t and vnc_kbdout_t typde definitions above. These - * callouts have arguments that match the inputs to nx_kbdin() and - * nx_mousein() (if arg is really of type NXHANDLE). - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch); -#endif - -#ifdef CONFIG_NX_XYINPUT -void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y, - uint8_t buttons); -#endif - -/**************************************************************************** - * Name: vnc_default_fbinitialize - * - * Description: - * This is just a wrapper around vnc_fbinitialize() that will establish - * the default mouse and keyboard callout functions. - * - * Input Parameters: - * display - In the case of hardware with multiple displays, this - * specifies the display. Normally this is zero. - * handle - And instance of NXHANDLE returned from initialization of the - * NX graphics system for that display. - * - * Returned Value: - * Zero (OK) is returned on success. Otherwise, a negated errno value is - * returned to indicate the nature of the failure. - * - ****************************************************************************/ - -/* int vnc_default_fbinitialize(int display, NXHANDLE handle); */ - -#if defined(CONFIG_NX_KBD) && defined(CONFIG_NX_XYINPUT) - -#define vnc_default_fbinitialize(d,h) \ - vnc_fbinitialize((d), vnc_kbdout, vnc_mouseout, (FAR void *)(h)) - -#elif defined(CONFIG_NX_KBD) - -#define vnc_default_fbinitialize(d,h) \ - vnc_fbinitialize((d), vnc_kbdout, NULL, (FAR void *)(h)) - -#elif defined(CONFIG_NX_XYINPUT) - -#define vnc_default_fbinitialize(d,h) \ - vnc_fbinitialize((d), NULL, vnc_mouseout, (FAR void *)(h)) - -#else - -#define vnc_default_fbinitialize(d,h) \ - vnc_fbinitialize((d), NULL, NULL, NULL) - -#endif - #undef EXTERN #ifdef __cplusplus } diff --git a/include/sys/boardctl.h b/include/sys/boardctl.h index a1059ec5790..561a1e1f41f 100644 --- a/include/sys/boardctl.h +++ b/include/sys/boardctl.h @@ -155,7 +155,7 @@ * ARG: A reference readable instance of struct * boardioc_vncstart_s * CONFIGURATION: CONFIG_VNCSERVER - * DEPENDENCIES: VNC server provides vnc_default_fbinitialize() + * DEPENDENCIES: VNC server provides nx_vnc_fbinitialize() * * CMD: BOARDIOC_NXTERM * DESCRIPTION: Create an NX terminal device