Hi,
I am writing a gfxdriver for Fujitsu mb86296 video card under DirectFB. When
I register layer in my driver, the example df_fire (
DirectFB-examples-1.0.0.tar.gz), there is no output in computer screen. the
error result looks like this:
sh-3.00# ./df_fire
=======================| DirectFB 1.0.0 |=======================
(c) 2001-2007 The DirectFB Organization (directfb.org)
(c) 2000-2004 Convergence (integrated media) GmbH
------------------------------------------------------------
(*) DirectFB/Core: Single Application Core. (2008-08-07 20:19) [ DEBUG ][
TRACE ]
(*) Direct/Memcpy: Using ppcasm_memcpy()
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 527)...
(*) Direct/Thread: Running 'PS/2 Input' (INPUT, 529)...
(*) DirectFB/Input: IMPS/2 Mouse 1.0 (directfb.org)
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 530)...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) DirectFB/Graphics: Fujitsu Fujitsu MB86296 0.5 (Atom Create)
(!) [ 519: 0.000] --> Caught signal 11 (at (nil), invalid address) <--
(-) [ 519: -STACK- ]
#0 0x0fe9db44 in signal_handler () from
/mnt/gtkdfb/lib/libdirect-1.0.so.0
[0xfe90000]
#1 0x0ffaece8 in dfb_layers_initialize () from
/mnt/gtkdfb/lib/libdirectfb-1.0.so.0 [0xff35000]
#2 0x0ff980c8 in dfb_core_part_initialize () from
/mnt/gtkdfb/lib/libdirectfb-1.0.so.0 [0xff35000]
#3 0x0ff97620 in dfb_core_initialize () from
/mnt/gtkdfb/lib/libdirectfb-1.0.so.0 [0xff35000]
#4 0x0ff97a70 in dfb_core_arena_initialize () from
/mnt/gtkdfb/lib/libdirectfb-1.0.so.0 [0xff35000]
#5 0x0fed45b0 in fusion_arena_enter () from
/mnt/gtkdfb/lib/libfusion-1.0.so.0 [0xfed0000]
#6 0x0ff953e0 in dfb_core_create () from
/mnt/gtkdfb/lib/libdirectfb-1.0.so.0 [0xff35000]
#7 0x100127b4 in DirectFBCreate () from ./df_fire [0x10000000]
(-) [ 527: -STACK- 'VT Switcher']
#0 0x0fcbf150 in vt_thread () from
/mnt/gtkdfb/lib/directfb-1.0-0/systems/libdirectfb_fbdev.so [0xfcb5000]
(-) [ 529: -STACK- 'PS/2 Input']
#0 0x0fb730d4 in ps2mouseEventThread () from
/mnt/gtkdfb/lib/directfb-1.0-0/inputdrivers/libdirectfb_ps2mouse.so
[0xfb71000]
(-) [ 530: -STACK- 'Keyboard Input']
#0 0x0fc247b8 in keyboardEventThread () from
/mnt/gtkdfb/lib/directfb-1.0-0/inputdrivers/libdirectfb_keyboard.so
[0xfc22000]
Aborted
my mb86296_layer.c refers to sh7722 gfxdriver and I don't understand some of
it since I don't have its munual. my mb86296_layer.c is as follows:
/*
mb86296_layer.c
(c) Copyright 2001-2007 The DirectFB Organization (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Antonino Daplas <[EMAIL PROTECTED]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <sys/ioctl.h>
#include <string.h>
#include <fbdev/fbdev.h> /* FIXME: Needs to be included before dfb_types.h
to work around a type clash with asm/types.h */
#include <core/coredefs.h>
#include <core/layers.h>
#include <core/surfaces.h>
#include <core/screens.h>
#include <core/screen.h>
#include <fbdev/fbdev.h>
#include <direct/mem.h>
#include <gfx/convert.h>
#include "mb86296.h"
#include "mb86290fbsys.h"
extern unsigned long drawRegRead32(unsigned long nOffset);
extern unsigned long geoRegRead32(unsigned long nOffset);
extern unsigned long dispRegRead32(unsigned long nOffset);
extern void drawRegWrite32(unsigned long nOffset, unsigned long nVal);
extern void geoRegWrite32(unsigned long nOffset, unsigned long nVal);
extern void dispRegWrite32(unsigned long nOffset, unsigned long nVal);
#define MB86296_OVERLAY_SUPPORTED_OPTIONS (DLOP_DST_COLORKEY |
DLOP_DEINTERLACING)
void
mb86296ovlOnOff( mb86296DriverData *idrv,
mb86296DeviceData *idev,
bool on,
int n)
{
unsigned long reg;
if (!on)
if (n = 0)
{
reg = dispReadReg(GDC_DISP_REG_EXT_MODE);
dispRegWrite32(GDC_DISP_REG_EXT_MODE, reg & 0xfffeffff);
}
else if (n = 1)
{
reg = dispReadReg(GDC_DISP_REG_EXT_MODE);
dispRegWrite32(GDC_DISP_REG_EXT_MODE, reg | 0xfffbffff);
}
else if (n = 2)
{
reg = dispReadReg(GDC_DISP_REG_EXT_MODE);
dispRegWrite32(GDC_DISP_REG_EXT_MODE, reg | 0xffff7ffff);
}
}
static int
mb86296LayerDataSize()
{
return sizeof(MB86296LayerData);
}
static DFBResult
mb86296InitLayer(
CoreLayer *layer,
void *driver_data,
void *layer_data,
DFBDisplayLayerDescription *description,
DFBDisplayLayerConfig *config,
DFBColorAdjustment *adjustment )
{
mb86296DriverData *sdrv = driver_data;
mb86296LayerData *data = layer_data;
/* initialize layer data */
data->layer = MB86296_LAYER_INPUT1 + sdrv->num_inputs++;
/* set capabilities and type */
description->caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL |
DLCAPS_OPACITY |
DLCAPS_SCREEN_POSITION | DLCAPS_SRC_COLORKEY |
DLCAPS_LEVELS;
description->type = DLTF_STILL_PICTURE | DLTF_GRAPHICS | DLTF_VIDEO |
DLTF_BACKGROUND;
/* set name */
snprintf( description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Input
%d", sdrv->num_inputs );
/* fill out the default configuration */
config->flags = DLCONF_WIDTH | DLCONF_HEIGHT |
DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE |
DLCONF_OPTIONS;
config->width = MB86290FB_DFLT_IP_HDP;
config->height = MB86290FB_DFLT_IP_VDP;
config->pixelformat = DSPF_RGB16;
config->buffermode = DLBM_FRONTONLY;
config->options = DLOP_NONE;
return DFB_OK;
}
static DFBResult
mb86296TestRegion( CoreLayer *layer,
void *driver_data,
void *layer_data,
CoreLayerRegionConfig *config,
CoreLayerRegionConfigFlags *failed )
{
mb86296LayerData *slay = layer_data;
CoreLayerRegionConfigFlags fail = 0;
if (config->options & ~MB86296_LAYER_SUPPORTED_OPTIONS)
fail |= CLRCF_OPTIONS;
switch (config->format) {
/* TODO: LUT8 on OSD (Input 3) */
case DSPF_NV12:
case DSPF_NV16:
/* YUV only for first input */
if (slay->layer != MB86296_LAYER_INPUT1)
fail |= CLRCF_FORMAT;
break;
case DSPF_ARGB:
case DSPF_RGB32:
case DSPF_RGB24:
case DSPF_RGB16:
break;
default:
fail |= CLRCF_FORMAT;
}
if (config->width < 32 || config->width > 1280)
fail |= CLRCF_WIDTH;
if (config->height < 32 || config->height > 1024)
fail |= CLRCF_HEIGHT;
if (config->dest.x >= MB86290FB_DFLT_IP_HDP || config->dest.y >=
MB86290FB_DFLT_IP_VDP)
fail |= CLRCF_DEST;
if (config->dest.x < 0) {
config->dest.x = 0;
// fail |= CLRCF_DEST;
}
if (config->dest.y < 0) {
config->dest.y = 0;
// fail |= CLRCF_DEST;
}
if (failed)
*failed = fail;
if (fail)
return DFB_UNSUPPORTED;
return DFB_OK;
}
static DFBResult
mb86296SetRegion( CoreLayer *layer,
void *driver_data,
void *layer_data,
void *region_data,
CoreLayerRegionConfig *config,
CoreLayerRegionConfigFlags updated,
CoreSurface *surface,
CorePalette *palette)
{
int n;
mb86296DriverData *sdrv = driver_data;
mb86296DeviceData *sdev = sdrv->dev;
MB86296RegionData *sreg = region_data;
MB86296LayerData *slay = layer_data;
n = slay->layer - MB86296_LAYER_INPUT1;
D_ASSERT( n >= 0 );
D_ASSERT( n <= 2 );
/* Update position? */
if (updated & CLRCF_DEST) {
/* Set horizontal and vertical offset. */
if(n = 0)
dispRegWrite32(GDC_DISP_REG_L0_WIN_POS, config->dest.y << 16) |
config->dest.x);
else if(n = 1)
dispRegWrite32(GDC_DISP_REG_L2_WIN_POS, config->dest.y << 16) |
config->dest.x);
else if (n = 2)
dispRegWrite32(GDC_DISP_REG_L4_WIN_POS, config->dest.y << 16) |
config->dest.x);
}
/* Update size? */
if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT)) {
int cw = config->width;
int ch = config->height;
if (config->dest.x + cw > MB86296_LCD_WIDTH)
cw = SH7722_LCD_WIDTH - config->dest.x;
if (config->dest.y + ch > MB86296_LCD_HEIGHT)
ch = SH7722_LCD_HEIGHT - config->dest.y;
if (n = 0)
dispRegWrite32(GDC_DISP_REG_L0_WIN_SIZE, (ch << 16) | cw);
else if (n = 1)
dispRegWrite32(GDC_DISP_REG_L2_WIN_SIZE, (ch << 16) | cw);
else if (n = 2)
dispRegWrite32(GDC_DISP_REG_L4_WIN_SIZE, (ch << 16) | cw);
}
/* Update format? */
if (updated & CLRCF_FORMAT) {
unsigned long tBSIFR = 0;
/* Set pixel format. */
switch (config->format) {
case DSPF_NV12:
tBSIFR |= CHRR_YCBCR_420 | 0x1000;
break;
case DSPF_NV16:
tBSIFR |= CHRR_YCBCR_422 | 0x1000;
break;
case DSPF_ARGB:
tBSIFR |= RPKF_ARGB;
if (n = 0)
dispRegWrite32(GDC_DISP_REG_C_MODE_W_H,
dispRegRead32(GDC_DISP_REG_C_MODE_W_H) | 0); //8bits/pixel
else if (n = 1)
dispRegWrite32(GDC_DISP_REG_ML_MODE_W_H,
dispRegRead32(GDC_DISP_REG_ML_MODE_W_H) | 0);
else if (n = 2)
dispRegWrite32(GDC_DISP_REG_BL_MODE_W_H,
dispRegRead32(GDC_DISP_REG_BL_MODE_W_H) | 0);
break;
case DSPF_RGB32:
tBSIFR |= RPKF_RGB32;
break;
case DSPF_RGB24:
tBSIFR |= RPKF_RGB24;
break;
case DSPF_RGB16:
tBSIFR |= RPKF_RGB16;
if (n = 0)
dispRegWrite32(GDC_DISP_REG_C_MODE_W_H,
dispRegRead32(GDC_DISP_REG_C_MODE_W_H) | 1); //16bits/pixel
else if (n = 1)
dispRegWrite32(GDC_DISP_REG_ML_MODE_W_H,
dispRegRead32(GDC_DISP_REG_ML_MODE_W_H) | 1);
else if (n = 2)
dispRegWrite32(GDC_DISP_REG_BL_MODE_W_H,
dispRegRead32(GDC_DISP_REG_BL_MODE_W_H) | 1);
break;
default:
break;
}
}
/* Update options or opacity? */
if (updated & (CLRCF_OPTIONS | CLRCF_OPACITY)) {
unsigned long tBBLCR0 = LAY_123;
/* Set opacity value. */
tBBLCR0 &= ~(0xff << (n*8));
tBBLCR0 |= ((config->options & CLRCF_OPACITY) ? config->opacity :
0xff) << (n*8);
/* Enable/disable alpha channel. */
if (config->options & DLOP_ALPHACHANNEL)
tBBLCR0 |= (0x10000000 << n);
else
tBBLCR0 &= ~(0x10000000 << n);
}
/* Enable or disable input. */
if ((config->options & DLOP_OPACITY) && !config->opacity)
sdev->input_mask &= ~(1 << n);
else
sdev->input_mask |= (1 << n);
sreg->config = *config;
return DFB_OK;
}
DisplayLayerFuncs mb86296LayerFuncs = {
LayerDataSize: mb86296LayerDataSize,
InitLayer: mb86296InitLayer,
TestRegion: mb86296TestRegion,
SetRegion: mb86296SetRegion,
};
in driver_init_driver() , I called dfb_layers_register() to register three
layers since my video card support six layers.
/* Register three input system layers. */
sdrv->input1 = dfb_layers_register( sdrv->screen, driver_data,
&mb86296LayerFuncs );
sdrv->input2 = dfb_layers_register( sdrv->screen, driver_data,
&mb86296LayerFuncs );
sdrv->input3 = dfb_layers_register( sdrv->screen, driver_data,
&mb86296LayerFuncs );
I don't get what is wrong in my code. has anybody who has wriiten the
gfxdriver for the same video card help me out. Thanks in advance.
Sincerely yours,
liuxs
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev