Closed sezero closed 2 years ago
These are fine to apply...
OK then, will push shortly.
Should I remove the _M_PPC
check (and maybe replace it with __PPC__
instead)?
OK, pushed b8f30c021bd4a96765b84744939eece23c432478 and 4fa2653394150140c4d69cf66a78cd83e1175f99, where I also removed that _M_PPC
thing.
The only remaining item in this ticket is that ppc sync
vs lwsync
thing: If we aren't going to do anything about it we can close this ticket.
The only remaining item in this ticket is that ppc
sync
vslwsync
thing: If we aren't going to do anything about it we can close this ticket.
We intentionally used lwsync
, but if there was a reason they used the heavy-weight primitive instead that would be good to know.
We intentionally used
lwsync
, but if there was a reason they used the heavy-weight primitive instead that would be good to know.
@BeWorld2018 ?
Maybe this? https://github.com/concurrencykit/ck/issues/121
Maybe this? concurrencykit/ck#121
@slouken?
Let's leave it as-is unless we get a PR with a specific test case.
These are fine to apply...
Even though you approved, I have a feeling that https://github.com/libsdl-org/SDL/commit/4fa2653394150140c4d69cf66a78cd83e1175f99 should be actually tested on a big-endian host. Do we have anyone who could do that?
If we write an automated test using the virtual joystick, we might be able to have @smcv run it on a big endian CI system.
I don't know how to do that though, can't help with it.
I have access to big-endian remote systems (Debian mips and s390x, which are 32-bit and 64-bit BE respectively), but not to real hardware; so yes, any test that you want me to run on those systems would have to be "headless" using a virtual game controller or something.
Assuming that defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__)
implies big-endian is not really 100% correct, because more recent PowerPC systems run in little-endian mode (the Debian ppc64el architecture is like this). However, modern gcc/clang versions have __BYTE_ORDER__
, and Linux/*BSD have <endian.h>
or similar, both of which SDL tests earlier; so the only systems where those architecture macros are used would be non-Linux, non-BSD systems with non-gcc, non-clang compilers, which is pretty obscure these days.
Assuming that
defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__)
implies big-endian is not really 100% correct,
Newer versions are already covered by __ORDER_xxx_ENDIAN__
and __BYTE_ORDER__
above.
I added a test to cover this in https://github.com/libsdl-org/SDL/commit/7e2a99695858e5c6c744ae3075513958ee6eebf6
Just build and run testautomation --filter Joystick
Please don't revert the commit, I'm sure @smcv will look at it as he has time. In the meantime it works correctly on little-endian platforms.
Noticed these in a morphos fork by @BeWorld2018, this commit in particular: https://github.com/BeWorld2018/SDL/commit/6f259e4f44dd4e0ea6518ba82e5107df798e06c1 If you guys review the following, we can pick the necessary bits for us here in mainstream.
In SDL_atomic.h, the morphos fork uses
sync
instead oflwsync
for SDL_MemoryBarrierAcquire and SDL_MemoryBarrierRelease. Don't know the difference / significance of it.Missing ppc checks for ppc: Our current ppc preprocessor checks reflect Apple's old gcc macros, and other macros, i.e.
__PPC__
and__powerpc__
are missing. On the other hand, the_M_PPC
macro feels like microsoft's and if it really is so then it is wrong because windows is always little endian.defined(ppc) || defined(POWERPC) || defined(_M_PPC) || \
defined(ppc) || defined(POWERPC) || defined(powerpc) || defined(_M_PPC) || \ defined(sparc)
define SDL_BYTEORDER SDL_BIG_ENDIAN
else
The vendor, product and version assignments in
SDL_GetJoystickGUIDInfo
need byte-swapping? The commit I referenced above swaps bytes for vendor and product, seems to have missed version.) {
) { if (vendor) {
*vendor = guid16[2];
*vendor = SDL_SwapLE16(guid16[2]); } if (product) {
*product = guid16[4];
*product = SDL_SwapLE16(guid16[4]); } if (version) {
*version = guid16[6];
*version = SDL_SwapLE16(guid16[6]); } } else { if (vendor) {