diff --git a/CMakeLists.txt b/CMakeLists.txt index bbcb87b1f..e1ab286ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,9 +29,9 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 0) -set(SDL_MICRO_VERSION 3) -set(SDL_INTERFACE_AGE 1) -set(SDL_BINARY_AGE 3) +set(SDL_MICRO_VERSION 4) +set(SDL_INTERFACE_AGE 0) +set(SDL_BINARY_AGE 4) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") # Calculate a libtool-like version number @@ -247,6 +247,7 @@ endforeach() set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE}) set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS}) set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS}) +set_option(VIDEO_MX6 "Use Freescale i.MX6 video driver" OFF) # TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here # The options below are for compatibility to configure's default behaviour. @@ -678,6 +679,7 @@ if(UNIX AND NOT APPLE) CheckOpenGLX11() CheckOpenGLESX11() CheckWayland() + CheckMX6() endif() if(LINUX) @@ -970,6 +972,7 @@ elseif(APPLE) set_source_files_properties(${EXTRA_SOURCES} PROPERTIES LANGUAGE C) set(HAVE_SDL_FILE TRUE) set(SDL_FRAMEWORK_COCOA 1) + set(SDL_FRAMEWORK_COREVIDEO 1) else() message_error("SDL_FILE must be enabled to build on MacOS X") endif() @@ -1029,6 +1032,10 @@ elseif(APPLE) endif() # Actually load the frameworks at the end so we don't duplicate include. + if(SDL_FRAMEWORK_COREVIDEO) + find_library(COREVIDEO CoreVideo) + list(APPEND EXTRA_LIBS ${COREVIDEO}) + endif() if(SDL_FRAMEWORK_COCOA) find_library(COCOA_LIBRARY Cocoa) list(APPEND EXTRA_LIBS ${COCOA_LIBRARY}) diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index fa55492b8..bccaa8afc 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.3 + 2.0.4 CFBundleSignature SDLX CFBundleVersion - 2.0.3 + 2.0.4 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 4faf0d544..6c618b4e8 100755 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -810,6 +810,9 @@ DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; + FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; + FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; + FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -830,7 +833,6 @@ 0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; 007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; - 00AE6E1E08B958CC00255E2F /* ReadMeDevLite.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMeDevLite.txt; sourceTree = ""; }; 00CFA89C106B4BA100758660 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; 00D0D08310675DD9004B05EF /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_glfuncs.h; sourceTree = ""; }; @@ -1100,15 +1102,10 @@ D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamousetap.m; sourceTree = ""; }; DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; DB89958518A1A5C50092407C /* SDL_syshaptic_c.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_syshaptic_c.h; sourceTree = ""; }; - F59C70FF00D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; - F59C710000D5CB5801000001 /* Welcome.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Welcome.txt; sourceTree = ""; }; F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; - F59C710500D5CB5801000001 /* SDL-devel.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "SDL-devel.info"; sourceTree = ""; }; F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; - F59C710C00D5D15801000001 /* install.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = install.sh; sourceTree = ""; }; F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; - F5A2EF3A00C6A3C201000001 /* README-macosx.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = "README-macosx.txt"; path = "../../README-macosx.txt"; sourceTree = SOURCE_ROOT; }; - F5F81AD400D706B101000001 /* Readme SDL Developer.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = "Readme SDL Developer.txt"; path = "pkg-support/Readme SDL Developer.txt"; sourceTree = SOURCE_ROOT; }; + FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1116,6 +1113,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */, 007317A20858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */, 007317A30858DECD00B2BC32 /* AudioUnit.framework in Frameworks */, 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */, @@ -1131,6 +1129,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */, 007317A90858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */, 007317AA0858DECD00B2BC32 /* AudioUnit.framework in Frameworks */, 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */, @@ -1145,6 +1144,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */, DB31406C17554B71006C0E22 /* AudioToolbox.framework in Frameworks */, DB31406D17554B71006C0E22 /* AudioUnit.framework in Frameworks */, DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */, @@ -1663,7 +1663,6 @@ isa = PBXGroup; children = ( F5A2EF3900C6A39A01000001 /* BUGS.txt */, - F5A2EF3A00C6A3C201000001 /* README-macosx.txt */, F59C70FC00D5CB5801000001 /* pkg-support */, 0153844A006D81B07F000001 /* Public Headers */, 08FB77ACFE841707C02AAC07 /* Library Source */, @@ -1738,6 +1737,7 @@ BEC562FE0761C0E800A33029 /* Linked Frameworks */ = { isa = PBXGroup; children = ( + FA73671C19A540EF004122E4 /* CoreVideo.framework */, 00D0D08310675DD9004B05EF /* CoreFoundation.framework */, 007317C10858E15000B2BC32 /* Carbon.framework */, 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */, @@ -1753,30 +1753,16 @@ F59C70FC00D5CB5801000001 /* pkg-support */ = { isa = PBXGroup; children = ( - F59C70FE00D5CB5801000001 /* devel-resources */, F59C710100D5CB5801000001 /* resources */, - F5F81AD400D706B101000001 /* Readme SDL Developer.txt */, - F59C710500D5CB5801000001 /* SDL-devel.info */, F59C710600D5CB5801000001 /* SDL.info */, ); path = "pkg-support"; sourceTree = SOURCE_ROOT; }; - F59C70FE00D5CB5801000001 /* devel-resources */ = { - isa = PBXGroup; - children = ( - F59C710C00D5D15801000001 /* install.sh */, - F59C70FF00D5CB5801000001 /* ReadMe.txt */, - F59C710000D5CB5801000001 /* Welcome.txt */, - ); - path = "devel-resources"; - sourceTree = ""; - }; F59C710100D5CB5801000001 /* resources */ = { isa = PBXGroup; children = ( 00794D3F09D0C461003FC8A1 /* License.txt */, - 00AE6E1E08B958CC00255E2F /* ReadMeDevLite.txt */, F59C710300D5CB5801000001 /* ReadMe.txt */, ); path = resources; @@ -2807,7 +2793,7 @@ buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 3.1.0; + DYLIB_CURRENT_VERSION = 5.0.0; FRAMEWORK_VERSION = A; HEADER_SEARCH_PATHS = /usr/X11R6/include; INFOPLIST_FILE = "Info-Framework.plist"; @@ -2862,7 +2848,7 @@ buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 3.1.0; + DYLIB_CURRENT_VERSION = 5.0.0; FRAMEWORK_VERSION = A; HEADER_SEARCH_PATHS = /usr/X11R6/include; INFOPLIST_FILE = "Info-Framework.plist"; diff --git a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index c04386b5e..d6619c2de 100755 --- a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -555,6 +555,51 @@ DB89957918A19ABA0092407C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; DB89957A18A19ABA0092407C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; DB89958418A19B130092407C /* testhotplug.c in Sources */ = {isa = PBXBuildFile; fileRef = DB89958318A19B130092407C /* testhotplug.c */; }; + FA73672319A54A90004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73672819A54AB6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73672919A54AB9004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73672A19A54AC0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73672B19A54AC2004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73672C19A54AC5004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73672D19A54AC7004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73672E19A54ACA004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73672F19A54ACC004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673019A54AD0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673119A54AD3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673219A54AD5004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673319A54AD8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673419A54ADB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673519A54ADE004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673619A54AE1004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673719A54AE3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673819A54AE6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673919A54AE8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673A19A54AEB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673B19A54AED004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673C19A54AF0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673D19A54AF3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673E19A54AF6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73673F19A54AF8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674019A54AFB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674119A54AFE004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674219A54B01004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674319A54B04004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674419A54B06004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674519A54B09004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674619A54B0B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674719A54B0F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674819A54B13004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674919A54B16004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674A19A54B19004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674B19A54B1B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674C19A54B1F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674D19A54B22004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674E19A54B25004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73674F19A54B28004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73675019A54B2B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73675119A54B2F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73675219A54B32004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; + FA73675319A54B35004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -1141,6 +1186,7 @@ DB89957E18A19ABA0092407C /* testhotplug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testhotplug; sourceTree = BUILT_PRODUCTS_DIR; }; DB89958318A19B130092407C /* testhotplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testhotplug.c; path = ../../test/testhotplug.c; sourceTree = ""; }; DBBC552C182831D700F3CA8D /* TestDropFile-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "TestDropFile-Info.plist"; sourceTree = ""; }; + FA73672219A54A90004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1148,6 +1194,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672919A54AB9004122E4 /* CoreVideo.framework in Frameworks */, 0017957C10741F7900F5D044 /* Cocoa.framework in Frameworks */, 0017957D10741F7900F5D044 /* CoreAudio.framework in Frameworks */, 0017957E10741F7900F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1164,6 +1211,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672A19A54AC0004122E4 /* CoreVideo.framework in Frameworks */, 0017959D107421BF00F5D044 /* Cocoa.framework in Frameworks */, 0017959E107421BF00F5D044 /* CoreAudio.framework in Frameworks */, 0017959F107421BF00F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1180,6 +1228,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673319A54AD8004122E4 /* CoreVideo.framework in Frameworks */, 0017971110742F3200F5D044 /* Cocoa.framework in Frameworks */, 0017971210742F3200F5D044 /* CoreAudio.framework in Frameworks */, 0017971310742F3200F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1197,6 +1246,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673419A54ADB004122E4 /* CoreVideo.framework in Frameworks */, 00179738107430D600F5D044 /* Cocoa.framework in Frameworks */, 00179739107430D600F5D044 /* CoreAudio.framework in Frameworks */, 0017973A107430D600F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1213,6 +1263,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672B19A54AC2004122E4 /* CoreVideo.framework in Frameworks */, 0017975E107431B300F5D044 /* Cocoa.framework in Frameworks */, 0017975F107431B300F5D044 /* CoreAudio.framework in Frameworks */, 00179760107431B300F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1230,6 +1281,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673719A54AE3004122E4 /* CoreVideo.framework in Frameworks */, 0017977E107432AE00F5D044 /* Cocoa.framework in Frameworks */, 0017977F107432AE00F5D044 /* CoreAudio.framework in Frameworks */, 00179780107432AE00F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1247,6 +1299,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673819A54AE6004122E4 /* CoreVideo.framework in Frameworks */, 0017979E1074334C00F5D044 /* Cocoa.framework in Frameworks */, 0017979F1074334C00F5D044 /* CoreAudio.framework in Frameworks */, 001797A01074334C00F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1264,6 +1317,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673B19A54AED004122E4 /* CoreVideo.framework in Frameworks */, 001797C0107433C600F5D044 /* Cocoa.framework in Frameworks */, 001797C1107433C600F5D044 /* CoreAudio.framework in Frameworks */, 001797C2107433C600F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1280,6 +1334,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673E19A54AF6004122E4 /* CoreVideo.framework in Frameworks */, 001798021074355200F5D044 /* Cocoa.framework in Frameworks */, 001798031074355200F5D044 /* CoreAudio.framework in Frameworks */, 001798041074355200F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1296,6 +1351,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673F19A54AF8004122E4 /* CoreVideo.framework in Frameworks */, 001798841074392D00F5D044 /* Cocoa.framework in Frameworks */, 001798851074392D00F5D044 /* CoreAudio.framework in Frameworks */, 001798861074392D00F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1312,6 +1368,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674219A54B01004122E4 /* CoreVideo.framework in Frameworks */, 001798A5107439DF00F5D044 /* Cocoa.framework in Frameworks */, 001798A6107439DF00F5D044 /* CoreAudio.framework in Frameworks */, 001798A7107439DF00F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1328,6 +1385,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674619A54B0B004122E4 /* CoreVideo.framework in Frameworks */, 001798E210743BEC00F5D044 /* Cocoa.framework in Frameworks */, 001798E310743BEC00F5D044 /* CoreAudio.framework in Frameworks */, 001798E410743BEC00F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1344,6 +1402,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674C19A54B1F004122E4 /* CoreVideo.framework in Frameworks */, 0017990610743F1000F5D044 /* Cocoa.framework in Frameworks */, 0017990710743F1000F5D044 /* CoreAudio.framework in Frameworks */, 0017990810743F1000F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1361,6 +1420,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73675219A54B32004122E4 /* CoreVideo.framework in Frameworks */, 0017992810743FB700F5D044 /* Cocoa.framework in Frameworks */, 0017992910743FB700F5D044 /* CoreAudio.framework in Frameworks */, 0017992A10743FB700F5D044 /* ForceFeedback.framework in Frameworks */, @@ -1378,6 +1438,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672F19A54ACC004122E4 /* CoreVideo.framework in Frameworks */, 002F340B09CA1BFF00EBEB88 /* Cocoa.framework in Frameworks */, 002A866B10730548007319AE /* CoreAudio.framework in Frameworks */, 002A866C10730548007319AE /* ForceFeedback.framework in Frameworks */, @@ -1394,6 +1455,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673619A54AE1004122E4 /* CoreVideo.framework in Frameworks */, 002F342A09CA1F0300EBEB88 /* Cocoa.framework in Frameworks */, 002A866210730547007319AE /* CoreAudio.framework in Frameworks */, 002A866310730547007319AE /* ForceFeedback.framework in Frameworks */, @@ -1410,6 +1472,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674019A54AFB004122E4 /* CoreVideo.framework in Frameworks */, 002F344609CA1FB300EBEB88 /* Cocoa.framework in Frameworks */, 002A868010730549007319AE /* CoreAudio.framework in Frameworks */, 002A868110730549007319AE /* ForceFeedback.framework in Frameworks */, @@ -1426,6 +1489,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674119A54AFE004122E4 /* CoreVideo.framework in Frameworks */, 002F346309CA204F00EBEB88 /* Cocoa.framework in Frameworks */, 002A868610730549007319AE /* CoreAudio.framework in Frameworks */, 002A868710730549007319AE /* ForceFeedback.framework in Frameworks */, @@ -1442,6 +1506,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674B19A54B1B004122E4 /* CoreVideo.framework in Frameworks */, DB166D7116A1CFB200A1396C /* AudioToolbox.framework in Frameworks */, DB166D7216A1CFB200A1396C /* AudioUnit.framework in Frameworks */, DB166D7316A1CFB200A1396C /* Carbon.framework in Frameworks */, @@ -1459,6 +1524,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673119A54AD3004122E4 /* CoreVideo.framework in Frameworks */, BBFC08C0164C6862003E6A99 /* Cocoa.framework in Frameworks */, BBFC08C1164C6862003E6A99 /* CoreAudio.framework in Frameworks */, BBFC08C2164C6862003E6A99 /* ForceFeedback.framework in Frameworks */, @@ -1475,6 +1541,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672319A54A90004122E4 /* CoreVideo.framework in Frameworks */, 002F33C109CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A863010730405007319AE /* libSDL2.a in Frameworks */, 002A864D10730546007319AE /* CoreAudio.framework in Frameworks */, @@ -1491,6 +1558,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672819A54AB6004122E4 /* CoreVideo.framework in Frameworks */, 002F33BF09CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A865310730547007319AE /* CoreAudio.framework in Frameworks */, 002A865410730547007319AE /* ForceFeedback.framework in Frameworks */, @@ -1507,6 +1575,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672E19A54ACA004122E4 /* CoreVideo.framework in Frameworks */, 002F33BC09CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A866E10730548007319AE /* CoreAudio.framework in Frameworks */, 002A866F10730548007319AE /* ForceFeedback.framework in Frameworks */, @@ -1523,6 +1592,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674F19A54B28004122E4 /* CoreVideo.framework in Frameworks */, 002F33B809CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A868F1073054A007319AE /* CoreAudio.framework in Frameworks */, 002A86901073054A007319AE /* ForceFeedback.framework in Frameworks */, @@ -1539,6 +1609,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673919A54AE8004122E4 /* CoreVideo.framework in Frameworks */, 002F33B709CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A867410730548007319AE /* CoreAudio.framework in Frameworks */, 002A867510730548007319AE /* ForceFeedback.framework in Frameworks */, @@ -1555,6 +1626,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673A19A54AEB004122E4 /* CoreVideo.framework in Frameworks */, 002F33B509CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A867710730548007319AE /* CoreAudio.framework in Frameworks */, 002A867810730548007319AE /* ForceFeedback.framework in Frameworks */, @@ -1571,6 +1643,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673C19A54AF0004122E4 /* CoreVideo.framework in Frameworks */, 002F33B609CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A867A10730549007319AE /* CoreAudio.framework in Frameworks */, 002A867B10730549007319AE /* ForceFeedback.framework in Frameworks */, @@ -1587,6 +1660,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674919A54B16004122E4 /* CoreVideo.framework in Frameworks */, 002F33B209CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A868910730549007319AE /* CoreAudio.framework in Frameworks */, 002A868A10730549007319AE /* ForceFeedback.framework in Frameworks */, @@ -1603,6 +1677,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73675019A54B2B004122E4 /* CoreVideo.framework in Frameworks */, 002F33B009CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A86981073054A007319AE /* CoreAudio.framework in Frameworks */, 002A86991073054A007319AE /* ForceFeedback.framework in Frameworks */, @@ -1619,6 +1694,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73675119A54B2F004122E4 /* CoreVideo.framework in Frameworks */, 002F33AF09CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A86951073054A007319AE /* CoreAudio.framework in Frameworks */, 002A86961073054A007319AE /* ForceFeedback.framework in Frameworks */, @@ -1635,6 +1711,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73675319A54B35004122E4 /* CoreVideo.framework in Frameworks */, 002F33AA09CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A864110730546007319AE /* CoreAudio.framework in Frameworks */, 002A864210730546007319AE /* ForceFeedback.framework in Frameworks */, @@ -1651,6 +1728,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672C19A54AC5004122E4 /* CoreVideo.framework in Frameworks */, DB0F48DD17CA51E5008798C5 /* Cocoa.framework in Frameworks */, DB0F48DE17CA51E5008798C5 /* CoreAudio.framework in Frameworks */, DB0F48DF17CA51E5008798C5 /* ForceFeedback.framework in Frameworks */, @@ -1667,6 +1745,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673019A54AD0004122E4 /* CoreVideo.framework in Frameworks */, DB0F48F317CA5212008798C5 /* Cocoa.framework in Frameworks */, DB0F48F417CA5212008798C5 /* CoreAudio.framework in Frameworks */, DB0F48F517CA5212008798C5 /* ForceFeedback.framework in Frameworks */, @@ -1690,6 +1769,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673219A54AD5004122E4 /* CoreVideo.framework in Frameworks */, DB166DB116A1D2F600A1396C /* Cocoa.framework in Frameworks */, DB166DB216A1D2F600A1396C /* CoreAudio.framework in Frameworks */, DB166DB316A1D2F600A1396C /* ForceFeedback.framework in Frameworks */, @@ -1706,6 +1786,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673D19A54AF3004122E4 /* CoreVideo.framework in Frameworks */, DB166DC816A1D36A00A1396C /* Cocoa.framework in Frameworks */, DB166DC916A1D36A00A1396C /* CoreAudio.framework in Frameworks */, DB166DCA16A1D36A00A1396C /* ForceFeedback.framework in Frameworks */, @@ -1722,6 +1803,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674319A54B04004122E4 /* CoreVideo.framework in Frameworks */, DB166DE016A1D50C00A1396C /* Cocoa.framework in Frameworks */, DB166DE116A1D50C00A1396C /* CoreAudio.framework in Frameworks */, DB166DE216A1D50C00A1396C /* ForceFeedback.framework in Frameworks */, @@ -1739,6 +1821,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674419A54B06004122E4 /* CoreVideo.framework in Frameworks */, DB166DF716A1D57C00A1396C /* Cocoa.framework in Frameworks */, DB166DF816A1D57C00A1396C /* CoreAudio.framework in Frameworks */, DB166DF916A1D57C00A1396C /* ForceFeedback.framework in Frameworks */, @@ -1756,6 +1839,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674519A54B09004122E4 /* CoreVideo.framework in Frameworks */, DB166E0E16A1D5AD00A1396C /* Cocoa.framework in Frameworks */, DB166E0F16A1D5AD00A1396C /* CoreAudio.framework in Frameworks */, DB166E1016A1D5AD00A1396C /* ForceFeedback.framework in Frameworks */, @@ -1773,6 +1857,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674719A54B0F004122E4 /* CoreVideo.framework in Frameworks */, DB166E2B16A1D64D00A1396C /* Cocoa.framework in Frameworks */, DB166E2C16A1D64D00A1396C /* CoreAudio.framework in Frameworks */, DB166E2D16A1D64D00A1396C /* ForceFeedback.framework in Frameworks */, @@ -1789,6 +1874,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674819A54B13004122E4 /* CoreVideo.framework in Frameworks */, DB166E4116A1D69000A1396C /* Cocoa.framework in Frameworks */, DB166E4216A1D69000A1396C /* CoreAudio.framework in Frameworks */, DB166E4316A1D69000A1396C /* ForceFeedback.framework in Frameworks */, @@ -1806,6 +1892,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674A19A54B19004122E4 /* CoreVideo.framework in Frameworks */, DB166E5B16A1D6F300A1396C /* Cocoa.framework in Frameworks */, DB166E5C16A1D6F300A1396C /* CoreAudio.framework in Frameworks */, DB166E5D16A1D6F300A1396C /* ForceFeedback.framework in Frameworks */, @@ -1822,6 +1909,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674D19A54B22004122E4 /* CoreVideo.framework in Frameworks */, DB166E7116A1D78400A1396C /* Cocoa.framework in Frameworks */, DB166E7216A1D78400A1396C /* CoreAudio.framework in Frameworks */, DB166E7316A1D78400A1396C /* ForceFeedback.framework in Frameworks */, @@ -1838,6 +1926,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73674E19A54B25004122E4 /* CoreVideo.framework in Frameworks */, DB166E8416A1D78C00A1396C /* Cocoa.framework in Frameworks */, DB166E8516A1D78C00A1396C /* CoreAudio.framework in Frameworks */, DB166E8616A1D78C00A1396C /* ForceFeedback.framework in Frameworks */, @@ -1854,6 +1943,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73672D19A54AC7004122E4 /* CoreVideo.framework in Frameworks */, DB445EEA18184B7000B306B0 /* Cocoa.framework in Frameworks */, DB445EEB18184B7000B306B0 /* CoreAudio.framework in Frameworks */, DB445EEC18184B7000B306B0 /* ForceFeedback.framework in Frameworks */, @@ -1871,6 +1961,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA73673519A54ADE004122E4 /* CoreVideo.framework in Frameworks */, DB89957118A19ABA0092407C /* Cocoa.framework in Frameworks */, DB89957218A19ABA0092407C /* CoreAudio.framework in Frameworks */, DB89957318A19ABA0092407C /* ForceFeedback.framework in Frameworks */, @@ -1889,6 +1980,7 @@ 002F33A209CA183B00EBEB88 /* Linked Frameworks */ = { isa = PBXGroup; children = ( + FA73672219A54A90004122E4 /* CoreVideo.framework */, 002A869F10730593007319AE /* AudioToolbox.framework */, 002A871410730623007319AE /* AudioUnit.framework */, 002A873910730675007319AE /* Carbon.framework */, diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index fa8aa396e..713fe7b94 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -600,6 +600,25 @@ macro(CheckDirectFB) endif(VIDEO_DIRECTFB) endmacro(CheckDirectFB) +# Requires: +# - n/a +macro(CheckMX6) + if(VIDEO_MX6) + check_c_source_compiles(" + #define EGL_API_FB + #include + int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL_VIVANTE) + if(HAVE_VIDEO_OPENGL_EGL_VIVANTE) + set(HAVE_VIDEO_MX6 TRUE) + set(HAVE_SDL_VIDEO TRUE) + + file(GLOB MX6_SOURCES ${SDL2_SOURCE_DIR}/src/video/mx6/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${MX6_SOURCES}) + set(SDL_VIDEO_DRIVER_MX6 1) + endif(HAVE_VIDEO_OPENGL_EGL_VIVANTE) + endif(VIDEO_MX6) +endmacro(CheckMX6) + # Requires: # - nada macro(CheckOpenGLX11) @@ -624,6 +643,7 @@ endmacro(CheckOpenGLX11) macro(CheckOpenGLESX11) if(VIDEO_OPENGLES) check_c_source_compiles(" + #define EGL_API_FB #include int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL) if(HAVE_VIDEO_OPENGL_EGL) diff --git a/configure b/configure index 08ecfbf35..2f1e5fee1 100755 --- a/configure +++ b/configure @@ -832,6 +832,7 @@ enable_video_x11_xrandr enable_video_x11_scrnsaver enable_video_x11_xshape enable_video_x11_vm +enable_video_mx6 enable_video_cocoa enable_video_directfb enable_directfb_shared @@ -1561,6 +1562,7 @@ Optional Features: --enable-video-x11-xshape enable X11 XShape support [[default=yes]] --enable-video-x11-vm use X11 VM extension for fullscreen [[default=yes]] + --enable-video-mx6 use Freescale i.MX6 video driver [[default=no]] --enable-video-cocoa use Cocoa video driver [[default=yes]] --enable-video-directfb use DirectFB video driver [[default=no]] --enable-directfb-shared @@ -2673,9 +2675,9 @@ orig_CFLAGS="$CFLAGS" # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=3 -SDL_INTERFACE_AGE=1 -SDL_BINARY_AGE=3 +SDL_MICRO_VERSION=4 +SDL_INTERFACE_AGE=0 +SDL_BINARY_AGE=4 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION @@ -20591,6 +20593,53 @@ $as_echo "#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1" >>confdefs.h fi } +CheckMX6Video() +{ + # Check whether --enable-video-mx6 was given. +if test "${enable_video_mx6+set}" = set; then : + enableval=$enable_video_mx6; +else + enable_video_mx6=no +fi + + if test x$enable_video = xyes -a x$enable_video_mx6 = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Vivante GPU SDK" >&5 +$as_echo_n "checking for Vivante GPU SDK... " >&6; } + have_viv_sdk=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define EGL_API_FB + #include + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_viv_sdk=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_viv_sdk" >&5 +$as_echo "$have_viv_sdk" >&6; } + if test x$have_viv_sdk = xyes; then + +$as_echo "#define SDL_VIDEO_DRIVER_MX6 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/video/mx6/*.c" + SUMMARY_video="${SUMMARY_video} mx6" + have_video=yes + fi + fi +} + CheckHaikuVideo() { if test x$enable_video = xyes; then @@ -21044,6 +21093,7 @@ $as_echo_n "checking for EGL support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + #define EGL_API_FB #include #include @@ -22818,6 +22868,7 @@ case "$host" in CheckClockGettime CheckLinuxVersion CheckRPATH + CheckMX6Video # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in @@ -23338,6 +23389,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h # The Mac OS X platform requires special setup. EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" diff --git a/configure.in b/configure.in index 3c87ea754..528a7a81e 100644 --- a/configure.in +++ b/configure.in @@ -20,9 +20,9 @@ dnl Set various version strings - taken gratefully from the GTk sources # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=3 -SDL_INTERFACE_AGE=1 -SDL_BINARY_AGE=3 +SDL_MICRO_VERSION=4 +SDL_INTERFACE_AGE=0 +SDL_BINARY_AGE=4 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION AC_SUBST(SDL_MAJOR_VERSION) @@ -1729,6 +1729,32 @@ AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[d fi } +dnl Set up the MX6 video driver if enabled +CheckMX6Video() +{ + AC_ARG_ENABLE(video-mx6, +AC_HELP_STRING([--enable-video-mx6], [use Freescale i.MX6 video driver [[default=no]]]), + , enable_video_mx6=no) + if test x$enable_video = xyes -a x$enable_video_mx6 = xyes; then + AC_MSG_CHECKING(for Vivante GPU SDK) + have_viv_sdk=no + AC_TRY_COMPILE([ + #define EGL_API_FB + #include + ],[ + ],[ + have_viv_sdk=yes + ]) + AC_MSG_RESULT($have_viv_sdk) + if test x$have_viv_sdk = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_MX6, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/mx6/*.c" + SUMMARY_video="${SUMMARY_video} mx6" + have_video=yes + fi + fi +} + dnl Set up the Haiku video driver if enabled CheckHaikuVideo() { @@ -1955,6 +1981,7 @@ CheckOpenGLESX11() AC_MSG_CHECKING(for EGL support) video_opengl_egl=no AC_TRY_COMPILE([ + #define EGL_API_FB #include #include ],[ @@ -2809,6 +2836,7 @@ case "$host" in CheckClockGettime CheckLinuxVersion CheckRPATH + CheckMX6Video # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in @@ -3215,6 +3243,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # The Mac OS X platform requires special setup. EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" diff --git a/docs/README-linux.md b/docs/README-linux.md index d9cf40fb9..fddabf524 100644 --- a/docs/README-linux.md +++ b/docs/README-linux.md @@ -19,7 +19,7 @@ sudo apt-get install build-essential mercurial make cmake autoconf automake \ libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \ libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \ libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \ -libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev +libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev Ubuntu 14.04 can also add "libwayland-dev libmirclient-dev libxkbcommon-dev" to that command line for Wayland and Mir support. diff --git a/docs/doxyfile b/docs/doxyfile index 67bec11f1..f17838d1c 100644 --- a/docs/doxyfile +++ b/docs/doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = SDL # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.0.0 +PROJECT_NUMBER = 2.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 51500fb2b..64f76bb05 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -264,6 +264,7 @@ #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@ #cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@ +#cmakedefine SDL_VIDEO_DRIVER_MX6 @SDL_VIDEO_DRIVER_MX6@ #if 0 /* !!! FIXME: in configure script version, missing here: */ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 145a7b772..67c08a145 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -308,6 +308,7 @@ #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM #undef SDL_VIDEO_DRIVER_NACL +#undef SDL_VIDEO_DRIVER_MX6 #undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_D3D11 diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 4cc34146d..222cf6b27 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -479,14 +479,13 @@ extern "C" { #define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION" /** - * \brief A variable to control whether certain IMs should handle text editing internally instead of sending TEXTEDITING events. - * + * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events. * * The variable can be set to the following values: - * "0" - TEXTEDITING events are sent, and it is the application's + * "0" - SDL_TEXTEDITING events are sent, and it is the application's * responsibility to render the text from these events and * differentiate it somehow from committed text. (default) - * "1" - If supported by the IM then TEXTEDITING events are not sent, + * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, * and text that is being composed will be rendered in its own UI. */ #define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING" diff --git a/include/SDL_thread.h b/include/SDL_thread.h index 4e48cc34c..9e5341410 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -233,9 +233,9 @@ extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread); * if (!thread_local_storage) { * thread_local_storage = SDL_TLSCreate(); * } - * SDL_AtomicUnLock(&tls_lock); + * SDL_AtomicUnlock(&tls_lock); * } - * SDL_TLSSet(thread_local_storage, value); + * SDL_TLSSet(thread_local_storage, value, 0); * } * * void *GetMyThreadData(void) diff --git a/include/SDL_version.h b/include/SDL_version.h index d02898bbb..b74e24c94 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 3 +#define SDL_PATCHLEVEL 4 /** * \brief Macro to determine SDL version program was compiled against. diff --git a/premake/README-macosx.txt b/premake/README-macosx.txt index 599e96e3c..55c6dfa17 100755 --- a/premake/README-macosx.txt +++ b/premake/README-macosx.txt @@ -17,6 +17,7 @@ tests on that platform. The Mac OS X projects currently have reliance on the following dependencies: + -CoreVideo.framework -AudioToolbox.framework -AudioUnit.framework -Cocoa.framework diff --git a/premake/projects/SDL2.lua b/premake/projects/SDL2.lua index 6e705bf17..0eaab6bbb 100755 --- a/premake/projects/SDL2.lua +++ b/premake/projects/SDL2.lua @@ -213,6 +213,7 @@ SDL_project "SDL2" } SDL_links { + "CoreVideo.framework", "AudioToolbox.framework", "AudioUnit.framework", "Cocoa.framework", diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index 2a538b1b1..1a0729f26 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -54,14 +54,14 @@ IBus_ModState(void) SDL_Keymod sdl_mods = SDL_GetModState(); /* Not sure about MOD3, MOD4 and HYPER mappings */ - if(sdl_mods & KMOD_LSHIFT) ibus_mods |= IBUS_SHIFT_MASK; - if(sdl_mods & KMOD_CAPS) ibus_mods |= IBUS_LOCK_MASK; - if(sdl_mods & KMOD_LCTRL) ibus_mods |= IBUS_CONTROL_MASK; - if(sdl_mods & KMOD_LALT) ibus_mods |= IBUS_MOD1_MASK; - if(sdl_mods & KMOD_NUM) ibus_mods |= IBUS_MOD2_MASK; - if(sdl_mods & KMOD_MODE) ibus_mods |= IBUS_MOD5_MASK; - if(sdl_mods & KMOD_LGUI) ibus_mods |= IBUS_SUPER_MASK; - if(sdl_mods & KMOD_RGUI) ibus_mods |= IBUS_META_MASK; + if (sdl_mods & KMOD_LSHIFT) ibus_mods |= IBUS_SHIFT_MASK; + if (sdl_mods & KMOD_CAPS) ibus_mods |= IBUS_LOCK_MASK; + if (sdl_mods & KMOD_LCTRL) ibus_mods |= IBUS_CONTROL_MASK; + if (sdl_mods & KMOD_LALT) ibus_mods |= IBUS_MOD1_MASK; + if (sdl_mods & KMOD_NUM) ibus_mods |= IBUS_MOD2_MASK; + if (sdl_mods & KMOD_MODE) ibus_mods |= IBUS_MOD5_MASK; + if (sdl_mods & KMOD_LGUI) ibus_mods |= IBUS_SUPER_MASK; + if (sdl_mods & KMOD_RGUI) ibus_mods |= IBUS_META_MASK; return ibus_mods; } @@ -71,34 +71,34 @@ IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext { /* The text we need is nested weirdly, use dbus-monitor to see the structure better */ const char *text = NULL; + const char *struct_id = NULL; DBusMessageIter sub1, sub2; - if(dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT){ + if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) { return NULL; } dbus->message_iter_recurse(iter, &sub1); - if(dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT){ + if (dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT) { return NULL; } dbus->message_iter_recurse(&sub1, &sub2); - if(dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING){ + if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { return NULL; } - const char *struct_id = NULL; dbus->message_iter_get_basic(&sub2, &struct_id); - if(!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0){ + if (!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0) { return NULL; } dbus->message_iter_next(&sub2); dbus->message_iter_next(&sub2); - if(dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING){ + if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { return NULL; } @@ -113,8 +113,8 @@ IBus_utf8_strlen(const char *str) size_t utf8_len = 0; const char *p; - for(p = str; *p; ++p){ - if(!((*p & 0x80) && !(*p & 0x40))){ + for (p = str; *p; ++p) { + if (!((*p & 0x80) && !(*p & 0x40))) { ++utf8_len; } } @@ -127,16 +127,18 @@ IBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *user_data) { SDL_DBusContext *dbus = (SDL_DBusContext *)user_data; - if(dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")){ + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")) { DBusMessageIter iter; + const char *text; + dbus->message_iter_init(msg, &iter); - const char *text = IBus_GetVariantText(conn, &iter, dbus); - if(text && *text){ + text = IBus_GetVariantText(conn, &iter, dbus); + if (text && *text) { char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; - while(i < text_bytes){ + while (i < text_bytes) { size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); SDL_SendKeyboardText(buf); @@ -147,17 +149,19 @@ IBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *user_data) return DBUS_HANDLER_RESULT_HANDLED; } - if(dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")){ + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")) { DBusMessageIter iter; + const char *text; + dbus->message_iter_init(msg, &iter); - const char *text = IBus_GetVariantText(conn, &iter, dbus); + text = IBus_GetVariantText(conn, &iter, dbus); - if(text && *text){ + if (text && *text) { char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; size_t cursor = 0; - while(i < text_bytes){ + while (i < text_bytes) { size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); size_t chars = IBus_utf8_strlen(buf); @@ -173,9 +177,9 @@ IBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *user_data) return DBUS_HANDLER_RESULT_HANDLED; } - if(dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")){ - SDL_SendEditingText("", 0, 0); - return DBUS_HANDLER_RESULT_HANDLED; + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")) { + SDL_SendEditingText("", 0, 0); + return DBUS_HANDLER_RESULT_HANDLED; } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -184,19 +188,20 @@ IBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *user_data) static char * IBus_ReadAddressFromFile(const char *file_path) { - FILE *addr_file = fopen(file_path, "r"); - if(!addr_file){ + char addr_buf[1024]; + SDL_bool success = SDL_FALSE; + FILE *addr_file; + + addr_file = fopen(file_path, "r"); + if (!addr_file) { return NULL; } - char addr_buf[1024]; - SDL_bool success = SDL_FALSE; - - while(fgets(addr_buf, sizeof(addr_buf), addr_file)){ - if(SDL_strncmp(addr_buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=")-1) == 0){ + while (fgets(addr_buf, sizeof(addr_buf), addr_file)) { + if (SDL_strncmp(addr_buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=")-1) == 0) { size_t sz = SDL_strlen(addr_buf); - if(addr_buf[sz-1] == '\n') addr_buf[sz-1] = 0; - if(addr_buf[sz-2] == '\r') addr_buf[sz-2] = 0; + if (addr_buf[sz-1] == '\n') addr_buf[sz-1] = 0; + if (addr_buf[sz-2] == '\r') addr_buf[sz-2] = 0; success = SDL_TRUE; break; } @@ -204,7 +209,7 @@ IBus_ReadAddressFromFile(const char *file_path) fclose(addr_file); - if(success){ + if (success) { return SDL_strdup(addr_buf + (sizeof("IBUS_ADDRESS=") - 1)); } else { return NULL; @@ -214,38 +219,47 @@ IBus_ReadAddressFromFile(const char *file_path) static char * IBus_GetDBusAddressFilename(void) { - if(ibus_addr_file){ + SDL_DBusContext *dbus; + const char *disp_env; + char config_dir[PATH_MAX]; + char *display = NULL; + const char *addr; + const char *conf_env; + char *key; + char file_path[PATH_MAX]; + const char *host; + char *disp_num, *screen_num; + + if (ibus_addr_file) { return SDL_strdup(ibus_addr_file); } - SDL_DBusContext *dbus = SDL_DBus_GetContext(); - - if(!dbus){ + dbus = SDL_DBus_GetContext(); + if (!dbus) { return NULL; } /* Use this environment variable if it exists. */ - const char *addr = SDL_getenv("IBUS_ADDRESS"); - if(addr && *addr){ + addr = SDL_getenv("IBUS_ADDRESS"); + if (addr && *addr) { return SDL_strdup(addr); } /* Otherwise, we have to get the hostname, display, machine id, config dir and look up the address from a filepath using all those bits, eek. */ - const char *disp_env = SDL_getenv("DISPLAY"); - char *display = NULL; - - if(!disp_env || !*disp_env){ + disp_env = SDL_getenv("DISPLAY"); + + if (!disp_env || !*disp_env) { display = SDL_strdup(":0.0"); } else { display = SDL_strdup(disp_env); } - const char *host = display; - char *disp_num = SDL_strrchr(display, ':'), - *screen_num = SDL_strrchr(display, '.'); + host = display; + disp_num = SDL_strrchr(display, ':'); + screen_num = SDL_strrchr(display, '.'); - if(!disp_num){ + if (!disp_num) { SDL_free(display); return NULL; } @@ -253,32 +267,30 @@ IBus_GetDBusAddressFilename(void) *disp_num = 0; disp_num++; - if(screen_num){ + if (screen_num) { *screen_num = 0; } - if(!*host){ + if (!*host) { host = "unix"; } - char config_dir[PATH_MAX]; SDL_memset(config_dir, 0, sizeof(config_dir)); - const char *conf_env = SDL_getenv("XDG_CONFIG_HOME"); - if(conf_env && *conf_env){ + conf_env = SDL_getenv("XDG_CONFIG_HOME"); + if (conf_env && *conf_env) { SDL_strlcpy(config_dir, conf_env, sizeof(config_dir)); } else { const char *home_env = SDL_getenv("HOME"); - if(!home_env || !*home_env){ + if (!home_env || !*home_env) { SDL_free(display); return NULL; } SDL_snprintf(config_dir, sizeof(config_dir), "%s/.config", home_env); } - char *key = dbus->get_local_machine_id(); - - char file_path[PATH_MAX]; + key = dbus->get_local_machine_id(); + SDL_memset(file_path, 0, sizeof(file_path)); SDL_snprintf(file_path, sizeof(file_path), "%s/ibus/bus/%s-%s-%s", config_dir, key, host, disp_num); @@ -296,15 +308,15 @@ IBus_SetCapabilities(void *data, const char *name, const char *old_val, { SDL_DBusContext *dbus = SDL_DBus_GetContext(); - if(IBus_CheckConnection(dbus)){ + if (IBus_CheckConnection(dbus)) { DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities"); - if(msg){ + if (msg) { Uint32 caps = IBUS_CAP_FOCUS; - if(!(internal_editing && *internal_editing == '1')){ + if (!(internal_editing && *internal_editing == '1')) { caps |= IBUS_CAP_PREEDIT_TEXT; } @@ -313,8 +325,8 @@ IBus_SetCapabilities(void *data, const char *name, const char *old_val, DBUS_TYPE_INVALID); } - if(msg){ - if(dbus->connection_send(ibus_conn, msg, NULL)){ + if (msg) { + if (dbus->connection_send(ibus_conn, msg, NULL)) { dbus->connection_flush(ibus_conn); } dbus->message_unref(msg); @@ -328,42 +340,40 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) { const char *path = NULL; SDL_bool result = SDL_FALSE; - + DBusMessage *msg; + ibus_conn = dbus->connection_open_private(addr, NULL); - if(!ibus_conn){ + if (!ibus_conn) { return SDL_FALSE; } dbus->connection_flush(ibus_conn); - if(!dbus->bus_register(ibus_conn, NULL)){ + if (!dbus->bus_register(ibus_conn, NULL)) { ibus_conn = NULL; return SDL_FALSE; } dbus->connection_flush(ibus_conn); - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - IBUS_PATH, - IBUS_INTERFACE, - "CreateInputContext"); - if(msg){ + msg = dbus->message_new_method_call(IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext"); + if (msg) { const char *client_name = "SDL2_Application"; dbus->message_append_args(msg, DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID); } - if(msg){ + if (msg) { DBusMessage *reply; reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 1000, NULL); - if(reply){ - if(dbus->message_get_args(reply, NULL, + if (reply) { + if (dbus->message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_INVALID)){ - if(input_ctx_path){ + DBUS_TYPE_INVALID)) { + if (input_ctx_path) { SDL_free(input_ctx_path); } input_ctx_path = SDL_strdup(path); @@ -374,7 +384,7 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) dbus->message_unref(msg); } - if(result){ + if (result) { SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL); dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL); @@ -391,27 +401,27 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus) { - if(!dbus) return SDL_FALSE; + if (!dbus) return SDL_FALSE; - if(ibus_conn && dbus->connection_get_is_connected(ibus_conn)){ + if (ibus_conn && dbus->connection_get_is_connected(ibus_conn)) { return SDL_TRUE; } - if(inotify_fd > 0 && inotify_wd > 0){ + if (inotify_fd > 0 && inotify_wd > 0) { char buf[1024]; ssize_t readsize = read(inotify_fd, buf, sizeof(buf)); - if(readsize > 0){ + if (readsize > 0) { char *p; SDL_bool file_updated = SDL_FALSE; - for(p = buf; p < buf + readsize; /**/){ + for (p = buf; p < buf + readsize; /**/) { struct inotify_event *event = (struct inotify_event*) p; - if(event->len > 0){ + if (event->len > 0) { char *addr_file_no_path = SDL_strrchr(ibus_addr_file, '/'); - if(!addr_file_no_path) return SDL_FALSE; + if (!addr_file_no_path) return SDL_FALSE; - if(SDL_strcmp(addr_file_no_path + 1, event->name) == 0){ + if (SDL_strcmp(addr_file_no_path + 1, event->name) == 0) { file_updated = SDL_TRUE; break; } @@ -420,9 +430,9 @@ IBus_CheckConnection(SDL_DBusContext *dbus) p += sizeof(struct inotify_event) + event->len; } - if(file_updated){ + if (file_updated) { char *addr = IBus_ReadAddressFromFile(ibus_addr_file); - if(addr){ + if (addr) { SDL_bool result = IBus_SetupConnection(dbus, addr); SDL_free(addr); return result; @@ -440,23 +450,26 @@ SDL_IBus_Init(void) SDL_bool result = SDL_FALSE; SDL_DBusContext *dbus = SDL_DBus_GetContext(); - if(dbus){ + if (dbus) { char *addr_file = IBus_GetDBusAddressFilename(); - if(!addr_file){ + char *addr; + char *addr_file_dir; + + if (!addr_file) { return SDL_FALSE; } ibus_addr_file = SDL_strdup(addr_file); - char *addr = IBus_ReadAddressFromFile(addr_file); + addr = IBus_ReadAddressFromFile(addr_file); - if(inotify_fd < 0){ + if (inotify_fd < 0) { inotify_fd = inotify_init(); fcntl(inotify_fd, F_SETFL, O_NONBLOCK); } - char *addr_file_dir = SDL_strrchr(addr_file, '/'); - if(addr_file_dir){ + addr_file_dir = SDL_strrchr(addr_file, '/'); + if (addr_file_dir) { *addr_file_dir = 0; } @@ -473,24 +486,26 @@ SDL_IBus_Init(void) void SDL_IBus_Quit(void) { - if(input_ctx_path){ + SDL_DBusContext *dbus; + + if (input_ctx_path) { SDL_free(input_ctx_path); input_ctx_path = NULL; } - if(ibus_addr_file){ + if (ibus_addr_file) { SDL_free(ibus_addr_file); ibus_addr_file = NULL; } - SDL_DBusContext *dbus = SDL_DBus_GetContext(); + dbus = SDL_DBus_GetContext(); - if(dbus && ibus_conn){ + if (dbus && ibus_conn) { dbus->connection_close(ibus_conn); dbus->connection_unref(ibus_conn); } - if(inotify_fd > 0 && inotify_wd > 0){ + if (inotify_fd > 0 && inotify_wd > 0) { inotify_rm_watch(inotify_fd, inotify_wd); inotify_wd = -1; } @@ -505,13 +520,13 @@ IBus_SimpleMessage(const char *method) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); - if(IBus_CheckConnection(dbus)){ + if (IBus_CheckConnection(dbus)) { DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, method); - if(msg){ - if(dbus->connection_send(ibus_conn, msg, NULL)){ + if (msg) { + if (dbus->connection_send(ibus_conn, msg, NULL)) { dbus->connection_flush(ibus_conn); } dbus->message_unref(msg); @@ -538,12 +553,12 @@ SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) SDL_bool result = SDL_FALSE; SDL_DBusContext *dbus = SDL_DBus_GetContext(); - if(IBus_CheckConnection(dbus)){ + if (IBus_CheckConnection(dbus)) { DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent"); - if(msg){ + if (msg) { Uint32 mods = IBus_ModState(); dbus->message_append_args(msg, DBUS_TYPE_UINT32, &keysym, @@ -552,14 +567,14 @@ SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) DBUS_TYPE_INVALID); } - if(msg){ + if (msg) { DBusMessage *reply; reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 300, NULL); - if(reply){ - if(!dbus->message_get_args(reply, NULL, + if (reply) { + if (!dbus->message_get_args(reply, NULL, DBUS_TYPE_BOOLEAN, &result, - DBUS_TYPE_INVALID)){ + DBUS_TYPE_INVALID)) { result = SDL_FALSE; } dbus->message_unref(reply); @@ -577,49 +592,51 @@ SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) void SDL_IBus_UpdateTextRect(SDL_Rect *rect) { - if(rect){ + SDL_Window *focused_win; + SDL_SysWMinfo info; + int x = 0, y = 0; + SDL_DBusContext *dbus; + + if (rect) { SDL_memcpy(&ibus_cursor_rect, rect, sizeof(ibus_cursor_rect)); } - - SDL_Window *focused_win = SDL_GetKeyboardFocus(); - if(!focused_win) return; - - SDL_SysWMinfo info; + focused_win = SDL_GetKeyboardFocus(); + if (!focused_win) { + return; + } + SDL_VERSION(&info.version); - - if(!SDL_GetWindowWMInfo(focused_win, &info)) return; - - int x = 0, y = 0; - + if (!SDL_GetWindowWMInfo(focused_win, &info)) { + return; + } + SDL_GetWindowPosition(focused_win, &x, &y); #if SDL_VIDEO_DRIVER_X11 - if(info.subsystem == SDL_SYSWM_X11){ - SDL_DisplayData *displaydata = - (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; + if (info.subsystem == SDL_SYSWM_X11) { + SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; Display *x_disp = info.info.x11.display; Window x_win = info.info.x11.window; int x_screen = displaydata->screen; Window unused; - X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), - 0, 0, &x, &y, &unused); + X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused); } #endif x += ibus_cursor_rect.x; y += ibus_cursor_rect.y; - SDL_DBusContext *dbus = SDL_DBus_GetContext(); + dbus = SDL_DBus_GetContext(); - if(IBus_CheckConnection(dbus)){ + if (IBus_CheckConnection(dbus)) { DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCursorLocation"); - if(msg){ + if (msg) { dbus->message_append_args(msg, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, @@ -628,8 +645,8 @@ SDL_IBus_UpdateTextRect(SDL_Rect *rect) DBUS_TYPE_INVALID); } - if(msg){ - if(dbus->connection_send(ibus_conn, msg, NULL)){ + if (msg) { + if (dbus->connection_send(ibus_conn, msg, NULL)) { dbus->connection_flush(ibus_conn); } dbus->message_unref(msg); @@ -642,10 +659,10 @@ SDL_IBus_PumpEvents(void) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); - if(IBus_CheckConnection(dbus)){ + if (IBus_CheckConnection(dbus)) { dbus->connection_read_write(ibus_conn, 0); - while(dbus->connection_dispatch(ibus_conn) == DBUS_DISPATCH_DATA_REMAINS){ + while (dbus->connection_dispatch(ibus_conn) == DBUS_DISPATCH_DATA_REMAINS) { /* Do nothing, actual work happens in IBus_MessageFilter */ } } diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index f0bd5b8d1..0518cc75b 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -364,15 +364,33 @@ GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) return SDL_TRUE; } +static SDL_bool +JoystickAlreadyKnown(IOHIDDeviceRef ioHIDDeviceObject) +{ + recDevice *i; + for (i = gpDeviceList; i != NULL; i = i->pNext) { + if (i->deviceRef == ioHIDDeviceObject) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + static void JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) { + recDevice *device; + if (res != kIOReturnSuccess) { return; } - recDevice *device = (recDevice *) SDL_calloc(1, sizeof(recDevice)); + if (JoystickAlreadyKnown(ioHIDDeviceObject)) { + return; /* IOKit sent us a duplicate. */ + } + + device = (recDevice *) SDL_calloc(1, sizeof(recDevice)); if (!device) { SDL_OutOfMemory(); diff --git a/src/main/windows/version.rc b/src/main/windows/version.rc index 2b7e2ddee..3a461276e 100644 --- a/src/main/windows/version.rc +++ b/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,3,0 - PRODUCTVERSION 2,0,3,0 + FILEVERSION 2,0,4,0 + PRODUCTVERSION 2,0,4,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 0, 3, 0\0" + VALUE "FileVersion", "2, 0, 4, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright © 2014 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 0, 3, 0\0" + VALUE "ProductVersion", "2, 0, 4, 0\0" END END BLOCK "VarFileInfo" diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index c43739ec8..ecd0d531f 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1429,6 +1429,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, format, type, temp_pixels); if (GL_CheckError("glReadPixels()", renderer) < 0) { + SDL_free(temp_pixels); return -1; } diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index e151d2018..fcc48c6d5 100644 --- a/src/video/SDL_bmp.c +++ b/src/video/SDL_bmp.c @@ -85,15 +85,17 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) int bmpPitch; int i, pad; SDL_Surface *surface; - Uint32 Rmask; - Uint32 Gmask; - Uint32 Bmask; - Uint32 Amask; + Uint32 Rmask = 0; + Uint32 Gmask = 0; + Uint32 Bmask = 0; + Uint32 Amask = 0; SDL_Palette *palette; Uint8 *bits; Uint8 *top, *end; SDL_bool topDown; int ExpandBMP; + SDL_bool haveRGBMasks = SDL_FALSE; + SDL_bool haveAlphaMask = SDL_FALSE; SDL_bool correctAlpha = SDL_FALSE; /* The Win32 BMP file header (14 bytes) */ @@ -144,15 +146,14 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) /* Read the Win32 BITMAPINFOHEADER */ biSize = SDL_ReadLE32(src); - if (biSize == 12) { + if (biSize == 12) { /* really old BITMAPCOREHEADER */ biWidth = (Uint32) SDL_ReadLE16(src); biHeight = (Uint32) SDL_ReadLE16(src); /* biPlanes = */ SDL_ReadLE16(src); biBitCount = SDL_ReadLE16(src); biCompression = BI_RGB; - } else { - const unsigned int headerSize = 40; - + } else if (biSize >= 40) { /* some version of BITMAPINFOHEADER */ + Uint32 headerSize; biWidth = SDL_ReadLE32(src); biHeight = SDL_ReadLE32(src); /* biPlanes = */ SDL_ReadLE16(src); @@ -164,6 +165,54 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) biClrUsed = SDL_ReadLE32(src); /* biClrImportant = */ SDL_ReadLE32(src); + /* 64 == BITMAPCOREHEADER2, an incompatible OS/2 2.x extension. Skip this stuff for now. */ + if (biSize == 64) { + /* ignore these extra fields. */ + if (biCompression == BI_BITFIELDS) { + /* this value is actually huffman compression in this variant. */ + SDL_SetError("Compressed BMP files not supported"); + was_error = SDL_TRUE; + goto done; + } + } else { + /* This is complicated. If compression is BI_BITFIELDS, then + we have 3 DWORDS that specify the RGB masks. This is either + stored here in an BITMAPV2INFOHEADER (which only differs in + that it adds these RGB masks) and biSize >= 52, or we've got + these masks stored in the exact same place, but strictly + speaking, this is the bmiColors field in BITMAPINFO immediately + following the legacy v1 info header, just past biSize. */ + if (biCompression == BI_BITFIELDS) { + haveRGBMasks = SDL_TRUE; + Rmask = SDL_ReadLE32(src); + Gmask = SDL_ReadLE32(src); + Bmask = SDL_ReadLE32(src); + + /* ...v3 adds an alpha mask. */ + if (biSize >= 56) { /* BITMAPV3INFOHEADER; adds alpha mask */ + haveAlphaMask = SDL_TRUE; + Amask = SDL_ReadLE32(src); + } + } else { + /* the mask fields are ignored for v2+ headers if not BI_BITFIELD. */ + if (biSize >= 52) { /* BITMAPV2INFOHEADER; adds RGB masks */ + /*Rmask = */ SDL_ReadLE32(src); + /*Gmask = */ SDL_ReadLE32(src); + /*Bmask = */ SDL_ReadLE32(src); + } + if (biSize >= 56) { /* BITMAPV3INFOHEADER; adds alpha mask */ + /*Amask = */ SDL_ReadLE32(src); + } + } + + /* Insert other fields here; Wikipedia and MSDN say we're up to + v5 of this header, but we ignore those for now (they add gamma, + color spaces, etc). Ignoring the weird OS/2 2.x format, we + currently parse up to v3 correctly (hopefully!). */ + } + + /* skip any header bytes we didn't handle... */ + headerSize = (Uint32) (SDL_RWtell(src) - (fp_offset + 14)); if (biSize > headerSize) { SDL_RWseek(src, (biSize - headerSize), RW_SEEK_CUR); } @@ -194,80 +243,46 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) } /* We don't support any BMP compression right now */ - Rmask = Gmask = Bmask = Amask = 0; switch (biCompression) { case BI_RGB: /* If there are no masks, use the defaults */ - if (bfOffBits == (14 + biSize)) { - /* Default values for the BMP format */ - switch (biBitCount) { - case 15: - case 16: - Rmask = 0x7C00; - Gmask = 0x03E0; - Bmask = 0x001F; - break; - case 24: -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - Rmask = 0x000000FF; - Gmask = 0x0000FF00; - Bmask = 0x00FF0000; -#else - Rmask = 0x00FF0000; - Gmask = 0x0000FF00; - Bmask = 0x000000FF; -#endif - break; - case 32: - /* We don't know if this has alpha channel or not */ - correctAlpha = SDL_TRUE; - Amask = 0xFF000000; - Rmask = 0x00FF0000; - Gmask = 0x0000FF00; - Bmask = 0x000000FF; - break; - default: - break; - } - break; - } - /* Fall through -- read the RGB masks */ - - case BI_BITFIELDS: + SDL_assert(!haveRGBMasks); + SDL_assert(!haveAlphaMask); + /* Default values for the BMP format */ switch (biBitCount) { case 15: case 16: - Rmask = SDL_ReadLE32(src); - Gmask = SDL_ReadLE32(src); - Bmask = SDL_ReadLE32(src); + Rmask = 0x7C00; + Gmask = 0x03E0; + Bmask = 0x001F; + break; + case 24: +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + Rmask = 0x000000FF; + Gmask = 0x0000FF00; + Bmask = 0x00FF0000; +#else + Rmask = 0x00FF0000; + Gmask = 0x0000FF00; + Bmask = 0x000000FF; +#endif break; case 32: - Rmask = SDL_ReadLE32(src); - Gmask = SDL_ReadLE32(src); - Bmask = SDL_ReadLE32(src); - Amask = SDL_ReadLE32(src); - - /* ImageMagick seems to put out bogus masks here. Pick a default. */ - if ((Rmask == 0xFFFFFF) && (Gmask == 0xFFFFFF) && - (Bmask == 0xFFFFFF) && (Amask == 0xFFFFFF) ) { - Amask = 0xFF000000; - Rmask = 0x00FF0000; - Gmask = 0x0000FF00; - Bmask = 0x000000FF; - } else if ((Rmask == 0xFFFFFF00) && (Gmask == 0xFFFFFF00) && - (Bmask == 0xFFFFFF00) && (Amask == 0xFFFFFF00) ) { - /* argh, The Gimp seems to put out different bogus masks! */ - Amask = 0x000000FF; - Rmask = 0xFF000000; - Gmask = 0x00FF0000; - Bmask = 0x0000FF00; - } - + /* We don't know if this has alpha channel or not */ + correctAlpha = SDL_TRUE; + Amask = 0xFF000000; + Rmask = 0x00FF0000; + Gmask = 0x0000FF00; + Bmask = 0x000000FF; break; default: break; } break; + + case BI_BITFIELDS: + break; /* we handled this in the info header. */ + default: SDL_SetError("Compressed BMP files not supported"); was_error = SDL_TRUE; diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c index 97248bbc8..147c60a5b 100644 --- a/src/video/SDL_shape.c +++ b/src/video/SDL_shape.c @@ -128,6 +128,7 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec SDL_Color key; SDL_ShapeTree* result = (SDL_ShapeTree*)SDL_malloc(sizeof(SDL_ShapeTree)); SDL_Rect next = {0,0,0,0}; + for(y=dimensions.y;ykind = QuadShape; - /* These will stay the same. */ - next.w = dimensions.w / 2; - next.h = dimensions.h / 2; - /* These will change from recursion to recursion. */ + next.x = dimensions.x; next.y = dimensions.y; + next.w = halfwidth; + next.h = halfheight; result->data.children.upleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next); - next.x += next.w; - /* Unneeded: next.y = dimensions.y; */ + + next.x = dimensions.x + halfwidth; + next.w = dimensions.w - halfwidth; result->data.children.upright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next); + next.x = dimensions.x; - next.y += next.h; + next.w = halfwidth; + next.y = dimensions.y + halfheight; + next.h = dimensions.h - halfheight; result->data.children.downleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next); - next.x += next.w; - /* Unneeded: next.y = dimensions.y + dimensions.h /2; */ + + next.x = dimensions.x + halfwidth; + next.w = dimensions.w - halfwidth; result->data.children.downright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next); + return result; } } } + + /* If we never recursed, all the pixels in this quadrant have the same "value". */ result->kind = (last_opaque == SDL_TRUE ? OpaqueShape : TransparentShape); result->data.shape = dimensions; diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index f552cb5b9..8f05bb3e7 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -391,6 +391,9 @@ extern VideoBootStrap Wayland_bootstrap; #if SDL_VIDEO_DRIVER_NACL extern VideoBootStrap NACL_bootstrap; #endif +#if SDL_VIDEO_DRIVER_MX6 +extern VideoBootStrap MX6_bootstrap; +#endif extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 0c92a872d..be32928b4 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -95,6 +95,9 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_NACL &NACL_bootstrap, #endif +#if SDL_VIDEO_DRIVER_MX6 + &MX6_bootstrap, +#endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, #endif diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 5f460589e..b3025c4f2 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -27,6 +27,10 @@ /* We need this for IODisplayCreateInfoDictionary and kIODisplayOnlyPreferredName */ #include +/* We need this for CVDisplayLinkGetNominalOutputVideoRefreshPeriod */ +#include +#include + /* we need this for ShowMenuBar() and HideMenuBar(). */ #include @@ -114,7 +118,7 @@ CG_SetError(const char *prefix, CGDisplayErr result) } static SDL_bool -GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode) +GetDisplayMode(_THIS, const void *moderef, CVDisplayLinkRef link, SDL_DisplayMode *mode) { SDL_DisplayModeData *data; long width = 0; @@ -133,7 +137,7 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode) CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode); width = (long) CGDisplayModeGetWidth(vidmode); height = (long) CGDisplayModeGetHeight(vidmode); - refreshRate = (long) CGDisplayModeGetRefreshRate(vidmode); + refreshRate = (long) (CGDisplayModeGetRefreshRate(vidmode) + 0.5); if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { @@ -141,6 +145,9 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode) } else if (CFStringCompare(fmt, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { bpp = 16; + } else if (CFStringCompare(fmt, CFSTR(kIO30BitDirectPixels), + kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + bpp = 30; } else { bpp = 0; /* ignore 8-bit and such for now. */ } @@ -151,6 +158,7 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode) #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 if (!IS_SNOW_LEOPARD_OR_LATER()) { CFNumberRef number; + double refresh; CFDictionaryRef vidmode = (CFDictionaryRef) moderef; number = CFDictionaryGetValue(vidmode, kCGDisplayWidth); CFNumberGetValue(number, kCFNumberLongType, &width); @@ -159,15 +167,27 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode) number = CFDictionaryGetValue(vidmode, kCGDisplayBitsPerPixel); CFNumberGetValue(number, kCFNumberLongType, &bpp); number = CFDictionaryGetValue(vidmode, kCGDisplayRefreshRate); - CFNumberGetValue(number, kCFNumberLongType, &refreshRate); + CFNumberGetValue(number, kCFNumberDoubleType, &refresh); + refreshRate = (long) (refresh + 0.5); } #endif + /* CGDisplayModeGetRefreshRate returns 0 for many non-CRT displays. */ + if (refreshRate == 0 && link != NULL) { + CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link); + if ((time.flags & kCVTimeIsIndefinite) == 0 && time.timeValue != 0) { + refreshRate = (long) ((time.timeScale / (double) time.timeValue) + 0.5); + } + } + mode->format = SDL_PIXELFORMAT_UNKNOWN; switch (bpp) { case 16: mode->format = SDL_PIXELFORMAT_ARGB1555; break; + case 30: + mode->format = SDL_PIXELFORMAT_ARGB2101010; + break; case 32: mode->format = SDL_PIXELFORMAT_ARGB8888; break; @@ -241,6 +261,7 @@ Cocoa_InitModes(_THIS) SDL_DisplayData *displaydata; SDL_DisplayMode mode; const void *moderef = NULL; + CVDisplayLinkRef link = NULL; if (pass == 0) { if (!CGDisplayIsMain(displays[i])) { @@ -277,16 +298,21 @@ Cocoa_InitModes(_THIS) } displaydata->display = displays[i]; + CVDisplayLinkCreateWithCGDisplay(displays[i], &link); + SDL_zero(display); /* this returns a stddup'ed string */ display.name = (char *)Cocoa_GetDisplayName(displays[i]); - if (!GetDisplayMode (_this, moderef, &mode)) { + if (!GetDisplayMode(_this, moderef, link, &mode)) { + CVDisplayLinkRelease(link); Cocoa_ReleaseDisplayMode(_this, moderef); SDL_free(display.name); SDL_free(displaydata); continue; } + CVDisplayLinkRelease(link); + display.desktop_mode = mode; display.current_mode = mode; display.driverdata = displaydata; @@ -328,13 +354,16 @@ Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display) #endif if (modes) { + CVDisplayLinkRef link = NULL; const CFIndex count = CFArrayGetCount(modes); CFIndex i; + CVDisplayLinkCreateWithCGDisplay(data->display, &link); + for (i = 0; i < count; i++) { const void *moderef = CFArrayGetValueAtIndex(modes, i); SDL_DisplayMode mode; - if (GetDisplayMode(_this, moderef, &mode)) { + if (GetDisplayMode(_this, moderef, link, &mode)) { if (IS_SNOW_LEOPARD_OR_LATER()) { CGDisplayModeRetain((CGDisplayModeRef) moderef); } @@ -342,6 +371,7 @@ Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display) } } + CVDisplayLinkRelease(link); Cocoa_ReleaseDisplayModeList(_this, modes); } } diff --git a/src/video/directfb/SDL_DirectFB_window.c b/src/video/directfb/SDL_DirectFB_window.c index be4969613..42064be4c 100644 --- a/src/video/directfb/SDL_DirectFB_window.c +++ b/src/video/directfb/SDL_DirectFB_window.c @@ -90,7 +90,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window) desc.height = windata->size.h; desc.pixelformat = dispdata->pixelformat; desc.surface_caps = DSCAPS_PREMULTIPLIED; -#if DIRECTFB_MAJOR_VERSION == 1 && DIRECTFB_MINOR_VERSION >= 4 +#if DIRECTFB_MAJOR_VERSION == 1 && DIRECTFB_MINOR_VERSION >= 6 if (window->flags & SDL_WINDOW_OPENGL) { desc.surface_caps |= DSCAPS_GL; } diff --git a/src/video/mx6/SDL_mx6events.c b/src/video/mx6/SDL_mx6events.c new file mode 100644 index 000000000..d024ce12d --- /dev/null +++ b/src/video/mx6/SDL_mx6events.c @@ -0,0 +1,45 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_MX6 + +#include "../../events/SDL_sysevents.h" +#include "../../events/SDL_events_c.h" +#include "../../events/SDL_keyboard_c.h" +#include "SDL_mx6video.h" +#include "SDL_mx6events_c.h" + +#ifdef SDL_INPUT_LINUXEV +#include "../../core/linux/SDL_evdev.h" +#endif + +void MX6_PumpEvents(_THIS) +{ +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Poll(); +#endif + +} + +#endif /* SDL_VIDEO_DRIVER_MX6 */ + diff --git a/src/video/mx6/SDL_mx6events_c.h b/src/video/mx6/SDL_mx6events_c.h new file mode 100644 index 000000000..570e28f76 --- /dev/null +++ b/src/video/mx6/SDL_mx6events_c.h @@ -0,0 +1,31 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_mx6events_c_h +#define _SDL_mx6events_c_h + +#include "SDL_mx6video.h" + +void MX6_PumpEvents(_THIS); +void MX6_EventInit(_THIS); +void MX6_EventQuit(_THIS); + +#endif /* _SDL_mx6events_c_h */ diff --git a/src/video/mx6/SDL_mx6opengles.c b/src/video/mx6/SDL_mx6opengles.c new file mode 100644 index 000000000..375a14a58 --- /dev/null +++ b/src/video/mx6/SDL_mx6opengles.c @@ -0,0 +1,209 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_MX6 && SDL_VIDEO_OPENGL_EGL + +#include "SDL_mx6opengles.h" +#include "SDL_loadso.h" +#include "SDL_mx6video.h" + +#define DEFAULT_OGL "libGL.so.1" +#define DEFAULT_EGL "libEGL.so.1" +#define DEFAULT_OGL_ES2 "libGLESv2.so.2" +#define DEFAULT_OGL_ES "libGLESv1_CM.so.1" + +#define LOAD_FUNC(NAME) \ +*((void**)&_this->egl_data->NAME) = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ +if (!_this->egl_data->NAME) \ +{ \ + return SDL_SetError("Could not retrieve EGL function " #NAME); \ +} + +#define LOAD_VIV_FUNC(NAME) \ +*((void**)&egl_viv_data->NAME) = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ +if (!egl_viv_data->NAME) \ +{ \ + return SDL_SetError("Could not retrieve EGL function " #NAME); \ +} + +/* EGL implementation of SDL OpenGL support */ + +int +MX6_GLES_LoadLibrary(_THIS, const char *egl_path) { + /* The definitions of egl_dll_handle and dll_handle were interchanged for some reason. + Just left them as is for compatibility */ + void *dll_handle = NULL, *egl_dll_handle = NULL; + char *path = NULL; + SDL_DisplayData *displaydata; + + if (_this->egl_data) { + return SDL_SetError("OpenGL ES context already created"); + } + + _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData)); + if (!_this->egl_data) { + return SDL_OutOfMemory(); + } + + egl_viv_data = (struct MX6_EGL_VivanteData *) SDL_calloc(1, sizeof(MX6_EGL_VivanteData)); + if (!egl_viv_data) { + return SDL_OutOfMemory(); + } + + path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); + if (path != NULL) { + egl_dll_handle = SDL_LoadObject(path); + } + + if (egl_dll_handle == NULL) { + if(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { + if (_this->gl_config.major_version > 1) { + path = DEFAULT_OGL_ES2; + egl_dll_handle = SDL_LoadObject(path); + } + else { + path = DEFAULT_OGL_ES; + egl_dll_handle = SDL_LoadObject(path); + } + } + else { + path = DEFAULT_OGL; + egl_dll_handle = SDL_LoadObject(path); + } + } + _this->egl_data->egl_dll_handle = egl_dll_handle; + + if (egl_dll_handle == NULL) { + return SDL_SetError("Could not initialize OpenGL / GLES library"); + } + + if (egl_path != NULL) { + dll_handle = SDL_LoadObject(egl_path); + } + + if (SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) { + if (dll_handle != NULL) { + SDL_UnloadObject(dll_handle); + } + path = SDL_getenv("SDL_VIDEO_EGL_DRIVER"); + if (path == NULL) { + path = DEFAULT_EGL; + } + dll_handle = SDL_LoadObject(path); + if (dll_handle == NULL) { + return SDL_SetError("Could not load EGL library"); + } + } + + _this->egl_data->dll_handle = dll_handle; + + /* Load new function pointers */ + LOAD_FUNC(eglGetDisplay); + LOAD_FUNC(eglInitialize); + LOAD_FUNC(eglTerminate); + LOAD_FUNC(eglGetProcAddress); + LOAD_FUNC(eglChooseConfig); + LOAD_FUNC(eglGetConfigAttrib); + LOAD_FUNC(eglCreateContext); + LOAD_FUNC(eglDestroyContext); + LOAD_FUNC(eglCreateWindowSurface); + LOAD_FUNC(eglDestroySurface); + LOAD_FUNC(eglMakeCurrent); + LOAD_FUNC(eglSwapBuffers); + LOAD_FUNC(eglSwapInterval); + LOAD_FUNC(eglWaitNative); + LOAD_FUNC(eglWaitGL); + LOAD_FUNC(eglBindAPI); + /* Functions from Vivante GPU SDK */ + LOAD_VIV_FUNC(fbGetDisplay); + LOAD_VIV_FUNC(fbGetDisplayByIndex); + LOAD_VIV_FUNC(fbGetDisplayGeometry); + LOAD_VIV_FUNC(fbGetDisplayInfo); + LOAD_VIV_FUNC(fbDestroyDisplay); + LOAD_VIV_FUNC(fbCreateWindow); + LOAD_VIV_FUNC(fbGetWindowGeometry); + LOAD_VIV_FUNC(fbGetWindowInfo); + LOAD_VIV_FUNC(fbDestroyWindow); + LOAD_VIV_FUNC(fbCreatePixmap); + LOAD_VIV_FUNC(fbCreatePixmapWithBpp); + LOAD_VIV_FUNC(fbGetPixmapGeometry); + LOAD_VIV_FUNC(fbGetPixmapInfo); + LOAD_VIV_FUNC(fbDestroyPixmap); + + displaydata = SDL_GetDisplayDriverData(0); + + _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(displaydata->native_display); + if (!_this->egl_data->egl_display) { + return SDL_SetError("Could not get EGL display"); + } + + if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { + return SDL_SetError("Could not initialize EGL"); + } + + displaydata->egl_display = _this->egl_data->egl_display; + + _this->gl_config.driver_loaded = 1; + + if (path) { + SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); + } else { + *_this->gl_config.driver_path = '\0'; + } + + return 0; +} + +void +MX6_GLES_UnloadLibrary(_THIS) +{ + if (_this->egl_data) { + if (_this->egl_data->egl_display) { + _this->egl_data->eglTerminate(_this->egl_data->egl_display); + _this->egl_data->egl_display = NULL; + } + + if (_this->egl_data->dll_handle) { + SDL_UnloadObject(_this->egl_data->dll_handle); + _this->egl_data->dll_handle = NULL; + } + if (_this->egl_data->egl_dll_handle) { + SDL_UnloadObject(_this->egl_data->egl_dll_handle); + _this->egl_data->egl_dll_handle = NULL; + } + + SDL_free(_this->egl_data); + _this->egl_data = NULL; + + SDL_free(egl_viv_data); + egl_viv_data = NULL; + } +} + +SDL_EGL_CreateContext_impl(MX6) +SDL_EGL_SwapWindow_impl(MX6) +SDL_EGL_MakeCurrent_impl(MX6) + +#endif /* SDL_VIDEO_DRIVER_MX6 && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/src/video/mx6/SDL_mx6opengles.h b/src/video/mx6/SDL_mx6opengles.h new file mode 100644 index 000000000..2cab8e9e3 --- /dev/null +++ b/src/video/mx6/SDL_mx6opengles.h @@ -0,0 +1,68 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef _SDL_mx6opengles_h +#define _SDL_mx6opengles_h + +#if SDL_VIDEO_DRIVER_MX6 && SDL_VIDEO_OPENGL_EGL + +#include "../SDL_sysvideo.h" +#include "../SDL_egl_c.h" + +typedef struct MX6_EGL_VivanteData +{ + EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplay) (void *context); + EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplayByIndex) (int DisplayIndex); + void(EGLAPIENTRY *fbGetDisplayGeometry) (EGLNativeDisplayType Display, int *Width, int *Height); + void(EGLAPIENTRY *fbGetDisplayInfo) (EGLNativeDisplayType Display, int *Width, int *Height, unsigned long *Physical, int *Stride, int *BitsPerPixel); + void(EGLAPIENTRY *fbDestroyDisplay) (EGLNativeDisplayType Display); + EGLNativeWindowType(EGLAPIENTRY *fbCreateWindow) (EGLNativeDisplayType Display, int X, int Y, int Width, int Height); + void(EGLAPIENTRY *fbGetWindowGeometry) (EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height); + void(EGLAPIENTRY *fbGetWindowInfo) (EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height, int *BitsPerPixel, unsigned int *Offset); + void(EGLAPIENTRY *fbDestroyWindow) (EGLNativeWindowType Window); + EGLNativePixmapType(EGLAPIENTRY *fbCreatePixmap) (EGLNativeDisplayType Display, int Width, int Height); + EGLNativePixmapType(EGLAPIENTRY *fbCreatePixmapWithBpp) (EGLNativeDisplayType Display, int Width, int Height, int BitsPerPixel); + void(EGLAPIENTRY *fbGetPixmapGeometry) (EGLNativePixmapType Pixmap, int *Width, int *Height); + void(EGLAPIENTRY *fbGetPixmapInfo) (EGLNativePixmapType Pixmap, int *Width, int *Height, int *BitsPerPixel, int *Stride, void **Bits); + void(EGLAPIENTRY *fbDestroyPixmap) (EGLNativePixmapType Pixmap); +} MX6_EGL_VivanteData; + +struct MX6_EGL_VivanteData *egl_viv_data; + +/* OpenGLES functions */ +#define MX6_GLES_GetAttribute SDL_EGL_GetAttribute +#define MX6_GLES_GetProcAddress SDL_EGL_GetProcAddress +#define MX6_GLES_SetSwapInterval SDL_EGL_SetSwapInterval +#define MX6_GLES_GetSwapInterval SDL_EGL_GetSwapInterval +#define MX6_GLES_DeleteContext SDL_EGL_DeleteContext + +extern int MX6_GLES_LoadLibrary(_THIS, const char *path); +extern void MX6_GLES_UnloadLibrary(_THIS); +extern SDL_GLContext MX6_GLES_CreateContext(_THIS, SDL_Window * window); +extern void MX6_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int MX6_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); + +#endif /* SDL_VIDEO_DRIVER_MX6 && SDL_VIDEO_OPENGL_EGL */ + +#endif /* _SDL_mx6opengles_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/mx6/SDL_mx6video.c b/src/video/mx6/SDL_mx6video.c new file mode 100644 index 000000000..2f9c04f2a --- /dev/null +++ b/src/video/mx6/SDL_mx6video.c @@ -0,0 +1,325 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_MX6 + +/* SDL internals */ +#include "../SDL_sysvideo.h" +#include "SDL_version.h" +#include "SDL_syswm.h" +#include "SDL_loadso.h" +#include "SDL_events.h" + +#ifdef SDL_INPUT_LINUXEV +#include "../../core/linux/SDL_evdev.h" +#endif + +#include "SDL_mx6video.h" +#include "SDL_mx6events_c.h" +#include "SDL_mx6opengles.h" + +static int +MX6_Available(void) +{ + return 1; +} + +static void +MX6_Destroy(SDL_VideoDevice * device) +{ + if (device->driverdata != NULL) { + device->driverdata = NULL; + } +} + +static SDL_VideoDevice * +MX6_Create() +{ + SDL_VideoDevice *device; + SDL_VideoData *phdata; + + /* Initialize SDL_VideoDevice structure */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device == NULL) { + SDL_OutOfMemory(); + return NULL; + } + + /* Initialize internal data */ + phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + if (phdata == NULL) { + SDL_OutOfMemory(); + SDL_free(device); + return NULL; + } + + device->driverdata = phdata; + + /* Setup amount of available displays and current display */ + device->num_displays = 0; + + /* Set device free function */ + device->free = MX6_Destroy; + + /* Setup all functions which we can handle */ + device->VideoInit = MX6_VideoInit; + device->VideoQuit = MX6_VideoQuit; + device->GetDisplayModes = MX6_GetDisplayModes; + device->SetDisplayMode = MX6_SetDisplayMode; + device->CreateWindow = MX6_CreateWindow; + device->CreateWindowFrom = MX6_CreateWindowFrom; + device->SetWindowTitle = MX6_SetWindowTitle; + device->SetWindowIcon = MX6_SetWindowIcon; + device->SetWindowPosition = MX6_SetWindowPosition; + device->SetWindowSize = MX6_SetWindowSize; + device->ShowWindow = MX6_ShowWindow; + device->HideWindow = MX6_HideWindow; + device->RaiseWindow = MX6_RaiseWindow; + device->MaximizeWindow = MX6_MaximizeWindow; + device->MinimizeWindow = MX6_MinimizeWindow; + device->RestoreWindow = MX6_RestoreWindow; + device->SetWindowGrab = MX6_SetWindowGrab; + device->DestroyWindow = MX6_DestroyWindow; + device->GetWindowWMInfo = MX6_GetWindowWMInfo; + + device->GL_LoadLibrary = MX6_GLES_LoadLibrary; + device->GL_GetProcAddress = MX6_GLES_GetProcAddress; + device->GL_UnloadLibrary = MX6_GLES_UnloadLibrary; + device->GL_CreateContext = MX6_GLES_CreateContext; + device->GL_MakeCurrent = MX6_GLES_MakeCurrent; + device->GL_SetSwapInterval = MX6_GLES_SetSwapInterval; + device->GL_GetSwapInterval = MX6_GLES_GetSwapInterval; + device->GL_SwapWindow = MX6_GLES_SwapWindow; + device->GL_DeleteContext = MX6_GLES_DeleteContext; + + device->PumpEvents = MX6_PumpEvents; + + return device; +} + +VideoBootStrap MX6_bootstrap = { + "MX6", + "Freescale i.MX6 Video Driver", + MX6_Available, + MX6_Create +}; + +static void +MX6_UpdateDisplay(_THIS) +{ + SDL_VideoDisplay *display = &_this->displays[0]; + SDL_DisplayData *data = (SDL_DisplayData*)display->driverdata; + EGLNativeDisplayType native_display = egl_viv_data->fbGetDisplayByIndex(0); + SDL_DisplayMode current_mode; + int pitch, bpp; + unsigned long pixels; + + /* Store the native EGL display */ + data->native_display = native_display; + + SDL_zero(current_mode); + egl_viv_data->fbGetDisplayInfo(native_display, ¤t_mode.w, ¤t_mode.h, &pixels, &pitch, &bpp); + /* FIXME: How do we query refresh rate? */ + current_mode.refresh_rate = 60; + + switch (bpp) + { + default: /* Is another format used? */ + case 16: + current_mode.format = SDL_PIXELFORMAT_RGB565; + break; + } + + display->desktop_mode = current_mode; + display->current_mode = current_mode; +} + +/*****************************************************************************/ +/* SDL Video and Display initialization/handling functions */ +/*****************************************************************************/ +int +MX6_VideoInit(_THIS) +{ + SDL_VideoDisplay display; + SDL_DisplayMode current_mode; + SDL_DisplayData *data; + + data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData)); + if (data == NULL) { + return SDL_OutOfMemory(); + } + + SDL_zero(display); + SDL_zero(current_mode); + display.desktop_mode = current_mode; + display.current_mode = current_mode; + display.driverdata = data; + SDL_AddVideoDisplay(&display); + + if (SDL_GL_LoadLibrary(NULL) < 0) { + return -1; + } + MX6_UpdateDisplay(_this); + +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Init(); +#endif + + return 1; +} + +void +MX6_VideoQuit(_THIS) +{ +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Quit(); +#endif +} + +void +MX6_GetDisplayModes(_THIS, SDL_VideoDisplay * display) +{ + /* Only one display mode available, the current one */ + SDL_AddDisplayMode(display, &display->current_mode); +} + +int +MX6_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) +{ + return 0; +} + +int +MX6_CreateWindow(_THIS, SDL_Window * window) +{ + SDL_DisplayData *displaydata; + SDL_WindowData *wdata; + + displaydata = SDL_GetDisplayDriverData(0); + + /* Allocate window internal data */ + wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); + if (wdata == NULL) { + return SDL_OutOfMemory(); + } + + /* Setup driver data for this window */ + window->driverdata = wdata; + window->flags |= SDL_WINDOW_OPENGL; + + if (!_this->egl_data) { + return -1; + } + + wdata->native_window = egl_viv_data->fbCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h); + if (!wdata->native_window) { + return SDL_SetError("MX6: Can't create native window"); + } + + wdata->egl_surface = SDL_EGL_CreateSurface(_this, wdata->native_window); + if (wdata->egl_surface == EGL_NO_SURFACE) { + return SDL_SetError("MX6: Can't create EGL surface"); + } + + /* Window has been successfully created */ + return 0; +} + +void +MX6_DestroyWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *wdata; + + wdata = window->driverdata; + if (wdata) { + SDL_EGL_DestroySurface(_this, wdata->egl_surface); + } + + if (egl_viv_data) { + egl_viv_data->fbDestroyWindow(wdata->native_window); + } +} + +int +MX6_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) +{ + return -1; +} + +void +MX6_SetWindowTitle(_THIS, SDL_Window * window) +{ +} +void +MX6_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) +{ +} +void +MX6_SetWindowPosition(_THIS, SDL_Window * window) +{ +} +void +MX6_SetWindowSize(_THIS, SDL_Window * window) +{ +} +void +MX6_ShowWindow(_THIS, SDL_Window * window) +{ +} +void +MX6_HideWindow(_THIS, SDL_Window * window) +{ +} +void +MX6_RaiseWindow(_THIS, SDL_Window * window) +{ +} +void +MX6_MaximizeWindow(_THIS, SDL_Window * window) +{ +} +void +MX6_MinimizeWindow(_THIS, SDL_Window * window) +{ +} +void +MX6_RestoreWindow(_THIS, SDL_Window * window) +{ +} +void +MX6_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) +{ +} + +/*****************************************************************************/ +/* SDL Window Manager function */ +/*****************************************************************************/ +SDL_bool +MX6_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) +{ + return SDL_TRUE; +} + +#endif /* SDL_VIDEO_DRIVER_MX6 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/mx6/SDL_mx6video.h b/src/video/mx6/SDL_mx6video.h new file mode 100644 index 000000000..7827337f8 --- /dev/null +++ b/src/video/mx6/SDL_mx6video.h @@ -0,0 +1,76 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2014 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef __SDL_MX6VIDEO_H__ +#define __SDL_MX6VIDEO_H__ + +#include "../../SDL_internal.h" +#include "../SDL_sysvideo.h" + +#include "SDL_egl.h" + +typedef struct SDL_VideoData +{ +} SDL_VideoData; + +typedef struct SDL_DisplayData +{ + EGLNativeDisplayType native_display; + EGLDisplay egl_display; +} SDL_DisplayData; + +typedef struct SDL_WindowData +{ + EGLNativeWindowType native_window; + EGLSurface egl_surface; +} SDL_WindowData; + +/****************************************************************************/ +/* SDL_VideoDevice functions declaration */ +/****************************************************************************/ + +/* Display and window functions */ +int MX6_VideoInit(_THIS); +void MX6_VideoQuit(_THIS); +void MX6_GetDisplayModes(_THIS, SDL_VideoDisplay * display); +int MX6_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); +int MX6_CreateWindow(_THIS, SDL_Window * window); +int MX6_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); +void MX6_SetWindowTitle(_THIS, SDL_Window * window); +void MX6_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); +void MX6_SetWindowPosition(_THIS, SDL_Window * window); +void MX6_SetWindowSize(_THIS, SDL_Window * window); +void MX6_ShowWindow(_THIS, SDL_Window * window); +void MX6_HideWindow(_THIS, SDL_Window * window); +void MX6_RaiseWindow(_THIS, SDL_Window * window); +void MX6_MaximizeWindow(_THIS, SDL_Window * window); +void MX6_MinimizeWindow(_THIS, SDL_Window * window); +void MX6_RestoreWindow(_THIS, SDL_Window * window); +void MX6_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); +void MX6_DestroyWindow(_THIS, SDL_Window * window); + +/* Window manager function */ +SDL_bool MX6_GetWindowWMInfo(_THIS, SDL_Window * window, + struct SDL_SysWMinfo *info); + +#endif /* __SDL_MX6VIDEO_H__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 5437d7011..05621e0ca 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -643,6 +643,7 @@ X11_GetWindowTitle(_THIS, Window xwindow) &items_read, &items_left, &propdata); if (status == Success && propdata) { title = SDL_iconv_string("UTF-8", "", SDL_static_cast(char*, propdata), items_read+1); + X11_XFree(propdata); } else { title = SDL_strdup(""); } diff --git a/test/testdrawchessboard.c b/test/testdrawchessboard.c index 3e6179e14..2456b6909 100644 --- a/test/testdrawchessboard.c +++ b/test/testdrawchessboard.c @@ -14,25 +14,22 @@ /* Sample program: Draw a Chess Board by using SDL_CreateSoftwareRenderer API */ -#include -#include - #include "SDL.h" void DrawChessBoard(SDL_Renderer * renderer) { - int row = 0,coloum = 0,x = 0; + int row = 0,column = 0,x = 0; SDL_Rect rect, darea; /* Get the Size of drawing surface */ SDL_RenderGetViewport(renderer, &darea); - for(row; row < 8; row++) + for( ; row < 8; row++) { - coloum = row%2; - x = x + coloum; - for(coloum; coloum < 4+(row%2); coloum++) + column = row%2; + x = x + column; + for( ; column < 4+(row%2); column++) { SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF); diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index f5ef6fb0b..10046bd39 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -28,51 +28,6 @@ #define SCREEN_HEIGHT 317 #endif -static const char * -ControllerAxisName(const SDL_GameControllerAxis axis) -{ - switch (axis) - { - #define AXIS_CASE(ax) case SDL_CONTROLLER_AXIS_##ax: return #ax - AXIS_CASE(INVALID); - AXIS_CASE(LEFTX); - AXIS_CASE(LEFTY); - AXIS_CASE(RIGHTX); - AXIS_CASE(RIGHTY); - AXIS_CASE(TRIGGERLEFT); - AXIS_CASE(TRIGGERRIGHT); - #undef AXIS_CASE - default: return "???"; - } -} - -static const char * -ControllerButtonName(const SDL_GameControllerButton button) -{ - switch (button) - { - #define BUTTON_CASE(btn) case SDL_CONTROLLER_BUTTON_##btn: return #btn - BUTTON_CASE(INVALID); - BUTTON_CASE(A); - BUTTON_CASE(B); - BUTTON_CASE(X); - BUTTON_CASE(Y); - BUTTON_CASE(BACK); - BUTTON_CASE(GUIDE); - BUTTON_CASE(START); - BUTTON_CASE(LEFTSTICK); - BUTTON_CASE(RIGHTSTICK); - BUTTON_CASE(LEFTSHOULDER); - BUTTON_CASE(RIGHTSHOULDER); - BUTTON_CASE(DPAD_UP); - BUTTON_CASE(DPAD_DOWN); - BUTTON_CASE(DPAD_LEFT); - BUTTON_CASE(DPAD_RIGHT); - #undef BUTTON_CASE - default: return "???"; - } -} - static SDL_Texture * LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) { diff --git a/test/teststreaming.c b/test/teststreaming.c index 3b6bbda90..e8bb1f21f 100644 --- a/test/teststreaming.c +++ b/test/teststreaming.c @@ -27,27 +27,27 @@ #define MOOSEFRAMES_COUNT 10 SDL_Color MooseColors[84] = { - {49, 49, 49}, {66, 24, 0}, {66, 33, 0}, {66, 66, 66}, - {66, 115, 49}, {74, 33, 0}, {74, 41, 16}, {82, 33, 8}, - {82, 41, 8}, {82, 49, 16}, {82, 82, 82}, {90, 41, 8}, - {90, 41, 16}, {90, 57, 24}, {99, 49, 16}, {99, 66, 24}, - {99, 66, 33}, {99, 74, 33}, {107, 57, 24}, {107, 82, 41}, - {115, 57, 33}, {115, 66, 33}, {115, 66, 41}, {115, 74, 0}, - {115, 90, 49}, {115, 115, 115}, {123, 82, 0}, {123, 99, 57}, - {132, 66, 41}, {132, 74, 41}, {132, 90, 8}, {132, 99, 33}, - {132, 99, 66}, {132, 107, 66}, {140, 74, 49}, {140, 99, 16}, - {140, 107, 74}, {140, 115, 74}, {148, 107, 24}, {148, 115, 82}, - {148, 123, 74}, {148, 123, 90}, {156, 115, 33}, {156, 115, 90}, - {156, 123, 82}, {156, 132, 82}, {156, 132, 99}, {156, 156, 156}, - {165, 123, 49}, {165, 123, 90}, {165, 132, 82}, {165, 132, 90}, - {165, 132, 99}, {165, 140, 90}, {173, 132, 57}, {173, 132, 99}, - {173, 140, 107}, {173, 140, 115}, {173, 148, 99}, {173, 173, 173}, - {181, 140, 74}, {181, 148, 115}, {181, 148, 123}, {181, 156, 107}, - {189, 148, 123}, {189, 156, 82}, {189, 156, 123}, {189, 156, 132}, - {189, 189, 189}, {198, 156, 123}, {198, 165, 132}, {206, 165, 99}, - {206, 165, 132}, {206, 173, 140}, {206, 206, 206}, {214, 173, 115}, - {214, 173, 140}, {222, 181, 148}, {222, 189, 132}, {222, 189, 156}, - {222, 222, 222}, {231, 198, 165}, {231, 231, 231}, {239, 206, 173} + {49, 49, 49, 255}, {66, 24, 0, 255}, {66, 33, 0, 255}, {66, 66, 66, 255}, + {66, 115, 49, 255}, {74, 33, 0, 255}, {74, 41, 16, 255}, {82, 33, 8, 255}, + {82, 41, 8, 255}, {82, 49, 16, 255}, {82, 82, 82, 255}, {90, 41, 8, 255}, + {90, 41, 16, 255}, {90, 57, 24, 255}, {99, 49, 16, 255}, {99, 66, 24, 255}, + {99, 66, 33, 255}, {99, 74, 33, 255}, {107, 57, 24, 255}, {107, 82, 41, 255}, + {115, 57, 33, 255}, {115, 66, 33, 255}, {115, 66, 41, 255}, {115, 74, 0, 255}, + {115, 90, 49, 255}, {115, 115, 115, 255}, {123, 82, 0, 255}, {123, 99, 57, 255}, + {132, 66, 41, 255}, {132, 74, 41, 255}, {132, 90, 8, 255}, {132, 99, 33, 255}, + {132, 99, 66, 255}, {132, 107, 66, 255}, {140, 74, 49, 255}, {140, 99, 16, 255}, + {140, 107, 74, 255}, {140, 115, 74, 255}, {148, 107, 24, 255}, {148, 115, 82, 255}, + {148, 123, 74, 255}, {148, 123, 90, 255}, {156, 115, 33, 255}, {156, 115, 90, 255}, + {156, 123, 82, 255}, {156, 132, 82, 255}, {156, 132, 99, 255}, {156, 156, 156, 255}, + {165, 123, 49, 255}, {165, 123, 90, 255}, {165, 132, 82, 255}, {165, 132, 90, 255}, + {165, 132, 99, 255}, {165, 140, 90, 255}, {173, 132, 57, 255}, {173, 132, 99, 255}, + {173, 140, 107, 255}, {173, 140, 115, 255}, {173, 148, 99, 255}, {173, 173, 173, 255}, + {181, 140, 74, 255}, {181, 148, 115, 255}, {181, 148, 123, 255}, {181, 156, 107, 255}, + {189, 148, 123, 255}, {189, 156, 82, 255}, {189, 156, 123, 255}, {189, 156, 132, 255}, + {189, 189, 189, 255}, {198, 156, 123, 255}, {198, 165, 132, 255}, {206, 165, 99, 255}, + {206, 165, 132, 255}, {206, 173, 140, 255}, {206, 206, 206, 255}, {214, 173, 115, 255}, + {214, 173, 140, 255}, {222, 181, 148, 255}, {222, 189, 132, 255}, {222, 189, 156, 255}, + {222, 222, 222, 255}, {231, 198, 165, 255}, {231, 231, 231, 255}, {239, 206, 173, 255} }; Uint8 MooseFrames[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE];