Reproduction of cursor bug

Discussion in 'Mac and Linux' started by SXX, August 23, 2013.

  1. eeyrjmr

    eeyrjmr Member

    Messages:
    137
    Likes Received:
    13
    interesting info thanks.

    Could nvidia users who have this issue check their driver options:

    Option "SWCursor" "boolean"
    Enable or disable software rendering of the X cursor.
    Default: off.

    Option "HWCursor" "boolean"
    Enable or disable hardware rendering of the X cursor.
    Default: on.





    Nvidia drivers have a couple of options todo with the cursor, It might be worth setting SWcursor on and HWcursor off to test
  2. rooly

    rooly New Member

    Messages:
    20
    Likes Received:
    2
    I've created a minimal sample using opengl and xcursor; and have managed to reproduce the bug.

    XDefineCursor with >64x64 cursor image specified will cause this issue on NVidia hardware. I will have to wait until I get home to to verify this on my AMD chipset.

    Since all your cursors are 100x100, this issue will occur every time you call setCursor

    Also, thanks, Uber, for not stripping debug symbols; XCursor has practically NO tutorials...

    tiny code update: replace "ReplaceCursor" with this, it's just a minor change
    Code:
    void ReplaceCursor() {
        XcursorImage* image = XcursorImageCreate(64, 64);
    
        for (int i = 0; i < image->width * image->height; i++)
        image->pixels[i] = i % 8 == 0 ? 0xffffffff : 0;
    
        image->xhot = image->width / 2;
        image->yhot = image->height / 2;
    
        cursor = XcursorImageLoadCursor(display, image);
        XcursorImageDestroy(image);
        XDefineCursor(display, window, cursor);
        XFlush(display);
    }

    Attached Files:

    Last edited: August 29, 2013
  3. SXX

    SXX Post Master General

    Messages:
    6,896
    Likes Received:
    1,812
    I also want to notice to build this text on deb-based you probably need to use add "-lX11" to LDLIBSOPTIONS.
    Also you choose very strange example which have shader broken for FOSS drivers... :confused:
  4. rooly

    rooly New Member

    Messages:
    20
    Likes Received:
    2
    I just used this: http://ogldev.atspace.co.uk/www/tutorial07/tutorial07.html tutorial.

    It's a standard netbeans c++ project so you can open and debug it in there, build on ubuntu (deb-based)
  5. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
    I managed to compile it without -lX11 as well on Kubuntu 12.04. Also, I can confirm that with a 64x64 cursor everything is fine, but with a 65x65 cursor, the cursor behaves as in PA. That is, flickering when moving and invisible when stationary.
    This is on Nvidia with 304.88 drivers by the way.
  6. SXX

    SXX Post Master General

    Messages:
    6,896
    Likes Received:
    1,812
    Yeah, I didn't tried it in NetBeans, just make in console. :)
  7. eeyrjmr

    eeyrjmr Member

    Messages:
    137
    Likes Received:
    13
    so a possible fix exists :) 65x65 is a non base2 number a
  8. rooly

    rooly New Member

    Messages:
    20
    Likes Received:
    2
    I've just confirmed the behavior for my AMD chipset:

    a 64x64 cursor operates without error on NVidia and AMD

    a 65x65 (or greator) cursor causes a backbuffer redraw issue in the rectangle covered by the mouse cursor on NVidia
    a 65x65 (or greator) cursor causes a total backbuffer redraw issue over the entire window on AMD.

    I can only hypothesize; but I believe eeyrjmr's cursor rendering options may be the culprit. On up to a 64x64 cursor, it appears the Compositor is able to compose the mouse in hardware, leaving no rendering issues. Any larger, and a software fallback mode in X11 seems to keep one of the backbuffers permanently locked, which means the compositor cannot draw to it correctly, and thus the cursor error occurs.

    The free drivers are probably able to reduce this error by accepting larger hardware-accellerated image buffers, it would be interesting to see at what point free drivers start having the issue. They may be stable all the way up to the GPU's maximum texture size, or they may just bump the maximum to 128x128.

    As for PA, I can see 2 solutions for Uber: reduce all cursor sizes to maximum 64x64, OR somehow enable full-screen rendering without output redirection (compositors work by redirecting window output to a gl texture)

    The former is far easier, and could be accomplished by resizing cursors for everyone or just scaling the images in linux before replacing them.

    The latter is much more difficult, is distro, compositor, and gpu specific, and requires far too much linux-specific work for me to recommend it.
  9. SXX

    SXX Post Master General

    Messages:
    6,896
    Likes Received:
    1,812
    Free drivers have no back buffering issues, but flickering happend in some cases.

    It's can work fine without flickering, but after some action clickeing starting. I enable FPS counter (which actually have 60fps) and flickering stopped, but it's not seems to be related on FPS/VSync because moment ago cursor working normal without FPS counter on same point of view. It's really weird.
  10. eeyrjmr

    eeyrjmr Member

    Messages:
    137
    Likes Received:
    13
    not my options, just Nvidia's
    64x64 is prob the limit then of binary drivers - they prob didn't think anyone would want any bigger or was some arbitrary limit set since a limit was needed.

    maybe the binary drv could up this, but for now it seems all Uber need todo is create a 64x64 cursor
  11. UberWilliam

    UberWilliam Uber Alumni

    Messages:
    28
    Likes Received:
    76
    I added code to clamp the cursor size to 64x64 on Linux. Turns out our cursors had a lot of blank padding around them so the cursors should still look fine even when clamped.

    Alas, I can't promise when the next build is going out, what with PAX going on right now. But it should be soon. :)

    -William
  12. sechastain

    sechastain Member

    Messages:
    84
    Likes Received:
    22
    You guys are awesome.

    I'd like to see more of this kind of thing :)
  13. liamdawe

    liamdawe Active Member

    Messages:
    349
    Likes Received:
    61
    I am glad to see you guys are putting in the effort for Linux & Mac folks, bring it on :D
  14. p1ng

    p1ng New Member

    Messages:
    2
    Likes Received:
    0
    Hey guys,

    nice to hear that u put efford into the Linux version! I've the exact same problem. With xcompmgr (don't need the -c for the shadows) it get's better. Anyway, I had to make a new user and use another WM to get it working.

    I'm kinda new to this kinda stuff, so if I can help u by providing data, I would need some help and explanation what u need and how. :)
  15. rooly

    rooly New Member

    Messages:
    20
    Likes Received:
    2
    WOO!!!!! NO MORE LINUX CURSOR BUG!
    mkrater likes this.
  16. SXX

    SXX Post Master General

    Messages:
    6,896
    Likes Received:
    1,812
    Only cropped cursor, but I'm think it's can be fixed by SVG resize. :)
  17. redstar427

    redstar427 Member

    Messages:
    46
    Likes Received:
    0
    I can confirm, build 52973, has fixed the cursor bug for me too.

    System specs:
    i7 980X Extreme cpu
    Geforce GTX 580 gpu (1.5 GiB)
    24 GiB ram
    SSD (6 Gbps)
    Kubuntu Linux 12.04 LTS 64-bit
    Linux kernel 3.5.0-18-generic
    Xorg 11, version 1.11.3
    Nvidia driver version 325.15
    OpenGL version 4.3.0
  18. p1ng

    p1ng New Member

    Messages:
    2
    Likes Received:
    0
    Cursor bug fixed for me too! Thanks! :)

Share This Page