DFBResult savage4_init_device( CoreGraphicsDevice *device, GraphicsDeviceInfo *device_info, void *driver_data, void *device_data ) { SavageDriverData *sdrv = (SavageDriverData*) driver_data; volatile u8 *mmio = sdrv->mmio_base; SVGDBG("savage4initdevice\n"); /* fill device info */ snprintf( device_info->name, DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Savage4 Series" ); snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "S3" ); device_info->caps.flags = CCF_CLIPPING; device_info->caps.accel = SAVAGE4_DRAWING_FUNCTIONS | SAVAGE4_BLITTING_FUNCTIONS; device_info->caps.drawing = SAVAGE4_DRAWING_FLAGS; device_info->caps.blitting = SAVAGE4_BLITTING_FLAGS; device_info->limits.surface_byteoffset_alignment = 2048; device_info->limits.surface_pixelpitch_alignment = 32; vga_out8( mmio, 0x3d4, CR_SYSCONF ); vga_out8( mmio, 0x3d5, CR_SYSCONF_ENABLE_2D_ENGINE_IO_ACCESS ); vga_out8( mmio, 0x3d4, CR_MEMCONF ); vga_out8( mmio, 0x3d5, CR_MEMCONF_ENABLE_VGA_16BIT_IO_ACCESS | CR_MEMCONF_ENHANCED_MODE_MEMORY_MAPPING ); /* Setup plane masks */ savage_out32( mmio, SAVAGE_2D_WRITE_MASK, ~0 ); savage_out32( mmio, SAVAGE_2D_READ_MASK, ~0 ); savage_out16( mmio, SAVAGE_2D_BACKGROUND_MIX, 0x03 ); savage_out16( mmio, SAVAGE_2D_FOREGROUND_MIX, 0x27 ); /* Disable BCI */ savage_out32( mmio, SAVAGE_COMMAND_OVERFLOW_BUFFER_POINTERS, (savage_in32( mmio, 0x48C18)) & 0x3FF0); /* Program shadow status update */ savage_out32( mmio, 0x48C10, 0x00700040); savage_out32( mmio, 0x48C0C, 0); /* Enable BCI without the COB */ savage_out32( mmio, SAVAGE_COMMAND_OVERFLOW_BUFFER_POINTERS, (savage_in32( mmio, 0x48C18)) | 0x08); return DFB_OK; }
DFBResult savage3d_init_device( CoreGraphicsDevice *device, GraphicsDeviceInfo *device_info, void *driver_data, void *device_data ) { SavageDriverData *sdrv = (SavageDriverData*) driver_data; volatile u8 *mmio = sdrv->mmio_base; unsigned long cobIndex; /* size index */ unsigned long cobSize; /* size in bytes */ unsigned long cobOffset; /* offset in frame buffer */ /* fill device info */ snprintf( device_info->name, DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Savage3D Series" ); snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "S3" ); device_info->caps.flags = CCF_CLIPPING; device_info->caps.accel = SAVAGE3D_DRAWING_FUNCTIONS | SAVAGE3D_BLITTING_FUNCTIONS; device_info->caps.drawing = SAVAGE3D_DRAWING_FLAGS; device_info->caps.blitting = SAVAGE3D_BLITTING_FLAGS; device_info->limits.surface_byteoffset_alignment = 2048; device_info->limits.surface_pixelpitch_alignment = 32; cobIndex = 7; cobSize = 0x400 << cobIndex; cobOffset = dfb_gfxcard_reserve_memory( device, cobSize ); /* savage_out32( 0x8504, 0x00008000 ); */ /* Disable BCI */ savage_out32( mmio, 0x48C18, savage_in32( mmio, 0x48C18 ) & 0x3FF0); /* Setup BCI command overflow buffer */ savage_out32( mmio, 0x48C14, (cobOffset >> 11) | (cobIndex << 29)); /* Program shadow status update. */ savage_out32( mmio, 0x48C10, 0x78207220); savage_out32( mmio, 0x48C0C, 0); /* Enable BCI and command overflow buffer */ savage_out32( mmio, 0x48C18, savage_in32( mmio, 0x48C18 ) | 0x0C); return DFB_OK; }