src/cpuinfo


Log

Author Commit Date CI Message
Pierre Wendling 65527537 2021-03-30T04:32:39 N3DS port (squashed) A dedicated renderer using Citro3D would likely allow for better much better graphical performances.
Pierre Wendling 46a13ad9 2022-09-18T12:35:32 N3DS: NEON is likely not supported.
Brad Smith 97239176 2022-06-25T23:33:53 Use proper header for OpenBSD PPC CPU detection
chalonverse 3b191580 2022-06-27T17:19:39 Windows GDK Support (#5830) * Added GDK * Simplfied checks in SDL_config_wingdk.h * Added testgdk sample * Added GDK readme * Fixed error in merge of SDL_windows.h * Additional GDK fixes * OpenWatcom should not export _SDL_GDKGetTaskQueue * Formatting fixes * Moved initialization code into SDL_GDKRunApp
Francisco Javier Trujillo Mata 7343ece8 2022-06-06T00:05:43 Define available PS2 RAM
yuanhecai 17f63e53 2022-05-31T19:10:05 Add loongarch support LSX and LASX are enabled by default if compiler supports them.
Pierre Wendling 501a4991 2022-05-05T18:44:32 Add clang-format on/off comments where necessary. Comments were added in places where INDENT-ON/OFF comments are. Places like stdlib's asm don't need it as clang-format doesn't try to indent it.
Simon McVittie 2a794801 2022-05-09T14:58:51 cpuinfo: Check for overflow in SIMD allocation If the size to be allocated is very large and untrusted, then adding the padding etc. might be enough to cause unsigned overflow, after which a very small amount of memory will be allocated. Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie cf1daafa 2022-05-09T18:48:46 cpuinfo: Set padding to 0 if none is needed It'll be simpler to use overflow detection after this refactor. Signed-off-by: Simon McVittie <smcv@collabora.com>
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Sylvain 0ef9d266 2021-11-22T16:24:19 cpuinfo: remove malloc from comments
Sylvain d31251b0 2021-11-21T22:30:48 use SDL's functions version inplace of libc version
Sam Lantinga c2dd50a9 2021-11-12T08:28:02 Fixed whitespace
pkubaj 9886d897 2021-09-21T16:23:48 Fix AltiVec detection on FreeBSD The previous code was not correct, because there's no PPC_FEATURE_HAS_ALTIVEC MIB. Instead, elf vector check should be done.
Sam Lantinga bf97c5a2 2021-09-08T14:47:40 Make sure SDL file descriptors don't leak into child processes
Jessica Clarke 02daab87 2021-07-29T18:09:38 Fix pointer provenance in SDL_SIMDRealloc This is needed to support CHERI, and thus Arm's experimental Morello prototype, where pointers are implemented using unforgeable capabilities that include bounds and permissions metadata to provide fine-grained spatial and referential memory safety, as well as revocation by sweeping memory to provide heap temporal memory safety. The C standard does not guarantee that if two pointers compare equal they are the same pointer, as C pointers have a notion of provenance, and compilers have been known to exploit this during optimisation. For CHERI, this becomes even more important, as in-place expansion can result in realloc returning a capability to the same address but with increased capability bounds, and so reusing the old capability will trap trying to access outside the bounds of the original allocation. In the case that ptr == mem, memdiff and ptrdiff should still be equal, so the only overhead is a small amount of pointer arithmetic and a store of the new pointer (which is required per the C standard in order to not be undefined behaviour when next loaded). This also fixes the calculation of oldmem to use uintptr_t rather than size_t as casting the pointer to size_t on CHERI will strip the capability metadata, including the validity tag, with the subsequent cast back to void * resulting in a null-derived capability whose validity tag is clear and thus cannot be dereferenced without trapping.
Ivan Epifanov 656eb7df 2021-06-23T14:35:36 Vite: return system installed memory
Ivan Epifanov 2d64e37e 2020-11-02T18:09:43 Initial rebase of xerpi's port
Ozkan Sezer c1c4f274 2021-03-04T18:27:32 cpuinfo: updated xgetbv call for windows clang-cl. from a patchset by Vladislav Dmitrievich Turbanov: https://github.com/libsdl-org/SDL/pull/4062
Nicolas Noble 61586216 2021-03-02T21:39:38 Update cpuid code for clang-cl The clang-cl compiler defines `__llvm__` but not `__GNUC__`. The `__cpuid` intrinsic doesn't seem to exist with clang-cl, so the code won't link properly. The `__GNUC__` versions of these functions will work properly on Windows with clang-cl.
Ozkan Sezer e561ce3a 2021-02-25T01:40:02 SDL_cpuinfo.c: replaced gcc i386 checks with __i386__ .
Cameron Cawley 98bf79cf 2021-02-16T18:13:15 Minor improvements for CPU detection on ARM
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga 67f0b9b8 2020-12-28T20:58:47 Fixed bug 5418 - Add system features detection for Elbrus (E2K) Ivan Kuzmenko MCST Elbrus 2000 (E2K, https://en.wikipedia.org/wiki/Elbrus_2000) is a russian processor architecture based on VLIW/EPIC instruction set (like Intel Itanium (IA-64) architecture). Architecture has half native / half software support of most Intel/AMD SIMD (e.g. MMX/SSE/SSE2/SSE3/SSSE3/SSE4.1/SSE4.2/AES/AVX/AVX2 & 3DNow!/SSE4a/XOP/FMA4). It also has built-in x86/x86_64 <-> e2k binary translators (RTC, http://www.mcst.ru/rtc and Lintel, http://www.mcst.ru/lintel) that can run code for x86/x86_64 architecture (Transmeta did something similiar with their Crusoe series) with SIMD extensions support. Attached patch allows SDL2 to detect extensions supported by E2K like MMX, 3dNOW!, AVX etc. (test/testplatform log: https://termbin.com/7qs3).
Sam Lantinga ee180efd 2020-12-20T12:08:49 Fixed bug 5406 - Upstreaming DragonFlyBSD changes from DeltaPorts (patch from David Carlier)
Ozkan Sezer e91153f2 2020-12-20T03:03:21 fix non-ARM h/w on FreeBSD builds (bug #5405, patch from David Carlier.)
Sam Lantinga 6bd4c717 2020-12-17T21:41:23 Fixed bug 5402 - ARM support little update proposal David Carlier No fix but mostly an update for ARM architecture.
Dylan Fan 02de8200 2020-11-09T20:36:35 Add Zhaoxin processor support CPU Vendor ID "Shanghai" and "CentaurHauls" belongs to Zhaoxin. Background: Shanghai Zhaoxin Semiconductor Co., Ltd ("Zhaoxin") , established in 2013, headquartered in Zhangjiang, Shanghai, China. Zhaoxin aims at providing general-purpose x86 processors. Related Zhaoxin Linux Kernel patch can be found at https://lore.kernel.org/lkml/01042674b2f741b2aed1f797359bdffb@zhaoxin.com Best regards.
Ozkan Sezer 34a82fca 2020-10-10T20:50:02 SDL_cpuinfo.c (OS2): undefine HAVE_SYSCTLBYNAME
Sylvain Becker 4d1c2a18 2020-09-07T19:00:21 Fix false compiler warning: initialize the variable 'memdiff'
Ozkan Sezer 49ec6558 2020-07-11T08:10:02 fix bug #5228 -- Add AltiVec detection for FreeBSD. thanks Piotr Kubaj.
Sam Lantinga c2b85305 2020-06-23T10:09:29 Fixed bug 5209 - cpuinfo recognize OpenBSD ARM Brad Smith OpenBSD/arm only supports ARMv7 and and not any CPUs that do not support NEON.
Ethan Lee 2aa8974f 2020-06-11T12:03:33 Add SDL_SIMDRealloc
Cameron Cawley 582f5706 2020-02-04T16:46:22 Improved CPU detection on ARM platforms
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 196f6998 2020-01-11T22:03:06 Fixed NEON detection on arm64 CPUs This probably breaks RISCOS, but we need a better fix from Cameron Cawley for this
Cameron Cawley 78ce18f5 2020-01-06T20:26:52 riscos: Add CPU feature detection
Sam Lantinga df728f85 2019-11-18T10:48:14 Fixed unused function warning on Android
Sylvain Becker 2dab79bc 2019-11-16T22:55:36 Fix crash when detecting SIMD
Sam Lantinga a63e93a1 2019-11-13T15:46:58 Supported Android and Apple hardware has ARM SIMD capability
Sylvain Becker 463bf5c2 2019-10-27T14:52:09 Android: fix compilation error of SDL_cpuinfo.c on android-r13b (bug 4365)
Ryan C. Gordon 6dffc5d4 2019-10-25T00:07:30 cpuinfo: Remove incorrect #warning when building for non-ARM architectures.
Ben Avison 6a6a0528 2019-10-24T21:12:08 ARM: Create configure option --enable-arm-simd to govern assembly optimizations
Ryan C. Gordon 9ececeea 2019-10-20T22:17:59 cpuinfo: Use a better default alignment value (thanks, Simon!). Fixes Bugzilla #4835.
Sam Lantinga 8728ce44 2019-06-08T14:54:37 Fixed bug 4557 - SDL_SIMDAlloc and *Free should be in the public interface Martin Gerhardy These functions are really useful and should get exposed imo.
Jinke Fan abd1dd66 2019-05-15T19:54:36 Add Hygon Dhyana processor support Background: Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture between AMD and Haiguang Information Technology Co.,Ltd., aims at providing high performance x86 processor for China server market. Its first generation processor codename is Dhyana, which originates from AMD technology and shares most of the architecture with AMD's family 17h, but with different CPU Vendor ID("HygonGenuine")/Family series number(Family 18h). Related Hygon kernel patch can be found on: http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn Best regards.
Sam Lantinga b2e76d86 2019-03-19T16:52:09 Fixed Windows RT build
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sylvain Becker 09b46204 2018-12-04T16:50:31 Windows: NEON detection and intrinsic includes on Visual Studio Visual Studio doesn't define __ARM_ARCH nor _ARM_NEON, but _M_ARM and _M_ARM64, so SDL_HasNEON() was bypassed. PF_ARM_NEON_INSTRUCTIONS_AVAILABLE doesn't see to be defined (but still works when defined as 19).
Ryan C. Gordon 3323b355 2018-12-01T12:19:11 android: use cpufeatures to support SDL_HasNEON() (thanks, Sylvain!). Fixes Bugzilla #4406.
Sam Lantinga 7df0f4fd 2018-09-27T14:56:29 Fixed bug 4277 - warnings patch Sylvain Patch a few warnings when using: -Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command They are automatically enabled with -Wall
Ryan C. Gordon 4df859c5 2018-05-21T11:35:42 cpuinfo: Added SDL_HasAVX512F(). This checks for the "foundation" AVX-512 instructions (that all AVX-512 compatible CPUs support).
Ryan C. Gordon 8543ad7d 2018-05-21T11:34:57 cpuinfo: Added some internal SIMD-aligned allocation functions. Fixes Bugzilla #4150 (sort of).
Ryan C. Gordon 4718791f 2018-05-14T00:03:39 cpuinfo: Make CPU flags easier to read and add to.
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga 20364769 2017-11-11T17:21:47 Fixed typo in comment
Sam Lantinga b821ded9 2017-08-21T13:00:40 SDL_cpuinfo.c: add os/2 support to SDL_GetCPUCount() and SDL_GetSystemRAM().
Ryan C. Gordon adecda50 2017-08-16T21:31:03 cpuinfo: Add SDL_HasNEON() support for ARM-based QNX.
Sam Lantinga c1802ef6 2017-03-06T21:25:06 Fixed compile error with gcc -std=c99
Ryan C. Gordon ca0bf151 2017-03-03T16:38:17 Fix some more compiler warnings on armcc.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Ryan C. Gordon a949882a 2016-11-21T20:35:59 cpuinfo: fix SDL_HasNEON() on older iOS devices, fixed C++ comment.
Ryan C. Gordon 32cb3494 2016-11-17T17:03:43 cpuinfo: patched to compile for getauxval() path.
Ryan C. Gordon 0b33a118 2016-11-17T16:10:32 cpuinfo: more patching for Android. Legacy platform targets are a pain.
Ryan C. Gordon a298e563 2016-11-17T16:04:00 cpuinfo: Patched to compile on Android, Linux.
Ryan C. Gordon e8f4b7c4 2016-11-17T16:01:59 cpuinfo: patched to compile. Nothing quite like experimentation via Buildbot! :/
Ryan C. Gordon 74eb78dc 2016-11-17T15:57:58 cpuinfo: more work on SDL_HasNEON().
Ryan C. Gordon db97c3d3 2016-11-17T01:41:56 cpuinfo: silence compiler warnings on non-Intel CPU architectures.
Ryan C. Gordon 66a36d56 2016-11-17T01:34:18 cpuinfo: disable NEON detection on Android for now. Will fix this properly soon.
Ryan C. Gordon 5c6b2ebf 2016-11-17T01:26:56 cpuinfo: more robust ARM preprocessor checks.
Ryan C. Gordon 35430a73 2016-11-17T01:15:16 cpuinfo: first attempt at SDL_HasNEON() implementation.
Ryan C. Gordon 7592b40b 2016-11-16T22:49:04 cpuinfo: Removed code duplication, cached CPUID details.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Ryan C. Gordon 696cd797 2015-12-29T02:32:47 NetBSD: fixed issues with cpuinfo and pthread_setname_np (thanks, Thomas!). Fixes Bugzilla #3176.
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
Ryan C. Gordon 16f3cbfc 2014-12-26T23:16:54 Cleaned up some compiler warnings.
Ryan C. Gordon fe40a172 2014-12-18T00:19:52 Initial merge of Emscripten port! With this commit, you can compile SDL2 with Emscripten ( http://emscripten.org/ ), and make your SDL-based C/C++ program into a web app. This port was due to the efforts of several people, including: Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jyl?nki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy. (Thanks, everyone!)
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
David Ludwig ff5caa17 2014-08-10T22:21:21 WinRT build fix for ARM platforms The _xgetbv intrinsic was being used in ARM builds of SDL/WinRT, which was leading to linker errors. This commit limits _xgetbv use to the platforms on which it is available, x86 and x64.
Sam Lantinga 454c4a01 2014-07-11T22:15:34 Fixed Visual Studio 2010 build
Sam Lantinga 6a1011ae 2014-07-11T22:14:14 Fixed build for arm platforms
Sam Lantinga eb1c6044 2014-07-11T22:02:50 Fixed bug in AVX detection and added AVX2 detection
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Ryan C. Gordon 546cb890 2014-03-19T16:55:38 Static analysis fix: Value stored to '[bcd]' is never read.
Sam Lantinga 9cd5f5ce 2014-02-22T19:10:45 Fixed bug 2404 - CPU detection not working with MSVC on x64 Tiemo Jung All CPU detection functions SDL_Has* will return false, even if it is supported by the CPU, if SDL is compiled with MSVC and the target is x64. The reason for this is that 'CPU_haveCPUID' will return 0 and macro 'cpuid' in SDL_cpuinfo.c is the fallback implementation, which sets all params to zero. It is safe to assume that cpuid is supported on a CPU that runs windows x64, so CPU_haveCPUID can just return 1, and the empty macro can be replaced with a small wrap around the __cpuid intrinsic.
Sam Lantinga fea87cc9 2014-02-22T18:01:18 Fixed bug 2335 - Fails to build on Debian GNU/kFreeBSD Felix Geyer Starting from version 2.0.1 libsdl fails to build on Debian GNU/kFreeBSD in SDL_cpuinfo.c. GNU/kFreeBSD defines __FreeBSD_kernel__ but not __FreeBSD__. The #ifdef __FreeBSD__ check should be extended for __FreeBSD_kernel__, see the attached patch. Build log: libtool: compile: gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DUSING_GENERATED_CONFIG_H -Iinclude -I/?BUILDDIR?/libsdl2-2.0.1+dfsg1/include -mmmx -m3dnow -msse -msse2 -fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-kfreebsd-gnu/dbus-1.0/include -DHAVE_USBHID_H -DUSBHID_NEW -D_REENTRANT -Wall -c /?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c -fPIC -DPIC -o build/.libs/SDL_cpuinfo.o /?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c: In function 'SDL_GetSystemRAM': /?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: error: 'HW_MEMSIZE' undeclared (first use in this function) int mib[2] = {CTL_HW, HW_MEMSIZE}; ^ /?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [build/SDL_cpuinfo.lo] Error 1
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Sam Lantinga 3bd0e900 2014-02-02T00:33:31 Fixed bug 2376 - no SDL_HasAVX Haneef Mubarak AVX is the successor to SSE* and is fairly widely available. As such, it really ought to be detectable. This functionality ought to be trivial to implement, and not having it means being forced to write an ugly workaround to check for AVX (so that normal SSE can be used if AVX is not available). Here is an example on detecting AVX from SO (it actually shows ways to cehck for all of teh fancy instructions): http://stackoverflow.com/questions/6121792/how-to-check-if-a-cpu-supports-the-sse3-instruction-set
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Ryan C. Gordon 72de99ae 2013-10-23T19:52:14 Initialize MEMORYSTATUSEX size before GlobalMemoryStatusEx() (thanks, Justin!). Fixes Bugzilla #2177.
Sam Lantinga 08fa8da7 2013-10-20T21:56:15 Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings Andreas Ertelt The problem in question is caused by changeset 7771 (http://hg.libsdl.org/SDL/rev/5486e579872e / https://bugzilla.libsdl.org/show_bug.cgi?id=2121) The redefinition of __inline__ (introduced by the addition of begin_code.h:128's "|| __STRICT_ANSI__") results in mingw's gcc throwing multiple warning: always_inline function might not be inlinable [-Wattributes] as well as a whole bunch of redefinitions of mingw internals which break linking of projects including the SDL2 headers.
Sam Lantinga 12ca3ce3 2013-10-17T23:02:29 Fixed building using MinGW Our SDL_windows.h needed to be included before anything else so UNICODE is defined.