SDL_GetVideoInfo returning incorrect information?

Started by
4 comments, last by Alan Kemp 19 years, 1 month ago
I'm just starting with SDL, and I appear to have hit a little snag already. The information returned by SDL_GetVideoInfo would have me believe my video card has no capabilities, but I'm fairly sure that is not the case (it's a GeForce Ti4400). I'm running Gentoo Linux, if that helps. Here's the entirety of the test program I'm using, and the output it generates:

#include <iostream>
#include <stdlib.h>
#include "SDL.h"

using namespace std;

int main(int argc, char *argv[])
{
  	if(SDL_Init(SDL_INIT_VIDEO)< 0) {
    		cout <<"Could not initialize SDL:" << SDL_GetError() << endl;
       		SDL_Quit();
		return 0;
	}
	
	const SDL_VideoInfo *vidinfo = SDL_GetVideoInfo();
	
	char drivername[255];
	SDL_VideoDriverName(drivername,255);
		
	cout << "Video Driver Name: " << drivername << endl;
	cout << "Hardware Surfaces: " << vidinfo->hw_available << endl;
	cout << "WM Available: " << vidinfo->wm_available << endl;
	cout << "HW Blits: " << vidinfo->blit_hw << endl;
	cout << "HW Colorkey Blits: " << vidinfo->blit_hw_CC << endl;
	cout << "HW Alpha Blits: " << vidinfo->blit_hw_A << endl;
	cout << "SW to HW Blits: " << vidinfo->blit_sw << endl;
	cout << "SW to HW Colorkey Blits: " << vidinfo->blit_sw_CC << endl;
	cout << "SW to HW Alpha Blits: " << vidinfo->blit_sw_A << endl;
	cout << "Color Fills: " << vidinfo->blit_fill << endl;
	cout << "Video Mem: " << vidinfo->video_mem << " kb" << endl;	
	
  	SDL_Quit();	
	return 0;
}


syph3r@tux src $ ./sdltest
Video Driver Name: x11
Hardware Surfaces: 0
WM Available: 1
HW Blits: 0
HW Colorkey Blits: 0
HW Alpha Blits: 0
SW to HW Blits: 0
SW to HW Colorkey Blits: 0
SW to HW Alpha Blits: 0
Color Fills: 0
Video Mem: 0 kb
Advertisement
Do you have the latest nVidia drivers installed? The device info is only as accurate as what the drivers tell it, so if you are running off the cd generic drivers I would expect pretty much exactly what you are getting.

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
I am using the latest nvidia drivers, and have specified 'Driver "nvidia"' in my xorg.conf file.
That's odd. It worked for me:
Video Driver Name: directxHardware Surfaces: 1WM Available: 1HW Blits: 1HW Colorkey Blits: 1HW Alpha Blits: 0SW to HW Blits: 1SW to HW Colorkey Blits: 1SW to HW Alpha Blits: 0Color Fills: 1Video Mem: 125824 kb


I have a 128MB ATI Radeon 9600 Pro. However, I am running Windows XP. Is there anyway for you to run that in Windows and see if you get different results?
I think I've figured out the problem, it seems to be Linux specific. According to http://www.libsdl.org/pipermail/sdl/2000-November/031339.html, SDL doesn't appear to do use any hardware acceleration unless you use the DGA driver by setting the environment variable SDL_VIDEODRIVER=dga.
SDL defaults to using the x11 backend, when what you probably want to try is dga. Either export an environment variable called SDL_VIDEODRIVER set to dga, or put this in your code (before SDL_Init):

putenv("SDL_VIDEODRIVER=dga");


Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour

This topic is closed to new replies.

Advertisement