Example #1
0
static DFBResult
driver_init_driver( GraphicsDevice      *device,
                    GraphicsDeviceFuncs *funcs,
                    void                *driver_data )
{
     ATI128DriverData *adrv = (ATI128DriverData*) driver_data;

     adrv->mmio_base = (volatile __u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
     if (!adrv->mmio_base)
          return DFB_IO;

     funcs->CheckState    = ati128CheckState;
     funcs->SetState      = ati128SetState;
     funcs->EngineSync    = ati128EngineSync;

     funcs->FillRectangle = ati128FillRectangle;
     funcs->DrawRectangle = ati128DrawRectangle;
     funcs->DrawLine      = ati128DrawLine;
     funcs->Blit          = ati128Blit;
     funcs->StretchBlit   = ati128StretchBlit;

     /* overlay support */
     dfb_layers_register( device, driver_data, &atiOverlayFuncs );
     
     return DFB_OK;
}
Example #2
0
File: tdfx.c Project: uiv/Lerdu
static DFBResult
driver_init_driver( CoreGraphicsDevice  *device,
                    GraphicsDeviceFuncs *funcs,
                    void                *driver_data,
                    void                *device_data,
                    CoreDFB             *core )
{
    TDFXDriverData *tdrv = (TDFXDriverData*) driver_data;

    tdrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
    if (!tdrv->mmio_base)
        return DFB_IO;

    tdrv->voodoo2D = (Voodoo2D*)(tdrv->mmio_base + 0x100000);
    tdrv->voodoo3D = (Voodoo3D*)(tdrv->mmio_base + 0x200000);

    funcs->CheckState    = tdfxCheckState;
    funcs->SetState      = tdfxSetState;
    funcs->EngineSync    = tdfxEngineSync;

    funcs->DrawRectangle = tdfxDrawRectangle;
    funcs->DrawLine      = tdfxDrawLine2D;
    funcs->Blit          = tdfxBlit;
    funcs->StretchBlit   = tdfxStretchBlit;

    return DFB_OK;
}
Example #3
0
static DFBResult
driver_init_driver( CoreGraphicsDevice  *device,
                    GraphicsDeviceFuncs *funcs,
                    void                *driver_data,
                    void                *device_data,
                    CoreDFB             *core )
{
     DFBResult       ret;
     I830DriverData *idrv = driver_data;
     I830DeviceData *idev = device_data;

     idrv->idev = device_data;

     idrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
     if (!idrv->mmio_base)
          return DFB_IO;

     ret = i830_agp_setup( device, idrv, idev );
     if (ret) {
          dfb_gfxcard_unmap_mmio( device, idrv->mmio_base, -1 );
          return ret;
     }

     idrv->info = idev->info;

     funcs->CheckState         = i830CheckState;
     funcs->SetState           = i830SetState;
     funcs->EngineSync         = i830EngineSync;
     funcs->FlushTextureCache  = i830FlushTextureCache;

     dfb_layers_register( dfb_screens_at(DSCID_PRIMARY), driver_data, &i830OverlayFuncs );

     return DFB_OK;
}
Example #4
0
static DFBResult
driver_init_driver( CoreGraphicsDevice  *device,
                    GraphicsDeviceFuncs *funcs,
                    void                *driver_data,
                    void                *device_data,
                    CoreDFB             *core )
{
     NeoDriverData *ndrv = (NeoDriverData*) driver_data;

     ndrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
     if (!ndrv->mmio_base)
          return DFB_IO;

     switch (dfb_gfxcard_get_accelerator( device )) {
          /* no support for other NeoMagic cards yet */
          case 95:        /* NM2200 */
          case 96:        /* NM2230 */
          case 97:        /* NM2360 */
          case 98:        /* NM2380 */
               return neo2200_init_driver( device, funcs, driver_data );
     }

     return DFB_BUG;
}
Example #5
0
static DFBResult
driver_init_driver( CoreGraphicsDevice  *device,
                    GraphicsDeviceFuncs *funcs,
                    void                *driver_data,
                    void                *device_data,
                    CoreDFB             *core )
{
    SH7722DriverData *sdrv = driver_data;
    SH7722DeviceData *sdev = device_data;

    D_DEBUG_AT( SH7722_Driver, "%s()\n", __FUNCTION__ );

    /* Keep pointer to shared device data. */
    sdrv->dev = device_data;

    /* Keep core and device pointer. */
    sdrv->core   = core;
    sdrv->device = device;

    /* Open the drawing engine device. */
    sdrv->gfx_fd = direct_try_open( "/dev/sh7722gfx", "/dev/misc/sh7722gfx", O_RDWR, true );
    if (sdrv->gfx_fd < 0)
        return DFB_INIT;

    /* Map its shared data. */
    sdrv->gfx_shared = mmap( NULL, direct_page_align( sizeof(SH7722GfxSharedArea) ),
                             PROT_READ | PROT_WRITE,
                             MAP_SHARED, sdrv->gfx_fd, 0 );
    if (sdrv->gfx_shared == MAP_FAILED) {
        D_PERROR( "SH7722/Driver: Could not map shared area!\n" );
        close( sdrv->gfx_fd );
        return DFB_INIT;
    }

    sdrv->mmio_base = dfb_gfxcard_map_mmio( device, 0, -1 );
    if (!sdrv->mmio_base) {
        D_PERROR( "SH7722/Driver: Could not map MMIO area!\n" );
        munmap( (void*) sdrv->gfx_shared, direct_page_align( sizeof(SH7722GfxSharedArea) ) );
        close( sdrv->gfx_fd );
        return DFB_INIT;
    }

    /* Check the magic value. */
    if (sdrv->gfx_shared->magic != SH7722GFX_SHARED_MAGIC) {
        D_ERROR( "SH7722/Driver: Magic value 0x%08x doesn't match 0x%08x!\n",
                 sdrv->gfx_shared->magic, SH7722GFX_SHARED_MAGIC );
        dfb_gfxcard_unmap_mmio( device, sdrv->mmio_base, -1 );
        munmap( (void*) sdrv->gfx_shared, direct_page_align( sizeof(SH7722GfxSharedArea) ) );
        close( sdrv->gfx_fd );
        return DFB_INIT;
    }

    /* Get virtual addresses for LCD buffer and JPEG reload buffers in slaves here,
       master does it in driver_init_device(). */
    if (!dfb_core_is_master( core )) {
        sdrv->lcd_virt  = dfb_gfxcard_memory_virtual( device, sdev->lcd_offset );
        sdrv->jpeg_virt = dfb_gfxcard_memory_virtual( device, sdev->jpeg_offset );
    }

    /* Initialize function table. */
    funcs->EngineReset       = sh7722EngineReset;
    funcs->EngineSync        = sh7722EngineSync;
    funcs->EmitCommands      = sh7722EmitCommands;
    funcs->CheckState        = sh7722CheckState;
    funcs->SetState          = sh7722SetState;
    funcs->FillTriangle      = sh7722FillTriangle;
    funcs->Blit              = sh7722Blit;
    funcs->StretchBlit       = sh7722StretchBlit;
    funcs->FlushTextureCache = sh7722FlushTextureCache;

    /* Register primary screen. */
    sdrv->screen = dfb_screens_register( device, driver_data, &sh7722ScreenFuncs );

    /* Register three input system layers. */
    sdrv->input1 = dfb_layers_register( sdrv->screen, driver_data, &sh7722LayerFuncs );
    sdrv->input2 = dfb_layers_register( sdrv->screen, driver_data, &sh7722LayerFuncs );
    sdrv->input3 = dfb_layers_register( sdrv->screen, driver_data, &sh7722LayerFuncs );

    /* Register multi window layer. */
    sdrv->multi = dfb_layers_register( sdrv->screen, driver_data, &sh7722MultiLayerFuncs );

    return DFB_OK;
}
Example #6
0
static DFBResult driver_init_driver(CoreGraphicsDevice *device,
				    GraphicsDeviceFuncs *funcs,
				    void *driver_data,
				    void *device_data,
                    CoreDFB *core)
{
	SiSDriverData *drv = (SiSDriverData *)driver_data;
	FBDev *dfb_fbdev;
	struct sisfb_info *fbinfo;
	u32 fbinfo_size;
	u32 zero = 0;

	(void)device_data;

	dfb_fbdev = dfb_system_data();
	if (!dfb_fbdev)
		return DFB_IO;

	if (ioctl(dfb_fbdev->fd, SISFB_GET_INFO_SIZE, &fbinfo_size) == 0) {
		fbinfo = D_MALLOC(fbinfo_size);
		drv->get_info = SISFB_GET_INFO | (fbinfo_size << 16);
		drv->get_automaximize = SISFB_GET_AUTOMAXIMIZE;
		drv->set_automaximize = SISFB_SET_AUTOMAXIMIZE;
	}
	else {
		fbinfo = D_MALLOC(sizeof(struct sisfb_info));
		drv->get_info = SISFB_GET_INFO_OLD;
		drv->get_automaximize = SISFB_GET_AUTOMAXIMIZE_OLD;
		drv->set_automaximize = SISFB_SET_AUTOMAXIMIZE_OLD;
	}

	if (fbinfo == NULL)
		return DFB_NOSYSTEMMEMORY;

	if (ioctl(dfb_fbdev->fd, drv->get_info, fbinfo) == -1) {
		D_FREE(fbinfo);
		return DFB_IO;
	}

	check_sisfb_version(drv, fbinfo);

	D_FREE(fbinfo);

	if (drv->has_auto_maximize) {
		if (ioctl(dfb_fbdev->fd, drv->get_automaximize, &drv->auto_maximize))
			return DFB_IO;
		if (drv->auto_maximize)
			if (ioctl(dfb_fbdev->fd, drv->set_automaximize, &zero))
				return DFB_IO;
	}

	drv->mmio_base = dfb_gfxcard_map_mmio(device, 0, -1);
	if (!drv->mmio_base)
		return DFB_IO;

	/* base functions */
	funcs->EngineSync = sis_engine_sync;
	funcs->CheckState = sis_check_state;
	funcs->SetState = sis_set_state;

	/* drawing functions */
	funcs->FillRectangle = sis_fill_rectangle;
	funcs->DrawRectangle = sis_draw_rectangle;
	funcs->DrawLine = sis_draw_line;

	/* blitting functions */
	funcs->Blit = sis_blit;
	funcs->StretchBlit = sis_stretchblit;

	/* allocate buffer for stretchBlit with colorkey */
	drv->buffer_offset = dfb_gfxcard_reserve_memory( device, 1024*768*4 );

	return DFB_OK;
}