git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@720 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2010-08-13 11:34:48 +00:00
parent 3c973dfdd5
commit 184dfd4b20

View File

@@ -81,13 +81,10 @@ extern CPictureViewer * g_PicViewer;
#define GXA_CMD_REG 0x001C
#define GXA_FG_COLOR_REG 0x0020
#define GXA_BG_COLOR_REG 0x0024
#define GXA_CFG_REG 0x0030
#define GXA_LINE_CONTROL_REG 0x0038
#define GXA_BLEND_CFG_REG 0x003C
#define GXA_BMP2_TYPE_REG 0x0050
#define GXA_BMP2_ADDR_REG 0x0054
#define GXA_DEPTH_REG 0x00F4
#define GXA_CFG2_REG 0x00FC
#define GXA_CONTENT_ID_REG 0x0144
#define GXA_CMD_BLT 0x00010800
@@ -98,6 +95,9 @@ extern CPictureViewer * g_PicViewer;
#define GXA_BMP1_TYPE_REG 0x0048
#define GXA_BMP1_ADDR_REG 0x004C
#define GXA_BLEND_CFG_REG 0x003C
#define GXA_CFG_REG 0x0030
#define GXA_CFG2_REG 0x00FC
/*
static unsigned int _read_gxa(volatile unsigned char *base_addr, unsigned int offset)
{
@@ -109,8 +109,8 @@ static unsigned int _mark = 0;
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)
{};
*(volatile unsigned int *)(base_addr + offset) = value;
}
@@ -118,11 +118,11 @@ static void _write_gxa(volatile unsigned char *base_addr, unsigned int offset, u
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)*/;
unsigned int cmd = GXA_CMD_QMARK | GXA_PARAM_COUNT(1);
// TODO: locking?
_mark++;
_mark &= 0x1f; /* bit 0x20 crashes the kernel, if set */
_write_gxa(gxa_base, cmd, _mark /*| 0x100*/);
_mark &= 0x0000001F; /* bit 0x20 crashes the kernel, if set */
_write_gxa(gxa_base, cmd, _mark);
//fprintf(stderr, "%s: wrote %02x\n", __FUNCTION__, _mark);
}
@@ -133,7 +133,7 @@ void CFrameBuffer::waitForIdle(void)
do {
cfg = *(volatile unsigned int *)(gxa_base + GXA_CMD_REG);
cfg >>= 24; /* the token is stored in bits 31...24 */
if (cfg >= _mark)
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 */
@@ -199,17 +199,16 @@ CFrameBuffer* CFrameBuffer::getInstance()
#ifdef USE_NEVIS_GXA
void CFrameBuffer::setupGXA(void)
{
// We (re)store the GXA regs here in case DFB override them and was not
// able to restore them.
// We (re)store the GXA regs here in case DFB override them and was not
// able to restore them.
_write_gxa(gxa_base, GXA_BMP2_TYPE_REG, (3 << 16) | screeninfo.xres);
_write_gxa(gxa_base, GXA_BMP2_ADDR_REG, (unsigned int) fix.smem_start);
// _write_gxa(gxa_base, GXA_CONTENT_ID_REG, 0);
_write_gxa(gxa_base, GXA_BLEND_CFG_REG, 0x00089064);
_write_gxa(gxa_base, GXA_CFG_REG, 0x100 | (1 << 12) | (1 << 29));
_write_gxa(gxa_base, GXA_CFG2_REG, 0x1FF);
_write_gxa(gxa_base, GXA_BMP2_ADDR_REG, (unsigned int) fix.smem_start);
_write_gxa(gxa_base, GXA_BLEND_CFG_REG, 0x00089064);
_write_gxa(gxa_base, GXA_CFG_REG, 0x100 | (1 << 12) | (1 << 29));
_write_gxa(gxa_base, GXA_CFG2_REG, 0x1FF);
_write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int) backgroundColor);
}
#endif
void CFrameBuffer::init(const char * const fbDevice)
{
int tr = 0xFF;
@@ -261,7 +260,7 @@ void CFrameBuffer::init(const char * const fbDevice)
/* tell the GXA where the framebuffer to draw on starts */
smem_start = (unsigned int) fix.smem_start;
printf("smem_start %x\n", smem_start);
printf("smem_start %x\n", smem_start);
setupGXA();
#endif
@@ -498,7 +497,6 @@ int CFrameBuffer::setMode(unsigned int /*nxRes*/, unsigned int /*nyRes*/, unsign
//memset(getFrameBufferPointer(), 0, stride * yRes);
paintBackground();
if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) {
printf("screen unblanking failed\n");
}
@@ -657,13 +655,10 @@ void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int
int line = 0;
#ifdef USE_NEVIS_GXA
setupGXA();
unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA;
unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA;
_write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int) col); /* setup the drawing color */
_write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int) backgroundColor); /* setup the drawing color */
_write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */
_write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int) col); /* setup the drawing color */
_write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */
#endif
if ((type) && (radius))
@@ -726,8 +721,8 @@ void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int
while (line < dy)
{
#ifdef USE_NEVIS_GXA
_write_gxa(gxa_base, cmd, GXA_POINT(x + dx, y + line)); /* endig point */
_write_gxa(gxa_base, cmd, GXA_POINT(x, y + line)); /* start point */
_write_gxa(gxa_base, cmd, GXA_POINT(x + dx, y + line)); /* endig point */
_write_gxa(gxa_base, cmd, GXA_POINT(x, y + line)); /* start point */
#else
for (int pos = x; pos < x + dx; pos++)
{
@@ -751,13 +746,10 @@ void CFrameBuffer::paintVLine(int x, int ya, int yb, const fb_pixel_t col)
return;
#ifdef USE_NEVIS_GXA
setupGXA();
/* draw a single vertical line from point x/ya to x/yb */
unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA;
_write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int) col); /* setup the drawing color */
_write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int) backgroundColor); /* setup the drawing color */
_write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */
_write_gxa(gxa_base, cmd, GXA_POINT(x, ya + (yb - ya))); /* end point */
_write_gxa(gxa_base, cmd, GXA_POINT(x, ya)); /* start point */
@@ -779,13 +771,10 @@ void CFrameBuffer::paintVLineRel(int x, int y, int dy, const fb_pixel_t col)
return;
#ifdef USE_NEVIS_GXA
setupGXA();
/* draw a single vertical line from point x/y with hight dx */
unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA;
_write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int) col); /* setup the drawing color */
_write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int) backgroundColor); /* setup the drawing color */
_write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */
_write_gxa(gxa_base, cmd, GXA_POINT(x, y + dy)); /* end point */
_write_gxa(gxa_base, cmd, GXA_POINT(x, y)); /* start point */
@@ -805,13 +794,10 @@ void CFrameBuffer::paintHLine(int xa, int xb, int y, const fb_pixel_t col)
return;
#ifdef USE_NEVIS_GXA
setupGXA();
/* draw a single horizontal line from point xa/y to xb/y */
unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA;
_write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int) col); /* setup the drawing color */
_write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int) backgroundColor); /* setup the drawing color */
_write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */
_write_gxa(gxa_base, cmd, GXA_POINT(xa + (xb - xa), y)); /* end point */
_write_gxa(gxa_base, cmd, GXA_POINT(xa, y)); /* start point */
@@ -832,13 +818,10 @@ void CFrameBuffer::paintHLineRel(int x, int dx, int y, const fb_pixel_t col)
return;
#ifdef USE_NEVIS_GXA
setupGXA();
/* draw a single horizontal line from point x/y with width dx */
unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA;
_write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int) col); /* setup the drawing color */
_write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int) backgroundColor); /* setup the drawing color */
_write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */
_write_gxa(gxa_base, cmd, GXA_POINT(x + dx, y)); /* end point */
_write_gxa(gxa_base, cmd, GXA_POINT(x, y)); /* start point */