Page MenuHome

Include SDL information in system info text.
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on Feb 15 2015, 5:09 PM.

Details

Summary

Adds bpy.app.sdl to expose SDL version information.

When SDL is not available on a Linux system, certain Blender features are silently disabled (like joystick support in the BGE). This change is the first step towards making it more obvious why something isn't working. For example T43647 was simply solved by installing SDL 2.0, but Blender didn't give any indication that this would be necessary.

SDL information is exposed to Python via bpy.app.sdl, in the same way as OCIO and OIIO information is exposed.

Generated system-info.txt contains SDL loading method (dynamically linked or dynamically loaded) and SDL version number.

Diff Detail

Event Timeline

Sybren A. Stüvel (sybren) retitled this revision from to Include SDL information in system info text..Feb 15 2015, 5:09 PM
Sybren A. Stüvel (sybren) updated this object.
Sybren A. Stüvel (sybren) updated this object.
Sybren A. Stüvel (sybren) updated this revision to Diff 3538.
Sergey Sharybin (sergey) added inline comments.
release/scripts/modules/sys_info.py
130

I can't follow this logic. There is no difference in dynamic linking and dynamic loading, you should just be able to query SDL version via it's API.

Also, if dynamic loading is not used, you know for sure if it's SDL1.2 or SDL2.0.

So to me it seems reporting here could be improved a lot.

source/blender/python/intern/bpy_app_sdl.c
75

This means SDL will be loaded regardless if it's enabled in preferences or not. Ideally it should be lazy-initialized i think, but not sure if python allows you to do this so need to ask @Campbell Barton (campbellbarton).

Updated after comments by Sergey.

Updated for compatibility with SDL 1.2.

release/scripts/modules/sys_info.py
130

There are three ways to configure SDL support:

"dynamic loading" - Blender loads the lib with dlopen(). "ldd blender" doesn't show the SDL library. This is the behaviour you'd get with WITH_SDL_DYNLOAD=yes.

"dynamic linking" - GCC links the lib, and the OS loads it when loading Blender. "ldd blender" does show the SDL library. This is the behaviour you'd get with WITH_SDL_DYNLOAD=no. This is still dynamic, as the library is not statically linked with Blender.

The third option is simply not supporting SDL, i.e. WITH_SDL=no

source/blender/python/intern/bpy_app_sdl.c
75

sdlewInit() is called from main() when WITH_SDL_DYNLOAD is defined, so this change doesn't initialize anything that wasn't initialized before. Calling sdlewInit() is actually the only way to fetch the SDLEW_XXX status code.

release/scripts/modules/sys_info.py
130

I know the technical aspects of difference between dynamic linking and dynamic loading. I don't see difference for handling both cases and showing exact version in the system info.

Meaning, IMO, you can always show relevant SDL version, optionally maybe also mentioning if it's dynload or not.

source/blender/python/intern/bpy_app_sdl.c
75

Hrm, stupid main :) Nevermind the comment then.

Idea: instead of testing version for (0,0,0) we could have bool flag indicating whether SDL is loaded or not?

Integrated Sergey's remarks.

This revision was automatically updated to reflect the committed changes.

Reopened; it was closed after a mistake with arc...

Campbell Barton (campbellbarton) accepted this revision.

Seems fine, only minor changes suggested

source/blender/python/intern/bpy_app_sdl.c
49

This seems s duplicate of bpy_app_build_options.c

102

*picky* style (newline before else)

This revision is now accepted and ready to land.Feb 18 2015, 9:50 AM
This revision was automatically updated to reflect the committed changes.