comparison test/testvidinfo.c @ 821:30168104389f

Date: Sat, 14 Feb 2004 14:52:40 +0200 From: "Mike Gorchak" Subject: Batch of the QNX6 fixes for the SDL 1. Updated readme.QNX 2. Fixed crashes during intensive window updating under fast machines (got over 200 rectangles for update). 3. Fixed double-buffered fullscreen modes, now it works as needed. 4. Fixed Photon detection algorithm. 5. Fixed HWSURFACE update function. 6. Added SDL_PHOTON_FULLSCREEN_REFRESH environment variable support for control refresh rates under Photon. 7. Added 640x400 fullscreen mode emulation via 640x480 (if videodriver not supports original 640x400 mode of course) shifted by 40 vertical pixels from begin, to center it. It's needed for some old DOS games which ran in doubled 320x200 mode. 8. Added available video ram amount support. 8. Added hardware surface allocation/deallocation support if current videomode and videodriver supports it. 9. Added hardware filling support. 10. Added hardware blits support (simple and colorkeyed). And I've added to testvidinfo test color-keyed blits benchmark (maybe need to add alpha blits benchmark too ?). Currently Photon not supporting any alpha hardware blittings (all drivers lack of alpha blitting code support, only software alpha blitting exist in photon, which is hundreds times slowest than the SDL's one). So I've not added the alpha support. I suppose new QNX 6.3 will have the hardware alpha support, so when it will be done, I'll add alpha support.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 14 Feb 2004 20:22:21 +0000
parents 1b8ea19e9ee4
children 05c551e5bc64
comparison
equal deleted inserted replaced
820:0b9b4bf3c1e7 821:30168104389f
24 if ( flags & SDL_FULLSCREEN ) { 24 if ( flags & SDL_FULLSCREEN ) {
25 printf(" | SDL_FULLSCREEN"); 25 printf(" | SDL_FULLSCREEN");
26 } 26 }
27 if ( flags & SDL_DOUBLEBUF ) { 27 if ( flags & SDL_DOUBLEBUF ) {
28 printf(" | SDL_DOUBLEBUF"); 28 printf(" | SDL_DOUBLEBUF");
29 }
30 if ( flags & SDL_SRCCOLORKEY ) {
31 printf(" | SDL_SRCCOLORKEY");
32 }
33 if ( flags & SDL_RLEACCEL ) {
34 printf(" | SDL_RLEACCEL");
29 } 35 }
30 } 36 }
31 37
32 int RunBlitTests(SDL_Surface *screen, SDL_Surface *bmp, int blitcount) 38 int RunBlitTests(SDL_Surface *screen, SDL_Surface *bmp, int blitcount)
33 { 39 {
65 Uint32 then, now; 71 Uint32 then, now;
66 Uint32 frames; 72 Uint32 frames;
67 float seconds; 73 float seconds;
68 int i; 74 int i;
69 Uint8 r, g, b; 75 Uint8 r, g, b;
70 SDL_Surface *bmp, *tmp; 76 SDL_Surface *bmp, *bmpcc, *tmp;
71 SDL_Event event; 77 SDL_Event event;
72 78
73 while ( SDL_PollEvent(&event) ) { 79 while ( SDL_PollEvent(&event) ) {
74 if ( event.type == SDL_KEYDOWN ) 80 if ( event.type == SDL_KEYDOWN )
75 return 0; 81 return 0;
114 while ( SDL_PollEvent(&event) ) { 120 while ( SDL_PollEvent(&event) ) {
115 if ( event.type == SDL_KEYDOWN ) 121 if ( event.type == SDL_KEYDOWN )
116 return 0; 122 return 0;
117 } 123 }
118 124
125 /* run the generic blit test */
119 bmp = SDL_LoadBMP("sample.bmp"); 126 bmp = SDL_LoadBMP("sample.bmp");
120 if ( ! bmp ) { 127 if ( ! bmp ) {
121 printf("Couldn't load sample.bmp: %s\n", SDL_GetError()); 128 printf("Couldn't load sample.bmp: %s\n", SDL_GetError());
122 return 0; 129 return 0;
123 } 130 }
133 printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds); 140 printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
134 } else { 141 } else {
135 printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames); 142 printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
136 } 143 }
137 144
145 /* run the colorkeyed blit test */
146 bmpcc = SDL_LoadBMP("sample.bmp");
147 if ( ! bmpcc ) {
148 printf("Couldn't load sample.bmp: %s\n", SDL_GetError());
149 return 0;
150 }
151 printf("Running freshly loaded cc blit test: %dx%d at %d bpp, flags: ",
152 bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
153 SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL, *(Uint8 *)bmpcc->pixels);
154
155 PrintFlags(bmpcc->flags);
156 printf("\n");
157 then = SDL_GetTicks();
158 frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
159 now = SDL_GetTicks();
160 seconds = (float)(now - then) / 1000.0f;
161 if ( seconds > 0.0f ) {
162 printf("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
163 } else {
164 printf("%d cc blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
165 }
166
167 /* run the generic blit test */
138 tmp = bmp; 168 tmp = bmp;
139 bmp = SDL_DisplayFormat(bmp); 169 bmp = SDL_DisplayFormat(bmp);
140 SDL_FreeSurface(tmp); 170 SDL_FreeSurface(tmp);
141 if ( ! bmp ) { 171 if ( ! bmp ) {
142 printf("Couldn't convert sample.bmp: %s\n", SDL_GetError()); 172 printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
153 if ( seconds > 0.0f ) { 183 if ( seconds > 0.0f ) {
154 printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds); 184 printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
155 } else { 185 } else {
156 printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames); 186 printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
157 } 187 }
188
189 /* run the colorkeyed blit test */
190 tmp = bmpcc;
191 bmpcc = SDL_DisplayFormat(bmpcc);
192 SDL_FreeSurface(tmp);
193 if ( ! bmpcc ) {
194 printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
195 return 0;
196 }
197 printf("Running display format cc blit test: %dx%d at %d bpp, flags: ",
198 bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
199 PrintFlags(bmpcc->flags);
200 printf("\n");
201 then = SDL_GetTicks();
202 frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
203 now = SDL_GetTicks();
204 seconds = (float)(now - then) / 1000.0f;
205 if ( seconds > 0.0f ) {
206 printf("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
207 } else {
208 printf("%d cc blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
209 }
210
211 SDL_FreeSurface(bmpcc);
158 SDL_FreeSurface(bmp); 212 SDL_FreeSurface(bmp);
159 213
160 while ( SDL_PollEvent(&event) ) { 214 while ( SDL_PollEvent(&event) ) {
161 if ( event.type == SDL_KEYDOWN ) 215 if ( event.type == SDL_KEYDOWN )
162 return 0; 216 return 0;