19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*
29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    SDL - Simple DirectMedia Layer
39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    Copyright (C) 1997-2012 Sam Lantinga
49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    This library is free software; you can redistribute it and/or
69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    modify it under the terms of the GNU Lesser General Public
79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    License as published by the Free Software Foundation; either
89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    version 2.1 of the License, or (at your option) any later version.
99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    This library is distributed in the hope that it will be useful,
119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    but WITHOUT ANY WARRANTY; without even the implied warranty of
129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    Lesser General Public License for more details.
149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    You should have received a copy of the GNU Lesser General Public
169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    License along with this library; if not, write to the Free Software
179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    Sam Lantinga
209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    slouken@libsdl.org
219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/
229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_config.h"
239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_video.h"
259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "../SDL_blit.h"
269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_fb3dfx.h"
279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "3dfx_mmio.h"
289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Wait for vertical retrace */
319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void WaitVBL(_THIS)
329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* find start of retrace */
349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_waitidle();
359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	while( (tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == STATUS_RETRACE )
369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		;
379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* wait until we're past the start */
389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	while( (tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == 0 )
399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		;
409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void WaitIdle(_THIS)
429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_waitidle();
449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Sets video mem colorkey and accelerated blit function */
479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key)
489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color)
539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int bpp;
559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Uint32 dst_base;
569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Uint32 format;
579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int dstX, dstY;
589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Don't blit to the display surface when switched away */
609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( switched_away ) {
619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return -2; /* no hardware access */
629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst == this->screen ) {
649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_mutexP(hw_lock);
659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set the destination pixel format */
689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dst_base = ((char *)dst->pixels - mapped_mem);
699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	bpp = dst->format->BitsPerPixel;
709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	format = dst->pitch | ((bpp+((bpp==8) ? 0 : 8)) << 13);
719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Calculate source and destination base coordinates */
739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstX = rect->x;
749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstY = rect->y;
759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Execute the fill command */
779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_wait(6);
789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(DSTBASE, dst_base);
799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(DSTFORMAT, format);
809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(COLORFORE, color);
819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(COMMAND_2D, COMMAND_2D_FILLRECT);
829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(DSTSIZE, rect->w | (rect->h << 16));
839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(LAUNCH_2D, dstX | (dstY << 16));
849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_AddBusySurface(dst);
869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst == this->screen ) {
889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_mutexV(hw_lock);
899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                       SDL_Surface *dst, SDL_Rect *dstrect)
959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_VideoDevice *this = current_video;
979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int bpp;
989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Uint32 src_format;
999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Uint32 src_base;
1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Uint32 dst_base;
1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int srcX, srcY;
1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int dstX, dstY;
1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Uint32 blitop;
1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Uint32 use_colorkey;
1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Don't blit to the display surface when switched away */
1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( switched_away ) {
1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return -2; /* no hardware access */
1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst == this->screen ) {
1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_mutexP(hw_lock);
1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set the source and destination pixel format */
1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	src_base = ((char *)src->pixels - mapped_mem);
1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	bpp = src->format->BitsPerPixel;
1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	src_format = src->pitch | ((bpp+((bpp==8) ? 0 : 8)) << 13);
1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dst_base = ((char *)dst->pixels - mapped_mem);
1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	bpp = dst->format->BitsPerPixel;
1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	srcX = srcrect->x;
1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	srcY = srcrect->y;
1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstX = dstrect->x;
1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstY = dstrect->y;
1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Assemble the blit operation */
1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	blitop = COMMAND_2D_BITBLT | (0xCC << 24);
1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( srcX <= dstX ) {
1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		blitop |= BIT(14);
1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		srcX += (dstrect->w - 1);
1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		dstX += (dstrect->w - 1);
1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( srcY <= dstY ) {
1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		blitop |= BIT(15);
1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		srcY += (dstrect->h - 1);
1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		dstY += (dstrect->h - 1);
1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Perform the blit! */
1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( (src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY ) {
1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    		tdfx_wait(3);
1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    		tdfx_out32(SRCCOLORKEYMIN, src->format->colorkey);
1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    		tdfx_out32(SRCCOLORKEYMAX, src->format->colorkey);
1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall    		tdfx_out32(ROP_2D, 0xAA00);
1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		use_colorkey = 1;
1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	} else {
1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		use_colorkey = 0;
1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_wait(9);
1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(SRCBASE, (Uint32)src_base);
1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(SRCFORMAT, src_format);
1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(DSTBASE, (Uint32)dst_base);
1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(DSTFORMAT, src_format);
1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(COMMAND_2D, blitop);
1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(COMMANDEXTRA_2D, use_colorkey);
1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(DSTSIZE, dstrect->w | (dstrect->h << 16));
1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(DSTXY, dstX | (dstY << 16));
1589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(LAUNCH_2D, srcX | (srcY << 16));
1599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_AddBusySurface(src);
1619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_AddBusySurface(dst);
1629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst == this->screen ) {
1649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_mutexV(hw_lock);
1659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
1679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst)
1709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
1719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int accelerated;
1729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set initial acceleration on */
1749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	src->flags |= SDL_HWACCEL;
1759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set the surface attributes */
1779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( (src->flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
1789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		if ( ! this->info.blit_hw_A ) {
1799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			src->flags &= ~SDL_HWACCEL;
1809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		}
1819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( (src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY ) {
1839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		if ( ! this->info.blit_hw_CC ) {
1849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			src->flags &= ~SDL_HWACCEL;
1859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		}
1869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Check to see if final surface blit is accelerated */
1899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	accelerated = !!(src->flags & SDL_HWACCEL);
1909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( accelerated ) {
1919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		src->map->hw_blit = HWAccelBlit;
1929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(accelerated);
1949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid FB_3DfxAccel(_THIS, __u32 card)
1979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
1989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* We have hardware accelerated surface functions */
1999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->CheckHWBlit = CheckHWBlit;
2009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	wait_vbl = WaitVBL;
2019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	wait_idle = WaitIdle;
2029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Reset the 3Dfx controller */
2049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(BRESERROR0, 0);
2059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	tdfx_out32(BRESERROR1, 0);
2069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* The 3Dfx has an accelerated color fill */
2089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->info.blit_fill = 1;
2099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->FillHWRect = FillHWRect;
2109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* The 3Dfx has accelerated normal and colorkey blits */
2129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->info.blit_hw = 1;
2139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->info.blit_hw_CC = 1;
2149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->SetHWColorKey = SetHWColorKey;
2159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
216