diff --git a/configs/same70-xplained/twm4nx/defconfig b/configs/same70-xplained/twm4nx/defconfig index 99589e68f59..09fdcfc91b1 100644 --- a/configs/same70-xplained/twm4nx/defconfig +++ b/configs/same70-xplained/twm4nx/defconfig @@ -8,8 +8,7 @@ # CONFIG_ARCH_RAMFUNCS is not set # CONFIG_MMCSD_MMCSUPPORT is not set # CONFIG_MMCSD_SPI is not set -# CONFIG_NXTK_DEFAULT_BORDERCOLORS is not set -# CONFIG_NX_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_8BPP is not set # CONFIG_SAMV7_UART0 is not set # CONFIG_SAMV7_UART2 is not set # CONFIG_SAMV7_UART4 is not set @@ -60,7 +59,7 @@ CONFIG_NETDEV_STATISTICS=y CONFIG_NETUTILS_TELNETD=y CONFIG_NET_ARP_SEND=y CONFIG_NET_BROADCAST=y -CONFIG_NET_ETH_PKTSIZE=1514 +CONFIG_NET_ETH_PKTSIZE=870 CONFIG_NET_ICMP=y CONFIG_NET_ICMP_SOCKET=y CONFIG_NET_SOCKOPTS=y @@ -79,17 +78,7 @@ CONFIG_NXTERM_CACHESIZE=32 CONFIG_NXTERM_CURSORCHAR=95 CONFIG_NXTERM_MXCHARS=325 CONFIG_NXTERM_NXKBDIN=y -CONFIG_NXTK_BORDERCOLOR1=0x5cb7 -CONFIG_NXTK_BORDERCOLOR2=0x21c9 -CONFIG_NXTK_BORDERCOLOR3=0xffdf -CONFIG_NXWIDGETS_BPP=16 -CONFIG_NXWIDGETS_CUSTOM_EDGECOLORS=y -CONFIG_NXWIDGETS_CUSTOM_FILLCOLORS=y -CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=0x9dfb -CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR=0xc618 -CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=0xd73e -CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=0x21e9 -CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR=0xffdf +CONFIG_NXWIDGETS_BPP=8 CONFIG_NXWIDGETS_SIZEOFCHAR=1 CONFIG_NX_BLOCKING=y CONFIG_NX_KBD=y @@ -132,8 +121,9 @@ CONFIG_TWM4NX_ARCHINIT=y CONFIG_USART1_SERIAL_CONSOLE=y CONFIG_USER_ENTRYPOINT="twm4nx_main" CONFIG_VNCSERVER=y +CONFIG_VNCSERVER_COLORFMT_RGB8=y CONFIG_VNCSERVER_PRIO=120 CONFIG_VNCSERVER_SCREENHEIGHT=600 CONFIG_VNCSERVER_SCREENWIDTH=800 CONFIG_VNCSERVER_UPDATER_PRIO=120 -CONFIG_VNCSERVER_UPDATE_BUFSIZE=2048 +CONFIG_VNCSERVER_UPDATE_BUFSIZE=800 diff --git a/graphics/vnc/server/Kconfig b/graphics/vnc/server/Kconfig index bb96d3f9889..cf7fca29b32 100644 --- a/graphics/vnc/server/Kconfig +++ b/graphics/vnc/server/Kconfig @@ -112,8 +112,25 @@ config VNCSERVER_UPDATE_BUFSIZE example, an update buffers of 32 pixels at 8-bits per pixel and 32-rows would yield a buffer size of 1024! - Ideally, this buffer should fit in one network packet to avoid - accessive re-assembly of partial TCP packets. + There is a very strong interaction with this setting and the network MTU. + Ideally, this buffer should fit in one network packet to avoid accessive + re-assembly of partial TCP packets. + + REVISIT: In fact, if the buffer does not fit in one network packet, + then there appears to be reliability issues in the connection. I am + not sure why that is; TCP is a stream so it should not matter how + many packets are in a transfer. + + Example: Negotiated pixel depth = 8 BPP, window width = 800 pixels. + CONFIG_VNCSERVER_UPDATE_BUFSIZE needs to be the payload size (MSS) + of the transfer or 800 bytes. The MTU is then: + + MSS = MTU - sizeof(IP Header) - sizeof(VNC FramebufferUpdate Header) + + For IPv4, the IP Header is 20 bytes; 40 bytes for IPv6. The + FramebufferUpdate header is 16 bytes so. The desired MSS is 800 bytes + so MTU = 836 or 856. For Ethernet, this is a total packet size of 870 + bytes. config VNCSERVER_KBDENCODE bool "Encode keyboard input" diff --git a/graphics/vnc/server/vnc_color.c b/graphics/vnc/server/vnc_color.c index 8543cf7866e..517f58de59c 100644 --- a/graphics/vnc/server/vnc_color.c +++ b/graphics/vnc/server/vnc_color.c @@ -155,7 +155,7 @@ uint8_t vnc_convert_rgb8_332(lfb_color_t rgb) * RRRGGGBB */ - return (uint8_t)(((rgb >> 8) & 0x0070) | + return (uint8_t)(((rgb >> 8) & 0x00e0) | ((rgb >> 6) & 0x001c) | ((rgb >> 3) & 0x0003)); } diff --git a/graphics/vnc/server/vnc_keymap.c b/graphics/vnc/server/vnc_keymap.c index 6914fde0f15..5e828d8da1c 100644 --- a/graphics/vnc/server/vnc_keymap.c +++ b/graphics/vnc/server/vnc_keymap.c @@ -651,4 +651,4 @@ void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch) (void)nx_kbdin((NXHANDLE)arg, nch, ch); } -#endif /* CONFIG_NX_KBD */ \ No newline at end of file +#endif /* CONFIG_NX_KBD */ diff --git a/graphics/vnc/server/vnc_raw.c b/graphics/vnc/server/vnc_raw.c index 2eb06bc30b8..acd195d989e 100644 --- a/graphics/vnc/server/vnc_raw.c +++ b/graphics/vnc/server/vnc_raw.c @@ -164,7 +164,8 @@ static size_t vnc_copy16(FAR struct vnc_session_s *session, /* Source rectangle start address (left/top)*/ - srcleft = (FAR lfb_color_t *)(session->fb + RFB_STRIDE * row + RFB_BYTESPERPIXEL * col); + srcleft = (FAR lfb_color_t *) + (session->fb + RFB_STRIDE * row + RFB_BYTESPERPIXEL * col); /* Transfer each row from the source buffer into the update buffer */ @@ -235,7 +236,8 @@ static size_t vnc_copy32(FAR struct vnc_session_s *session, /* Source rectangle start address (left/top)*/ - srcleft = (FAR lfb_color_t *)(session->fb + RFB_STRIDE * row + RFB_BYTESPERPIXEL * col); + srcleft = (FAR lfb_color_t *) + (session->fb + RFB_STRIDE * row + RFB_BYTESPERPIXEL * col); /* Transfer each row from the source buffer into the update buffer */