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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ioCx

Pages: [1]
1
Window / Re: Slow Event Polling (Linux x64)
« on: August 02, 2013, 11:49:45 am »
Among GLFW, SDL, and SFML, they all seem to detect the correct amount of actual joysticks; with my accelerometer /dev/input/js0, 0 joysticks are reported by all three. When I plug in an actual joystick they all report one joystick. It seems to be just SFML that ends up slowing down when /dev/input/js0 is the accelerometer.

Thanks for your concern.

2
Window / Re: Slow Event Polling (Linux x64)
« on: August 02, 2013, 10:34:32 am »
Yeah, I'm still running into the same problem on SFML 2.1.

It looks like the detected "joystick" at /dev/input/js0 is actually an accelerometer. :

cat /proc/bus/input/devices
...
I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Acer BMA150 accelerometer"
P: Phys=wmi/input1
S: Sysfs=/devices/virtual/input/input7
U: Uniq=
H: Handlers=event7 js0
B: PROP=0
B: EV=9
B: ABS=7
...

I can't access it:

# cat js0
cat: js0: Operation not permitted
 

I'm not exactly sure what to do from here.

EDIT: So I found a thread somewhere that said I should just rm js0, and it ended up working fine. Before I was just unloading the joydev whenever I was going to work on an sfml project. I don't know, simply removing something from /dev/ just seems wrong to me (not to mention it won't be persistent), if anyone knows of a better solution, let me know.

3
Window / Re: Slow Event Polling (Linux x64)
« on: July 26, 2013, 06:07:33 am »
Alright, I updated my kernel back to 3.10.2, and the extreme slowdown returned. I'm not too sure what changed between 3.9.9 and this version but it got much worse. Netrick, what version of the Linux kernel are you using?

Good news is that I made a very silly mistake earlier; I recompiled the library but I kept the sfml libraries from my package manager installed, so when I ran executables, it would use the .so files from that instead of the newly compiled ones. The solution from the link in the OP (http://en.sfml-dev.org/forums/index.php?topic=6079.0) worked. It's a little bit strange that I encountered the same problem as they did even though they used Windows.

I commented out the body of "processJoystickEvents" in SFML/Window/WindowImpl.hpp, recompiled, and linked an example executable to the libraries in the lib folder and everything ran great.

Looking back at that old thread, was there a proper solution for their problem?

4
Window / Re: Slow Event Polling (Linux x64)
« on: July 18, 2013, 05:58:16 am »
SFML 2.0. I had the same problem with both the version from the package manager as well as the version I compiled from the source code on the SFML website.

Fake Edit: I just cloned the SFML repository from github and compiled, same issue.

The minor slowdown I've been getting from keyboard events is probably negligable. And the USB mouse issue is probably because the mouse reports at a much higher rate and at a higher dpi than the laptop touchpad which makes it send a million more mouse movement events.

This is the code I've been using to test this out:

#include <SFML/Window.hpp>
#include <cstdio>

void calculate(sf::Time elapsedTime, sf::Time& updateTime, std::size_t& frameCount)
{
    updateTime += elapsedTime;
    frameCount += 1;

    if (updateTime >= sf::seconds(1.0f))
    {
        printf("fps: %d\n dt: %d\n", frameCount, updateTime.asMicroseconds() / frameCount);
        updateTime -= sf::seconds(1.0f);
        frameCount = 0;
    }
}

int main()
{
    // Create the main window
    sf::Window window(sf::VideoMode(640, 480, 32), "SFML Window", sf::Style::Close);
    window.setFramerateLimit(60);
    window.setKeyRepeatEnabled(true);

    std::size_t frameCount = 0;
    sf::Time updateTime = sf::Time::Zero;
    sf::Clock frameClock;

    // Start the game loop
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close window : exit
            if (event.type == sf::Event::Closed)
                window.close();

            // Escape key : exit
            if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))
                window.close();
        }

        calculate(frameClock.restart(), updateTime, frameCount);

        // Finally, display the rendered frame on screen
        window.display();
    }

    return EXIT_SUCCESS;
}
 

I think I get an average of 30 frames per second when I just made circles with my mouse on the empty window as opposed to 60 frames per second when idling.

Another thing to note is that I solved my initial issue by downgrading my kernel and switching from a kernel with the ck patchset to a more vanilla kernel (in one step). I guess that might be something to look into also. I was getting idling at 20 frames per second and it would instantly drop down to <5 if I sent any event to the window. I'm aware that I changed two variables there; I'm not completely sure whether it was the new kernel version or the ck-patchset that caused the problem the first time around.

5
Window / Slow Event Polling (Linux x64)
« on: July 18, 2013, 02:37:51 am »
When I run the example programs provided with the SFML source code (notably "window"), SFML slows to a crawl and gets even slower when I give it events by hitting keys or moving my mouse inside the window. The problem disappears when I completely comment out the event handling loop.

I tried following the advice here: http://en.sfml-dev.org/forums/index.php?topic=6079.0
They had a similar problem to mine, but their issue is from two years ago and the solution provided did not work for me now.

I'm running Arch Linux (x86_64) kernel 3.10.1-2.

EDIT: I downgraded my kernel and it looks like it runs fine, except when I use a USB mouse over the window. My laptop's touchpad mouse doesn't seem to affect the event handling speed. I also experience minor slowdown if I hold down a key with setKeyRepeatEnabled(true) or if I move my laptop's touchpad over the window.

Pages: [1]
anything