Menu

#10 Odd SDL_imageFilterMMXdetect behavior

v1.0 (example)
closed
nobody
None
5
2013-10-27
2012-07-27
Anonymous
No

In Ubuntu, I was tracking down a libsdl-perl build failure that I traced to SDL_gfx. See downstream bug https://bugs.launchpad.net/ubuntu/+source/sdlgfx/+bug/1029981

Basically, I think something is odd with the _cpuflags() call on i386. It seems to return different results based on whether it has been called before or whether it is in a function or main(). There is some alternate assembly code in the downstream bug that seems like it might be more reliable, but I'm not sure why, as I'm not well versed in assembly.

Any ideas why this would be so?

Discussion

  • Beuc

    Beuc - 2013-09-22

    2 notes:

    • It's best to fix it by just using SDL's dedicated function:

    That is:

    int SDL_imageFilterMMXdetect(void)
    {
            unsigned int mmx_bit;
    
            /* Check override flag */
            if (SDL_imageFilterUseMMX == 0) {
                    return (0);
            }
    
            return SDL_HasMMX();
    }
    
    • The rest of the MMX code also uses pusha/popa and segfaults under GNU/Linux, so it doesn't matter much - but a patch is in progress, see https://gitorious.org/sdlgfx/asm/ (should be included in SDL2_gfx)
     
  • ferzkopp

    ferzkopp - 2013-10-27

    Fixed in latest version ... uses SDL_HasMMX().

     
  • ferzkopp

    ferzkopp - 2013-10-27
    • status: open --> closed
    • Group: --> v1.0 (example)
     

Log in to post a comment.