You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/08/10 06:08:39 UTC
[incubator-nuttx] branch master updated: drivers/video: Refine the
update region notification mechanism
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new fd78f83 drivers/video: Refine the update region notification mechanism
fd78f83 is described below
commit fd78f83e02f16da9e5859ded629ca16989109864
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Thu Jun 4 10:35:50 2020 +0800
drivers/video: Refine the update region notification mechanism
1.Expose the notification through fb_vtable_s::updatearea
2.Incorporate old nx_notify_rectangle into the new updatearea callback
3.Migrate the calle of nx_notify_rectangle to fb_vtable_s::updatearea
Change-Id: Ia3d1f73e8757b2d381586d76ec6adc16c810018d
Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
arch/sim/src/sim/up_framebuffer.c | 24 ---------
drivers/lcd/Kconfig | 7 +--
drivers/lcd/lcd_framebuffer.c | 91 ++++++++-------------------------
drivers/video/Kconfig | 32 ++++++------
drivers/video/fb.c | 19 ++-----
graphics/Kconfig | 9 ++--
graphics/nxbe/Make.defs | 4 ++
graphics/nxbe/nxbe.h | 52 ++++++++++++++-----
graphics/nxbe/nxbe_bitmap.c | 10 ++--
graphics/nxbe/nxbe_configure.c | 8 ++-
graphics/nxbe/nxbe_fill.c | 6 +--
graphics/nxbe/nxbe_filltrapezoid.c | 30 ++++++-----
graphics/nxbe/nxbe_move.c | 24 +++++----
graphics/nxbe/nxbe_notify_rectangle.c | 65 ++++++++++++++++++++++++
graphics/nxbe/nxbe_setpixel.c | 9 ++--
graphics/vnc/server/Kconfig | 2 +-
graphics/vnc/server/vnc_fbdev.c | 96 ++++++++++++++++-------------------
graphics/vnc/server/vnc_server.h | 4 --
include/nuttx/nx/nx.h | 53 +++++--------------
include/nuttx/nx/nxglib.h | 29 ++++++++++-
include/nuttx/video/fb.h | 31 +++++++----
libs/libnx/nxglib/Make.defs | 10 ++--
libs/libnx/nxglib/nxgl_area2rect.c | 48 ++++++++++++++++++
libs/libnx/nxglib/nxgl_rect2area.c | 48 ++++++++++++++++++
24 files changed, 410 insertions(+), 301 deletions(-)
diff --git a/arch/sim/src/sim/up_framebuffer.c b/arch/sim/src/sim/up_framebuffer.c
index 2457bcc..cdfaf19 100644
--- a/arch/sim/src/sim/up_framebuffer.c
+++ b/arch/sim/src/sim/up_framebuffer.c
@@ -46,8 +46,6 @@
#include <nuttx/clock.h>
#include <nuttx/wqueue.h>
-#include <nuttx/nx/nx.h>
-#include <nuttx/nx/nxglib.h>
#include <nuttx/video/fb.h>
#include "up_internal.h"
@@ -461,25 +459,3 @@ FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane)
void up_fbuninitialize(int display)
{
}
-
-/****************************************************************************
- * Name: nx_notify_rectangle
- *
- * Description:
- * Must be provided if CONFIG_NX_UPDATE is enabled
- *
- * Input Parameters:
- * display - In the case of hardware with multiple displays, this
- * specifies the display. Normally this is zero.
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-#ifdef CONFIG_NX_UPDATE
-void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
- FAR const struct nxgl_rect_s *rect)
-{
-}
-#endif
diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig
index abaf281..cb4912f 100644
--- a/drivers/lcd/Kconfig
+++ b/drivers/lcd/Kconfig
@@ -22,17 +22,12 @@ config LCD_PACKEDMSFIRST
bool
default n
-config LCD_UPDATE
- bool
- default n
- select NX_UPDATE if NX
-
comment "Common Graphic LCD Settings"
config LCD_FRAMEBUFFER
bool "LCD framebuffer front end"
default n
- select LCD_UPDATE
+ select FB_UPDATE
---help---
Enable a "front end" that converts an sequential LCD driver into a
standard, NuttX frame buffer driver.
diff --git a/drivers/lcd/lcd_framebuffer.c b/drivers/lcd/lcd_framebuffer.c
index fc00ff9..e049e6f 100644
--- a/drivers/lcd/lcd_framebuffer.c
+++ b/drivers/lcd/lcd_framebuffer.c
@@ -47,8 +47,6 @@
#include <nuttx/board.h>
#include <nuttx/kmalloc.h>
-#include <nuttx/nx/nx.h>
-#include <nuttx/nx/nxglib.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/video/fb.h>
@@ -88,8 +86,8 @@ struct lcdfb_dev_s
/* Update the LCD when there is a change to the framebuffer */
-static int lcdfb_update(FAR struct lcdfb_dev_s *priv,
- FAR const struct nxgl_rect_s *rect);
+static int lcdfb_updateearea(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_area_s *area);
/* Get information about the video controller configuration and the
* configuration of each color plane.
@@ -167,16 +165,17 @@ static FAR struct lcdfb_dev_s *lcdfb_find(int display)
}
/****************************************************************************
- * Name: lcdfb_update
+ * Name: lcdfb_updateearea
*
* Description:
* Update the LCD when there is a change to the framebuffer.
*
****************************************************************************/
-static int lcdfb_update(FAR struct lcdfb_dev_s *priv,
- FAR const struct nxgl_rect_s *rect)
+static int lcdfb_updateearea(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_area_s *area)
{
+ FAR struct lcdfb_dev_s *priv = (FAR struct lcdfb_dev_s *)vtable;
FAR struct lcd_planeinfo_s *pinfo = &priv->pinfo;
FAR uint8_t *run;
fb_coord_t row;
@@ -187,27 +186,31 @@ static int lcdfb_update(FAR struct lcdfb_dev_s *priv,
fb_coord_t endy;
int ret;
+ DEBUGASSERT(area != NULL);
+ DEBUGASSERT(area->w >= 1);
+ DEBUGASSERT(area->h >= 1);
+
/* Clip to fit in the framebuffer */
- startx = rect->pt1.x;
+ startx = area->x;
if (startx < 0)
{
startx = 0;
}
- endx = rect->pt2.x;
+ endx = startx + area->w - 1;
if (endx >= priv->xres)
{
endx = priv->xres - 1;
}
- starty = rect->pt1.y;
+ starty = area->y;
if (starty < 0)
{
starty = 0;
}
- endy = rect->pt2.y;
+ endy = starty + area->h - 1;
if (endy >= priv->yres)
{
endy = priv->yres - 1;
@@ -473,7 +476,7 @@ int up_fbinitialize(int display)
FAR struct lcdfb_dev_s *priv;
FAR struct lcd_dev_s *lcd;
struct fb_videoinfo_s vinfo;
- struct nxgl_rect_s rect;
+ struct fb_area_s area;
int ret;
lcdinfo("display=%d\n", display);
@@ -502,6 +505,7 @@ int up_fbinitialize(int display)
priv->vtable.getcursor = lcdfb_getcursor,
priv->vtable.setcursor = lcdfb_setcursor,
#endif
+ priv->vtable.updatearea = lcdfb_updateearea,
#ifdef CONFIG_LCD_EXTERNINIT
/* Use external graphics driver initialization */
@@ -577,12 +581,12 @@ int up_fbinitialize(int display)
/* Write the entire framebuffer to the LCD */
- rect.pt1.x = 0;
- rect.pt1.y = 0;
- rect.pt2.x = priv->xres - 1;
- rect.pt2.y = priv->yres - 1;
+ area.x = 0;
+ area.y = 0;
+ area.w = priv->xres;
+ area.h = priv->yres;
- ret = lcdfb_update(priv, &rect);
+ ret = lcdfb_updateearea(&priv->vtable, &area);
if (ret < 0)
{
lcderr("FB update failed: %d\n", ret);
@@ -700,57 +704,4 @@ void up_fbuninitialize(int display)
}
}
-/****************************************************************************
- * Name: nx_notify_rectangle
- *
- * Description:
- * When CONFIG_LCD_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.
- *
- * NOTE: This function is also required for use with the LCD framebuffer
- * driver front end when CONFIG_LCD_UPDATE=y, although that use does not
- * depend on CONFIG_NX (and this function seems misnamed in that case).
- *
- ****************************************************************************/
-
-#if defined(CONFIG_LCD_UPDATE) || defined(CONFIG_NX_UPDATE)
-void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
- FAR const struct nxgl_rect_s *rect)
-{
- FAR struct fb_planeinfo_s *fpinfo = (FAR struct fb_planeinfo_s *)pinfo;
- FAR struct lcdfb_dev_s *priv;
- int ret;
-
- DEBUGASSERT(fpinfo != NULL && rect != NULL);
-
- /* Look up the LCD framebuffer state structure for this display.
- *
- * REVISIT: If many LCD framebuffers are used, then this lookup would be
- * a performance issue.
- */
-
- priv = lcdfb_find(fpinfo->display);
- if (priv != NULL)
- {
- ret = lcdfb_update(priv, rect);
- if (ret < 0)
- {
- lcderr("FB update failed: %d\n", ret);
- }
- }
-}
-#endif
-
#endif /* CONFIG_LCD_FRAMEBUFFER */
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index e7c0bcb..f0af427 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -3,21 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
-menuconfig DRIVERS_VIDEO
- bool "Video Device Support"
- default n
- ---help---
- Enable support for video device drivers.
-
-if DRIVERS_VIDEO
-
-config VIDEO_FB
- bool "Framebuffer character driver"
- default n
-
config FB_CMAP
bool
- depends on VIDEO_FB
default n
---help---
Set by driver-specific configuration to indicate support for color
@@ -25,20 +12,21 @@ config FB_CMAP
config FB_TRANSPARENCY
bool
- depends on VIDEO_FB
default n
---help---
Set by driver-specific configuration to indicate support for color
transparency. Not directly user selectable.
+config FB_UPDATE
+ bool
+ default n
+
config FB_SYNC
bool "Hardware signals vertical sync"
- depends on VIDEO_FB
default n
config FB_OVERLAY
bool "Framebuffer overlay support"
- depends on VIDEO_FB
default n
config FB_OVERLAY_BLIT
@@ -46,6 +34,18 @@ config FB_OVERLAY_BLIT
depends on FB_OVERLAY
default n
+menuconfig DRIVERS_VIDEO
+ bool "Video Device Support"
+ default n
+ ---help---
+ Enable support for video device drivers.
+
+if DRIVERS_VIDEO
+
+config VIDEO_FB
+ bool "Framebuffer character driver"
+ default n
+
config VIDEO_STREAM
bool "Video Stream Support"
default n
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index fecf0aa..a1423a8 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -49,8 +49,6 @@
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/ioctl.h>
-#include <nuttx/nx/nx.h>
-#include <nuttx/nx/nxglib.h>
#include <nuttx/video/fb.h>
/****************************************************************************
@@ -402,20 +400,13 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
#endif
-#ifdef CONFIG_LCD_UPDATE
- case FBIO_UPDATE: /* Update the LCD with the modified framebuffer data */
+#ifdef CONFIG_FB_UPDATE
+ case FBIO_UPDATE: /* Update the modified framebuffer data */
{
- FAR struct nxgl_rect_s *rect =
- (FAR struct nxgl_rect_s *)((uintptr_t)arg);
- struct fb_planeinfo_s pinfo;
+ struct fb_area_s *area = (FAR struct fb_area_s *)((uintptr_t)arg);
- DEBUGASSERT(fb->vtable != NULL &&
- fb->vtable->getplaneinfo != NULL);
- ret = fb->vtable->getplaneinfo(fb->vtable, fb->plane, &pinfo);
- if (ret >= 0)
- {
- nx_notify_rectangle((FAR NX_PLANEINFOTYPE *)&pinfo, rect);
- }
+ DEBUGASSERT(fb->vtable != NULL && fb->vtable->updatearea != NULL);
+ ret = fb->vtable->updatearea(fb->vtable, area);
}
break;
#endif
diff --git a/graphics/Kconfig b/graphics/Kconfig
index 0e243f5..aa7ccf8 100644
--- a/graphics/Kconfig
+++ b/graphics/Kconfig
@@ -143,7 +143,7 @@ config NX_WRITEONLY
config NX_UPDATE
bool "Display update hooks"
- default n
+ default FB_UPDATE && !NX_LCDDRIVER
---help---
Enable a callout to inform some external module that the display has
been updated. This would be useful in a couple for cases.
@@ -158,8 +158,11 @@ config NX_UPDATE
When this feature is enabled, some external logic must provide this
interface:
- void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
- FAR const struct nxgl_rect_s *rect);
+ fb_vtable_s
+ {
+ int (*updatearea)(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_area_s *area);
+ };
That is the function that will handle the notification. It
receives the rectangular region that was updated in the provided
diff --git a/graphics/nxbe/Make.defs b/graphics/nxbe/Make.defs
index e6f9ff7..c2ae20a 100644
--- a/graphics/nxbe/Make.defs
+++ b/graphics/nxbe/Make.defs
@@ -50,6 +50,10 @@ else ifeq ($(CONFIG_NX_HWCURSOR),y)
CSRCS += nxbe_cursor.c
endif
+ifeq ($(CONFIG_NX_UPDATE),y)
+CSRCS += nxbe_notify_rectangle.c
+endif
+
DEPPATH += --dep-path nxbe
CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)/graphics/nxbe}
VPATH += :nxbe
diff --git a/graphics/nxbe/nxbe.h b/graphics/nxbe/nxbe.h
index ecea23c..e56ba0c 100644
--- a/graphics/nxbe/nxbe.h
+++ b/graphics/nxbe/nxbe.h
@@ -189,6 +189,7 @@ struct nxbe_plane_s
/* Framebuffer plane info describing destination video plane */
+ NX_DRIVERTYPE *driver;
NX_PLANEINFOTYPE pinfo;
};
@@ -216,14 +217,14 @@ struct nxbe_clipops_s
#if defined(CONFIG_NX_SWCURSOR)
struct nxbe_cursor_s
{
- bool visible; /* True: the cursor is visible */
- struct nxgl_rect_s bounds; /* Cursor image bounding box */
+ bool visible; /* True: the cursor is visible */
+ struct nxgl_rect_s bounds; /* Cursor image bounding box */
nxgl_mxpixel_t color1[CONFIG_NX_NPLANES]; /* Color1 is main color of the cursor */
nxgl_mxpixel_t color2[CONFIG_NX_NPLANES]; /* Color2 is color of any border */
nxgl_mxpixel_t color3[CONFIG_NX_NPLANES]; /* Color3 is the blended color */
- size_t allocsize; /* Size of the background allocation */
- FAR const uint8_t *image; /* Cursor image at 2-bits/pixel */
- FAR nxgl_mxpixel_t *bkgd; /* Cursor background in device pixels */
+ size_t allocsize; /* Size of the background allocation */
+ FAR const uint8_t *image; /* Cursor image at 2-bits/pixel */
+ FAR nxgl_mxpixel_t *bkgd; /* Cursor background in device pixels */
};
#elif defined(CONFIG_NX_HWCURSOR)
struct nxbe_cursor_s
@@ -252,9 +253,9 @@ struct nxbe_state_s
FAR struct nxbe_window_s *topwnd; /* The window at the top of the display */
struct nxbe_window_s bkgd; /* The background window is always at the bottom */
- /* At present, only a solid colored background is supported for refills. The
- * following provides the background color. It would be nice to support
- * background bitmap images as well.
+ /* At present, only a solid colored background is supported for refills.
+ * The following provides the background color. It would be nice to
+ * support background bitmap images as well.
*/
nxgl_mxpixel_t bgcolor[CONFIG_NX_NPLANES];
@@ -279,13 +280,14 @@ struct nxbe_state_s
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
-extern "C" {
+extern "C"
+{
#else
#define EXTERN extern
#endif
/****************************************************************************
- * Public Functions
+ * Public Function Prototypes
****************************************************************************/
/****************************************************************************
@@ -301,6 +303,32 @@ int nxbe_colormap(FAR NX_DRIVERTYPE *dev);
#endif
/****************************************************************************
+ * Name: nxbe_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 nxbe_notify_rectangle(FAR NX_DRIVERTYPE *dev,
+ FAR const struct nxgl_rect_s *rect);
+#endif
+
+/****************************************************************************
* Name: nx_configure
*
* Description:
@@ -523,8 +551,8 @@ void nxbe_setvisibility(FAR struct nxbe_window_s *wnd, bool hide);
* Name: nxbe_setpixel
*
* Description:
- * Set a single pixel in the window to the specified color. This is simply
- * a degenerate case of nxbe_fill(), but may be optimized in some architectures.
+ * Set a single pixel in the window to the specified color. This is simply a
+ * degenerate case of nxbe_fill, but may be optimized in some architectures.
*
* Input Parameters:
* wnd - The window structure reference
diff --git a/graphics/nxbe/nxbe_bitmap.c b/graphics/nxbe/nxbe_bitmap.c
index b93899e..0b76d34 100644
--- a/graphics/nxbe/nxbe_bitmap.c
+++ b/graphics/nxbe/nxbe_bitmap.c
@@ -67,8 +67,8 @@ struct nx_bitmap_s
* Name: bitmap_clipcopy
*
* Description:
- * Called from nxbe_clipper() to performed the fill operation on visible portions
- * of the rectangle.
+ * Called from nxbe_clipper() to performed the fill operation on visible
+ * portions of the rectangle.
*
****************************************************************************/
@@ -86,7 +86,7 @@ static void bitmap_clipcopy(FAR struct nxbe_clipops_s *cops,
#ifdef CONFIG_NX_UPDATE
/* Notify external logic that the display has been updated */
- nx_notify_rectangle(&plane->pinfo, rect);
+ nxbe_notify_rectangle(plane->driver, rect);
#endif
}
@@ -340,8 +340,8 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd,
nxbe_bitmap_dev(wnd, dest, src, origin, stride);
#ifdef CONFIG_NX_SWCURSOR
- /* Update cursor backup memory and redraw the cursor in the modified window
- * region.
+ /* Update cursor backup memory and redraw the cursor in the modified
+ * window region.
*/
nxbe_cursor_backupdraw_all(wnd, dest);
diff --git a/graphics/nxbe/nxbe_configure.c b/graphics/nxbe/nxbe_configure.c
index 5178e81..802012f 100644
--- a/graphics/nxbe/nxbe_configure.c
+++ b/graphics/nxbe/nxbe_configure.c
@@ -107,11 +107,6 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
CONFIG_NX_NPLANES, be->vinfo.nplanes);
return -E2BIG;
}
- else if (be->vinfo.nplanes < CONFIG_NX_NPLANES)
- {
- gwarn("WARNING: NX configured for %d planes, controller only needs %d\n",
- CONFIG_NX_NPLANES, be->vinfo.nplanes);
- }
#endif
/* Then get information about each color plane */
@@ -125,6 +120,8 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
return ret;
}
+ be->plane[i].driver = dev;
+
/* Select rasterizers to match the BPP reported for this plane.
* NOTE that there are configuration options to eliminate support
* for unused BPP values. If the unused BPP values are not suppressed
@@ -309,5 +306,6 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
return -ENOSYS;
}
}
+
return OK;
}
diff --git a/graphics/nxbe/nxbe_fill.c b/graphics/nxbe/nxbe_fill.c
index 8f941b1..94052bd 100644
--- a/graphics/nxbe/nxbe_fill.c
+++ b/graphics/nxbe/nxbe_fill.c
@@ -83,7 +83,7 @@ static void nxbe_clipfill(FAR struct nxbe_clipops_s *cops,
#ifdef CONFIG_NX_UPDATE
/* Notify external logic that the display has been updated */
- nx_notify_rectangle(&plane->pinfo, rect);
+ nxbe_notify_rectangle(plane->driver, rect);
#endif
}
@@ -168,8 +168,8 @@ static inline void nxbe_fill_pwfb(FAR struct nxbe_window_s *wnd,
DEBUGASSERT(wnd->be->plane[0].pwfb.fillrectangle != NULL);
- /* The rectangle that we receive here is in absolute device coordinates. We
- * need to restore this to windows relative coordinates.
+ /* The rectangle that we receive here is in absolute device coordinates.
+ * We need to restore this to windows relative coordinates.
*/
nxgl_rectoffset(&relrect, rect, -wnd->bounds.pt1.x, -wnd->bounds.pt1.y);
diff --git a/graphics/nxbe/nxbe_filltrapezoid.c b/graphics/nxbe/nxbe_filltrapezoid.c
index e150636..62a455d 100644
--- a/graphics/nxbe/nxbe_filltrapezoid.c
+++ b/graphics/nxbe/nxbe_filltrapezoid.c
@@ -78,8 +78,8 @@ struct nxbe_filltrap_s
* Name: nxbe_clipfilltrapezoid
*
* Description:
- * Called from nxbe_clipper() to performed the fill operation on visible portions
- * of the rectangle.
+ * Called from nxbe_clipper() to performed the fill operation on visible
+ * portions of the rectangle.
*
****************************************************************************/
@@ -107,7 +107,7 @@ static void nxbe_clipfilltrapezoid(FAR struct nxbe_clipops_s *cops,
MIN(fillinfo->trap.bot.x2, rect->pt2.x));
update.pt2.y = MIN(fillinfo->trap.bot.y, rect->pt2.y);
- nx_notify_rectangle(&plane->pinfo, &update);
+ nxbe_notify_rectangle(plane->driver, &update);
#endif
}
@@ -129,10 +129,11 @@ static void nxbe_clipfilltrapezoid(FAR struct nxbe_clipops_s *cops,
*
****************************************************************************/
-static inline void nxbe_filltrapezoid_dev(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *bounds,
- FAR const struct nxgl_trapezoid_s *trap,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
+static inline void
+nxbe_filltrapezoid_dev(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *bounds,
+ FAR const struct nxgl_trapezoid_s *trap,
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
struct nxbe_filltrap_s info;
int i;
@@ -190,10 +191,11 @@ static inline void nxbe_filltrapezoid_dev(FAR struct nxbe_window_s *wnd,
****************************************************************************/
#ifdef CONFIG_NX_RAMBACKED
-static inline void nxbe_filltrapezoid_pwfb(FAR struct nxbe_window_s *wnd,
- FAR const struct nxgl_rect_s *bounds,
- FAR const struct nxgl_trapezoid_s *trap,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
+static inline void
+nxbe_filltrapezoid_pwfb(FAR struct nxbe_window_s *wnd,
+ FAR const struct nxgl_rect_s *bounds,
+ FAR const struct nxgl_trapezoid_s *trap,
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
FAR const void *src[CONFIG_NX_NPLANES];
struct nxgl_trapezoid_s reltrap;
@@ -214,9 +216,9 @@ static inline void nxbe_filltrapezoid_pwfb(FAR struct nxbe_window_s *wnd,
* REVISIT: Assumes a single color plane.
*/
- DEBUGASSERT(wnd->be->plane[0].pwfb.filltrapezoid != NULL);
- wnd->be->plane[0].pwfb.filltrapezoid(wnd, &reltrap, &relbounds,
- color[0]);
+ DEBUGASSERT(wnd->be->plane[0].pwfb.filltrapezoid != NULL);
+ wnd->be->plane[0].pwfb.filltrapezoid(wnd, &reltrap, &relbounds,
+ color[0]);
/* Get the source of address of the trapezoid bounding box in the
* framebuffer.
diff --git a/graphics/nxbe/nxbe_move.c b/graphics/nxbe/nxbe_move.c
index 94051e7..a512980 100644
--- a/graphics/nxbe/nxbe_move.c
+++ b/graphics/nxbe/nxbe_move.c
@@ -69,8 +69,8 @@ struct nxbe_move_s
* Name: nxbe_clipmovesrc
*
* Description:
- * Called from nxbe_clipper() to performed the move operation on visible regions
- * of the rectangle.
+ * Called from nxbe_clipper() to performed the move operation on visible
+ * regions of the rectangle.
*
****************************************************************************/
@@ -92,7 +92,9 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops,
offset.x = rect->pt1.x + info->offset.x;
offset.y = rect->pt1.y + info->offset.y;
- /* Move the source rectangle to the destination position in the device */
+ /* Move the source rectangle to the destination position in the
+ * device
+ */
plane->dev.moverectangle(&plane->pinfo, rect, &offset);
@@ -109,7 +111,7 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops,
* rectangle has changed.
*/
- nx_notify_rectangle(&plane->pinfo, &update);
+ nxbe_notify_rectangle(plane->driver, &update);
#endif
}
}
@@ -118,8 +120,8 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops,
* Name: nxbe_clipmoveobscured
*
* Description:
- * Called from nxbe_clipper() to performed the move operation on obsrured regions
- * of the rectangle.
+ * Called from nxbe_clipper() to performed the move operation on obsrured
+ * regions of the rectangle.
*
****************************************************************************/
@@ -189,7 +191,7 @@ static void nxbe_clipmovedest(FAR struct nxbe_clipops_s *cops,
nxbe_clipper(dstdata->wnd->above, &src, dstdata->order,
&srcinfo.cops, plane);
- }
+ }
}
/****************************************************************************
@@ -336,8 +338,8 @@ static inline void nxbe_move_pwfb(FAR struct nxbe_window_s *wnd,
struct nxgl_rect_s destrect;
unsigned int bpp;
- /* The rectangle that we receive here is in absolute device coordinates. We
- * need to restore this to windows relative coordinates.
+ /* The rectangle that we receive here is in absolute device coordinates.
+ * We need to restore this to windows relative coordinates.
*/
nxgl_rectoffset(&srcrect, rect, -wnd->bounds.pt1.x, -wnd->bounds.pt1.y);
@@ -457,7 +459,9 @@ void nxbe_move(FAR struct nxbe_window_s *wnd,
if (!nxgl_nullrect(&srcrect))
{
#ifdef CONFIG_NX_RAMBACKED
- /* Update the pre-window framebuffer first, then the device memory. */
+ /* Update the pre-window framebuffer first, then the device
+ * memory.
+ */
if (NXBE_ISRAMBACKED(wnd))
{
diff --git a/graphics/nxbe/nxbe_notify_rectangle.c b/graphics/nxbe/nxbe_notify_rectangle.c
new file mode 100644
index 0000000..62bd3fa
--- /dev/null
+++ b/graphics/nxbe/nxbe_notify_rectangle.c
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * graphics/nxbe/nxbe_notify_rectangle.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/nx/nxglib.h>
+
+#include "nxbe.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxbe_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 nxbe_notify_rectangle(FAR NX_DRIVERTYPE *dev,
+ FAR const struct nxgl_rect_s *rect)
+{
+ struct fb_area_s area;
+
+ nxgl_rect2area(&area, rect);
+ dev->updatearea(dev, &area);
+}
+#endif
diff --git a/graphics/nxbe/nxbe_setpixel.c b/graphics/nxbe/nxbe_setpixel.c
index 97562b9..a118772 100644
--- a/graphics/nxbe/nxbe_setpixel.c
+++ b/graphics/nxbe/nxbe_setpixel.c
@@ -64,8 +64,8 @@ struct nxbe_setpixel_s
* Name: nxbe_clipfill
*
* Description:
- * Called from nxbe_clipper() to performed the fill operation on visible portions
- * of the rectangle.
+ * Called from nxbe_clipper() to performed the fill operation on visible
+ * portions of the rectangle.
*
****************************************************************************/
@@ -82,7 +82,7 @@ static void nxbe_clipfill(FAR struct nxbe_clipops_s *cops,
#ifdef CONFIG_NX_UPDATE
/* Notify external logic that the display has been updated */
- nx_notify_rectangle(&plane->pinfo, rect);
+ nxbe_notify_rectangle(plane->driver, rect);
#endif
}
@@ -189,7 +189,8 @@ void nxbe_setpixel(FAR struct nxbe_window_s *wnd,
#ifdef CONFIG_NX_RAMBACKED
/* If this window supports a pre-window frame buffer then shadow the full,
* unclipped bitmap in that framebuffer.
- * REVISIT: The logic to set a pixel in the per-window frame buffer is missing
+ * REVISIT: The logic to set a pixel in the per-window frame buffer is
+ * missing
*/
DEBUGASSERT(!NXBE_ISRAMBACKED(wnd));
diff --git a/graphics/vnc/server/Kconfig b/graphics/vnc/server/Kconfig
index 1b9aec0..53d1862 100644
--- a/graphics/vnc/server/Kconfig
+++ b/graphics/vnc/server/Kconfig
@@ -7,7 +7,7 @@ menuconfig VNCSERVER
bool "VNC server"
default n
depends on NET_TCP && !NX_LCDDRIVER
- select NX_UPDATE
+ select FB_UPDATE
---help---
Enable support for a VNC Remote Frame Buffer (RFB) server.
diff --git a/graphics/vnc/server/vnc_fbdev.c b/graphics/vnc/server/vnc_fbdev.c
index 5983a08..74ae166 100644
--- a/graphics/vnc/server/vnc_fbdev.c
+++ b/graphics/vnc/server/vnc_fbdev.c
@@ -109,6 +109,11 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_setcursor_s *settings);
#endif
+/* Update the host window when there is a change to the framebuffer */
+
+static int up_updateearea(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_area_s *area);
+
/****************************************************************************
* Private Data
****************************************************************************/
@@ -404,6 +409,44 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
#endif
/****************************************************************************
+ * Name: up_updateearea
+ ****************************************************************************/
+
+static int up_updateearea(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_area_s *area)
+{
+ 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);
+
+ /* Recover the session information from the display number in the planeinfo
+ * structure.
+ */
+
+ DEBUGASSERT(fbinfo->display >= 0 && fbinfo->display < RFB_MAX_DISPLAYS);
+ session = g_vnc_sessions[fbinfo->display];
+
+ /* Verify that the session is still valid */
+
+ if (session != NULL && session->state == VNCSERVER_RUNNING)
+ {
+ /* Queue the rectangular update */
+
+ nxgl_area2rect(&rect, area);
+ ret = vnc_update_rectangle(session, &rect, true);
+ if (ret < 0)
+ {
+ gerr("ERROR: vnc_update_rectangle failed: %d\n", ret);
+ }
+ }
+
+ return ret;
+}
+
+/****************************************************************************
* Name: vnc_start_server
*
* Description:
@@ -774,6 +817,7 @@ FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane)
fbinfo->vtable.getcursor = up_getcursor,
fbinfo->vtable.setcursor = up_setcursor,
#endif
+ fbinfo->vtable.updatearea = up_updateearea,
fbinfo->display = display;
fbinfo->initialized = true;
}
@@ -821,55 +865,3 @@ void up_fbuninitialize(int display)
}
#endif
}
-
-/****************************************************************************
- * 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 information from the display number in the planeinfo
- * structure.
- */
-
- DEBUGASSERT(pinfo->display >= 0 && pinfo->display < RFB_MAX_DISPLAYS);
- session = g_vnc_sessions[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, true);
- if (ret < 0)
- {
- gerr("ERROR: vnc_update_rectangle failed: %d\n", ret);
- }
- }
-}
-#endif
diff --git a/graphics/vnc/server/vnc_server.h b/graphics/vnc/server/vnc_server.h
index d341066..379649b 100644
--- a/graphics/vnc/server/vnc_server.h
+++ b/graphics/vnc/server/vnc_server.h
@@ -60,10 +60,6 @@
/* Configuration */
-#ifndef CONFIG_NX_UPDATE
-# error CONFIG_NX_UPDATE must be set to use VNC
-#endif
-
#if !defined(CONFIG_VNCSERVER_PROTO3p3) && !defined(CONFIG_VNCSERVER_PROTO3p8)
# error No VNC protocol selected
#endif
diff --git a/include/nuttx/nx/nx.h b/include/nuttx/nx/nx.h
index fa3cc13..69f3273 100644
--- a/include/nuttx/nx/nx.h
+++ b/include/nuttx/nx/nx.h
@@ -205,7 +205,8 @@ struct nx_callback_s
**************************************************************************/
#ifdef CONFIG_NX_KBD
- void (*kbdin)(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, FAR void *arg);
+ void (*kbdin)(NXWINDOW hwnd, uint8_t nch,
+ FAR const uint8_t *ch, FAR void *arg);
#endif
/**************************************************************************
@@ -270,7 +271,7 @@ extern "C"
#endif
/****************************************************************************
- * Public Functions
+ * Public Function Prototypes
****************************************************************************/
/****************************************************************************
@@ -383,8 +384,8 @@ int nx_eventhandler(NXHANDLE handle);
* client can then call nv_eventhandler() only when incoming events are
* available.
*
- * Only one such event is issued. Upon receipt of the signal, if the client
- * wishes further notifications, it must call nx_eventnotify again.
+ * Only one such event is issued. Upon receipt of the signal, if the
+ * client wishes further notifications, it must call nx_eventnotify again.
*
* Input Parameters:
* handle - the handle returned by nx_connect
@@ -726,7 +727,7 @@ bool nx_ishidden(NXWINDOW hwnd);
*
* Description:
* Set a single pixel in the window to the specified color. This is simply
- * a degenerate case of nx_fill(), but may be optimized in some architectures.
+ * a degenerate case of nx_fill but may be optimized in some architectures.
*
* Input Parameters:
* wnd - The window structure reference
@@ -794,7 +795,8 @@ int nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
* Name: nx_filltrapezoid
*
* Description:
- * Fill the specified trapezoidal region in the window with the specified color
+ * Fill the specified trapezoidal region in the window with the specified
+ * color
*
* Input Parameters:
* hwnd - The window handle
@@ -944,36 +946,6 @@ int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
FAR const struct nxgl_point_s *origin, unsigned int stride);
/****************************************************************************
- * 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.
- *
- * NOTE: This function is also required for use with the LCD framebuffer
- * driver front end when CONFIG_LCD_UPDATE=y, although that use does not
- * depend on CONFIG_NX (and this function seems misnamed in that case).
- *
- ****************************************************************************/
-
-#if defined(CONFIG_NX_UPDATE) || defined(CONFIG_LCD_UPDATE)
-void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
- FAR const struct nxgl_rect_s *rect);
-#endif
-
-/****************************************************************************
* Name: nx_kbdin
*
* Description:
@@ -993,13 +965,14 @@ int nx_kbdin(NXHANDLE handle, uint8_t nch, FAR const uint8_t *ch);
*
* Description:
* Used by a thread or interrupt handler that manages some kind of pointing
- * hardware to report new positional data to the NX server. That positional
+ * hardware to report new positional data to the NX server. That positional
* data will be routed by the NX server to the appropriate window client.
*
****************************************************************************/
#ifdef CONFIG_NX_XYINPUT
-int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, uint8_t buttons);
+int nx_mousein(NXHANDLE handle, nxgl_coord_t x,
+ nxgl_coord_t y, uint8_t buttons);
#endif
/****************************************************************************
@@ -1033,7 +1006,7 @@ void nx_redrawreq(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect);
* Name: nx_constructwindow
*
* Description:
- * This function is the same a nx_openwindow EXCEPT that the client provides
+ * This function is the same as nx_openwindow EXCEPT the client provides
* the window structure instance. nx_constructwindow will initialize the
* the pre-allocated window structure for use by NX. This function is
* provided in addition to nx_openwindow in order to support a kind of
@@ -1041,7 +1014,7 @@ void nx_redrawreq(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect);
* are not visible to NX.
*
* NOTE: hwnd must have been allocated using a user-space allocator that
- * permits user access to the window. Once provided to nx_constructwindow()
+ * permits user access to the window. Once provided to nx_constructwindow
* that memory is owned and managed by NX. On certain error conditions or
* when the window is closed, NX will free the window.
*
diff --git a/include/nuttx/nx/nxglib.h b/include/nuttx/nx/nxglib.h
index 25a630e..58dccfa 100644
--- a/include/nuttx/nx/nxglib.h
+++ b/include/nuttx/nx/nxglib.h
@@ -65,6 +65,7 @@
#endif
/* Driver Selection *********************************************************/
+
/* NX_DRIVERTYPE selects either the framebuffer or LCD driver;
* NX_PLANINFO_TYPE hides the difference in the framebuffer and LCD driver
* plane types. defines are used instead of a typedefs to avoid type
@@ -80,6 +81,7 @@
#endif
/* NXGL Macros **************************************************************/
+
/* Mnemonics for indices */
#define NX_TOP_NDX (0)
@@ -145,6 +147,28 @@ void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v,
uint8_t *r, uint8_t *g, uint8_t *b);
/****************************************************************************
+ * Name: nxgl_area2rect
+ *
+ * Description:
+ * Convert nxgl_rect_s to fb_area_s.
+ *
+ ****************************************************************************/
+
+void nxgl_area2rect(FAR struct nxgl_rect_s *dest,
+ FAR const struct fb_area_s *src);
+
+/****************************************************************************
+ * Name: nxgl_rect2area
+ *
+ * Description:
+ * Convert nxgl_rect_s to fb_area_s.
+ *
+ ****************************************************************************/
+
+void nxgl_rect2area(FAR struct fb_area_s *dest,
+ FAR const struct nxgl_rect_s *src);
+
+/****************************************************************************
* Name: nxgl_rectcopy
*
* Description:
@@ -184,7 +208,8 @@ void nxgl_vectoradd(FAR struct nxgl_point_s *dest,
* Name: nxgl_vectsubtract
*
* Description:
- * Add subtract vector v2 from vector v1 and return the result in vector dest
+ * Add subtract vector v2 from vector v1 and return the result in vector
+ * dest
*
****************************************************************************/
@@ -196,7 +221,7 @@ void nxgl_vectsubtract(FAR struct nxgl_point_s *dest,
* Name: nxgl_rectintersect
*
* Description:
- * Return the rectangle representing the intersection of the two rectangles.
+ * Return the rectangle representing the intersection of the two rectangles
*
****************************************************************************/
diff --git a/include/nuttx/video/fb.h b/include/nuttx/video/fb.h
index 51fbf1e..3692406 100644
--- a/include/nuttx/video/fb.h
+++ b/include/nuttx/video/fb.h
@@ -245,11 +245,11 @@
* fb_setcursor_s */
#endif
-#ifdef CONFIG_LCD_UPDATE
+#ifdef CONFIG_FB_UPDATE
# define FBIO_UPDATE _FBIOC(0x0007) /* Update a rectangular region in
* the framebuffer
* Argument: read-only struct
- * nxgl_rect_s */
+ * fb_area_s */
#endif
#ifdef CONFIG_FB_SYNC
@@ -324,15 +324,6 @@ struct fb_planeinfo_s
uint8_t bpp; /* Bits per pixel */
};
-#ifdef CONFIG_FB_OVERLAY
-/* This structure describes the transparency. */
-
-struct fb_transp_s
-{
- uint8_t transp; /* Transparency */
- uint8_t transp_mode; /* Transparency mode */
-};
-
/* This structure describes an area. */
struct fb_area_s
@@ -343,6 +334,15 @@ struct fb_area_s
fb_coord_t h; /* Height of the area */
};
+#ifdef CONFIG_FB_OVERLAY
+/* This structure describes the transparency. */
+
+struct fb_transp_s
+{
+ uint8_t transp; /* Transparency */
+ uint8_t transp_mode; /* Transparency mode */
+};
+
/* This structure describes one overlay. */
struct fb_overlayinfo_s
@@ -511,6 +511,15 @@ struct fb_vtable_s
FAR struct fb_setcursor_s *settings);
#endif
+#ifdef CONFIG_FB_UPDATE
+ /* The following are provided only if the video hardware need extera
+ * notification to update display content.
+ */
+
+ int (*updatearea)(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_area_s *area);
+#endif
+
#ifdef CONFIG_FB_SYNC
/* The following are provided only if the video hardware signals
* vertical sync.
diff --git a/libs/libnx/nxglib/Make.defs b/libs/libnx/nxglib/Make.defs
index dee47b8..a293c78 100644
--- a/libs/libnx/nxglib/Make.defs
+++ b/libs/libnx/nxglib/Make.defs
@@ -44,11 +44,11 @@ CSRCS += nxglib_rgbblend.c
# Files needed only by NX
ifeq ($(CONFIG_NX),y)
-CSRCS += nxglib_circlepts.c nxglib_circletraps.c nxglib_intersecting.c
-CSRCS += nxglib_nonintersecting.c nxglib_nullrect.c nxglib_rectadd.c
-CSRCS += nxglib_rectcopy.c nxglib_rectinside.c nxglib_rectintersect.c
-CSRCS += nxglib_rectoffset.c nxglib_rectoverlap.c nxglib_rectsize.c
-CSRCS += nxglib_rectunion.c nxglib_rgb2yuv.c
+CSRCS += nxgl_area2rect.c nxglib_circlepts.c nxglib_circletraps.c
+CSRCS += nxglib_intersecting.c nxglib_nonintersecting.c nxglib_nullrect.c
+CSRCS += nxgl_rect2area.c nxglib_rectadd.c nxglib_rectcopy.c nxglib_rectinside.c
+CSRCS += nxglib_rectintersect.c nxglib_rectoffset.c nxglib_rectoverlap.c
+CSRCS += nxglib_rectsize.c nxglib_rectunion.c nxglib_rgb2yuv.c
CSRCS += nxglib_runcopy.c nxglib_runoffset.c nxglib_splitline.c
CSRCS += nxglib_trapcopy.c nxglib_trapoffset.c nxglib_vectoradd.c
CSRCS += nxglib_vectsubtract.c nxglib_yuv2rgb.c
diff --git a/libs/libnx/nxglib/nxgl_area2rect.c b/libs/libnx/nxglib/nxgl_area2rect.c
new file mode 100644
index 0000000..6624641
--- /dev/null
+++ b/libs/libnx/nxglib/nxgl_area2rect.c
@@ -0,0 +1,48 @@
+/****************************************************************************
+ * libs/libnx/nxglib/nxgl_area2rect.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxgl_area2rect
+ *
+ * Description:
+ * Convert fb_area_s to nxgl_rect_s.
+ *
+ ****************************************************************************/
+
+void nxgl_area2rect(FAR struct nxgl_rect_s *dest,
+ FAR const struct fb_area_s *src)
+{
+ dest->pt1.x = src->x;
+ dest->pt1.y = src->y;
+ dest->pt2.x = src->x + src->w - 1;
+ dest->pt2.y = src->y + src->h - 1;
+}
diff --git a/libs/libnx/nxglib/nxgl_rect2area.c b/libs/libnx/nxglib/nxgl_rect2area.c
new file mode 100644
index 0000000..1374d62
--- /dev/null
+++ b/libs/libnx/nxglib/nxgl_rect2area.c
@@ -0,0 +1,48 @@
+/****************************************************************************
+ * libs/libnx/nxglib/nxgl_rect2area.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxgl_rect2area
+ *
+ * Description:
+ * Convert nxgl_rect_s to fb_area_s.
+ *
+ ****************************************************************************/
+
+void nxgl_rect2area(FAR struct fb_area_s *dest,
+ FAR const struct nxgl_rect_s *src)
+{
+ dest->x = src->pt1.x;
+ dest->y = src->pt1.y;
+ dest->w = src->pt2.x - src->pt1.x + 1;
+ dest->h = src->pt2.y - src->pt1.y + 1;
+}