test/testvidinfo.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 06 Mar 2003 06:22:33 +0000
changeset 607 f8710950cddc
parent 524 1b8ea19e9ee4
child 821 30168104389f
permissions -rw-r--r--
Date: Sat, 1 Mar 2003 16:13:57 -0500 From: Wilbern Cobb Subject: OpenBSD/sparc64 video init fix This patch fixes remote X sessions on OpenBSD/sparc64.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     2
/* Simple program -- figure out what kind of video display we have */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     3
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
     4
#include <stdlib.h>
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     5
#include <stdio.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     6
#include <stdlib.h>
524
1b8ea19e9ee4 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 483
diff changeset
     7
#include <string.h>
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     8
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     9
#include "SDL.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    10
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    11
#define NUM_BLITS	10
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    12
#define NUM_UPDATES	500
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    13
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    14
#define FLAG_MASK	(SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF)
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    15
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    16
void PrintFlags(Uint32 flags)
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    17
{
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    18
	printf("0x%8.8x", (flags & FLAG_MASK));
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    19
	if ( flags & SDL_HWSURFACE ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    20
		printf(" SDL_HWSURFACE");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    21
	} else {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    22
		printf(" SDL_SWSURFACE");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    23
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    24
	if ( flags & SDL_FULLSCREEN ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    25
		printf(" | SDL_FULLSCREEN");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    26
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    27
	if ( flags & SDL_DOUBLEBUF ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    28
		printf(" | SDL_DOUBLEBUF");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    29
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    30
}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    31
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    32
int RunBlitTests(SDL_Surface *screen, SDL_Surface *bmp, int blitcount)
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    33
{
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    34
	int i, j;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    35
	int maxx;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    36
	int maxy;
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    37
	SDL_Rect dst;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    38
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    39
	maxx = (int)screen->w - bmp->w + 1;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    40
	maxy = (int)screen->h - bmp->h + 1;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    41
	for ( i = 0; i < NUM_UPDATES; ++i ) {
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    42
		for ( j = 0; j < blitcount; ++j ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    43
			if ( maxx ) {
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    44
				dst.x = rand() % maxx;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    45
			} else {
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    46
				dst.x = 0;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    47
			}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    48
			if ( maxy ) {
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    49
				dst.y = rand() % maxy;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    50
			} else {
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    51
				dst.y = 0;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    52
			}
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    53
			dst.w = bmp->w;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    54
			dst.h = bmp->h;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    55
			SDL_BlitSurface(bmp, NULL, screen, &dst);
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    56
		}
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    57
		SDL_Flip(screen);
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    58
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    59
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    60
	return i;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    61
}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    62
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    63
int RunModeTests(SDL_Surface *screen)
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    64
{
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    65
	Uint32 then, now;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    66
	Uint32 frames;
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    67
	float seconds;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    68
	int i;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    69
	Uint8 r, g, b;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    70
	SDL_Surface *bmp, *tmp;
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    71
	SDL_Event event;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    72
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    73
	while ( SDL_PollEvent(&event) ) {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    74
		if ( event.type == SDL_KEYDOWN )
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    75
			return 0;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
    76
	}
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    77
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    78
	/* First test fills and screen update speed */
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    79
	printf("Running color fill and fullscreen update test\n");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    80
	then = SDL_GetTicks();
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    81
	frames = 0;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    82
	for ( i = 0; i < 256; ++i ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    83
		r = i;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    84
		g = 0;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    85
		b = 0;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    86
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    87
		SDL_Flip(screen);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    88
		++frames;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    89
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    90
	for ( i = 0; i < 256; ++i ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    91
		r = 0;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    92
		g = i;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    93
		b = 0;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    94
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    95
		SDL_Flip(screen);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    96
		++frames;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    97
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    98
	for ( i = 0; i < 256; ++i ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
    99
		r = 0;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   100
		g = 0;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   101
		b = i;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   102
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   103
		SDL_Flip(screen);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   104
		++frames;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   105
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   106
	now = SDL_GetTicks();
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   107
	seconds = (float)(now - then) / 1000.0f;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   108
	if ( seconds > 0.0f ) {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   109
		printf("%d fills and flips in %2.2f seconds, %2.2f FPS\n", frames, seconds, (float)frames / seconds);
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   110
	} else {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   111
		printf("%d fills and flips in zero seconds!n", frames);
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   112
	}
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   113
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   114
	while ( SDL_PollEvent(&event) ) {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   115
		if ( event.type == SDL_KEYDOWN )
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   116
			return 0;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   117
	}
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   118
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   119
	bmp = SDL_LoadBMP("sample.bmp");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   120
	if ( ! bmp ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   121
		printf("Couldn't load sample.bmp: %s\n", SDL_GetError());
482
6417071ba2e5 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 480
diff changeset
   122
		return 0;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   123
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   124
	printf("Running freshly loaded blit test: %dx%d at %d bpp, flags: ",
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   125
		bmp->w, bmp->h, bmp->format->BitsPerPixel);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   126
	PrintFlags(bmp->flags);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   127
	printf("\n");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   128
	then = SDL_GetTicks();
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   129
	frames = RunBlitTests(screen, bmp, NUM_BLITS);
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   130
	now = SDL_GetTicks();
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   131
	seconds = (float)(now - then) / 1000.0f;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   132
	if ( seconds > 0.0f ) {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   133
		printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   134
	} else {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   135
		printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   136
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   137
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   138
	tmp = bmp;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   139
	bmp = SDL_DisplayFormat(bmp);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   140
	SDL_FreeSurface(tmp);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   141
	if ( ! bmp ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   142
		printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
482
6417071ba2e5 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 480
diff changeset
   143
		return 0;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   144
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   145
	printf("Running display format blit test: %dx%d at %d bpp, flags: ",
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   146
		bmp->w, bmp->h, bmp->format->BitsPerPixel);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   147
	PrintFlags(bmp->flags);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   148
	printf("\n");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   149
	then = SDL_GetTicks();
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   150
	frames = RunBlitTests(screen, bmp, NUM_BLITS);
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   151
	now = SDL_GetTicks();
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   152
	seconds = (float)(now - then) / 1000.0f;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   153
	if ( seconds > 0.0f ) {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   154
		printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   155
	} else {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   156
		printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   157
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   158
	SDL_FreeSurface(bmp);
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   159
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   160
	while ( SDL_PollEvent(&event) ) {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   161
		if ( event.type == SDL_KEYDOWN )
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   162
			return 0;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   163
	}
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   164
	return 1;
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   165
}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   166
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   167
void RunVideoTests()
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   168
{
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   169
	static const struct {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   170
		int w, h, bpp;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   171
	} mode_list[] = {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   172
		{ 640, 480, 8 }, { 640, 480, 16 }, { 640, 480, 32 },
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   173
		{ 800, 600, 8 }, { 800, 600, 16 }, { 800, 600, 32 },
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   174
		{ 1024, 768, 8 }, { 1024, 768, 16 }, { 1024, 768, 32 }
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   175
	};
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   176
	static const Uint32 flags[] = {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   177
		(SDL_SWSURFACE),
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   178
		(SDL_SWSURFACE | SDL_FULLSCREEN),
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   179
		(SDL_HWSURFACE | SDL_FULLSCREEN),
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   180
		(SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF)
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   181
	};
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   182
	int i, j;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   183
	SDL_Surface *screen;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   184
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   185
	/* Test out several different video mode combinations */
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   186
	SDL_WM_SetCaption("SDL Video Benchmark", "vidtest");
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   187
	SDL_ShowCursor(0);
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   188
	for ( i = 0; i < SDL_TABLESIZE(mode_list); ++i ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   189
		for ( j = 0; j < SDL_TABLESIZE(flags); ++j ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   190
			printf("===================================\n");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   191
			printf("Setting video mode: %dx%d at %d bpp, flags: ",
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   192
			                          mode_list[i].w,
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   193
			                          mode_list[i].h,
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   194
			                          mode_list[i].bpp);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   195
			PrintFlags(flags[j]);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   196
			printf("\n");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   197
			screen = SDL_SetVideoMode(mode_list[i].w,
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   198
			                          mode_list[i].h,
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   199
			                          mode_list[i].bpp,
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   200
			                          flags[j]);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   201
			if ( ! screen ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   202
				printf("Setting video mode failed: %s\n", SDL_GetError());
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   203
				continue;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   204
			}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   205
			if ( (screen->flags & FLAG_MASK) != flags[j] ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   206
				printf("Flags didn't match: ");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   207
				PrintFlags(screen->flags);
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   208
				printf("\n");
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   209
				continue;
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   210
			}
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   211
			if ( ! RunModeTests(screen) ) {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   212
				return;
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   213
			}
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   214
		}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   215
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   216
}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   217
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   218
int main(int argc, char *argv[])
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   219
{
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   220
	const SDL_VideoInfo *info;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   221
	int i;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   222
	SDL_Rect **modes;
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   223
	char driver[128];
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   224
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   225
	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   226
		fprintf(stderr,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   227
			"Couldn't initialize SDL: %s\n", SDL_GetError());
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   228
		exit(1);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   229
	}
480
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   230
	if ( SDL_VideoDriverName(driver, sizeof(driver)) ) {
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   231
		printf("Video driver: %s\n", driver);
92596bfe8446 Fixed some bugs and added some features to the -benchmark facility
Sam Lantinga <slouken@libsdl.org>
parents: 479
diff changeset
   232
	}
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   233
	info = SDL_GetVideoInfo();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   234
	printf(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   235
"Current display: %d bits-per-pixel\n",info->vfmt->BitsPerPixel);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   236
	if ( info->vfmt->palette == NULL ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   237
		printf("	Red Mask = 0x%.8x\n", info->vfmt->Rmask);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   238
		printf("	Green Mask = 0x%.8x\n", info->vfmt->Gmask);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   239
		printf("	Blue Mask = 0x%.8x\n", info->vfmt->Bmask);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   240
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   241
	/* Print available fullscreen video modes */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   242
	modes = SDL_ListModes(NULL, SDL_FULLSCREEN);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   243
	if ( modes == (SDL_Rect **)0 ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   244
		printf("No available fullscreen video modes\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   245
	} else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   246
	if ( modes == (SDL_Rect **)-1 ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   247
		printf("No special fullscreen video modes\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   248
	} else {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   249
		printf("Fullscreen video modes:\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   250
		for ( i=0; modes[i]; ++i ) {
266
c6abdda2f666 Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents: 0
diff changeset
   251
			printf("\t%dx%dx%d\n", modes[i]->w, modes[i]->h, info->vfmt->BitsPerPixel);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   252
		}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   253
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   254
	if ( info->wm_available ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   255
		printf("A window manager is available\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   256
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   257
	if ( info->hw_available ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   258
		printf("Hardware surfaces are available (%dK video memory)\n",
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   259
			info->video_mem);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   260
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   261
	if ( info->blit_hw ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   262
		printf(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   263
"Copy blits between hardware surfaces are accelerated\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   264
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   265
	if ( info->blit_hw_CC ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   266
		printf(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   267
"Colorkey blits between hardware surfaces are accelerated\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   268
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   269
	if ( info->blit_hw_A ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   270
		printf(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   271
"Alpha blits between hardware surfaces are accelerated\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   272
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   273
	if ( info->blit_sw ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   274
		printf(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   275
"Copy blits from software surfaces to hardware surfaces are accelerated\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   276
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   277
	if ( info->blit_sw_CC ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   278
		printf(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   279
"Colorkey blits from software surfaces to hardware surfaces are accelerated\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   280
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   281
	if ( info->blit_sw_A ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   282
		printf(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   283
"Alpha blits from software surfaces to hardware surfaces are accelerated\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   284
	}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   285
	if ( info->blit_fill ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   286
		printf(
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   287
"Color fills on hardware surfaces are accelerated\n");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   288
	}
479
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   289
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   290
	if ( argv[1] && (strcmp(argv[1], "-benchmark") == 0) ) {
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   291
		RunVideoTests();
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   292
	}
c0a1744bc2cf Added a -benchmark flag for testing the speeds of various video modes
Sam Lantinga <slouken@libsdl.org>
parents: 266
diff changeset
   293
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   294
	SDL_Quit();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   295
	return(0);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   296
}