Jump to content
  • Advertisement
Sign in to follow this  

SDL_GetVideoInfo returning incorrect information?

This topic is 4816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
That's odd. It worked for me:

Video Driver Name: directx
Hardware Surfaces: 1
WM Available: 1
HW Blits: 1
HW Colorkey Blits: 1
HW Alpha Blits: 0
SW to HW Blits: 1
SW to HW Colorkey Blits: 1
SW to HW Alpha Blits: 0
Color Fills: 1
Video 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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!