comparison src/video/fbcon/SDL_fb3dfx.c @ 106:63ec24e0575f

Merged DGA video surface handling improvements, unified locking code. Fixed matrox blit bug where src Y less than dst Y Fixed hardware surface init when no resolution change
author Sam Lantinga <slouken@lokigames.com>
date Fri, 13 Jul 2001 10:19:51 +0000
parents 74212992fb08
children 5a9c36a45db1
comparison
equal deleted inserted replaced
105:2136ea8953f9 106:63ec24e0575f
29 #include "SDL_video.h" 29 #include "SDL_video.h"
30 #include "SDL_blit.h" 30 #include "SDL_blit.h"
31 #include "SDL_fb3dfx.h" 31 #include "SDL_fb3dfx.h"
32 #include "3dfx_mmio.h" 32 #include "3dfx_mmio.h"
33 33
34
35 static int LockHWSurface(_THIS, SDL_Surface *surface)
36 {
37 if ( surface == SDL_VideoSurface ) {
38 tdfx_waitidle();
39 }
40 return(0);
41 }
42 static void UnlockHWSurface(_THIS, SDL_Surface *surface)
43 {
44 return;
45 }
46 34
47 /* Wait for vertical retrace */ 35 /* Wait for vertical retrace */
48 static void WaitVBL(_THIS) 36 static void WaitVBL(_THIS)
49 { 37 {
50 /* find start of retrace */ 38 /* find start of retrace */
52 while( (tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == STATUS_RETRACE ) 40 while( (tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == STATUS_RETRACE )
53 ; 41 ;
54 /* wait until we're past the start */ 42 /* wait until we're past the start */
55 while( (tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == 0 ) 43 while( (tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == 0 )
56 ; 44 ;
45 }
46 static void WaitIdle(_THIS)
47 {
48 tdfx_waitidle();
57 } 49 }
58 50
59 /* Sets video mem colorkey and accelerated blit function */ 51 /* Sets video mem colorkey and accelerated blit function */
60 static int SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key) 52 static int SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key)
61 { 53 {
84 tdfx_out32(DSTFORMAT, format); 76 tdfx_out32(DSTFORMAT, format);
85 tdfx_out32(COLORFORE, color); 77 tdfx_out32(COLORFORE, color);
86 tdfx_out32(COMMAND_2D, COMMAND_2D_FILLRECT); 78 tdfx_out32(COMMAND_2D, COMMAND_2D_FILLRECT);
87 tdfx_out32(DSTSIZE, rect->w | (rect->h << 16)); 79 tdfx_out32(DSTSIZE, rect->w | (rect->h << 16));
88 tdfx_out32(LAUNCH_2D, dstX | (dstY << 16)); 80 tdfx_out32(LAUNCH_2D, dstX | (dstY << 16));
81
82 FB_AddBusySurface(dst);
83
89 return(0); 84 return(0);
90 } 85 }
91 86
92 static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, 87 static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
93 SDL_Surface *dst, SDL_Rect *dstrect) 88 SDL_Surface *dst, SDL_Rect *dstrect)
149 tdfx_out32(COMMANDEXTRA_2D, use_colorkey); 144 tdfx_out32(COMMANDEXTRA_2D, use_colorkey);
150 tdfx_out32(DSTSIZE, dstrect->w | (dstrect->h << 16)); 145 tdfx_out32(DSTSIZE, dstrect->w | (dstrect->h << 16));
151 tdfx_out32(DSTXY, dstX | (dstY << 16)); 146 tdfx_out32(DSTXY, dstX | (dstY << 16));
152 tdfx_out32(LAUNCH_2D, srcX | (srcY << 16)); 147 tdfx_out32(LAUNCH_2D, srcX | (srcY << 16));
153 148
149 FB_AddBusySurface(src);
150 FB_AddBusySurface(dst);
151
154 return(0); 152 return(0);
155 } 153 }
156 154
157 static int CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst) 155 static int CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst)
158 { 156 {
183 181
184 void FB_3DfxAccel(_THIS, __u32 card) 182 void FB_3DfxAccel(_THIS, __u32 card)
185 { 183 {
186 /* We have hardware accelerated surface functions */ 184 /* We have hardware accelerated surface functions */
187 this->CheckHWBlit = CheckHWBlit; 185 this->CheckHWBlit = CheckHWBlit;
188 this->LockHWSurface = LockHWSurface;
189 this->UnlockHWSurface = UnlockHWSurface;
190 wait_vbl = WaitVBL; 186 wait_vbl = WaitVBL;
187 wait_idle = WaitIdle;
191 188
192 /* Reset the 3Dfx controller */ 189 /* Reset the 3Dfx controller */
193 tdfx_out32(BRESERROR0, 0); 190 tdfx_out32(BRESERROR0, 0);
194 tdfx_out32(BRESERROR1, 0); 191 tdfx_out32(BRESERROR1, 0);
195 192