Date: Sat, 24 Apr 2004 15:13:32 +0300

From: "Mike Gorchak"
Subject: SDL updates for the QNX6

1. Updated the README.QNX
2. Updated libtool scripts, which are shipped with SDL for QNX6 support.
3. Added some code to support the new QNX 6.3.0, which is in beta now.
4. Added code to detect the hw features, which driver supports.
5. Added hw alpha blits code.
6. Fixed bug when application switches to fullscreen more the 2 times. (afte\
r that window becames always stay on top).
7. Updated a bit README for the tests.
8. Added information about acceleration show in the testalpha.c test.
9. Added small fixes to the testoverlay2.c test.
10. Added alpha and cc+alpha blits benchmarks to the testvidinfo.c test.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40887
This commit is contained in:
Sam Lantinga 2004-05-06 15:55:06 +00:00
parent 2ca2c6c186
commit edba2cc827
13 changed files with 336 additions and 80 deletions

View file

@ -11,7 +11,7 @@ These are test programs for the SDL library:
loopwave Audio test -- loop playing a WAV file
testcdrom Sample audio CD control program
testkeys List the available keyboard keys
testvidinfo Show the pixel format of the display
testvidinfo Show the pixel format of the display and perfom the benchmark
checkkeys Watch the key events to check the keyboard
testwin Display a BMP image at various depths
graywin Display a gray gradient and center mouse on spacebar
@ -22,4 +22,5 @@ These are test programs for the SDL library:
threadwin Test multi-threaded event handling
testgl A very simple example of using OpenGL with SDL
testjoystick List joysticks and watch joystick events
testoverlay Tests the software/hardware overlay functionality.
testoverlay2 Tests the overlay flickering/scaling during playback.

View file

@ -380,6 +380,37 @@ int main(int argc, char *argv[])
exit(1);
}
/* Print out information about our surfaces */
printf("Screen is at %d bits per pixel\n",screen->format->BitsPerPixel);
if ( (screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
printf("Screen is in video memory\n");
} else {
printf("Screen is in system memory\n");
}
if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
printf("Screen has double-buffering enabled\n");
}
if ( (sprite->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
printf("Sprite is in video memory\n");
} else {
printf("Sprite is in system memory\n");
}
/* Run a sample blit to trigger blit acceleration */
{ SDL_Rect dst;
dst.x = 0;
dst.y = 0;
dst.w = sprite->w;
dst.h = sprite->h;
SDL_BlitSurface(sprite, NULL, screen, &dst);
SDL_FillRect(screen, &dst, 0);
}
if ( (sprite->flags & SDL_HWACCEL) == SDL_HWACCEL ) {
printf("Sprite blit uses hardware alpha acceleration\n");
} else {
printf("Sprite blit dosn't uses hardware alpha acceleration\n");
}
/* Set a clipping rectangle to clip the outside edge of the screen */
{ SDL_Rect clip;
clip.x = 32;

View file

@ -254,13 +254,15 @@ ConvertRGBtoYUY2(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
static void PrintUsage(char *argv0)
{
fprintf(stderr, "Usage: %s [arg] [arg] [arg] ...\n", argv0);
fprintf(stderr, "Where 'arg' is one of:\n");
fprintf(stderr, "\n");
fprintf(stderr, "Where 'arg' is any of the following options:\n");
fprintf(stderr, "\n");
fprintf(stderr, " -fps <frames per second>\n");
fprintf(stderr, " -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n");
fprintf(stderr, " -scale <scale factor> (initial scale of the overlay)\n");
fprintf(stderr, " -help (shows this help)\n");
fprintf(stderr, "\n");
fprintf(stderr, " Press ESC to exit, or SPACE to freeze the movie while application running.\n");
fprintf(stderr, "Press ESC to exit, or SPACE to freeze the movie while application running.\n");
fprintf(stderr, "\n");
}
@ -466,6 +468,11 @@ int main(int argc, char **argv)
free(RawMooseData);
overlay=SDL_CreateYUVOverlay(MOOSEPIC_W, MOOSEPIC_H, overlay_format, screen);
if (!overlay)
{
fprintf(stderr, "Couldn't create overlay: %s\n", SDL_GetError());
return 7;
}
printf("Created %dx%dx%d %s %s overlay\n",overlay->w,overlay->h,overlay->planes,
overlay->hw_overlay?"hardware":"software",

View file

@ -11,7 +11,9 @@
#define NUM_BLITS 10
#define NUM_UPDATES 500
#define FLAG_MASK (SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF)
#define FLAG_MASK (SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF | \
SDL_SRCCOLORKEY | SDL_SRCALPHA | SDL_RLEACCEL | \
SDL_RLEACCELOK)
void PrintFlags(Uint32 flags)
{
@ -30,9 +32,15 @@ void PrintFlags(Uint32 flags)
if ( flags & SDL_SRCCOLORKEY ) {
printf(" | SDL_SRCCOLORKEY");
}
if ( flags & SDL_SRCALPHA ) {
printf(" | SDL_SRCALPHA");
}
if ( flags & SDL_RLEACCEL ) {
printf(" | SDL_RLEACCEL");
}
if ( flags & SDL_RLEACCELOK ) {
printf(" | SDL_RLEACCELOK");
}
}
int RunBlitTests(SDL_Surface *screen, SDL_Surface *bmp, int blitcount)
@ -117,6 +125,10 @@ int RunModeTests(SDL_Surface *screen)
printf("%d fills and flips in zero seconds!n", frames);
}
/* clear the screen after fill test */
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
while ( SDL_PollEvent(&event) ) {
if ( event.type == SDL_KEYDOWN )
return 0;
@ -142,6 +154,15 @@ int RunModeTests(SDL_Surface *screen)
printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
}
/* clear the screen after blit test */
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
while ( SDL_PollEvent(&event) ) {
if ( event.type == SDL_KEYDOWN )
return 0;
}
/* run the colorkeyed blit test */
bmpcc = SDL_LoadBMP("sample.bmp");
if ( ! bmpcc ) {
@ -164,6 +185,15 @@ int RunModeTests(SDL_Surface *screen)
printf("%d cc blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
}
/* clear the screen after cc blit test */
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
while ( SDL_PollEvent(&event) ) {
if ( event.type == SDL_KEYDOWN )
return 0;
}
/* run the generic blit test */
tmp = bmp;
bmp = SDL_DisplayFormat(bmp);
@ -186,6 +216,15 @@ int RunModeTests(SDL_Surface *screen)
printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
}
/* clear the screen after blit test */
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
while ( SDL_PollEvent(&event) ) {
if ( event.type == SDL_KEYDOWN )
return 0;
}
/* run the colorkeyed blit test */
tmp = bmpcc;
bmpcc = SDL_DisplayFormat(bmpcc);
@ -208,6 +247,81 @@ int RunModeTests(SDL_Surface *screen)
printf("%d cc blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
}
/* clear the screen after cc blit test */
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
while ( SDL_PollEvent(&event) ) {
if ( event.type == SDL_KEYDOWN )
return 0;
}
/* run the alpha blit test only if screen bpp>8 */
if (bmp->format->BitsPerPixel>8)
{
SDL_FreeSurface(bmp);
bmp = SDL_LoadBMP("sample.bmp");
SDL_SetAlpha(bmp, SDL_SRCALPHA, 85); /* 85 - 33% alpha */
tmp = bmp;
bmp = SDL_DisplayFormat(bmp);
SDL_FreeSurface(tmp);
if ( ! bmp ) {
printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
return 0;
}
printf("Running display format alpha blit test: %dx%d at %d bpp, flags: ",
bmp->w, bmp->h, bmp->format->BitsPerPixel);
PrintFlags(bmp->flags);
printf("\n");
then = SDL_GetTicks();
frames = RunBlitTests(screen, bmp, NUM_BLITS);
now = SDL_GetTicks();
seconds = (float)(now - then) / 1000.0f;
if ( seconds > 0.0f ) {
printf("%d alpha blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
} else {
printf("%d alpha blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
}
}
/* clear the screen after alpha blit test */
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
while ( SDL_PollEvent(&event) ) {
if ( event.type == SDL_KEYDOWN )
return 0;
}
/* run the cc+alpha blit test only if screen bpp>8 */
if (bmp->format->BitsPerPixel>8)
{
SDL_FreeSurface(bmpcc);
bmpcc = SDL_LoadBMP("sample.bmp");
SDL_SetAlpha(bmpcc, SDL_SRCALPHA, 85); /* 85 - 33% alpha */
SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL, *(Uint8 *)bmpcc->pixels);
tmp = bmpcc;
bmpcc = SDL_DisplayFormat(bmpcc);
SDL_FreeSurface(tmp);
if ( ! bmpcc ) {
printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
return 0;
}
printf("Running display format cc+alpha blit test: %dx%d at %d bpp, flags: ",
bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
PrintFlags(bmpcc->flags);
printf("\n");
then = SDL_GetTicks();
frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
now = SDL_GetTicks();
seconds = (float)(now - then) / 1000.0f;
if ( seconds > 0.0f ) {
printf("%d cc+alpha blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
} else {
printf("%d cc+alpha blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
}
}
SDL_FreeSurface(bmpcc);
SDL_FreeSurface(bmp);