mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 23:42:51 +02:00
neutrino: speed up the fontrenderer
Speed up the fontrenderer by *not* using the GXA accelerator. To
prevent artifacts, add a routine to framebuffer class to sync on
the GXA engine being ready with drawing.
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@196 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Branch: ni/coolstream
Commit: 230a966e7d
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2010-01-20 (Wed, 20 Jan 2010)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -36,7 +36,9 @@
|
|||||||
|
|
||||||
#include <system/debug.h>
|
#include <system/debug.h>
|
||||||
|
|
||||||
//#undef USE_NEVIS_GXA // since OSD problem gone with new driver, until GXA will be faster//reenabled GXA-luc
|
/* Drawing pixels is actually faster without the GXA accelerator (wich OTOH is
|
||||||
|
faster for drawing lines, so disable it here. */
|
||||||
|
#undef USE_NEVIS_GXA
|
||||||
|
|
||||||
FT_Error FBFontRenderClass::myFTC_Face_Requester(FTC_FaceID face_id,
|
FT_Error FBFontRenderClass::myFTC_Face_Requester(FTC_FaceID face_id,
|
||||||
FT_Library /*library*/,
|
FT_Library /*library*/,
|
||||||
@@ -455,6 +457,11 @@ void Font::RenderString(int x, int y, const int width, const char *text, const u
|
|||||||
spread_by = 1;
|
spread_by = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* the GXA seems to do it's job asynchonously, so we need to wait until
|
||||||
|
it's ready, otherwise the font will sometimes "be overwritten" with
|
||||||
|
background color */
|
||||||
|
frameBuffer->waitForIdle();
|
||||||
|
|
||||||
for (; *text; text++)
|
for (; *text; text++)
|
||||||
{
|
{
|
||||||
FTC_SBit glyph;
|
FTC_SBit glyph;
|
||||||
|
@@ -75,6 +75,7 @@ extern CPictureViewer * g_PicViewer;
|
|||||||
#define GXA_DST_BMP_SEL(x) (x << 5)
|
#define GXA_DST_BMP_SEL(x) (x << 5)
|
||||||
#define GXA_PARAM_COUNT(x) (x << 2)
|
#define GXA_PARAM_COUNT(x) (x << 2)
|
||||||
|
|
||||||
|
#define GXA_CMD_REG 0x001C
|
||||||
#define GXA_FG_COLOR_REG 0x0020
|
#define GXA_FG_COLOR_REG 0x0020
|
||||||
#define GXA_BG_COLOR_REG 0x0024
|
#define GXA_BG_COLOR_REG 0x0024
|
||||||
#define GXA_LINE_CONTROL_REG 0x0038
|
#define GXA_LINE_CONTROL_REG 0x0038
|
||||||
@@ -86,6 +87,7 @@ extern CPictureViewer * g_PicViewer;
|
|||||||
#define GXA_CMD_BLT 0x00010800
|
#define GXA_CMD_BLT 0x00010800
|
||||||
#define GXA_CMD_NOT_ALPHA 0x00011000
|
#define GXA_CMD_NOT_ALPHA 0x00011000
|
||||||
#define GXA_CMD_NOT_TEXT 0x00018000
|
#define GXA_CMD_NOT_TEXT 0x00018000
|
||||||
|
#define GXA_CMD_QMARK 0x00001000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static unsigned int _read_gxa(volatile unsigned char *base_addr, unsigned int offset)
|
static unsigned int _read_gxa(volatile unsigned char *base_addr, unsigned int offset)
|
||||||
@@ -93,6 +95,9 @@ static unsigned int _read_gxa(volatile unsigned char *base_addr, unsigned int of
|
|||||||
return *(volatile unsigned int *)(base_addr + offset);
|
return *(volatile unsigned int *)(base_addr + offset);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static unsigned int _mark = 0;
|
||||||
|
|
||||||
static void _write_gxa(volatile unsigned char *base_addr, unsigned int offset, unsigned int value)
|
static void _write_gxa(volatile unsigned char *base_addr, unsigned int offset, unsigned int value)
|
||||||
{
|
{
|
||||||
while( (*(volatile unsigned int *)(base_addr + GXA_DEPTH_REG)) & 0x40000000)
|
while( (*(volatile unsigned int *)(base_addr + GXA_DEPTH_REG)) & 0x40000000)
|
||||||
@@ -100,6 +105,36 @@ static void _write_gxa(volatile unsigned char *base_addr, unsigned int offset, u
|
|||||||
*(volatile unsigned int *)(base_addr + offset) = value;
|
*(volatile unsigned int *)(base_addr + offset) = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this adds a tagged marker into the GXA queue. Once this comes out
|
||||||
|
of the other end of the queue, all commands before it are finished */
|
||||||
|
void CFrameBuffer::add_gxa_sync_marker(void)
|
||||||
|
{
|
||||||
|
unsigned int cmd = GXA_CMD_QMARK | GXA_PARAM_COUNT(1);
|
||||||
|
// TODO: locking?
|
||||||
|
_mark++;
|
||||||
|
_mark &= 0x0000001F; /* bit 0x20 crashes the kernel, if set */
|
||||||
|
_write_gxa(gxa_base, cmd, _mark);
|
||||||
|
//fprintf(stderr, "%s: wrote %02x\n", __FUNCTION__, _mark);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wait until the current marker comes out of the GXA command queue */
|
||||||
|
void CFrameBuffer::waitForIdle(void)
|
||||||
|
{
|
||||||
|
unsigned int cfg, count = 0;
|
||||||
|
do {
|
||||||
|
cfg = *(volatile unsigned int *)(gxa_base + GXA_CMD_REG);
|
||||||
|
cfg >>= 24; /* the token is stored in bits 31...24 */
|
||||||
|
if (cfg == _mark)
|
||||||
|
break;
|
||||||
|
/* usleep is too coarse, because of CONFIG_HZ=100 in kernel
|
||||||
|
so use sched_yield to at least give other threads a chance to run */
|
||||||
|
sched_yield();
|
||||||
|
//fprintf(stderr, "%s: read %02x, expected %02x\n", __FUNCTION__, cfg, _mark);
|
||||||
|
} while(++count < 2048); /* don't deadlock here if there is an error */
|
||||||
|
|
||||||
|
if (count > 512) /* more than 100 are unlikely, */
|
||||||
|
fprintf(stderr, "CFrameBuffer::waitForIdle: count is big (%d)!\n", count);
|
||||||
|
}
|
||||||
#endif /* USE_NEVIS_GXA */
|
#endif /* USE_NEVIS_GXA */
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
@@ -634,6 +669,11 @@ void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int
|
|||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef USE_NEVIS_GXA
|
||||||
|
/* the GXA seems to do asynchronous rendering, so we add a sync marker
|
||||||
|
to which the fontrenderer code can synchronize */
|
||||||
|
add_gxa_sync_marker();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrameBuffer::paintVLine(int x, int ya, int yb, const fb_pixel_t col)
|
void CFrameBuffer::paintVLine(int x, int ya, int yb, const fb_pixel_t col)
|
||||||
|
@@ -214,6 +214,12 @@ class CFrameBuffer
|
|||||||
bool Lock(void);
|
bool Lock(void);
|
||||||
void Unlock(void);
|
void Unlock(void);
|
||||||
bool Locked(void) { return locked; };
|
bool Locked(void) { return locked; };
|
||||||
|
#ifdef USE_NEVIS_GXA
|
||||||
|
void add_gxa_sync_marker(void);
|
||||||
|
void waitForIdle(void);
|
||||||
|
#else
|
||||||
|
inline void waitForIdle(void) {};
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user