Nobody has stepped up to maintain a framebuffer console driver. Bye bye! :)
This commit is contained in:
parent
c14d8951f3
commit
90a214c4e9
25 changed files with 0 additions and 6092 deletions
28
configure.in
28
configure.in
|
@ -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
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,225 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,462 +0,0 @@
|
|||
/*
|
||||
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 <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_fbvideo.h"
|
||||
#include "SDL_fbelo.h"
|
||||
|
||||
/*
|
||||
calibration default values
|
||||
values are read from the following environment variables:
|
||||
|
||||
SDL_ELO_MIN_X
|
||||
SDL_ELO_MAX_X
|
||||
SDL_ELO_MIN_Y
|
||||
SDL_ELO_MAX_Y
|
||||
*/
|
||||
|
||||
static int ELO_MIN_X = 400;
|
||||
static int ELO_MAX_X = 3670;
|
||||
static int ELO_MIN_Y = 500;
|
||||
static int ELO_MAX_Y = 3540;
|
||||
|
||||
#define ELO_SNAP_SIZE 6
|
||||
#define ELO_TOUCH_BYTE 'T'
|
||||
#define ELO_ID 'I'
|
||||
#define ELO_MODE 'M'
|
||||
#define ELO_PARAMETER 'P'
|
||||
#define ELO_REPORT 'B'
|
||||
#define ELO_ACK 'A'
|
||||
|
||||
#define ELO_INIT_CHECKSUM 0xAA
|
||||
|
||||
#define ELO_BTN_PRESS 0x01
|
||||
#define ELO_STREAM 0x02
|
||||
#define ELO_BTN_RELEASE 0x04
|
||||
|
||||
#define ELO_TOUCH_MODE 0x01
|
||||
#define ELO_STREAM_MODE 0x02
|
||||
#define ELO_UNTOUCH_MODE 0x04
|
||||
#define ELO_RANGE_CHECK_MODE 0x40
|
||||
#define ELO_TRIM_MODE 0x02
|
||||
#define ELO_CALIB_MODE 0x04
|
||||
#define ELO_SCALING_MODE 0x08
|
||||
#define ELO_TRACKING_MODE 0x40
|
||||
|
||||
#define ELO_SERIAL_MASK 0xF8
|
||||
|
||||
#define ELO_SERIAL_IO '0'
|
||||
|
||||
#define ELO_MAX_TRIALS 3
|
||||
#define ELO_MAX_WAIT 100000
|
||||
#define ELO_UNTOUCH_DELAY 5
|
||||
#define ELO_REPORT_DELAY 1
|
||||
|
||||
/* eloParsePacket
|
||||
*/
|
||||
int
|
||||
eloParsePacket(unsigned char *mousebuf, int *dx, int *dy, int *button_state)
|
||||
{
|
||||
static int elo_button = 0;
|
||||
static int last_x = 0;
|
||||
static int last_y = 0;
|
||||
int x, y;
|
||||
|
||||
/* Check if we have a touch packet */
|
||||
if (mousebuf[1] != ELO_TOUCH_BYTE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
x = ((mousebuf[4] << 8) | mousebuf[3]);
|
||||
y = ((mousebuf[6] << 8) | mousebuf[5]);
|
||||
|
||||
if ((SDL_abs(x - last_x) > ELO_SNAP_SIZE)
|
||||
|| (SDL_abs(y - last_y) > ELO_SNAP_SIZE)) {
|
||||
*dx = ((mousebuf[4] << 8) | mousebuf[3]);
|
||||
*dy = ((mousebuf[6] << 8) | mousebuf[5]);
|
||||
} else {
|
||||
*dx = last_x;
|
||||
*dy = last_y;
|
||||
}
|
||||
|
||||
last_x = *dx;
|
||||
last_y = *dy;
|
||||
|
||||
if ((mousebuf[2] & 0x07) == ELO_BTN_PRESS) {
|
||||
elo_button = 1;
|
||||
}
|
||||
if ((mousebuf[2] & 0x07) == ELO_BTN_RELEASE) {
|
||||
elo_button = 0;
|
||||
}
|
||||
|
||||
*button_state = elo_button;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Convert the raw coordinates from the ELO controller
|
||||
to a screen position.
|
||||
*/
|
||||
void
|
||||
eloConvertXY(_THIS, int *dx, int *dy)
|
||||
{
|
||||
int input_x = *dx;
|
||||
int input_y = *dy;
|
||||
int width = ELO_MAX_X - ELO_MIN_X;
|
||||
int height = ELO_MAX_Y - ELO_MIN_Y;
|
||||
|
||||
*dx =
|
||||
((int) cache_vinfo.xres -
|
||||
((int) cache_vinfo.xres * (input_x - ELO_MIN_X)) / width);
|
||||
*dy = (cache_vinfo.yres * (input_y - ELO_MIN_Y)) / height;
|
||||
}
|
||||
|
||||
|
||||
/* eloGetPacket
|
||||
*/
|
||||
int
|
||||
eloGetPacket(unsigned char *buffer, int *buffer_p, int *checksum, int fd)
|
||||
{
|
||||
int num_bytes;
|
||||
int ok;
|
||||
|
||||
if (fd == 0) {
|
||||
num_bytes = ELO_PACKET_SIZE;
|
||||
} else {
|
||||
num_bytes = read(fd,
|
||||
(char *) (buffer + *buffer_p),
|
||||
ELO_PACKET_SIZE - *buffer_p);
|
||||
}
|
||||
|
||||
if (num_bytes < 0) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr,
|
||||
"System error while reading from Elographics touchscreen.\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (num_bytes) {
|
||||
if ((*buffer_p == 0) && (buffer[0] != ELO_START_BYTE)) {
|
||||
SDL_memcpy(&buffer[0], &buffer[1], num_bytes - 1);
|
||||
} else {
|
||||
if (*buffer_p < ELO_PACKET_SIZE - 1) {
|
||||
*checksum = *checksum + buffer[*buffer_p];
|
||||
*checksum = *checksum % 256;
|
||||
}
|
||||
(*buffer_p)++;
|
||||
}
|
||||
num_bytes--;
|
||||
}
|
||||
|
||||
if (*buffer_p == ELO_PACKET_SIZE) {
|
||||
ok = (*checksum == buffer[ELO_PACKET_SIZE - 1]);
|
||||
*checksum = ELO_INIT_CHECKSUM;
|
||||
*buffer_p = 0;
|
||||
|
||||
if (!ok) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* eloSendPacket
|
||||
*/
|
||||
|
||||
int
|
||||
eloSendPacket(unsigned char *packet, int fd)
|
||||
{
|
||||
int i, result;
|
||||
int sum = ELO_INIT_CHECKSUM;
|
||||
|
||||
packet[0] = ELO_START_BYTE;
|
||||
for (i = 0; i < ELO_PACKET_SIZE - 1; i++) {
|
||||
sum += packet[i];
|
||||
sum &= 0xFF;
|
||||
}
|
||||
packet[ELO_PACKET_SIZE - 1] = sum;
|
||||
|
||||
result = write(fd, packet, ELO_PACKET_SIZE);
|
||||
|
||||
if (result != ELO_PACKET_SIZE) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
printf("System error while sending to Elographics touchscreen.\n");
|
||||
#endif
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* eloWaitForInput
|
||||
*/
|
||||
int
|
||||
eloWaitForInput(int fd, int timeout)
|
||||
{
|
||||
fd_set readfds;
|
||||
struct timeval to;
|
||||
int r;
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(fd, &readfds);
|
||||
to.tv_sec = 0;
|
||||
to.tv_usec = timeout;
|
||||
|
||||
r = select(FD_SETSIZE, &readfds, NULL, NULL, &to);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* eloWaitReply
|
||||
*/
|
||||
int
|
||||
eloWaitReply(unsigned char type, unsigned char *reply, int fd)
|
||||
{
|
||||
int ok;
|
||||
int i, result;
|
||||
int reply_p = 0;
|
||||
int sum = ELO_INIT_CHECKSUM;
|
||||
|
||||
i = ELO_MAX_TRIALS;
|
||||
do {
|
||||
ok = 0;
|
||||
|
||||
result = eloWaitForInput(fd, ELO_MAX_WAIT);
|
||||
|
||||
if (result > 0) {
|
||||
ok = eloGetPacket(reply, &reply_p, &sum, fd);
|
||||
|
||||
if (ok && reply[1] != type && type != ELO_PARAMETER) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr, "Wrong reply received\n");
|
||||
#endif
|
||||
ok = 0;
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr, "No input!\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (result == 0) {
|
||||
i--;
|
||||
}
|
||||
} while (!ok && (i > 0));
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
/* eloWaitAck
|
||||
*/
|
||||
|
||||
int
|
||||
eloWaitAck(int fd)
|
||||
{
|
||||
unsigned char packet[ELO_PACKET_SIZE];
|
||||
int i, nb_errors;
|
||||
|
||||
if (eloWaitReply(ELO_ACK, packet, fd)) {
|
||||
for (i = 0, nb_errors = 0; i < 4; i++) {
|
||||
if (packet[2 + i] != '0') {
|
||||
nb_errors++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nb_errors != 0) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr,
|
||||
"Elographics acknowledge packet reports %d errors\n",
|
||||
nb_errors);
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* eloSendQuery --
|
||||
*/
|
||||
int
|
||||
eloSendQuery(unsigned char *request, unsigned char *reply, int fd)
|
||||
{
|
||||
int ok;
|
||||
|
||||
if (eloSendPacket(request, fd)) {
|
||||
ok = eloWaitReply(toupper(request[1]), reply, fd);
|
||||
if (ok) {
|
||||
ok = eloWaitAck(fd);
|
||||
}
|
||||
return ok;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* eloSendControl
|
||||
*/
|
||||
int
|
||||
eloSendControl(unsigned char *control, int fd)
|
||||
{
|
||||
if (eloSendPacket(control, fd)) {
|
||||
return eloWaitAck(fd);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* eloInitController
|
||||
*/
|
||||
int
|
||||
eloInitController(int fd)
|
||||
{
|
||||
unsigned char req[ELO_PACKET_SIZE];
|
||||
unsigned char reply[ELO_PACKET_SIZE];
|
||||
const char *buffer = NULL;
|
||||
int result = 0;
|
||||
|
||||
struct termios mouse_termios;
|
||||
|
||||
/* try to read the calibration values */
|
||||
buffer = SDL_getenv("SDL_ELO_MIN_X");
|
||||
if (buffer) {
|
||||
ELO_MIN_X = SDL_atoi(buffer);
|
||||
}
|
||||
buffer = SDL_getenv("SDL_ELO_MAX_X");
|
||||
if (buffer) {
|
||||
ELO_MAX_X = SDL_atoi(buffer);
|
||||
}
|
||||
buffer = SDL_getenv("SDL_ELO_MIN_Y");
|
||||
if (buffer) {
|
||||
ELO_MIN_Y = SDL_atoi(buffer);
|
||||
}
|
||||
buffer = SDL_getenv("SDL_ELO_MAX_Y");
|
||||
if (buffer) {
|
||||
ELO_MAX_Y = SDL_atoi(buffer);
|
||||
}
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr,
|
||||
"ELO calibration values:\nmin_x: %i\nmax_x: %i\nmin_y: %i\nmax_y: %i\n",
|
||||
ELO_MIN_X, ELO_MAX_X, ELO_MIN_Y, ELO_MAX_Y);
|
||||
#endif
|
||||
|
||||
/* set comm params */
|
||||
SDL_memset(&mouse_termios, 0, sizeof(mouse_termios));
|
||||
mouse_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL;
|
||||
mouse_termios.c_cc[VMIN] = 1;
|
||||
result = tcsetattr(fd, TCSANOW, &mouse_termios);
|
||||
|
||||
if (result < 0) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr, "Unable to configure Elographics touchscreen port\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_memset(req, 0, ELO_PACKET_SIZE);
|
||||
req[1] = tolower(ELO_PARAMETER);
|
||||
if (!eloSendQuery(req, reply, fd)) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr,
|
||||
"Not at the specified rate or model 2310, will continue\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_memset(req, 0, ELO_PACKET_SIZE);
|
||||
req[1] = tolower(ELO_ID);
|
||||
if (eloSendQuery(req, reply, fd)) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr, "Ok, controller configured!\n");
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr,
|
||||
"Unable to ask Elographics touchscreen identification\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_memset(req, 0, ELO_PACKET_SIZE);
|
||||
req[1] = ELO_MODE;
|
||||
req[3] = ELO_TOUCH_MODE | ELO_STREAM_MODE | ELO_UNTOUCH_MODE;
|
||||
req[4] = ELO_TRACKING_MODE;
|
||||
if (!eloSendControl(req, fd)) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr,
|
||||
"Unable to change Elographics touchscreen operating mode\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_memset(req, 0, ELO_PACKET_SIZE);
|
||||
req[1] = ELO_REPORT;
|
||||
req[2] = ELO_UNTOUCH_DELAY;
|
||||
req[3] = ELO_REPORT_DELAY;
|
||||
if (!eloSendControl(req, fd)) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
fprintf(stderr,
|
||||
"Unable to change Elographics touchscreen reports timings\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
eloReadPosition(_THIS, int fd, int *x, int *y, int *button_state, int *realx,
|
||||
int *realy)
|
||||
{
|
||||
unsigned char buffer[ELO_PACKET_SIZE];
|
||||
int pointer = 0;
|
||||
int checksum = ELO_INIT_CHECKSUM;
|
||||
|
||||
while (pointer < ELO_PACKET_SIZE) {
|
||||
if (eloGetPacket(buffer, &pointer, &checksum, fd)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!eloParsePacket(buffer, realx, realy, button_state)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*x = *realx;
|
||||
*y = *realy;
|
||||
|
||||
eloConvertXY(this, x, y);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
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: */
|
File diff suppressed because it is too large
Load diff
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,139 +0,0 @@
|
|||
|
||||
/* 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: */
|
|
@ -1,285 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,231 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
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: */
|
File diff suppressed because it is too large
Load diff
|
@ -1,189 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
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: */
|
|
@ -1,376 +0,0 @@
|
|||
|
||||
/*
|
||||
* MGA Millennium (MGA2064W) functions
|
||||
* MGA Mystique (MGA1064SG) functions
|
||||
*
|
||||
* Copyright 1996 The XFree86 Project, Inc.
|
||||
*
|
||||
* Authors
|
||||
* Dirk Hohndel
|
||||
* hohndel@XFree86.Org
|
||||
* David Dawes
|
||||
* dawes@XFree86.Org
|
||||
* Contributors:
|
||||
* Guy DESBIEF, Aix-en-provence, France
|
||||
* g.desbief@aix.pacwan.net
|
||||
* MGA1064SG Mystique register file
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MGA_REG_H_
|
||||
#define _MGA_REG_H_
|
||||
|
||||
#define MGAREG_DWGCTL 0x1c00
|
||||
#define MGAREG_MACCESS 0x1c04
|
||||
/* the following is a mystique only register */
|
||||
#define MGAREG_MCTLWTST 0x1c08
|
||||
#define MGAREG_ZORG 0x1c0c
|
||||
|
||||
#define MGAREG_PAT0 0x1c10
|
||||
#define MGAREG_PAT1 0x1c14
|
||||
#define MGAREG_PLNWT 0x1c1c
|
||||
|
||||
#define MGAREG_BCOL 0x1c20
|
||||
#define MGAREG_FCOL 0x1c24
|
||||
|
||||
#define MGAREG_SRC0 0x1c30
|
||||
#define MGAREG_SRC1 0x1c34
|
||||
#define MGAREG_SRC2 0x1c38
|
||||
#define MGAREG_SRC3 0x1c3c
|
||||
|
||||
#define MGAREG_XYSTRT 0x1c40
|
||||
#define MGAREG_XYEND 0x1c44
|
||||
|
||||
#define MGAREG_SHIFT 0x1c50
|
||||
/* the following is a mystique only register */
|
||||
#define MGAREG_DMAPAD 0x1c54
|
||||
#define MGAREG_SGN 0x1c58
|
||||
#define MGAREG_LEN 0x1c5c
|
||||
|
||||
#define MGAREG_AR0 0x1c60
|
||||
#define MGAREG_AR1 0x1c64
|
||||
#define MGAREG_AR2 0x1c68
|
||||
#define MGAREG_AR3 0x1c6c
|
||||
#define MGAREG_AR4 0x1c70
|
||||
#define MGAREG_AR5 0x1c74
|
||||
#define MGAREG_AR6 0x1c78
|
||||
|
||||
#define MGAREG_CXBNDRY 0x1c80
|
||||
#define MGAREG_FXBNDRY 0x1c84
|
||||
#define MGAREG_YDSTLEN 0x1c88
|
||||
#define MGAREG_PITCH 0x1c8c
|
||||
|
||||
#define MGAREG_YDST 0x1c90
|
||||
#define MGAREG_YDSTORG 0x1c94
|
||||
#define MGAREG_YTOP 0x1c98
|
||||
#define MGAREG_YBOT 0x1c9c
|
||||
|
||||
#define MGAREG_CXLEFT 0x1ca0
|
||||
#define MGAREG_CXRIGHT 0x1ca4
|
||||
#define MGAREG_FXLEFT 0x1ca8
|
||||
#define MGAREG_FXRIGHT 0x1cac
|
||||
|
||||
#define MGAREG_XDST 0x1cb0
|
||||
|
||||
#define MGAREG_DR0 0x1cc0
|
||||
#define MGAREG_DR1 0x1cc4
|
||||
#define MGAREG_DR2 0x1cc8
|
||||
#define MGAREG_DR3 0x1ccc
|
||||
|
||||
#define MGAREG_DR4 0x1cd0
|
||||
#define MGAREG_DR5 0x1cd4
|
||||
#define MGAREG_DR6 0x1cd8
|
||||
#define MGAREG_DR7 0x1cdc
|
||||
|
||||
#define MGAREG_DR8 0x1ce0
|
||||
#define MGAREG_DR9 0x1ce4
|
||||
#define MGAREG_DR10 0x1ce8
|
||||
#define MGAREG_DR11 0x1cec
|
||||
|
||||
#define MGAREG_DR12 0x1cf0
|
||||
#define MGAREG_DR13 0x1cf4
|
||||
#define MGAREG_DR14 0x1cf8
|
||||
#define MGAREG_DR15 0x1cfc
|
||||
|
||||
#define MGAREG_SRCORG 0x2cb4
|
||||
#define MGAREG_DSTORG 0x2cb8
|
||||
|
||||
/* add or or this to one of the previous "power registers" to start
|
||||
the drawing engine */
|
||||
|
||||
#define MGAREG_EXEC 0x0100
|
||||
|
||||
#define MGAREG_FIFOSTATUS 0x1e10
|
||||
#define MGAREG_STATUS 0x1e14
|
||||
#define MGAREG_ICLEAR 0x1e18
|
||||
#define MGAREG_IEN 0x1e1c
|
||||
|
||||
#define MGAREG_VCOUNT 0x1e20
|
||||
|
||||
#define MGAREG_Reset 0x1e40
|
||||
|
||||
#define MGAREG_OPMODE 0x1e54
|
||||
|
||||
/* OPMODE register additives */
|
||||
|
||||
#define MGAOPM_DMA_GENERAL (0x00 << 2)
|
||||
#define MGAOPM_DMA_BLIT (0x01 << 2)
|
||||
#define MGAOPM_DMA_VECTOR (0x10 << 2)
|
||||
|
||||
/* DWGCTL register additives */
|
||||
|
||||
/* Lines */
|
||||
|
||||
#define MGADWG_LINE_OPEN 0x00
|
||||
#define MGADWG_AUTOLINE_OPEN 0x01
|
||||
#define MGADWG_LINE_CLOSE 0x02
|
||||
#define MGADWG_AUTOLINE_CLOSE 0x03
|
||||
|
||||
/* Trapezoids */
|
||||
#define MGADWG_TRAP 0x04
|
||||
#define MGADWG_TEXTURE_TRAP 0x05
|
||||
|
||||
/* BitBlts */
|
||||
|
||||
#define MGADWG_BITBLT 0x08
|
||||
#define MGADWG_FBITBLT 0x0c
|
||||
#define MGADWG_ILOAD 0x09
|
||||
#define MGADWG_ILOAD_SCALE 0x0d
|
||||
#define MGADWG_ILOAD_FILTER 0x0f
|
||||
#define MGADWG_IDUMP 0x0a
|
||||
|
||||
/* atype access to WRAM */
|
||||
|
||||
#define MGADWG_RPL ( 0x00 << 4 )
|
||||
#define MGADWG_RSTR ( 0x01 << 4 )
|
||||
#define MGADWG_ZI ( 0x03 << 4 )
|
||||
#define MGADWG_BLK ( 0x04 << 4 )
|
||||
#define MGADWG_I ( 0x07 << 4 )
|
||||
|
||||
/* specifies whether bit blits are linear or xy */
|
||||
#define MGADWG_LINEAR ( 0x01 << 7 )
|
||||
|
||||
/* z drawing mode. use MGADWG_NOZCMP for always */
|
||||
|
||||
#define MGADWG_NOZCMP ( 0x00 << 8 )
|
||||
#define MGADWG_ZE ( 0x02 << 8 )
|
||||
#define MGADWG_ZNE ( 0x03 << 8 )
|
||||
#define MGADWG_ZLT ( 0x04 << 8 )
|
||||
#define MGADWG_ZLTE ( 0x05 << 8 )
|
||||
#define MGADWG_GT ( 0x06 << 8 )
|
||||
#define MGADWG_GTE ( 0x07 << 8 )
|
||||
|
||||
/* use this to force colour expansion circuitry to do its stuff */
|
||||
|
||||
#define MGADWG_SOLID ( 0x01 << 11 )
|
||||
|
||||
/* ar register at zero */
|
||||
|
||||
#define MGADWG_ARZERO ( 0x01 << 12 )
|
||||
|
||||
#define MGADWG_SGNZERO ( 0x01 << 13 )
|
||||
|
||||
#define MGADWG_SHIFTZERO ( 0x01 << 14 )
|
||||
|
||||
/* See table on 4-43 for bop ALU operations */
|
||||
|
||||
/* See table on 4-44 for translucidity masks */
|
||||
|
||||
#define MGADWG_BMONOLEF ( 0x00 << 25 )
|
||||
#define MGADWG_BMONOWF ( 0x04 << 25 )
|
||||
#define MGADWG_BPLAN ( 0x01 << 25 )
|
||||
|
||||
/* note that if bfcol is specified and you're doing a bitblt, it causes
|
||||
a fbitblt to be performed, so check that you obey the fbitblt rules */
|
||||
|
||||
#define MGADWG_BFCOL ( 0x02 << 25 )
|
||||
#define MGADWG_BUYUV ( 0x0e << 25 )
|
||||
#define MGADWG_BU32BGR ( 0x03 << 25 )
|
||||
#define MGADWG_BU32RGB ( 0x07 << 25 )
|
||||
#define MGADWG_BU24BGR ( 0x0b << 25 )
|
||||
#define MGADWG_BU24RGB ( 0x0f << 25 )
|
||||
|
||||
#define MGADWG_REPLACE 0x000C0000 /* From Linux kernel sources */
|
||||
#define MGADWG_PATTERN ( 0x01 << 29 )
|
||||
#define MGADWG_TRANSC ( 0x01 << 30 )
|
||||
#define MGADWG_NOCLIP ( 0x01 << 31 )
|
||||
#define MGAREG_MISC_WRITE 0x3c2
|
||||
#define MGAREG_MISC_READ 0x3cc
|
||||
#define MGAREG_MISC_IOADSEL (0x1 << 0)
|
||||
#define MGAREG_MISC_RAMMAPEN (0x1 << 1)
|
||||
#define MGAREG_MISC_CLK_SEL_VGA25 (0x0 << 2)
|
||||
#define MGAREG_MISC_CLK_SEL_VGA28 (0x1 << 2)
|
||||
#define MGAREG_MISC_CLK_SEL_MGA_PIX (0x2 << 2)
|
||||
#define MGAREG_MISC_CLK_SEL_MGA_MSK (0x3 << 2)
|
||||
#define MGAREG_MISC_VIDEO_DIS (0x1 << 4)
|
||||
#define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5)
|
||||
|
||||
/* MMIO VGA registers */
|
||||
#define MGAREG_CRTC_INDEX 0x1fd4
|
||||
#define MGAREG_CRTC_DATA 0x1fd5
|
||||
#define MGAREG_CRTCEXT_INDEX 0x1fde
|
||||
#define MGAREG_CRTCEXT_DATA 0x1fdf
|
||||
|
||||
|
||||
/* MGA bits for registers PCI_OPTION_REG */
|
||||
#define MGA1064_OPT_SYS_CLK_PCI ( 0x00 << 0 )
|
||||
#define MGA1064_OPT_SYS_CLK_PLL ( 0x01 << 0 )
|
||||
#define MGA1064_OPT_SYS_CLK_EXT ( 0x02 << 0 )
|
||||
#define MGA1064_OPT_SYS_CLK_MSK ( 0x03 << 0 )
|
||||
|
||||
#define MGA1064_OPT_SYS_CLK_DIS ( 0x01 << 2 )
|
||||
#define MGA1064_OPT_G_CLK_DIV_1 ( 0x01 << 3 )
|
||||
#define MGA1064_OPT_M_CLK_DIV_1 ( 0x01 << 4 )
|
||||
|
||||
#define MGA1064_OPT_SYS_PLL_PDN ( 0x01 << 5 )
|
||||
#define MGA1064_OPT_VGA_ION ( 0x01 << 8 )
|
||||
|
||||
/* MGA registers in PCI config space */
|
||||
#define PCI_MGA_INDEX 0x44
|
||||
#define PCI_MGA_DATA 0x48
|
||||
#define PCI_MGA_OPTION2 0x50
|
||||
#define PCI_MGA_OPTION3 0x54
|
||||
|
||||
#define RAMDAC_OFFSET 0x3c00
|
||||
|
||||
/* TVP3026 direct registers */
|
||||
|
||||
#define TVP3026_INDEX 0x00
|
||||
#define TVP3026_WADR_PAL 0x00
|
||||
#define TVP3026_COL_PAL 0x01
|
||||
#define TVP3026_PIX_RD_MSK 0x02
|
||||
#define TVP3026_RADR_PAL 0x03
|
||||
#define TVP3026_CUR_COL_ADDR 0x04
|
||||
#define TVP3026_CUR_COL_DATA 0x05
|
||||
#define TVP3026_DATA 0x0a
|
||||
#define TVP3026_CUR_RAM 0x0b
|
||||
#define TVP3026_CUR_XLOW 0x0c
|
||||
#define TVP3026_CUR_XHI 0x0d
|
||||
#define TVP3026_CUR_YLOW 0x0e
|
||||
#define TVP3026_CUR_YHI 0x0f
|
||||
|
||||
/* TVP3026 indirect registers */
|
||||
|
||||
#define TVP3026_SILICON_REV 0x01
|
||||
#define TVP3026_CURSOR_CTL 0x06
|
||||
#define TVP3026_LATCH_CTL 0x0f
|
||||
#define TVP3026_TRUE_COLOR_CTL 0x18
|
||||
#define TVP3026_MUX_CTL 0x19
|
||||
#define TVP3026_CLK_SEL 0x1a
|
||||
#define TVP3026_PAL_PAGE 0x1c
|
||||
#define TVP3026_GEN_CTL 0x1d
|
||||
#define TVP3026_MISC_CTL 0x1e
|
||||
#define TVP3026_GEN_IO_CTL 0x2a
|
||||
#define TVP3026_GEN_IO_DATA 0x2b
|
||||
#define TVP3026_PLL_ADDR 0x2c
|
||||
#define TVP3026_PIX_CLK_DATA 0x2d
|
||||
#define TVP3026_MEM_CLK_DATA 0x2e
|
||||
#define TVP3026_LOAD_CLK_DATA 0x2f
|
||||
#define TVP3026_KEY_RED_LOW 0x32
|
||||
#define TVP3026_KEY_RED_HI 0x33
|
||||
#define TVP3026_KEY_GREEN_LOW 0x34
|
||||
#define TVP3026_KEY_GREEN_HI 0x35
|
||||
#define TVP3026_KEY_BLUE_LOW 0x36
|
||||
#define TVP3026_KEY_BLUE_HI 0x37
|
||||
#define TVP3026_KEY_CTL 0x38
|
||||
#define TVP3026_MCLK_CTL 0x39
|
||||
#define TVP3026_SENSE_TEST 0x3a
|
||||
#define TVP3026_TEST_DATA 0x3b
|
||||
#define TVP3026_CRC_LSB 0x3c
|
||||
#define TVP3026_CRC_MSB 0x3d
|
||||
#define TVP3026_CRC_CTL 0x3e
|
||||
#define TVP3026_ID 0x3f
|
||||
#define TVP3026_RESET 0xff
|
||||
|
||||
|
||||
/* MGA1064 DAC Register file */
|
||||
/* MGA1064 direct registers */
|
||||
|
||||
#define MGA1064_INDEX 0x00
|
||||
#define MGA1064_WADR_PAL 0x00
|
||||
#define MGA1064_COL_PAL 0x01
|
||||
#define MGA1064_PIX_RD_MSK 0x02
|
||||
#define MGA1064_RADR_PAL 0x03
|
||||
#define MGA1064_DATA 0x0a
|
||||
|
||||
#define MGA1064_CUR_XLOW 0x0c
|
||||
#define MGA1064_CUR_XHI 0x0d
|
||||
#define MGA1064_CUR_YLOW 0x0e
|
||||
#define MGA1064_CUR_YHI 0x0f
|
||||
|
||||
/* MGA1064 indirect registers */
|
||||
#define MGA1064_CURSOR_BASE_ADR_LOW 0x04
|
||||
#define MGA1064_CURSOR_BASE_ADR_HI 0x05
|
||||
#define MGA1064_CURSOR_CTL 0x06
|
||||
#define MGA1064_CURSOR_COL0_RED 0x08
|
||||
#define MGA1064_CURSOR_COL0_GREEN 0x09
|
||||
#define MGA1064_CURSOR_COL0_BLUE 0x0a
|
||||
|
||||
#define MGA1064_CURSOR_COL1_RED 0x0c
|
||||
#define MGA1064_CURSOR_COL1_GREEN 0x0d
|
||||
#define MGA1064_CURSOR_COL1_BLUE 0x0e
|
||||
|
||||
#define MGA1064_CURSOR_COL2_RED 0x010
|
||||
#define MGA1064_CURSOR_COL2_GREEN 0x011
|
||||
#define MGA1064_CURSOR_COL2_BLUE 0x012
|
||||
|
||||
#define MGA1064_VREF_CTL 0x018
|
||||
|
||||
#define MGA1064_MUL_CTL 0x19
|
||||
#define MGA1064_MUL_CTL_8bits 0x0
|
||||
#define MGA1064_MUL_CTL_15bits 0x01
|
||||
#define MGA1064_MUL_CTL_16bits 0x02
|
||||
#define MGA1064_MUL_CTL_24bits 0x03
|
||||
#define MGA1064_MUL_CTL_32bits 0x04
|
||||
#define MGA1064_MUL_CTL_2G8V16bits 0x05
|
||||
#define MGA1064_MUL_CTL_G16V16bits 0x06
|
||||
#define MGA1064_MUL_CTL_32_24bits 0x07
|
||||
|
||||
#define MGAGDAC_XVREFCTRL 0x18
|
||||
#define MGA1064_PIX_CLK_CTL 0x1a
|
||||
#define MGA1064_PIX_CLK_CTL_CLK_DIS ( 0x01 << 2 )
|
||||
#define MGA1064_PIX_CLK_CTL_CLK_POW_DOWN ( 0x01 << 3 )
|
||||
#define MGA1064_PIX_CLK_CTL_SEL_PCI ( 0x00 << 0 )
|
||||
#define MGA1064_PIX_CLK_CTL_SEL_PLL ( 0x01 << 0 )
|
||||
#define MGA1064_PIX_CLK_CTL_SEL_EXT ( 0x02 << 0 )
|
||||
#define MGA1064_PIX_CLK_CTL_SEL_MSK ( 0x03 << 0 )
|
||||
|
||||
#define MGA1064_GEN_CTL 0x1d
|
||||
#define MGA1064_MISC_CTL 0x1e
|
||||
#define MGA1064_MISC_CTL_DAC_POW_DN ( 0x01 << 0 )
|
||||
#define MGA1064_MISC_CTL_VGA ( 0x01 << 1 )
|
||||
#define MGA1064_MISC_CTL_DIS_CON ( 0x03 << 1 )
|
||||
#define MGA1064_MISC_CTL_MAFC ( 0x02 << 1 )
|
||||
#define MGA1064_MISC_CTL_VGA8 ( 0x01 << 3 )
|
||||
#define MGA1064_MISC_CTL_DAC_RAM_CS ( 0x01 << 4 )
|
||||
|
||||
#define MGA1064_GEN_IO_CTL 0x2a
|
||||
#define MGA1064_GEN_IO_DATA 0x2b
|
||||
#define MGA1064_SYS_PLL_M 0x2c
|
||||
#define MGA1064_SYS_PLL_N 0x2d
|
||||
#define MGA1064_SYS_PLL_P 0x2e
|
||||
#define MGA1064_SYS_PLL_STAT 0x2f
|
||||
#define MGA1064_ZOOM_CTL 0x38
|
||||
#define MGA1064_SENSE_TST 0x3a
|
||||
|
||||
#define MGA1064_CRC_LSB 0x3c
|
||||
#define MGA1064_CRC_MSB 0x3d
|
||||
#define MGA1064_CRC_CTL 0x3e
|
||||
#define MGA1064_COL_KEY_MSK_LSB 0x40
|
||||
#define MGA1064_COL_KEY_MSK_MSB 0x41
|
||||
#define MGA1064_COL_KEY_LSB 0x42
|
||||
#define MGA1064_COL_KEY_MSB 0x43
|
||||
#define MGA1064_PIX_PLLA_M 0x44
|
||||
#define MGA1064_PIX_PLLA_N 0x45
|
||||
#define MGA1064_PIX_PLLA_P 0x46
|
||||
#define MGA1064_PIX_PLLB_M 0x48
|
||||
#define MGA1064_PIX_PLLB_N 0x49
|
||||
#define MGA1064_PIX_PLLB_P 0x4a
|
||||
#define MGA1064_PIX_PLLC_M 0x4c
|
||||
#define MGA1064_PIX_PLLC_N 0x4d
|
||||
#define MGA1064_PIX_PLLC_P 0x4e
|
||||
|
||||
#define MGA1064_PIX_PLL_STAT 0x4f
|
||||
|
||||
#endif
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -1,455 +0,0 @@
|
|||
/***************************************************************************\
|
||||
|* *|
|
||||
|* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *|
|
||||
|* *|
|
||||
|* NOTICE TO USER: The source code is copyrighted under U.S. and *|
|
||||
|* international laws. Users and possessors of this source code are *|
|
||||
|* hereby granted a nonexclusive, royalty-free copyright license to *|
|
||||
|* use this code in individual and commercial software. *|
|
||||
|* *|
|
||||
|* Any use of this source code must include, in the user documenta- *|
|
||||
|* tion and internal comments to the code, notices to the end user *|
|
||||
|* as follows: *|
|
||||
|* *|
|
||||
|* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *|
|
||||
|* *|
|
||||
|* NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY *|
|
||||
|* OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" *|
|
||||
|* WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. NVIDIA, CORPOR- *|
|
||||
|* ATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOURCE CODE, *|
|
||||
|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE- *|
|
||||
|* MENT, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL *|
|
||||
|* NVIDIA, CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT, INCI- *|
|
||||
|* DENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RE- *|
|
||||
|* SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION *|
|
||||
|* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *|
|
||||
|* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
|
||||
|* *|
|
||||
|* U.S. Government End Users. This source code is a "commercial *|
|
||||
|* item," as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
|
||||
|* consisting of "commercial computer software" and "commercial *|
|
||||
|* computer software documentation," as such terms are used in *|
|
||||
|* 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Govern- *|
|
||||
|* ment only as a commercial end item. Consistent with 48 C.F.R. *|
|
||||
|* 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
|
||||
|* all U.S. Government End Users acquire the source code with only *|
|
||||
|* those rights set forth herein. *|
|
||||
|* *|
|
||||
\***************************************************************************/
|
||||
|
||||
#ifndef __RIVA_HW_H__
|
||||
#define __RIVA_HW_H__
|
||||
#define RIVA_SW_VERSION 0x00010003
|
||||
|
||||
/*
|
||||
* Typedefs to force certain sized values.
|
||||
*/
|
||||
typedef Uint8 U008;
|
||||
typedef Uint16 U016;
|
||||
typedef Uint32 U032;
|
||||
|
||||
/*
|
||||
* HW access macros.
|
||||
*/
|
||||
#define NV_WR08(p,i,d) (((U008 *)(p))[i]=(d))
|
||||
#define NV_RD08(p,i) (((U008 *)(p))[i])
|
||||
#define NV_WR16(p,i,d) (((U016 *)(p))[(i)/2]=(d))
|
||||
#define NV_RD16(p,i) (((U016 *)(p))[(i)/2])
|
||||
#define NV_WR32(p,i,d) (((U032 *)(p))[(i)/4]=(d))
|
||||
#define NV_RD32(p,i) (((U032 *)(p))[(i)/4])
|
||||
#define VGA_WR08(p,i,d) NV_WR08(p,i,d)
|
||||
#define VGA_RD08(p,i) NV_RD08(p,i)
|
||||
|
||||
/*
|
||||
* Define supported architectures.
|
||||
*/
|
||||
#define NV_ARCH_03 0x03
|
||||
#define NV_ARCH_04 0x04
|
||||
#define NV_ARCH_10 0x10
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* FIFO registers. *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
/*
|
||||
* Raster OPeration. Windows style ROP3.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BB];
|
||||
U032 Rop3;
|
||||
} RivaRop;
|
||||
/*
|
||||
* 8X8 Monochrome pattern.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BD];
|
||||
U032 Shape;
|
||||
U032 reserved03[0x001];
|
||||
U032 Color0;
|
||||
U032 Color1;
|
||||
U032 Monochrome[2];
|
||||
} RivaPattern;
|
||||
/*
|
||||
* Scissor clip rectangle.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BB];
|
||||
U032 TopLeft;
|
||||
U032 WidthHeight;
|
||||
} RivaClip;
|
||||
/*
|
||||
* 2D filled rectangle.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop[1];
|
||||
U032 reserved01[0x0BC];
|
||||
U032 Color;
|
||||
U032 reserved03[0x03E];
|
||||
U032 TopLeft;
|
||||
U032 WidthHeight;
|
||||
} RivaRectangle;
|
||||
/*
|
||||
* 2D screen-screen BLT.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BB];
|
||||
U032 TopLeftSrc;
|
||||
U032 TopLeftDst;
|
||||
U032 WidthHeight;
|
||||
} RivaScreenBlt;
|
||||
/*
|
||||
* 2D pixel BLT.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop[1];
|
||||
U032 reserved01[0x0BC];
|
||||
U032 TopLeft;
|
||||
U032 WidthHeight;
|
||||
U032 WidthHeightIn;
|
||||
U032 reserved02[0x03C];
|
||||
U032 Pixels;
|
||||
} RivaPixmap;
|
||||
/*
|
||||
* Filled rectangle combined with monochrome expand. Useful for glyphs.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BB];
|
||||
U032 reserved03[(0x040) - 1];
|
||||
U032 Color1A;
|
||||
struct
|
||||
{
|
||||
U032 TopLeft;
|
||||
U032 WidthHeight;
|
||||
} UnclippedRectangle[64];
|
||||
U032 reserved04[(0x080) - 3];
|
||||
struct
|
||||
{
|
||||
U032 TopLeft;
|
||||
U032 BottomRight;
|
||||
} ClipB;
|
||||
U032 Color1B;
|
||||
struct
|
||||
{
|
||||
U032 TopLeft;
|
||||
U032 BottomRight;
|
||||
} ClippedRectangle[64];
|
||||
U032 reserved05[(0x080) - 5];
|
||||
struct
|
||||
{
|
||||
U032 TopLeft;
|
||||
U032 BottomRight;
|
||||
} ClipC;
|
||||
U032 Color1C;
|
||||
U032 WidthHeightC;
|
||||
U032 PointC;
|
||||
U032 MonochromeData1C;
|
||||
U032 reserved06[(0x080) + 121];
|
||||
struct
|
||||
{
|
||||
U032 TopLeft;
|
||||
U032 BottomRight;
|
||||
} ClipD;
|
||||
U032 Color1D;
|
||||
U032 WidthHeightInD;
|
||||
U032 WidthHeightOutD;
|
||||
U032 PointD;
|
||||
U032 MonochromeData1D;
|
||||
U032 reserved07[(0x080) + 120];
|
||||
struct
|
||||
{
|
||||
U032 TopLeft;
|
||||
U032 BottomRight;
|
||||
} ClipE;
|
||||
U032 Color0E;
|
||||
U032 Color1E;
|
||||
U032 WidthHeightInE;
|
||||
U032 WidthHeightOutE;
|
||||
U032 PointE;
|
||||
U032 MonochromeData01E;
|
||||
} RivaBitmap;
|
||||
/*
|
||||
* 3D textured, Z buffered triangle.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BC];
|
||||
U032 TextureOffset;
|
||||
U032 TextureFormat;
|
||||
U032 TextureFilter;
|
||||
U032 FogColor;
|
||||
/* This is a problem on LynxOS */
|
||||
#ifdef Control
|
||||
#undef Control
|
||||
#endif
|
||||
U032 Control;
|
||||
U032 AlphaTest;
|
||||
U032 reserved02[0x339];
|
||||
U032 FogAndIndex;
|
||||
U032 Color;
|
||||
float ScreenX;
|
||||
float ScreenY;
|
||||
float ScreenZ;
|
||||
float EyeM;
|
||||
float TextureS;
|
||||
float TextureT;
|
||||
} RivaTexturedTriangle03;
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BB];
|
||||
U032 ColorKey;
|
||||
U032 TextureOffset;
|
||||
U032 TextureFormat;
|
||||
U032 TextureFilter;
|
||||
U032 Blend;
|
||||
/* This is a problem on LynxOS */
|
||||
#ifdef Control
|
||||
#undef Control
|
||||
#endif
|
||||
U032 Control;
|
||||
U032 FogColor;
|
||||
U032 reserved02[0x39];
|
||||
struct
|
||||
{
|
||||
float ScreenX;
|
||||
float ScreenY;
|
||||
float ScreenZ;
|
||||
float EyeM;
|
||||
U032 Color;
|
||||
U032 Specular;
|
||||
float TextureS;
|
||||
float TextureT;
|
||||
} Vertex[16];
|
||||
U032 DrawTriangle3D;
|
||||
} RivaTexturedTriangle05;
|
||||
/*
|
||||
* 2D line.
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop[1];
|
||||
U032 reserved01[0x0BC];
|
||||
U032 Color; /* source color 0304-0307 */
|
||||
U032 Reserved02[0x03e];
|
||||
struct
|
||||
{ /* start aliased methods in array 0400- */
|
||||
U032 point0; /* y_x S16_S16 in pixels 0- 3 */
|
||||
U032 point1; /* y_x S16_S16 in pixels 4- 7 */
|
||||
} Lin[16]; /* end of aliased methods in array -047f */
|
||||
struct
|
||||
{ /* start aliased methods in array 0480- */
|
||||
U032 point0X; /* in pixels, 0 at left 0- 3 */
|
||||
U032 point0Y; /* in pixels, 0 at top 4- 7 */
|
||||
U032 point1X; /* in pixels, 0 at left 8- b */
|
||||
U032 point1Y; /* in pixels, 0 at top c- f */
|
||||
} Lin32[8]; /* end of aliased methods in array -04ff */
|
||||
U032 PolyLin[32]; /* y_x S16_S16 in pixels 0500-057f */
|
||||
struct
|
||||
{ /* start aliased methods in array 0580- */
|
||||
U032 x; /* in pixels, 0 at left 0- 3 */
|
||||
U032 y; /* in pixels, 0 at top 4- 7 */
|
||||
} PolyLin32[16]; /* end of aliased methods in array -05ff */
|
||||
struct
|
||||
{ /* start aliased methods in array 0600- */
|
||||
U032 color; /* source color 0- 3 */
|
||||
U032 point; /* y_x S16_S16 in pixels 4- 7 */
|
||||
} ColorPolyLin[16]; /* end of aliased methods in array -067f */
|
||||
} RivaLine;
|
||||
/*
|
||||
* 2D/3D surfaces
|
||||
*/
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BE];
|
||||
U032 Offset;
|
||||
} RivaSurface;
|
||||
typedef volatile struct
|
||||
{
|
||||
U032 reserved00[4];
|
||||
U016 FifoFree;
|
||||
U016 Nop;
|
||||
U032 reserved01[0x0BD];
|
||||
U032 Pitch;
|
||||
U032 RenderBufferOffset;
|
||||
U032 ZBufferOffset;
|
||||
} RivaSurface3D;
|
||||
|
||||
/***************************************************************************\
|
||||
* *
|
||||
* Virtualized RIVA H/W interface. *
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
struct _riva_hw_inst;
|
||||
struct _riva_hw_state;
|
||||
/*
|
||||
* Virtialized chip interface. Makes RIVA 128 and TNT look alike.
|
||||
*/
|
||||
typedef struct _riva_hw_inst
|
||||
{
|
||||
/*
|
||||
* Chip specific settings.
|
||||
*/
|
||||
U032 Architecture;
|
||||
U032 Version;
|
||||
U032 CrystalFreqKHz;
|
||||
U032 RamAmountKBytes;
|
||||
U032 MaxVClockFreqKHz;
|
||||
U032 RamBandwidthKBytesPerSec;
|
||||
U032 EnableIRQ;
|
||||
U032 IO;
|
||||
U032 VBlankBit;
|
||||
U032 FifoFreeCount;
|
||||
U032 FifoEmptyCount;
|
||||
/*
|
||||
* Non-FIFO registers.
|
||||
*/
|
||||
volatile U032 *PCRTC;
|
||||
volatile U032 *PRAMDAC;
|
||||
volatile U032 *PFB;
|
||||
volatile U032 *PFIFO;
|
||||
volatile U032 *PGRAPH;
|
||||
volatile U032 *PEXTDEV;
|
||||
volatile U032 *PTIMER;
|
||||
volatile U032 *PMC;
|
||||
volatile U032 *PRAMIN;
|
||||
volatile U032 *FIFO;
|
||||
volatile U032 *CURSOR;
|
||||
volatile U032 *CURSORPOS;
|
||||
volatile U032 *VBLANKENABLE;
|
||||
volatile U032 *VBLANK;
|
||||
volatile U008 *PCIO;
|
||||
volatile U008 *PVIO;
|
||||
volatile U008 *PDIO;
|
||||
/*
|
||||
* Common chip functions.
|
||||
*/
|
||||
int (*Busy) (struct _riva_hw_inst *);
|
||||
void (*CalcStateExt) (struct _riva_hw_inst *, struct _riva_hw_state *,
|
||||
int, int, int, int, int, int, int, int, int, int,
|
||||
int, int, int);
|
||||
void (*LoadStateExt) (struct _riva_hw_inst *, struct _riva_hw_state *);
|
||||
void (*UnloadStateExt) (struct _riva_hw_inst *, struct _riva_hw_state *);
|
||||
void (*SetStartAddress) (struct _riva_hw_inst *, U032);
|
||||
void (*SetSurfaces2D) (struct _riva_hw_inst *, U032, U032);
|
||||
void (*SetSurfaces3D) (struct _riva_hw_inst *, U032, U032);
|
||||
int (*ShowHideCursor) (struct _riva_hw_inst *, int);
|
||||
void (*LockUnlock) (struct _riva_hw_inst *, int);
|
||||
/*
|
||||
* Current extended mode settings.
|
||||
*/
|
||||
struct _riva_hw_state *CurrentState;
|
||||
/*
|
||||
* FIFO registers.
|
||||
*/
|
||||
RivaRop *Rop;
|
||||
RivaPattern *Patt;
|
||||
RivaClip *Clip;
|
||||
RivaPixmap *Pixmap;
|
||||
RivaScreenBlt *Blt;
|
||||
RivaBitmap *Bitmap;
|
||||
RivaLine *Line;
|
||||
RivaTexturedTriangle03 *Tri03;
|
||||
RivaTexturedTriangle05 *Tri05;
|
||||
} RIVA_HW_INST;
|
||||
/*
|
||||
* Extended mode state information.
|
||||
*/
|
||||
typedef struct _riva_hw_state
|
||||
{
|
||||
U032 bpp;
|
||||
U032 width;
|
||||
U032 height;
|
||||
U032 repaint0;
|
||||
U032 repaint1;
|
||||
U032 screen;
|
||||
U032 pixel;
|
||||
U032 horiz;
|
||||
U032 arbitration0;
|
||||
U032 arbitration1;
|
||||
U032 vpll;
|
||||
U032 pllsel;
|
||||
U032 general;
|
||||
U032 config;
|
||||
U032 cursor0;
|
||||
U032 cursor1;
|
||||
U032 cursor2;
|
||||
U032 offset0;
|
||||
U032 offset1;
|
||||
U032 offset2;
|
||||
U032 offset3;
|
||||
U032 pitch0;
|
||||
U032 pitch1;
|
||||
U032 pitch2;
|
||||
U032 pitch3;
|
||||
} RIVA_HW_STATE;
|
||||
|
||||
/*
|
||||
* FIFO Free Count. Should attempt to yield processor if RIVA is busy.
|
||||
*/
|
||||
|
||||
#define RIVA_FIFO_FREE(hwptr,cnt) \
|
||||
{ \
|
||||
while (FifoFreeCount < (cnt)) \
|
||||
FifoFreeCount = hwptr->FifoFree >> 2; \
|
||||
FifoFreeCount -= (cnt); \
|
||||
}
|
||||
#endif /* __RIVA_HW_H__ */
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
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: */
|
Loading…
Add table
Add a link
Reference in a new issue