More fixes for NxConsole driver

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4543 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-03-30 22:49:08 +00:00
parent 6542745de8
commit 3d86917712
15 changed files with 135 additions and 159 deletions

View File

@ -3368,13 +3368,25 @@ int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height,
<dd>NxConsole needs to remember every character written to the console so that it can redraw the window.
This setting determines the size of some internal memory allocations used to hold the character data.
Default: 128.
<dt><code>CONFIG_NXCONSOLE_FONTCACHE</code>:
<dd>If this setting is defined, then caching of fonts will be supported by NxConsole.
Each font must be rendered from the tiny font storage format to the full display size and pixel depth.
If this setting is defined, then the more recently used font glyphs will be retained in a cache of size <code>CONFIG_NXCONSOLE_CACHESIZE</code>.
Default: No font caching.
<dt><code>CONFIG_NXCONSOLE_CACHESIZE</code>:
<dd>If <code>CONFIG_NXCONSOLE_FONTCACHE</code>, then this setting will control the size of the font cache (in number of glyphs). Default: 16.
<dd>
NxConsole supports caching of rendered fonts.
This font caching is required for two reasons:
(1) First, it improves text performance, but more importantly
(2) it preserves the font memory.
Since the NX server runs on a separate server thread, it requires that the rendered font memory persist until the server has a chance to render the font.
Unfortunately, the font cache would be quite large if all fonts were saved.
The <code>CONFIG_NXCONSOLE_CACHESIZE</code> setting will control the size of the font cache (in number of glyphs).
Only that number of the most recently used glyphs will be retained.
Default: 16.
<blockquote>
NOTE: There can still be a race condition between the NxConsole driver and the
NX task. If you every see character corruption (especially when printing
a lot of data or scrolling), then increasing the value of <code>CONFIG_NXCONSOLE_CACHESIZE</code>
is something that you should try.
Alternatively, you can reduce the size of <code>CONFIG_MQ_MAXMSGSIZE</code> which will force NxConsole task to pace the server task.
<code>CONFIG_NXCONSOLE_CACHESIZE</code> should be larger than <code>CONFIG_MQ_MAXMSGSIZE</code> in any event.
</blockquote>
<dt><code>CONFIG_NXCONSOLE_LINESEPARATION</code>:
<dd>This the space (in rows) between each row of test. Default: 0
<dt><code>CONFIG_NXCONSOLE_NOWRAP</code>:

View File

@ -438,15 +438,16 @@ CONFIG_NX_MXCLIENTMSGS=16
# NxConsole needs to remember every character written to the console so
# that it can redraw the window. This setting determines the size of some
# internal memory allocations used to hold the character data. Default: 128.
# CONFIG_NXCONSOLE_FONTCACHE
# If this setting is defined, then caching of fonts will be supported by
# NxConsole. Each font must be rendered from the tiny font storage format
# to the full display size and pixel depth. If this setting is defined, then
# the more recently used font glyphs will be retained in a cache of size
# CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
# CONFIG_NXCONSOLE_CACHESIZE
# If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
# of the font cache (in number of glyphs). Default: 16.
# NxConsole supports caching of rendered fonts. This font caching is required
# for two reasons: (1) First, it improves text performance, but more
# importantly (2) it preserves the font memory. Since the NX server runs on
# a separate server thread, it requires that the rendered font memory persist
# until the server has a chance to render the font. (NOTE: There is still
# inherently a race condition in this!). Unfortunately, the font cache would
# be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
# will control the size of the font cache (in number of glyphs). Only that
# number of the most recently used glyphs will be retained. Default: 16.
# CONFIG_NXCONSOLE_LINESEPARATION
# This the space (in rows) between each row of test. Default: 2
# CONFIG_NXCONSOLE_NOWRAP
@ -458,7 +459,6 @@ CONFIG_NXCONSOLE=n
CONFIG_NXCONSOLE_BPP=8
# CONFIG_NXCONSOLE_NOGETRUN
CONFIG_NXCONSOLE_MXCHARS=256
# CONFIG_NXCONSOLE_FONTCACHE
# CONFIG_NXCONSOLE_CACHESIZE
# CONFIG_NXCONSOLE_LINESEPARATION
# CONFIG_NXCONSOLE_NOWRAP

View File

@ -439,15 +439,16 @@ CONFIG_NX_MXCLIENTMSGS=16
# NxConsole needs to remember every character written to the console so
# that it can redraw the window. This setting determines the size of some
# internal memory allocations used to hold the character data. Default: 128.
# CONFIG_NXCONSOLE_FONTCACHE
# If this setting is defined, then caching of fonts will be supported by
# NxConsole. Each font must be rendered from the tiny font storage format
# to the full display size and pixel depth. If this setting is defined, then
# the more recently used font glyphs will be retained in a cache of size
# CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
# CONFIG_NXCONSOLE_CACHESIZE
# If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
# of the font cache (in number of glyphs). Default: 16.
# NxConsole supports caching of rendered fonts. This font caching is required
# for two reasons: (1) First, it improves text performance, but more
# importantly (2) it preserves the font memory. Since the NX server runs on
# a separate server thread, it requires that the rendered font memory persist
# until the server has a chance to render the font. (NOTE: There is still
# inherently a race condition in this!). Unfortunately, the font cache would
# be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
# will control the size of the font cache (in number of glyphs). Only that
# number of the most recently used glyphs will be retained. Default: 16.
# CONFIG_NXCONSOLE_LINESEPARATION
# This the space (in rows) between each row of test. Default: 2
# CONFIG_NXCONSOLE_NOWRAP
@ -459,7 +460,6 @@ CONFIG_NXCONSOLE=n
CONFIG_NXCONSOLE_BPP=32
# CONFIG_NXCONSOLE_NOGETRUN
CONFIG_NXCONSOLE_MXCHARS=256
# CONFIG_NXCONSOLE_FONTCACHE
# CONFIG_NXCONSOLE_CACHESIZE
# CONFIG_NXCONSOLE_LINESEPARATION
# CONFIG_NXCONSOLE_NOWRAP

View File

@ -1057,15 +1057,16 @@ CONFIG_NX_MXCLIENTMSGS=16
# NxConsole needs to remember every character written to the console so
# that it can redraw the window. This setting determines the size of some
# internal memory allocations used to hold the character data. Default: 128.
# CONFIG_NXCONSOLE_FONTCACHE
# If this setting is defined, then caching of fonts will be supported by
# NxConsole. Each font must be rendered from the tiny font storage format
# to the full display size and pixel depth. If this setting is defined, then
# the more recently used font glyphs will be retained in a cache of size
# CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
# CONFIG_NXCONSOLE_CACHESIZE
# If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
# of the font cache (in number of glyphs). Default: 16.
# NxConsole supports caching of rendered fonts. This font caching is required
# for two reasons: (1) First, it improves text performance, but more
# importantly (2) it preserves the font memory. Since the NX server runs on
# a separate server thread, it requires that the rendered font memory persist
# until the server has a chance to render the font. (NOTE: There is still
# inherently a race condition in this!). Unfortunately, the font cache would
# be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
# will control the size of the font cache (in number of glyphs). Only that
# number of the most recently used glyphs will be retained. Default: 16.
# CONFIG_NXCONSOLE_LINESEPARATION
# This the space (in rows) between each row of test. Default: 2
# CONFIG_NXCONSOLE_NOWRAP
@ -1075,10 +1076,9 @@ CONFIG_NX_MXCLIENTMSGS=16
#
CONFIG_NXCONSOLE=n
CONFIG_NXCONSOLE_BPP=16
# CONFIG_NXCONSOLE_NOGETRUN
CONFIG_NXCONSOLE_NOGETRUN=y
CONFIG_NXCONSOLE_MXCHARS=256
# CONFIG_NXCONSOLE_FONTCACHE
# CONFIG_NXCONSOLE_CACHESIZE
CONFIG_NXCONSOLE_CACHESIZE=32
# CONFIG_NXCONSOLE_LINESEPARATION
# CONFIG_NXCONSOLE_NOWRAP

View File

@ -907,15 +907,16 @@ CONFIG_NX_MXCLIENTMSGS=16
# NxConsole needs to remember every character written to the console so
# that it can redraw the window. This setting determines the size of some
# internal memory allocations used to hold the character data. Default: 128.
# CONFIG_NXCONSOLE_FONTCACHE
# If this setting is defined, then caching of fonts will be supported by
# NxConsole. Each font must be rendered from the tiny font storage format
# to the full display size and pixel depth. If this setting is defined, then
# the more recently used font glyphs will be retained in a cache of size
# CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
# CONFIG_NXCONSOLE_CACHESIZE
# If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
# of the font cache (in number of glyphs). Default: 16.
# NxConsole supports caching of rendered fonts. This font caching is required
# for two reasons: (1) First, it improves text performance, but more
# importantly (2) it preserves the font memory. Since the NX server runs on
# a separate server thread, it requires that the rendered font memory persist
# until the server has a chance to render the font. (NOTE: There is still
# inherently a race condition in this!). Unfortunately, the font cache would
# be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
# will control the size of the font cache (in number of glyphs). Only that
# number of the most recently used glyphs will be retained. Default: 16.
# CONFIG_NXCONSOLE_LINESEPARATION
# This the space (in rows) between each row of test. Default: 2
# CONFIG_NXCONSOLE_NOWRAP
@ -925,10 +926,9 @@ CONFIG_NX_MXCLIENTMSGS=16
#
CONFIG_NXCONSOLE=n
CONFIG_NXCONSOLE_BPP=16
# CONFIG_NXCONSOLE_NOGETRUN
CONFIG_NXCONSOLE_NOGETRUN=y
CONFIG_NXCONSOLE_MXCHARS=256
# CONFIG_NXCONSOLE_FONTCACHE
# CONFIG_NXCONSOLE_CACHESIZE
CONFIG_NXCONSOLE_CACHESIZE=32
# CONFIG_NXCONSOLE_LINESEPARATION
# CONFIG_NXCONSOLE_NOWRAP

View File

@ -915,15 +915,16 @@ CONFIG_NX_MXCLIENTMSGS=16
# NxConsole needs to remember every character written to the console so
# that it can redraw the window. This setting determines the size of some
# internal memory allocations used to hold the character data. Default: 128.
# CONFIG_NXCONSOLE_FONTCACHE
# If this setting is defined, then caching of fonts will be supported by
# NxConsole. Each font must be rendered from the tiny font storage format
# to the full display size and pixel depth. If this setting is defined, then
# the more recently used font glyphs will be retained in a cache of size
# CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
# CONFIG_NXCONSOLE_CACHESIZE
# If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
# of the font cache (in number of glyphs). Default: 16.
# NxConsole supports caching of rendered fonts. This font caching is required
# for two reasons: (1) First, it improves text performance, but more
# importantly (2) it preserves the font memory. Since the NX server runs on
# a separate server thread, it requires that the rendered font memory persist
# until the server has a chance to render the font. (NOTE: There is still
# inherently a race condition in this!). Unfortunately, the font cache would
# be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
# will control the size of the font cache (in number of glyphs). Only that
# number of the most recently used glyphs will be retained. Default: 16.
# CONFIG_NXCONSOLE_LINESEPARATION
# This the space (in rows) between each row of test. Default: 2
# CONFIG_NXCONSOLE_NOWRAP
@ -933,10 +934,9 @@ CONFIG_NX_MXCLIENTMSGS=16
#
CONFIG_NXCONSOLE=y
CONFIG_NXCONSOLE_BPP=16
# CONFIG_NXCONSOLE_NOGETRUN
CONFIG_NXCONSOLE_NOGETRUN=y
CONFIG_NXCONSOLE_MXCHARS=256
# CONFIG_NXCONSOLE_FONTCACHE
# CONFIG_NXCONSOLE_CACHESIZE
CONFIG_NXCONSOLE_CACHESIZE=32
# CONFIG_NXCONSOLE_LINESEPARATION
# CONFIG_NXCONSOLE_NOWRAP

View File

@ -906,15 +906,16 @@ CONFIG_NX_MXCLIENTMSGS=16
# NxConsole needs to remember every character written to the console so
# that it can redraw the window. This setting determines the size of some
# internal memory allocations used to hold the character data. Default: 128.
# CONFIG_NXCONSOLE_FONTCACHE
# If this setting is defined, then caching of fonts will be supported by
# NxConsole. Each font must be rendered from the tiny font storage format
# to the full display size and pixel depth. If this setting is defined, then
# the more recently used font glyphs will be retained in a cache of size
# CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
# CONFIG_NXCONSOLE_CACHESIZE
# If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
# of the font cache (in number of glyphs). Default: 16.
# NxConsole supports caching of rendered fonts. This font caching is required
# for two reasons: (1) First, it improves text performance, but more
# importantly (2) it preserves the font memory. Since the NX server runs on
# a separate server thread, it requires that the rendered font memory persist
# until the server has a chance to render the font. (NOTE: There is still
# inherently a race condition in this!). Unfortunately, the font cache would
# be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
# will control the size of the font cache (in number of glyphs). Only that
# number of the most recently used glyphs will be retained. Default: 16.
# CONFIG_NXCONSOLE_LINESEPARATION
# This the space (in rows) between each row of test. Default: 2
# CONFIG_NXCONSOLE_NOWRAP
@ -924,10 +925,9 @@ CONFIG_NX_MXCLIENTMSGS=16
#
CONFIG_NXCONSOLE=n
CONFIG_NXCONSOLE_BPP=16
# CONFIG_NXCONSOLE_NOGETRUN
CONFIG_NXCONSOLE_NOGETRUN=y
CONFIG_NXCONSOLE_MXCHARS=256
# CONFIG_NXCONSOLE_FONTCACHE
# CONFIG_NXCONSOLE_CACHESIZE
CONFIG_NXCONSOLE_CACHESIZE=32
# CONFIG_NXCONSOLE_LINESEPARATION
# CONFIG_NXCONSOLE_NOWRAP

View File

@ -906,15 +906,16 @@ CONFIG_NX_MXCLIENTMSGS=16
# NxConsole needs to remember every character written to the console so
# that it can redraw the window. This setting determines the size of some
# internal memory allocations used to hold the character data. Default: 128.
# CONFIG_NXCONSOLE_FONTCACHE
# If this setting is defined, then caching of fonts will be supported by
# NxConsole. Each font must be rendered from the tiny font storage format
# to the full display size and pixel depth. If this setting is defined, then
# the more recently used font glyphs will be retained in a cache of size
# CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
# CONFIG_NXCONSOLE_CACHESIZE
# If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
# of the font cache (in number of glyphs). Default: 16.
# NxConsole supports caching of rendered fonts. This font caching is required
# for two reasons: (1) First, it improves text performance, but more
# importantly (2) it preserves the font memory. Since the NX server runs on
# a separate server thread, it requires that the rendered font memory persist
# until the server has a chance to render the font. (NOTE: There is still
# inherently a race condition in this!). Unfortunately, the font cache would
# be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
# will control the size of the font cache (in number of glyphs). Only that
# number of the most recently used glyphs will be retained. Default: 16.
# CONFIG_NXCONSOLE_LINESEPARATION
# This the space (in rows) between each row of test. Default: 2
# CONFIG_NXCONSOLE_NOWRAP
@ -924,10 +925,9 @@ CONFIG_NX_MXCLIENTMSGS=16
#
CONFIG_NXCONSOLE=n
CONFIG_NXCONSOLE_BPP=16
# CONFIG_NXCONSOLE_NOGETRUN
CONFIG_NXCONSOLE_NOGETRUN=y
CONFIG_NXCONSOLE_MXCHARS=256
# CONFIG_NXCONSOLE_FONTCACHE
# CONFIG_NXCONSOLE_CACHESIZE
CONFIG_NXCONSOLE_CACHESIZE=32
# CONFIG_NXCONSOLE_LINESEPARATION
# CONFIG_NXCONSOLE_NOWRAP

View File

@ -336,15 +336,21 @@ CONFIG_NXCONSOLE_MXCHARS
NxConsole needs to remember every character written to the console so
that it can redraw the window. This setting determines the size of some
internal memory allocations used to hold the character data. Default: 128.
CONFIG_NXCONSOLE_FONTCACHE
If this setting is defined, then caching of fonts will be supported by
NxConsole. Each font must be rendered from the tiny font storage format
to the full display size and pixel depth. If this setting is defined, then
the more recently used font glyphs will be retained in a cache of size
CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
CONFIG_NXCONSOLE_CACHESIZE
If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
of the font cache (in number of glyphs). Default: 16.
NxConsole supports caching of rendered fonts. This font caching is required
for two reasons: (1) First, it improves text performance, but more
importantly (2) it preserves the font memory. Since the NX server runs on
a separate server thread, it requires that the rendered font memory persist
until the server has a chance to render the font. Unfortunately, the font
cache would be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE
setting will control the size of the font cache (in number of glyphs). Only that
number of the most recently used glyphs will be retained. Default: 16.
NOTE: There can still be a race condition between the NxConsole driver and the
NX task. If you every see character corruption (especially when printing
a lot of data or scrolling), then increasing the value of CONFIG_NXCONSOLE_CACHESIZE
is something that you should try. Alternatively, you can reduce the size of
CONFIG_MQ_MAXMSGSIZE which will force NxConsole task to pace the server task.
CONFIG_NXCONSOLE_CACHESIZE should be larger than ONFIG_MQ_MAXMSGSIZE in any event.
CONFIG_NXCONSOLE_LINESEPARATION
This the space (in rows) between each row of test. Default: 0
CONFIG_NXCONSOLE_NOWRAP

View File

@ -39,9 +39,12 @@
#include <nuttx/config.h>
#include <string.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include "nxcon_internal.h"
/****************************************************************************
@ -94,7 +97,6 @@
* Name: nxcon_freeglyph
****************************************************************************/
#ifdef CONFIG_NXCONSOLE_FONTCACHE
static void nxcon_freeglyph(FAR struct nxcon_glyph_s *glyph)
{
if (glyph->bitmap)
@ -103,7 +105,6 @@ static void nxcon_freeglyph(FAR struct nxcon_glyph_s *glyph)
}
memset(glyph, 0, sizeof(struct nxcon_glyph_s));
}
#endif
/****************************************************************************
* Name: nxcon_allocglyph
@ -112,7 +113,6 @@ static void nxcon_freeglyph(FAR struct nxcon_glyph_s *glyph)
static inline FAR struct nxcon_glyph_s *
nxcon_allocglyph(FAR struct nxcon_state_s *priv)
{
#ifdef CONFIG_NXCONSOLE_FONTCACHE
FAR struct nxcon_glyph_s *glyph = NULL;
FAR struct nxcon_glyph_s *luglyph = NULL;
uint8_t luusecnt;
@ -175,16 +175,12 @@ nxcon_allocglyph(FAR struct nxcon_state_s *priv)
luglyph->usecnt = 1;
return luglyph;
#else
return &priv->glyph;
#endif
}
/****************************************************************************
* Name: nxcon_findglyph
****************************************************************************/
#ifdef CONFIG_NXCONSOLE_FONTCACHE
static FAR struct nxcon_glyph_s *
nxcon_findglyph(FAR struct nxcon_state_s *priv, uint8_t ch)
{
@ -211,7 +207,6 @@ nxcon_findglyph(FAR struct nxcon_state_s *priv, uint8_t ch)
}
return NULL;
}
#endif
/****************************************************************************
* Name: nxcon_renderglyph
@ -226,6 +221,7 @@ nxcon_renderglyph(FAR struct nxcon_state_s *priv,
#if CONFIG_NXCONSOLE_BPP < 8
nxgl_mxpixel_t pixel;
#endif
int bmsize;
int row;
int col;
int ret;
@ -246,15 +242,8 @@ nxcon_renderglyph(FAR struct nxcon_state_s *priv,
/* Allocate memory to hold the glyph with its offsets */
#ifdef CONFIG_NXCONSOLE_FONTCACHE
{
DEBUGASSERT(glyph->bitmap == NULL);
int bmsize = glyph->stride * glyph->height;
glyph->bitmap = (FAR uint8_t *)kmalloc(bmsize);
}
#else
DEBUGASSERT(glyph->bitmap != NULL);
#endif
bmsize = glyph->stride * glyph->height;
glyph->bitmap = (FAR uint8_t *)kmalloc(bmsize);
if (glyph->bitmap)
{
@ -329,9 +318,7 @@ nxcon_renderglyph(FAR struct nxcon_state_s *priv,
/* Actually, the RENDERER never returns a failure */
gdbg("nxcon_renderglyph: RENDERER failed\n");
#ifdef CONFIG_NXCONSOLE_FONTCACHE
nxcon_freeglyph(glyph);
#endif
glyph = NULL;
}
}
@ -374,7 +361,6 @@ nxcon_getglyph(NXHANDLE hfont, FAR struct nxcon_state_s *priv, uint8_t ch)
/* First, try to find the glyph in the cache of pre-rendered glyphs */
#ifdef CONFIG_NXCONSOLE_FONTCACHE
glyph = nxcon_findglyph(priv, ch);
if (glyph)
{
@ -382,9 +368,6 @@ nxcon_getglyph(NXHANDLE hfont, FAR struct nxcon_state_s *priv, uint8_t ch)
return glyph;
}
#else
glyph = NULL;
#endif
/* No, it is not cached... Does the code map to a font? */

View File

@ -119,9 +119,7 @@ struct nxcon_glyph_s
uint8_t height; /* Height of this glyph (in rows) */
uint8_t width; /* Width of this glyph (in pixels) */
uint8_t stride; /* Width of the glyph row (in bytes) */
#ifdef CONFIG_NXCONSOLE_FONTCACHE
uint8_t usecnt; /* Use count */
#endif
FAR uint8_t *bitmap; /* Allocated bitmap memory */
};
@ -155,9 +153,7 @@ struct nxcon_state_s
uint8_t fheight; /* Max height of a font in pixels */
uint8_t fwidth; /* Max width of a font in pixels */
uint8_t spwidth; /* The width of a space */
#ifdef CONFIG_NXCONSOLE_FONTCACHE
uint8_t maxglyphs; /* Size of the glyph[] array */
#endif
/* VT100 escape sequence processing */
@ -170,13 +166,7 @@ struct nxcon_state_s
/* Glyph cache data storage */
#ifdef CONFIG_NXCONSOLE_FONTCACHE
struct nxcon_glyph_s glyph[CONFIG_NXCONSOLE_CACHESIZE];
#else
/* A glyph cache of size one -- all fonts will be re-rendered on each use */
struct nxcon_glyph_s glyph;
#endif
};
/****************************************************************************

View File

@ -124,27 +124,9 @@ FAR struct nxcon_state_s *
priv->maxchars = CONFIG_NXCONSOLE_MXCHARS;
/* Set up the font glyph bitmap cache (if enabled) */
/* Set up the font glyph bitmap cache */
#ifdef CONFIG_NXCONSOLE_FONTCACHE
priv->maxglyphs = CONFIG_NXCONSOLE_CACHESIZE;
#endif
/* Pre-allocate maximal sized glyph bitmap memory (only if we are not
* using the glyph cache.
*/
#ifndef CONFIG_NXCONSOLE_FONTCACHE
{
int allocsize = (priv->fheight * priv->fwidth * CONFIG_NXCONSOLE_BPP + 7) >> 3;
priv->glyph.bitmap = (FAR uint8_t *)kmalloc(allocsize);
if (!priv->glyph.bitmap)
{
gdbg("Failed to allocate glyph memory\n");
goto errout;
}
}
#endif
/* Set the initial display position */

View File

@ -87,7 +87,7 @@
* only.
****************************************************************************/
#ifndef CONFIG_NXCONSOLE_NOGETRUN
#ifdef CONFIG_NXCONSOLE_NOGETRUN
static inline void nxcon_movedisplay(FAR struct nxcon_state_s *priv,
int bottom, int scrollheight)
{
@ -170,7 +170,7 @@ static inline void nxcon_movedisplay(FAR struct nxcon_state_s *priv,
/* Move the source rectangle */
ret = priv->move(priv, &rect, &offset);
ret = priv->ops->move(priv, &rect, &offset);
if (ret < 0)
{
gdbg("move failed: %d\n", errno);

View File

@ -89,6 +89,7 @@ void nxcon_unregister(NXCONSOLE handle)
{
FAR struct nxcon_state_s *priv;
char devname[NX_DEVNAME_SIZE];
int i;
DEBUGASSERT(handle);
@ -97,11 +98,16 @@ void nxcon_unregister(NXCONSOLE handle)
priv = (FAR struct nxcon_state_s *)handle;
sem_destroy(&priv->exclsem);
/* Free the pre-allocated glyph bitmap */
/* Free all allocated glyph bitmap */
#ifndef CONFIG_NXCONSOLE_FONTCACHE
kfree(priv->glyph.bitmap);
#endif
for (i = 0; i < CONFIG_NXCONSOLE_CACHESIZE; i++)
{
FAR struct nxcon_glyph_s *glyph = &priv->glyph[i];
if (glyph->bitmap)
{
kfree(glyph->bitmap);
}
}
/* Unregister the driver */

View File

@ -77,15 +77,16 @@
* NxConsole needs to remember every character written to the console so
* that it can redraw the window. This setting determines the size of some
* internal memory allocations used to hold the character data. Default: 128.
* CONFIG_NXCONSOLE_FONTCACHE
* If this setting is defined, then caching of fonts will be supported by
* NxConsole. Each font must be rendered from the tiny font storage format
* to the full display size and pixel depth. If this setting is defined, then
* the more recently used font glyphs will be retained in a cache of size
* CONFIG_NXCONSOLE_CACHESIZE. Default: No font caching.
* CONFIG_NXCONSOLE_CACHESIZE
* If CONFIG_NXCONSOLE_FONTCACHE, then this setting will control the size
* of the font cache (in number of glyphs). Default: 16.
* NxConsole supports caching of rendered fonts. This font caching is required
* for two reasons: (1) First, it improves text performance, but more
* importantly (2) it preserves the font memory. Since the NX server runs on
* a separate server thread, it requires that the rendered font memory persist
* until the server has a chance to render the font. (NOTE: There is still
* inherently a race condition in this!). Unfortunately, the font cache would
* be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
* will control the size of the font cache (in number of glyphs). Only that
* number of the most recently used glyphs will be retained. Default: 16.
* CONFIG_NXCONSOLE_LINESEPARATION
* This the space (in rows) between each row of test. Default: 0
* CONFIG_NXCONSOLE_NOWRAP
@ -104,12 +105,8 @@
* remembered.
*/
#ifdef CONFIG_NXCONSOLE_FONTCACHE
# ifndef CONFIG_NXCONSOLE_CACHESIZE
# define CONFIG_NXCONSOLE_CACHESIZE 16
# endif
#else
# undef CONFIG_NXCONSOLE_CACHESIZE
#ifndef CONFIG_NXCONSOLE_CACHESIZE
# define CONFIG_NXCONSOLE_CACHESIZE 16
#endif
/* Pixel depth */