Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: probably problem with linux nvidia driver  (Read 6006 times)

0 Members and 1 Guest are viewing this topic.

sfora14

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
probably problem with linux nvidia driver
« on: August 27, 2013, 12:32:04 pm »
Hello i have problem with sprite movement which is imho connected with poor nvidia support for linux. When im moving sprite in any direction it looks like every few seconds sprite moves a bit faster and then it moves normally and then again bit faster. It seems like redrawing few frames is skipped. Additionally at the top of screen some tearing can be seen.

In windows any of that issues are not existant. I tried "windows.setFramelimit" and changing position of sprite accordingly to time elapsed in previous frame. Tried also syncing to vblank and moving with constant speed. None of this works. Its additionally a bit strange that when i check time elapsed in previous frame they are almost identical to each other but sprite still moves not smooth.

Im posting to ask other linux users if they have simmillar issues and maybe they solved it somehow. I tried with Ubuntu 12.04,12.10,13.04 and nouveau drivers and closed nvidia drivers. Now im trying with Manjaro linux with compton compositor and nvidia drivers version 325.15.1 its maybe a bit better but still issue is visible.

I cant believe that with all that recent buzz about linux gaming (steam, humble bundle etc.) there are still such stupid, unsolved  problems . To sum it up here is a question:

Is anybody have simmilar problem with stuttering sprite and is anybody solved it ?

fatum

  • Newbie
  • *
  • Posts: 47
    • MSN Messenger - bowsers7@hotmail.com
    • AOL Instant Messenger - therealblah569
    • View Profile
    • http://boards.psynetfm.com
Re: probably problem with linux nvidia driver
« Reply #1 on: August 31, 2013, 02:24:50 am »
I'm using Arch with the stable nvidia package (325.15) with KDE, and honestly I get better results whenever I test my game on GNU/Linux than I do whenever I test it on Windows with the same hardware, and I hardly ever use my Windows partition either.  It's smooth on both platforms, but I notice occasionally every so often that it skips a little bit on Windows.  Strange.

Are you using a fixed time step for updating your physics and interpolation for drawing sprites on the screen?  That can make a big difference.

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: probably problem with linux nvidia driver
« Reply #2 on: August 31, 2013, 08:31:40 pm »
I know exactly what you mean. Even though I'm on a Mobility Radeon HD 3650, I always get these "jerks" as I call them. I never managed to get rid of them besides rendering at ridiculously high frame rates.
The vsync implementation in my driver is also broken, it uses a spinlock instead of properly sleeping until vblank (you can see the system load going towards 50% (one full core) with vsync as compared to ~4% without).

sfora14

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: probably problem with linux nvidia driver
« Reply #3 on: August 31, 2013, 10:42:47 pm »
I'm using Arch with the stable nvidia package (325.15) with KDE,

im not sure but it may have something to do not only with used drivers but also used composition manager. Im not any Linux guru, 99% of my knowledge comes form reading forums etc. but there is no much about simmillar issue. To tell the truth there is so little that im even not sure which keywords type in google :) 


Are you using a fixed time step for updating your physics and interpolation for drawing sprites on the screen?  That can make a big difference.
I think that when im limmiting framerate or waiting for sync to vblank and testing on computer with much higher framerate ability than limit is set it is equal to fixed timestep. Code responsible for moving my sprite is:
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
        {
            pozycja=sprite.getPosition();
            rotacja=sprite.getRotation();
            zapieprzaj.x=sin(rotacja*PI/180);
            zapieprzaj.y=-cos(rotacja*PI/180);
            sprite.setPosition(pozycja+zapieprzaj*300.0f*deltat);
        }
where deltat is timespan of previous frame.

sfora14

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: probably problem with linux nvidia driver
« Reply #4 on: August 31, 2013, 10:50:03 pm »
I know exactly what you mean. Even though I'm on a Mobility Radeon HD 3650, I always get these "jerks" as I call them. I never managed to get rid of them besides rendering at ridiculously high frame rates.
The vsync implementation in my driver is also broken, it uses a spinlock instead of properly sleeping until vblank (you can see the system load going towards 50% (one full core) with vsync as compared to ~4% without).

I thought that this is only nvidia cards issue, soon ill install linux on laptop with radeon and then ill post if problem still exists. Strange that so few people have simmillar problems. I tested today on my sons if they also see those "jerks", they both saw them so luckily this is not mine personal issue :) If you know any good "fraps" like application for linux i may try to capture short video and if problem will be visible ill post link here. Maybe mine description of that problem is not clear enough  and people dont really know what we are talking about

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: probably problem with linux nvidia driver
« Reply #5 on: September 01, 2013, 09:33:58 am »
You could try recording an area of your screen using ffmpeg, with eg.:

Code: [Select]
ffmpeg -f x11grab -r 40 -s 800x600 -i :0.0+0,0 output.mkv
Although if your GPU is already weak, the video will lag no matter what, so I'm not sure screen recording is the way to go here..

By the way, have you tried running your application with everything else on your desktop closed? I have found that the jerking goes down a bit when there's not as much load on the GPU.

sfora14

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: probably problem with linux nvidia driver
« Reply #6 on: September 01, 2013, 10:28:51 am »
I tried with ffmpeg, i got around 30fps but the issue was not really visible. Ill try again and limit my app framerate to 30 also. I doubt if my card is a reason i have gtx275 , it should be enough for moving 1 sprite across screen smoothly .

fatum

  • Newbie
  • *
  • Posts: 47
    • MSN Messenger - bowsers7@hotmail.com
    • AOL Instant Messenger - therealblah569
    • View Profile
    • http://boards.psynetfm.com
Re: probably problem with linux nvidia driver
« Reply #7 on: September 01, 2013, 06:23:53 pm »
I went a little overboard creating an example to see how well this works for you:
https://github.com/fatumlegion/smooth-movement-test

You can also use the various command line flags to test various settings.  By default, the program limits the FPS to 60 frames per second.  However, you can use --force-fps off, --force-fps x, and --enable-vsync to test how various setups might effect you.

If it still doesn't work work as expected, then it's either an issue with your compositor, your nvidia card doesn't work well with the newest driver, or my example is broken.

I'm using an nVidia GeForce GTS 450 graphics card with the 325.15 driver.  Here's my configuration:


You could also try turning off the "Sync to VBlank" setting in the nvidia control panel, but this might cause tearing if your compositor doesn't automatically turn on vsync for you.

Let me know!

sfora14

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: probably problem with linux nvidia driver
« Reply #8 on: September 02, 2013, 11:15:38 am »
Let me know!

I tried to compile your app but there are some errors, to be exact:
/home/kuba/cpp/smooth-movement-test-master/src/Application.cpp: In member function ‘void Application::popWorld()’:
/home/kuba/cpp/smooth-movement-test-master/src/Application.cpp:45:21: error: ‘cont_worlds’ was not declared in this scope

and another one also with `cont_worlds' not declared in this scope. I tried to correct it on my own but failed miserably. Ill try to compile it in evening but i doubt if ill manage without your help. Anyway i really appreciate your help.

regards Kuba

fatum

  • Newbie
  • *
  • Posts: 47
    • MSN Messenger - bowsers7@hotmail.com
    • AOL Instant Messenger - therealblah569
    • View Profile
    • http://boards.psynetfm.com
Re: probably problem with linux nvidia driver
« Reply #9 on: September 02, 2013, 05:27:35 pm »
I tried to compile your app but there are some errors, to be exact:
/home/kuba/cpp/smooth-movement-test-master/src/Application.cpp: In member function ‘void Application::popWorld()’:
/home/kuba/cpp/smooth-movement-test-master/src/Application.cpp:45:21: error: ‘cont_worlds’ was not declared in this scope

Ah, sorry about that!  I can't believe I didn't notice that as I thought that I was able to successfully compile the complete example before pushing the source code.

Change all occurrences of "cont_worlds" to just "world" in Application.hpp and Application.cpp to hopefully resolve the build errors.

sfora14

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: probably problem with linux nvidia driver
« Reply #10 on: September 02, 2013, 09:51:24 pm »
Managed to compile it, there was also some problem with world being * to GameWorld and world being name of stack but after resolving it everything was fine.

After few tests i can say that i still see some stutering. No matter what i do, curious thing is that when i limit framerate to 50 stuttering is much worse than at 60fps, if i use enable-vsync option it becomes better but at both framerates it is still visible.  It seems that best result i have with framerate limited to 60 and vsync on.

There are not too many options left for me it seems, i may install some old drivers and try or maybe install kde, i red some time ago about composition manager being a cause of screen tearing and KDE is only major GUI that left for me.

Really thank you for your effort, it had also some educational aspect for me to see your coding style, seems a bit complicated first but after some time i can say that it is pretty elegant :)

Anyway if any other people using linux  have/not have simmillar issues i would be really grateful if they post in this topic with graphis card,drivers and GUI used if possible.