Commit 90a214c4 authored by Sam Lantinga's avatar Sam Lantinga

Nobody has stepped up to maintain a framebuffer console driver. Bye bye! :)

parent c14d8951
......@@ -1420,33 +1420,6 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]])
fi
}
dnl Find the framebuffer console includes
CheckFBCON()
{
AC_ARG_ENABLE(video-fbcon,
AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=no]]]),
, enable_video_fbcon=no)
if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
AC_MSG_CHECKING(for framebuffer console support)
video_fbcon=no
AC_TRY_COMPILE([
#include <linux/fb.h>
#include <linux/kd.h>
#include <linux/keyboard.h>
],[
],[
video_fbcon=yes
])
AC_MSG_RESULT($video_fbcon)
if test x$video_fbcon = xyes; then
AC_CHECK_FUNCS(getpagesize)
AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
have_video=yes
fi
fi
}
dnl Find DirectFB
CheckDirectFB()
{
......@@ -2300,7 +2273,6 @@ case "$host" in
CheckESD
CheckNAS
CheckX11
CheckFBCON
CheckDirectFB
CheckFusionSound
CheckPS3
......
......@@ -261,7 +261,6 @@
#undef SDL_VIDEO_DRIVER_DIRECTFB
#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
#undef SDL_VIDEO_DRIVER_DUMMY
#undef SDL_VIDEO_DRIVER_FBCON
#undef SDL_VIDEO_DRIVER_NDS
#undef SDL_VIDEO_DRIVER_PHOTON
#undef SDL_VIDEO_DRIVER_QNXGF
......
......@@ -408,9 +408,6 @@ extern VideoBootStrap COCOA_bootstrap;
#if SDL_VIDEO_DRIVER_X11
extern VideoBootStrap X11_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_FBCON
extern VideoBootStrap FBCON_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_DIRECTFB
extern VideoBootStrap DirectFB_bootstrap;
#endif
......
......@@ -62,9 +62,6 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_X11
&X11_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_FBCON
&FBCON_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DIRECTFB
&DirectFB_bootstrap,
#endif
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* 3Dfx register definitions */
#include "3dfx_regs.h"
/* 3Dfx control macros */
#define tdfx_in8(reg) *(volatile Uint8 *)(mapped_io + (reg))
#define tdfx_in32(reg) *(volatile Uint32 *)(mapped_io + (reg))
#define tdfx_out8(reg,v) *(volatile Uint8 *)(mapped_io + (reg)) = v;
#define tdfx_out32(reg,v) *(volatile Uint32 *)(mapped_io + (reg)) = v;
/* Wait for fifo space */
#define tdfx_wait(space) \
{ \
while ( (tdfx_in8(TDFX_STATUS) & 0x1F) < space ) \
; \
}
/* Wait for idle accelerator */
#define tdfx_waitidle() \
{ \
int i = 0; \
\
tdfx_wait(1); \
tdfx_out32(COMMAND_3D, COMMAND_3D_NOP); \
do { \
i = (tdfx_in32(TDFX_STATUS) & STATUS_BUSY) ? 0 : i + 1; \
} while ( i != 3 ); \
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _3DFX_REGS_H
#define _3DFX_REGS_H
/* This information comes from the public 3Dfx specs for the Voodoo 3000 */
/* mapped_io register offsets */
#define TDFX_STATUS 0x00
#define INTCTRL (0x00100000 + 0x04)
#define CLIP0MIN (0x00100000 + 0x08)
#define CLIP0MAX (0x00100000 + 0x0c)
#define DSTBASE (0x00100000 + 0x10)
#define DSTFORMAT (0x00100000 + 0x14)
#define SRCCOLORKEYMIN (0x00100000 + 0x18)
#define SRCCOLORKEYMAX (0x00100000 + 0x1c)
#define DSTCOLORKEYMIN (0x00100000 + 0x20)
#define DSTCOLORKEYMAX (0x00100000 + 0x24)
#define BRESERROR0 (0x00100000 + 0x28)
#define BRESERROR1 (0x00100000 + 0x2c)
#define ROP_2D (0x00100000 + 0x30)
#define SRCBASE (0x00100000 + 0x34)
#define COMMANDEXTRA_2D (0x00100000 + 0x38)
#define PATTERN0 (0x00100000 + 0x44)
#define PATTERN1 (0x00100000 + 0x48)
#define CLIP1MIN (0x00100000 + 0x4c)
#define CLIP1MAX (0x00100000 + 0x50)
#define SRCFORMAT (0x00100000 + 0x54)
#define SRCSIZE (0x00100000 + 0x58)
#define SRCXY (0x00100000 + 0x5c)
#define COLORBACK (0x00100000 + 0x60)
#define COLORFORE (0x00100000 + 0x64)
#define DSTSIZE (0x00100000 + 0x68)
#define DSTXY (0x00100000 + 0x6c)
#define COMMAND_2D (0x00100000 + 0x70)
#define LAUNCH_2D (0x00100000 + 0x80)
#define PATTERNBASE (0x00100000 + 0x100)
#define COMMAND_3D (0x00200000 + 0x120)
/* register bitfields (not all, only as needed) */
#define BIT(x) (1UL << (x))
#define COMMAND_2D_BITBLT 0x01
#define COMMAND_2D_FILLRECT 0x05
#define COMMAND_2D_LINE 0x06
#define COMMAND_2D_POLYGON_FILL 0x08
#define COMMAND_2D_INITIATE BIT(8)
#define COMMAND_2D_REVERSELINE BIT(9)
#define COMMAND_2D_STIPPLELINE BIT(12)
#define COMMAND_2D_MONOCHROME_PATT BIT(13)
#define COMMAND_2D_MONOCHROME_TRANSP BIT(16)
#define COMMAND_3D_NOP 0x00
#define STATUS_RETRACE BIT(6)
#define STATUS_BUSY BIT(9)
#endif /* _3DFX_REGS_H */
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_video.h"
#include "../SDL_blit.h"
#include "SDL_fb3dfx.h"
#include "3dfx_mmio.h"
/* Wait for vertical retrace */
static void
WaitVBL(_THIS)
{
/* find start of retrace */
tdfx_waitidle();
while ((tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == STATUS_RETRACE);
/* wait until we're past the start */
while ((tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == 0);
}
static void
WaitIdle(_THIS)
{
tdfx_waitidle();
}
/* Sets video mem colorkey and accelerated blit function */
static int
SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key)
{
return (0);
}
static int
FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * rect, Uint32 color)
{
int bpp;
char *dst_base;
Uint32 format;
int dstX, dstY;
/* Don't blit to the display surface when switched away */
if (switched_away) {
return -2; /* no hardware access */
}
if (dst == this->screen) {
SDL_mutexP(hw_lock);
}
/* Set the destination pixel format */
dst_base = (char *) ((char *) dst->pixels - mapped_mem);
bpp = dst->format->BitsPerPixel;
format = dst->pitch | ((bpp + ((bpp == 8) ? 0 : 8)) << 13);
/* Calculate source and destination base coordinates */
dstX = rect->x;
dstY = rect->y;
/* Execute the fill command */
tdfx_wait(6);
tdfx_out32(DSTBASE, (Uint32) dst_base);
tdfx_out32(DSTFORMAT, format);
tdfx_out32(COLORFORE, color);
tdfx_out32(COMMAND_2D, COMMAND_2D_FILLRECT);
tdfx_out32(DSTSIZE, rect->w | (rect->h << 16));
tdfx_out32(LAUNCH_2D, dstX | (dstY << 16));
FB_AddBusySurface(dst);
if (dst == this->screen) {
SDL_mutexV(hw_lock);
}
return (0);
}
static int
HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect)
{
SDL_VideoDevice *this = current_video;
int bpp;
Uint32 src_format;
Uint32 dst_format;
char *src_base;
char *dst_base;
int srcX, srcY;
int dstX, dstY;
Uint32 blitop;
Uint32 use_colorkey;
/* Don't blit to the display surface when switched away */
if (switched_away) {
return -2; /* no hardware access */
}
if (dst == this->screen) {
SDL_mutexP(hw_lock);
}
/* Set the source and destination pixel format */
src_base = (char *) ((char *) src->pixels - mapped_mem);
bpp = src->format->BitsPerPixel;
src_format = src->pitch | ((bpp + ((bpp == 8) ? 0 : 8)) << 13);
dst_base = (char *) ((char *) dst->pixels - mapped_mem);
bpp = dst->format->BitsPerPixel;
dst_format = dst->pitch | ((bpp + ((bpp == 8) ? 0 : 8)) << 13);
srcX = srcrect->x;
srcY = srcrect->y;
dstX = dstrect->x;
dstY = dstrect->y;
/* Assemble the blit operation */
blitop = COMMAND_2D_BITBLT | (0xCC << 24);
if (srcX <= dstX) {
blitop |= BIT(14);
srcX += (dstrect->w - 1);
dstX += (dstrect->w - 1);
}
if (srcY <= dstY) {
blitop |= BIT(15);
srcY += (dstrect->h - 1);
dstY += (dstrect->h - 1);
}
/* Perform the blit! */
if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
tdfx_wait(3);
tdfx_out32(SRCCOLORKEYMIN, src->format->colorkey);
tdfx_out32(SRCCOLORKEYMAX, src->format->colorkey);
tdfx_out32(ROP_2D, 0xAA00);
use_colorkey = 1;
} else {
use_colorkey = 0;
}
tdfx_wait(9);
tdfx_out32(SRCBASE, (Uint32) src_base);
tdfx_out32(SRCFORMAT, src_format);
tdfx_out32(DSTBASE, (Uint32) dst_base);
tdfx_out32(DSTFORMAT, src_format);
tdfx_out32(COMMAND_2D, blitop);
tdfx_out32(COMMANDEXTRA_2D, use_colorkey);
tdfx_out32(DSTSIZE, dstrect->w | (dstrect->h << 16));
tdfx_out32(DSTXY, dstX | (dstY << 16));
tdfx_out32(LAUNCH_2D, srcX | (srcY << 16));
FB_AddBusySurface(src);
FB_AddBusySurface(dst);
if (dst == this->screen) {
SDL_mutexV(hw_lock);
}
return (0);
}
static int
CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst)
{
int accelerated;
/* Set initial acceleration on */
src->flags |= SDL_HWACCEL;
/* Set the surface attributes */
if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
if (!this->info.blit_hw_A) {
src->flags &= ~SDL_HWACCEL;
}
}
if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
if (!this->info.blit_hw_CC) {
src->flags &= ~SDL_HWACCEL;
}
}
/* Check to see if final surface blit is accelerated */
accelerated = !!(src->flags & SDL_HWACCEL);
if (accelerated) {
src->map->hw_blit = HWAccelBlit;
}
return (accelerated);
}
void
FB_3DfxAccel(_THIS, __u32 card)
{
/* We have hardware accelerated surface functions */
this->CheckHWBlit = CheckHWBlit;
wait_vbl = WaitVBL;
wait_idle = WaitIdle;
/* Reset the 3Dfx controller */
tdfx_out32(BRESERROR0, 0);
tdfx_out32(BRESERROR1, 0);
/* The 3Dfx has an accelerated color fill */
this->info.blit_fill = 1;
this->FillHWRect = FillHWRect;
/* The 3Dfx has accelerated normal and colorkey blits */
this->info.blit_hw = 1;
this->info.blit_hw_CC = 1;
this->SetHWColorKey = SetHWColorKey;
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* 3Dfx hardware acceleration for the SDL framebuffer console driver */
#include "SDL_fbvideo.h"
/* Set up the driver for 3Dfx acceleration */
extern void FB_3DfxAccel(_THIS, __u32 card);
/* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef SDL_fbelo_h
#define SDL_fbelo_h
#include "SDL_fbvideo.h"
/* ELO */
#define ELO_PACKET_SIZE 10
#define ELO_START_BYTE 'U'
/* eloConvertXY
Convert the raw coordinates from the ELO controller
to a screen position.
*/
void eloConvertXY(_THIS, int *dx, int *dy);
/* eloInitController(int fd)
Initialize the ELO serial touchscreen controller
*/
int eloInitController(int fd);
/* eloParsePacket
extract position and button state from a packet
*/
int eloParsePacket(unsigned char *mousebuf, int *dx, int *dy,
int *button_state);
/* eloReadPosition
read a packet and get the cursor position
*/
int eloReadPosition(_THIS, int fd, int *x, int *y, int *button_state,
int *realx, int *realy);
#endif /* SDL_fbelo_h */
/* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_fbvideo.h"
/* Variables and functions exported by SDL_sysevents.c to other parts
of the native video subsystem (SDL_sysvideo.c)
*/
extern int FB_OpenKeyboard(_THIS);
extern void FB_CloseKeyboard(_THIS);
extern int FB_OpenMouse(_THIS);
extern void FB_CloseMouse(_THIS);
extern int FB_EnterGraphicsMode(_THIS);
extern int FB_InGraphicsMode(_THIS);
extern void FB_LeaveGraphicsMode(_THIS);
extern void FB_InitOSKeymap(_THIS);
extern void FB_PumpEvents(_THIS);
/* vi: set ts=4 sw=4 expandtab: */
/* Scancodes for the Linux framebuffer console
- Taken with thanks from SVGAlib 1.4.0
*/
#define SCANCODE_ESCAPE 1
#define SCANCODE_1 2
#define SCANCODE_2 3
#define SCANCODE_3 4
#define SCANCODE_4 5
#define SCANCODE_5 6
#define SCANCODE_6 7
#define SCANCODE_7 8
#define SCANCODE_8 9
#define SCANCODE_9 10
#define SCANCODE_0 11
#define SCANCODE_MINUS 12
#define SCANCODE_EQUAL 13
#define SCANCODE_BACKSPACE 14
#define SCANCODE_TAB 15
#define SCANCODE_Q 16
#define SCANCODE_W 17
#define SCANCODE_E 18
#define SCANCODE_R 19
#define SCANCODE_T 20
#define SCANCODE_Y 21
#define SCANCODE_U 22
#define SCANCODE_I 23
#define SCANCODE_O 24
#define SCANCODE_P 25
#define SCANCODE_BRACKET_LEFT 26
#define SCANCODE_BRACKET_RIGHT 27
#define SCANCODE_ENTER 28
#define SCANCODE_LEFTCONTROL 29
#define SCANCODE_A 30
#define SCANCODE_S 31
#define SCANCODE_D 32
#define SCANCODE_F 33
#define SCANCODE_G 34
#define SCANCODE_H 35
#define SCANCODE_J 36
#define SCANCODE_K 37
#define SCANCODE_L 38
#define SCANCODE_SEMICOLON 39
#define SCANCODE_APOSTROPHE 40
#define SCANCODE_GRAVE 41
#define SCANCODE_LEFTSHIFT 42
#define SCANCODE_BACKSLASH 43
#define SCANCODE_Z 44
#define SCANCODE_X 45
#define SCANCODE_C 46
#define SCANCODE_V 47
#define SCANCODE_B 48
#define SCANCODE_N 49
#define SCANCODE_M 50
#define SCANCODE_COMMA 51
#define SCANCODE_PERIOD 52
#define SCANCODE_SLASH 53
#define SCANCODE_RIGHTSHIFT 54
#define SCANCODE_KEYPADMULTIPLY 55
#define SCANCODE_LEFTALT 56
#define SCANCODE_SPACE 57
#define SCANCODE_CAPSLOCK 58
#define SCANCODE_F1 59
#define SCANCODE_F2 60
#define SCANCODE_F3 61
#define SCANCODE_F4 62
#define SCANCODE_F5 63
#define SCANCODE_F6 64
#define SCANCODE_F7 65
#define SCANCODE_F8 66
#define SCANCODE_F9 67
#define SCANCODE_F10 68
#define SCANCODE_NUMLOCK 69
#define SCANCODE_SCROLLLOCK 70
#define SCANCODE_KEYPAD7 71
#define SCANCODE_CURSORUPLEFT 71
#define SCANCODE_KEYPAD8 72
#define SCANCODE_CURSORUP 72
#define SCANCODE_KEYPAD9 73
#define SCANCODE_CURSORUPRIGHT 73
#define SCANCODE_KEYPADMINUS 74
#define SCANCODE_KEYPAD4 75
#define SCANCODE_CURSORLEFT 75
#define SCANCODE_KEYPAD5 76
#define SCANCODE_KEYPAD6 77
#define SCANCODE_CURSORRIGHT 77
#define SCANCODE_KEYPADPLUS 78
#define SCANCODE_KEYPAD1 79
#define SCANCODE_CURSORDOWNLEFT 79
#define SCANCODE_KEYPAD2 80
#define SCANCODE_CURSORDOWN 80
#define SCANCODE_KEYPAD3 81
#define SCANCODE_CURSORDOWNRIGHT 81
#define SCANCODE_KEYPAD0 82
#define SCANCODE_KEYPADPERIOD 83
#define SCANCODE_LESS 86
#define SCANCODE_F11 87
#define SCANCODE_F12 88
#define SCANCODE_KEYPADENTER 96
#define SCANCODE_RIGHTCONTROL 97
#define SCANCODE_CONTROL 97
#define SCANCODE_KEYPADDIVIDE 98
#define SCANCODE_PRINTSCREEN 99
#define SCANCODE_RIGHTALT 100
#define SCANCODE_BREAK 101 /* Beware: is 119 */
#define SCANCODE_BREAK_ALTERNATIVE 119 /* on some keyboards! */
#define SCANCODE_HOME 102
#define SCANCODE_CURSORBLOCKUP 103 /* Cursor key block */
#define SCANCODE_PAGEUP 104
#define SCANCODE_CURSORBLOCKLEFT 105 /* Cursor key block */
#define SCANCODE_CURSORBLOCKRIGHT 106 /* Cursor key block */
#define SCANCODE_END 107
#define SCANCODE_CURSORBLOCKDOWN 108 /* Cursor key block */
#define SCANCODE_PAGEDOWN 109
#define SCANCODE_INSERT 110
#define SCANCODE_REMOVE 111
#define SCANCODE_RIGHTWIN 126
#define SCANCODE_LEFTWIN 125
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_video.h"
#include "../SDL_blit.h"
#include "SDL_fbmatrox.h"
#include "matrox_mmio.h"
/* Wait for vertical retrace - taken from the XFree86 Matrox driver */
static void
WaitVBL(_THIS)
{
int count;
/* find start of retrace */
mga_waitidle();
while ((mga_in8(0x1FDA) & 0x08));
while (!(mga_in8(0x1FDA) & 0x08));
/* wait until we're past the start */
count = mga_in32(0x1E20) + 2;
while (mga_in32(0x1E20) < count);
}
static void
WaitIdle(_THIS)
{
mga_waitidle();
}
/* Sets video mem colorkey and accelerated blit function */
static int
SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key)
{
return (0);
}
/* Sets per surface hardware alpha value */
#if 0
static int
SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 value)
{
return (0);
}
#endif
static int
FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * rect, Uint32 color)
{
int dstX, dstY;
Uint32 fxbndry;
Uint32 ydstlen;
Uint32 fillop;
/* Don't blit to the display surface when switched away */
if (switched_away) {
return -2; /* no hardware access */
}
if (dst == this->screen) {
SDL_mutexP(hw_lock);
}
switch (dst->format->BytesPerPixel) {
case 1:
color |= (color << 8);
case 2:
color |= (color << 16);
break;
}
/* Set up the X/Y base coordinates */
FB_dst_to_xy(this, dst, &dstX, &dstY);
/* Adjust for the current rectangle */
dstX += rect->x;
dstY += rect->y;
/* Set up the X boundaries */
fxbndry = (dstX | ((dstX + rect->w) << 16));
/* Set up the Y boundaries */
ydstlen = (rect->h | (dstY << 16));
/* Set up for color fill operation */
fillop = MGADWG_TRAP | MGADWG_SOLID |
MGADWG_ARZERO | MGADWG_SGNZERO | MGADWG_SHIFTZERO;
/* Execute the operations! */
mga_wait(5);
mga_out32(MGAREG_DWGCTL, fillop | MGADWG_REPLACE);
mga_out32(MGAREG_FCOL, color);
mga_out32(MGAREG_FXBNDRY, fxbndry);
mga_out32(MGAREG_YDSTLEN + MGAREG_EXEC, ydstlen);
FB_AddBusySurface(dst);
if (dst == this->screen) {
SDL_mutexV(hw_lock);
}
return (0);
}
static int
HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect)
{
SDL_VideoDevice *this = current_video;
int pitch, w, h;
int srcX, srcY;
int dstX, dstY;
Uint32 sign;
Uint32 start, stop;
int skip;
Uint32 blitop;
/* FIXME: For now, only blit to display surface */
if (dst->pitch != SDL_VideoSurface->pitch) {
return (src->map->sw_blit(src, srcrect, dst, dstrect));
}
/* Don't blit to the display surface when switched away */
if (switched_away) {
return -2; /* no hardware access */
}
if (dst == this->screen) {
SDL_mutexP(hw_lock);
}
/* Calculate source and destination base coordinates (in pixels) */
w = dstrect->w;
h = dstrect->h;
FB_dst_to_xy(this, src, &srcX, &srcY);
FB_dst_to_xy(this, dst, &dstX, &dstY);
/* Adjust for the current blit rectangles */
srcX += srcrect->x;
srcY += srcrect->y;
dstX += dstrect->x;
dstY += dstrect->y;
pitch = dst->pitch / dst->format->BytesPerPixel;
/* Set up the blit direction (sign) flags */
sign = 0;
if (srcX < dstX) {
sign |= 1;
}
if (srcY < dstY) {
sign |= 4;
srcY += (h - 1);
dstY += (h - 1);
}
/* Set up the blit source row start, end, and skip (in pixels) */
stop = start = (srcY * pitch) + srcX;
if (srcX < dstX) {
start += (w - 1);
} else {
stop += (w - 1);
}
if (srcY < dstY) {
skip = -pitch;
} else {
skip = pitch;
}
/* Set up the blit operation */
if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
Uint32 colorkey;
blitop = MGADWG_BFCOL | MGADWG_BITBLT |
MGADWG_SHIFTZERO | MGADWG_RSTR | (0x0C << 16) | MGADWG_TRANSC;
colorkey = src->format->colorkey;
switch (dst->format->BytesPerPixel) {
case 1:
colorkey |= (colorkey << 8);
case 2:
colorkey |= (colorkey << 16);
break;
}
mga_wait(2);
mga_out32(MGAREG_FCOL, colorkey);
mga_out32(MGAREG_BCOL, 0xFFFFFFFF);
} else {
blitop = MGADWG_BFCOL | MGADWG_BITBLT |
MGADWG_SHIFTZERO | MGADWG_RSTR | (0x0C << 16);
}
mga_wait(7);
mga_out32(MGAREG_SGN, sign);
mga_out32(MGAREG_AR3, start);
mga_out32(MGAREG_AR0, stop);
mga_out32(MGAREG_AR5, skip);
mga_out32(MGAREG_FXBNDRY, (dstX | ((dstX + w - 1) << 16)));
mga_out32(MGAREG_YDSTLEN, (dstY << 16) | h);
mga_out32(MGAREG_DWGCTL + MGAREG_EXEC, blitop);
FB_AddBusySurface(src);
FB_AddBusySurface(dst);
if (dst == this->screen) {
SDL_mutexV(hw_lock);
}
return (0);
}
static int
CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst)
{
int accelerated;
/* Set initial acceleration on */
src->flags |= SDL_HWACCEL;
/* Set the surface attributes */
if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
if (!this->info.blit_hw_A) {
src->flags &= ~SDL_HWACCEL;
}
}
if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
if (!this->info.blit_hw_CC) {
src->flags &= ~SDL_HWACCEL;
}
}
/* Check to see if final surface blit is accelerated */
accelerated = !!(src->flags & SDL_HWACCEL);
if (accelerated) {
src->map->hw_blit = HWAccelBlit;
}
return (accelerated);
}
void
FB_MatroxAccel(_THIS, __u32 card)
{
/* We have hardware accelerated surface functions */
this->CheckHWBlit = CheckHWBlit;
wait_vbl = WaitVBL;
wait_idle = WaitIdle;
/* The Matrox has an accelerated color fill */
this->info.blit_fill = 1;
this->FillHWRect = FillHWRect;
/* The Matrox has accelerated normal and colorkey blits. */
this->info.blit_hw = 1;
/* The Millenium I appears to do the colorkey test a word
at a time, and the transparency is intverted. (?)
*/
if (card != FB_ACCEL_MATROX_MGA2064W) {
this->info.blit_hw_CC = 1;
this->SetHWColorKey = SetHWColorKey;
}
#if 0 /* Not yet implemented? */
/* The Matrox G200/G400 has an accelerated alpha blit */
if ((card == FB_ACCEL_MATROX_MGAG200)
|| (card == FB_ACCEL_MATROX_MGAG400)) {
this->info.blit_hw_A = 1;
this->SetHWAlpha = SetHWAlpha;
}
#endif
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Matrox hardware acceleration for the SDL framebuffer console driver */
#include "SDL_fbvideo.h"
/* Set up the driver for Matrox acceleration */
extern void FB_MatroxAccel(_THIS, __u32 card);
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_mouse.h"
#include "../../events/SDL_events_c.h"
#include "SDL_fbvideo.h"
#include "SDL_fbmouse_c.h"
/* The implementation dependent data for the window manager cursor */
struct WMcursor
{
int unused;
};
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_fbvideo.h"
/* Functions to be exported */
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_video.h"
#include "../SDL_blit.h"
#include "SDL_fbriva.h"
#include "riva_mmio.h"
#include "riva_regs.h"
static int FifoEmptyCount = 0;
static int FifoFreeCount = 0;
/* Wait for vertical retrace */
static void
WaitVBL(_THIS)
{
volatile Uint8 *port = (Uint8 *) (mapped_io + PCIO_OFFSET + 0x3DA);
while ((*port & 0x08));
while (!(*port & 0x08));
}
static void
NV3WaitIdle(_THIS)
{
RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET);
while ((Rop->FifoFree < FifoEmptyCount) ||
(*(mapped_io + PGRAPH_OFFSET + 0x000006B0) & 0x01));
}
static void
NV4WaitIdle(_THIS)
{
RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET);
while ((Rop->FifoFree < FifoEmptyCount) ||
(*(mapped_io + PGRAPH_OFFSET + 0x00000700) & 0x01));
}
#if 0 /* Not yet implemented? */
/* Sets video mem colorkey and accelerated blit function */
static int
SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key)
{
return (0);
}
/* Sets per surface hardware alpha value */
static int
SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 value)
{
return (0);
}
#endif /* Not yet implemented */
static int
FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * rect, Uint32 color)
{
int dstX, dstY;
int dstW, dstH;
RivaBitmap *Bitmap = (RivaBitmap *) (mapped_io + BITMAP_OFFSET);
/* Don't blit to the display surface when switched away */
if (switched_away) {
return -2; /* no hardware access */
}
if (dst == this->screen) {
SDL_mutexP(hw_lock);
}
/* Set up the X/Y base coordinates */
dstW = rect->w;
dstH = rect->h;
FB_dst_to_xy(this, dst, &dstX, &dstY);
/* Adjust for the current rectangle */
dstX += rect->x;
dstY += rect->y;
RIVA_FIFO_FREE(Bitmap, 1);
Bitmap->Color1A = color;
RIVA_FIFO_FREE(Bitmap, 2);
Bitmap->UnclippedRectangle[0].TopLeft = (dstX << 16) | dstY;
Bitmap->UnclippedRectangle[0].WidthHeight = (dstW << 16) | dstH;
FB_AddBusySurface(dst);
if (dst == this->screen) {
SDL_mutexV(hw_lock);
}
return (0);
}
static int
HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect)
{
SDL_VideoDevice *this = current_video;
int srcX, srcY;
int dstX, dstY;
int dstW, dstH;
RivaScreenBlt *Blt = (RivaScreenBlt *) (mapped_io + BLT_OFFSET);
/* FIXME: For now, only blit to display surface */
if (dst->pitch != SDL_VideoSurface->pitch) {
return (src->map->sw_blit(src, srcrect, dst, dstrect));
}
/* Don't blit to the display surface when switched away */
if (switched_away) {
return -2; /* no hardware access */
}
if (dst == this->screen) {
SDL_mutexP(hw_lock);
}
/* Calculate source and destination base coordinates (in pixels) */
dstW = dstrect->w;
dstH = dstrect->h;
FB_dst_to_xy(this, src, &srcX, &srcY);
FB_dst_to_xy(this, dst, &dstX, &dstY);
/* Adjust for the current blit rectangles */
srcX += srcrect->x;
srcY += srcrect->y;
dstX += dstrect->x;
dstY += dstrect->y;
RIVA_FIFO_FREE(Blt, 3);
Blt->TopLeftSrc = (srcY << 16) | srcX;
Blt->TopLeftDst = (dstY << 16) | dstX;
Blt->WidthHeight = (dstH << 16) | dstW;
FB_AddBusySurface(src);
FB_AddBusySurface(dst);
if (dst == this->screen) {
SDL_mutexV(hw_lock);
}
return (0);
}
static int
CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst)
{
int accelerated;
/* Set initial acceleration on */
src->flags |= SDL_HWACCEL;
/* Set the surface attributes */
if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
if (!this->info.blit_hw_A) {
src->flags &= ~SDL_HWACCEL;
}
}
if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
if (!this->info.blit_hw_CC) {
src->flags &= ~SDL_HWACCEL;
}
}
/* Check to see if final surface blit is accelerated */
accelerated = !!(src->flags & SDL_HWACCEL);
if (accelerated) {
src->map->hw_blit = HWAccelBlit;
}
return (accelerated);
}
void
FB_RivaAccel(_THIS, __u32 card)
{
RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET);
/* We have hardware accelerated surface functions */
this->CheckHWBlit = CheckHWBlit;
wait_vbl = WaitVBL;
switch (card) {
case FB_ACCEL_NV3:
wait_idle = NV3WaitIdle;
break;
case FB_ACCEL_NV4:
wait_idle = NV4WaitIdle;
break;
default:
/* Hmm... FIXME */
break;
}
FifoEmptyCount = Rop->FifoFree;
/* The Riva has an accelerated color fill */
this->info.blit_fill = 1;
this->FillHWRect = FillHWRect;
/* The Riva has accelerated normal and colorkey blits. */
this->info.blit_hw = 1;
#if 0 /* Not yet implemented? */
this->info.blit_hw_CC = 1;
this->SetHWColorKey = SetHWColorKey;
#endif
#if 0 /* Not yet implemented? */
/* The Riva has an accelerated alpha blit */
this->info.blit_hw_A = 1;
this->SetHWAlpha = SetHWAlpha;
#endif
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Riva hardware acceleration for the SDL framebuffer console driver */
#include "SDL_fbvideo.h"
#ifndef FB_ACCEL_NV3
#define FB_ACCEL_NV3 27
#endif
#ifndef FB_ACCEL_NV4
#define FB_ACCEL_NV4 28
#endif
/* Set up the driver for Riva acceleration */
extern void FB_RivaAccel(_THIS, __u32 card);
/* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_fbvideo_h
#define _SDL_fbvideo_h
#include <sys/types.h>
#include <termios.h>
#include <linux/fb.h>
#include "SDL_mouse.h"
#include "SDL_mutex.h"
#include "../SDL_sysvideo.h"
#if SDL_INPUT_TSLIB
#include "tslib.h"
#endif
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this
/* This is the structure we use to keep track of video memory */
typedef struct vidmem_bucket
{
struct vidmem_bucket *prev;
int used;
int dirty;
char *base;
unsigned int size;
struct vidmem_bucket *next;
} vidmem_bucket;
/* Private display data */
struct SDL_PrivateVideoData
{
int console_fd;
struct fb_var_screeninfo cache_vinfo;
struct fb_var_screeninfo saved_vinfo;
int saved_cmaplen;
__u16 *saved_cmap;
int current_vt;
int saved_vt;
int keyboard_fd;
int saved_kbd_mode;
struct termios saved_kbd_termios;
int mouse_fd;
#if SDL_INPUT_TSLIB
struct tsdev *ts_dev;
#endif
char *mapped_mem;
int mapped_memlen;
int mapped_offset;
char *mapped_io;
long mapped_iolen;
int flip_page;
char *flip_address[2];
#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
int SDL_nummodes[NUM_MODELISTS];
SDL_Rect **SDL_modelist[NUM_MODELISTS];
vidmem_bucket surfaces;
int surfaces_memtotal;
int surfaces_memleft;
SDL_mutex *hw_lock;
int switched_away;
struct fb_var_screeninfo screen_vinfo;
Uint32 screen_arealen;
Uint8 *screen_contents;
__u16 screen_palette[3 * 256];
void (*wait_vbl) (_THIS);
void (*wait_idle) (_THIS);
};
/* Old variable names */
#define console_fd (this->hidden->console_fd)
#define current_vt (this->hidden->current_vt)
#define saved_vt (this->hidden->saved_vt)
#define keyboard_fd (this->hidden->keyboard_fd)
#define saved_kbd_mode (this->hidden->saved_kbd_mode)
#define saved_kbd_termios (this->hidden->saved_kbd_termios)
#define mouse_fd (this->hidden->mouse_fd)
#if SDL_INPUT_TSLIB
#define ts_dev (this->hidden->ts_dev)
#endif
#define cache_vinfo (this->hidden->cache_vinfo)
#define saved_vinfo (this->hidden->saved_vinfo)
#define saved_cmaplen (this->hidden->saved_cmaplen)
#define saved_cmap (this->hidden->saved_cmap)
#define mapped_mem (this->hidden->mapped_mem)
#define mapped_memlen (this->hidden->mapped_memlen)
#define mapped_offset (this->hidden->mapped_offset)
#define mapped_io (this->hidden->mapped_io)
#define mapped_iolen (this->hidden->mapped_iolen)
#define flip_page (this->hidden->flip_page)
#define flip_address (this->hidden->flip_address)
#define SDL_nummodes (this->hidden->SDL_nummodes)
#define SDL_modelist (this->hidden->SDL_modelist)
#define surfaces (this->hidden->surfaces)
#define surfaces_memtotal (this->hidden->surfaces_memtotal)
#define surfaces_memleft (this->hidden->surfaces_memleft)
#define hw_lock (this->hidden->hw_lock)
#define switched_away (this->hidden->switched_away)
#define screen_vinfo (this->hidden->screen_vinfo)
#define screen_arealen (this->hidden->screen_arealen)
#define screen_contents (this->hidden->screen_contents)
#define screen_palette (this->hidden->screen_palette)
#define wait_vbl (this->hidden->wait_vbl)
#define wait_idle (this->hidden->wait_idle)
/* Accelerator types that are supported by the driver, but are not
necessarily in the kernel headers on the system we compile on.
*/
#ifndef FB_ACCEL_MATROX_MGAG400
#define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */
#endif
#ifndef FB_ACCEL_3DFX_BANSHEE
#define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */
#endif
/* These functions are defined in SDL_fbvideo.c */
extern void FB_SavePaletteTo(_THIS, int palette_len, __u16 * area);
extern void FB_RestorePaletteFrom(_THIS, int palette_len, __u16 * area);
/* These are utility functions for working with video surfaces */
static __inline__ void
FB_AddBusySurface(SDL_Surface * surface)
{
((vidmem_bucket *) surface->hwdata)->dirty = 1;
}
static __inline__ int
FB_IsSurfaceBusy(SDL_Surface * surface)
{
return ((vidmem_bucket *) surface->hwdata)->dirty;
}
static __inline__ void
FB_WaitBusySurfaces(_THIS)
{
vidmem_bucket *bucket;
/* Wait for graphic operations to complete */
wait_idle(this);
/* Clear all surface dirty bits */
for (bucket = &surfaces; bucket; bucket = bucket->next) {
bucket->dirty = 0;
}
}
static __inline__ void
FB_dst_to_xy(_THIS, SDL_Surface * dst, int *x, int *y)
{
*x = (long) ((char *) dst->pixels - mapped_mem) % this->screen->pitch;
*y = (long) ((char *) dst->pixels - mapped_mem) / this->screen->pitch;
if (dst == this->screen) {
*x += this->offset_x;
*y += this->offset_y;
}
}
#endif /* _SDL_fbvideo_h */
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* MGA register definitions */
#include "matrox_regs.h"
/* MGA control macros */
#define mga_in8(reg) *(volatile Uint8 *)(mapped_io + (reg))
#define mga_in32(reg) *(volatile Uint32 *)(mapped_io + (reg))
#define mga_out8(reg,v) *(volatile Uint8 *)(mapped_io + (reg)) = v;
#define mga_out32(reg,v) *(volatile Uint32 *)(mapped_io + (reg)) = v;
/* Wait for fifo space */
#define mga_wait(space) \
{ \
while ( mga_in8(MGAREG_FIFOSTATUS) < space ) \
; \
}
/* Wait for idle accelerator */
#define mga_waitidle() \
{ \
while ( mga_in32(MGAREG_STATUS) & 0x10000 ) \
; \
}
/* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _RIVA_REGS_H
#define _RIVA_REGS_H
/* This information comes from the XFree86 NVidia hardware driver */
/* mapped_io register offsets */
#define PGRAPH_OFFSET 0x00400000
#define FIFO_OFFSET 0x00800000
#define ROP_OFFSET FIFO_OFFSET+0x00000000
#define CLIP_OFFSET FIFO_OFFSET+0x00002000
#define PATT_OFFSET FIFO_OFFSET+0x00004000
#define PIXMAP_OFFSET FIFO_OFFSET+0x00006000
#define BLT_OFFSET FIFO_OFFSET+0x00008000
#define BITMAP_OFFSET FIFO_OFFSET+0x0000A000
#define LINE_OFFSET FIFO_OFFSET+0x0000C000
#define TRI03_OFFSET FIFO_OFFSET+0x0000E000
#define PCIO_OFFSET 0x00601000
#endif /* _RIVA_REGS_H */
/* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment