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_fbriva.h"
279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "riva_mmio.h"
289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "riva_regs.h"
299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int FifoEmptyCount = 0;
329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int FifoFreeCount = 0;
339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Wait for vertical retrace */
359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void WaitVBL(_THIS)
369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	volatile Uint8 *port = (Uint8 *)(mapped_io + PCIO_OFFSET + 0x3DA);
389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	while (  (*port & 0x08) )
409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		;
419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	while ( !(*port & 0x08) )
429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		;
439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void NV3WaitIdle(_THIS)
459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	RivaRop *Rop = (RivaRop *)(mapped_io + ROP_OFFSET);
479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	while ( (Rop->FifoFree < FifoEmptyCount) ||
489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	        (*(mapped_io + PGRAPH_OFFSET + 0x000006B0) & 0x01) )
499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		;
509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void NV4WaitIdle(_THIS)
529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	RivaRop *Rop = (RivaRop *)(mapped_io + ROP_OFFSET);
549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	while ( (Rop->FifoFree < FifoEmptyCount) ||
559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	        (*(mapped_io + PGRAPH_OFFSET + 0x00000700) & 0x01) )
569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		;
579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if 0 /* Not yet implemented? */
609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Sets video mem colorkey and accelerated blit function */
619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key)
629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Sets per surface hardware alpha value */
679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int SetHWAlpha(_THIS, SDL_Surface *surface, Uint8 value)
689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* Not yet implemented */
729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color)
749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int dstX, dstY;
769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int dstW, dstH;
779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	RivaBitmap *Bitmap = (RivaBitmap *)(mapped_io + BITMAP_OFFSET);
789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Don't blit to the display surface when switched away */
809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( switched_away ) {
819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return -2; /* no hardware access */
829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst == this->screen ) {
849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_mutexP(hw_lock);
859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set up the X/Y base coordinates */
889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstW = rect->w;
899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstH = rect->h;
909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_dst_to_xy(this, dst, &dstX, &dstY);
919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Adjust for the current rectangle */
939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstX += rect->x;
949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstY += rect->y;
959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	RIVA_FIFO_FREE(Bitmap, 1);
979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Bitmap->Color1A = color;
989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	RIVA_FIFO_FREE(Bitmap, 2);
1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Bitmap->UnclippedRectangle[0].TopLeft     = (dstX << 16) | dstY;
1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Bitmap->UnclippedRectangle[0].WidthHeight = (dstW << 16) | dstH;
1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_AddBusySurface(dst);
1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst == this->screen ) {
1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_mutexV(hw_lock);
1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall                       SDL_Surface *dst, SDL_Rect *dstrect)
1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_VideoDevice *this = current_video;
1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int srcX, srcY;
1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int dstX, dstY;
1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int dstW, dstH;
1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	RivaScreenBlt *Blt = (RivaScreenBlt *)(mapped_io + BLT_OFFSET);
1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* FIXME: For now, only blit to display surface */
1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst->pitch != SDL_VideoSurface->pitch ) {
1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return(src->map->sw_blit(src, srcrect, dst, dstrect));
1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Don't blit to the display surface when switched away */
1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( switched_away ) {
1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		return -2; /* no hardware access */
1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst == this->screen ) {
1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_mutexP(hw_lock);
1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Calculate source and destination base coordinates (in pixels) */
1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstW = dstrect->w;
1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstH = dstrect->h;
1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_dst_to_xy(this, src, &srcX, &srcY);
1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_dst_to_xy(this, dst, &dstX, &dstY);
1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Adjust for the current blit rectangles */
1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	srcX += srcrect->x;
1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	srcY += srcrect->y;
1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstX += dstrect->x;
1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	dstY += dstrect->y;
1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	RIVA_FIFO_FREE(Blt, 3);
1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Blt->TopLeftSrc  = (srcY << 16) | srcX;
1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Blt->TopLeftDst  = (dstY << 16) | dstX;
1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	Blt->WidthHeight = (dstH  << 16) | dstW;
1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_AddBusySurface(src);
1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FB_AddBusySurface(dst);
1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( dst == this->screen ) {
1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		SDL_mutexV(hw_lock);
1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst)
1609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
1619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	int accelerated;
1629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set initial acceleration on */
1649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	src->flags |= SDL_HWACCEL;
1659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Set the surface attributes */
1679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( (src->flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
1689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		if ( ! this->info.blit_hw_A ) {
1699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			src->flags &= ~SDL_HWACCEL;
1709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		}
1719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( (src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY ) {
1739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		if ( ! this->info.blit_hw_CC ) {
1749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			src->flags &= ~SDL_HWACCEL;
1759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		}
1769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Check to see if final surface blit is accelerated */
1799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	accelerated = !!(src->flags & SDL_HWACCEL);
1809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( accelerated ) {
1819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		src->map->hw_blit = HWAccelBlit;
1829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
1839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(accelerated);
1849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
1859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid FB_RivaAccel(_THIS, __u32 card)
1879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
1889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	RivaRop *Rop = (RivaRop *)(mapped_io + ROP_OFFSET);
1899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
1909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* We have hardware accelerated surface functions */
1919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->CheckHWBlit = CheckHWBlit;
1929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	wait_vbl = WaitVBL;
1939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	switch (card) {
1949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	    case FB_ACCEL_NV3:
1959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		wait_idle = NV3WaitIdle;
1969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		break;
1979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	    case FB_ACCEL_NV4:
1989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		wait_idle = NV4WaitIdle;
1999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		break;
2009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	    default:
2019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		/* Hmm... FIXME */
2029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		break;
2039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
2049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	FifoEmptyCount = Rop->FifoFree;
2059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* The Riva has an accelerated color fill */
2079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->info.blit_fill = 1;
2089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->FillHWRect = FillHWRect;
2099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* The Riva has accelerated normal and colorkey blits. */
2119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->info.blit_hw = 1;
2129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if 0 /* Not yet implemented? */
2139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->info.blit_hw_CC = 1;
2149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->SetHWColorKey = SetHWColorKey;
2159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif
2169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
2179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if 0 /* Not yet implemented? */
2189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* The Riva has an accelerated alpha blit */
2199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->info.blit_hw_A = 1;
2209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	this->SetHWAlpha = SetHWAlpha;
2219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif
2229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
223