PDA

View Full Version : No access to hardware surface with SDL


taxtropel
11-20-02, 12:25 PM
:confused:

I've got this problem, and I've had it for a while (actually 2 problems, but I think they are related)
The first is with SDL, and yes I've already asked over at #sdl on openprojects.net.

I've go a Gforce4 MX 440, and the drivers seem to be installed right (they are in the right place, I can run and compile GL/GLx programs), however cannot seem to get a hardware surface or hardware accelerated drawing.

Here is what SDL reports as being available:

Flag: Hardare Surface Available: hw_available = 0
Flag: Window Manager Available: wm_available = 1with antialiasing turned on everything is super slow (even the most basic AA)with antialiasing turned on everything is super slow (even the most basic AA)
Flag: Accelerated Hardware Blits: blit_hw = 0
Flag: Accelerated Hardware Blits with Colorkey: blit_hw_CC = 0
Flag: Accelerated Hardware Blits with Alpha: blit_hw_A = 0
Flag: Accelerated Software Blits: blit_sw = 0
Flag: Accelerated Software Blits with Colorkey: blit_sw_CC = 0
Flag: Accelerated Software Blits with Alpha: blit_sw_A = 0
Flag: Accelerated color fill: blit_fill = 0
Video Memory: video_mem = 0K (but I've got 64mb of ddr)

Here's the code that provides the above information:


/* This code falls under the GPL v2.0 */
/* (C) 2002 Aristoi Daneel */
/* aristoidaneel<ANTI-SPAM>@yahoo.com */
/* remove <ANTI-SPAM> */
/* NO WARRANTY */
/* builds nicely with :
* gcc -o SDL_videoInfo SDL_videoInfo.c -ggdb -Wall `sdl-config --cflags --libs` */

#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>

#define THE_MEANING_OF_LIFE 42


void Quit(int returnCode)
{

SDL_Quit();
if(returnCode != THE_MEANING_OF_LIFE)
exit(returnCode);
fprintf(stdout,"I have been given the Meaning of Life\n");
}


int main(int argc, char *argv[])
{

const SDL_VideoInfo *videoInfo;
SDL_Surface *frameBuffer;

/* initialize SDL
* exit on error */
if(SDL_Init(SDL_INIT_VIDEO) != 0)
{
fprintf(stderr, "Video Initialization failed:\n\t%s\n",
SDL_GetError());
fprintf(stderr,"Dying...AARRGGHH!...\n");
Quit(1);
}

if((frameBuffer = SDL_SetVideoMode(640,480, 0, SDL_ANYFORMAT)) == NULL)
{
fprintf(stderr,"Unable to set video mode: %s\n",SDL_GetError());
Quit(1);
}

/* Grab video info according to SDL */
/* Exit on error */
if(!(videoInfo = SDL_GetVideoInfo()))
{
fprintf(stderr,"Video query failed:\n\t%s\n",
SDL_GetError());
fprintf(stderr,"Dying...AARRGGHH!...\n");
Quit(1);
}

fprintf(stdout, "Flag: Hardare Surface Available: hw_available = %d\n", videoInfo->hw_available);
fprintf(stdout, "Flag: Window Manager Available: wm_available = %d\n", videoInfo->wm_available);
fprintf(stdout, "Flag: Accelerated Hardware Blits: blit_hw = %d\n", videoInfo->blit_hw);
fprintf(stdout, "Flag: Accelerated Hardware Blits with Colorkey: blit_hw_CC = %d\n", videoInfo->blit_hw_CC);
fprintf(stdout, "Flag: Accelerated Hardware Blits with Alpha: blit_hw_A = %d\n", videoInfo->blit_hw_A);
fprintf(stdout, "Flag: Accelerated Software Blits: blit_sw = %d\n", videoInfo->blit_sw);
fprintf(stdout, "Flag: Accelerated Software Blits with Colorkey: blit_sw_CC = %d\n", videoInfo->blit_sw_CC);
fprintf(stdout, "Flag: Accelerated Software Blits with Alpha: blit_sw_A = %d\n", videoInfo->blit_sw_A);
fprintf(stdout, "Flag: Accelerated color fill: blit_fill = %d\n", videoInfo->blit_fill);
fprintf(stdout, "Video Memory: video_mem = %dK\n", videoInfo->video_mem);

/* now try to force the issue */
if((frameBuffer = SDL_SetVideoMode(640,480,0, SDL_HWSURFACE | SDL_HWPALETTE | SDL_HWACCEL)) == NULL)
{
fprintf(stderr,"Unable to set video mode: %s\n",SDL_GetError());
Quit(1);
}

/* Grab video info according to SDL */
/* Exit on error */
if(!(videoInfo = SDL_GetVideoInfo()))
{
fprintf(stderr,"Video query failed:\n\t%s\n",
SDL_GetError());
fprintf(stderr,"Dying...AARRGGHH!...\n");
Quit(1);
}

frpintf(stdout, "\n\n Attempt to set HW video results:\n");
fprintf(stdout, "Flag: Hardare Surface Available: hw_available = %d\n", videoInfo->hw_available);
fprintf(stdout, "Flag: Window Manager Available: wm_available = %d\n", videoInfo->wm_available);
fprintf(stdout, "Flag: Accelerated Hardware Blits: blit_hw = %d\n", videoInfo->blit_hw);
fprintf(stdout, "Flag: Accelerated Hardware Blits with Colorkey: blit_hw_CC = %d\n", videoInfo->blit_hw_CC);
fprintf(stdout, "Flag: Accelerated Hardware Blits with Alpha: blit_hw_A = %d\n", videoInfo->blit_hw_A);
fprintf(stdout, "Flag: Accelerated Software Blits: blit_sw = %d\n", videoInfo->blit_sw);
fprintf(stdout, "Flag: Accelerated Software Blits with Colorkey: blit_sw_CC = %d\n", videoInfo->blit_sw_CC);
fprintf(stdout, "Flag: Accelerated Software Blits with Alpha: blit_sw_A = %d\n", videoInfo->blit_sw_A);
fprintf(stdout, "Flag: Accelerated color fill: blit_fill = %d\n", videoInfo->blit_fill);
fprintf(stdout, "Video Memory: video_mem = %dK\n", videoInfo->video_mem);

Quit(THE_MEANING_OF_LIFE); /* exit gracefully */
return 0;
}


and here is my XF86config stuff


Section "Module"
SubSection "extmod"
EndSubSection
Load "glx"
Load "type1"
Load "freetype"
EndSection


Section "Device"
Identifier "MyVideoCard"
Driver "nvidia"
Option "NvAGP" "1"
Option "NoLogo" "1"
Option "DigitalVibrance" "0"
Option "CursorShadow" "1"
EndSection



** SYSTEM INFO **
all the DRI and DRM stuff in the kernel is off

here's some other stuff

NVdriver 3123 (GLX too)
kernel: 2.4.19 (compiled from source)
XFree86: 4.2.0 (precompiled binary)
gcc: 2.59.3
libSDL: 1.2.3 - 1.2.5

he hardware is:
AMD Athlon 1700
256MB DDR
MSI nForce mainboard
AGP 4x Chaintech Gforce4 mx 440 64MB DDR


** END SYSTEM INFO **

second problem: (related i think)
X starts sooo slow.
Between when I run startx to the nvidia logo screen is a time of about 50 sec

my XFree86.0.log is attached as a texfile

And these problems started showing up as soon as my nVidia card was installed (with the drivers) and not before with my old video card (ATI rage 128)

Note that X works just fine otherwise, the only other graphical problem i can find is blender runs really really slow
both precompiled blender publisher and open source version compiled on my system blender creator

WineX runs peachy for the most part, and my loki games seem to run well, although Descent3 (loki port) runs at a measly 35fps

but all the OpenGL stuff for xscreensaver run keen. (compiled on my system)

any ideas anybody?

Thanks for reading this and helping out.
confused geek
Aristoi Daneel
aristoidaneel<ANTI-SPAM>@yahoo.com

taxtropel
11-20-02, 12:28 PM
Ok, well, here is the log file (i hope)

bwkaz
11-20-02, 12:35 PM
My machine reports the same thing about no SDL hardware surfaces, and I don't know why. It doesn't bother me, though, as I get great performance on everything I've thrown at it (GF4 Ti4200).

There are a lot of people with the delay at X startup with the MX series cards. I believe one solution was to remove any resolutions you won't be using from your Modes line in XF86Config(-4), as the problem was that the card's BIOS was validating each and every mode. You might also try to replace the VertRefresh range with whatever refresh rate you want, to see if that cuts out the testing of extraneous refresh rates.

I can't find that thread anymore, though, so I don't remember if there are any other solutions... :(

taxtropel
11-20-02, 02:25 PM
Well, I tried to remove resolutions in my modes section, but to no avail.
Same super slow startup for X.:(