1. __builtin_bswap{32,64} were added in GCC 4.3, and __builtin_bswap16
was added in GCC 4.8, however, currently, the GCC requirements in
bswap.h file has >= 10. This requirement of GCC version is false for
bswap* but true for __has_builtin() (as it first was added in GCC 10.1).
As bswap* builtins were added before GCC 10, the preprocessor check will
always going to be true for bswap but will be false if GCC version is
< 10 as __has_builtin() won't be present. Since the byteswap function,
on x86-64, can boil down to a single bswap instruction, this optimization
may left behind (unless GCC do some pattern matching). To avoid this,
just use the compiler macros (for GCC: __GNUC__, clang: __GNUC__ or
__clang__) and if the compiler is neither GCC or Clang, fall-back to
native implementation.
2. Remove the useless casts (uint{16,32,64}_t) from the constants. These
constants already has their own suffix, and casting to a different type
will just get ignored as the return value already gets casts to it's
appropriate type.
3. Previously, Clang couldn't able to use __builtin_bswap* (even if it was
newer) as LLVM define __GNUC__ macro to a specific constant (usually lower
than GCC's (__GNUC__) and on my system it's 4) which is indeed < 10. The
first comment also fixes this issue.
Link: <https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Other-Builtins.html>
Link: <https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Other-Builtins.html>
Link: <https://libc-alpha.sourceware.narkive.com/PfaB4BGP/patch-byteswap-h-fix-gcc-ver-test-for-builtin-bswap32>
plat_serpt_write_vcon(): write() returns how much data it has written
to the file descriptor, and in case an error, it returns -1. So the
EWOULDBLOCK never really triggers, as in the following condition we're
not checking the errno, but the return value of the write() function.
IBM/ATI 8514/A side:
Made mode switches more immediate when actually switching from VGA to 8514/A and viceversa.
Tseng ET4000AX/W32 series side:
Actually use bit 2 of index 0x3f for the horizontal blank start bit 8 instead of bit 4 (horizontal retrace start), fixes skew issues with the et4000w32i rev B. card with resolutions like 1024x768 at 15 or 16bpp and others.
S3 side:
Temporary changes to match the release (due to tomorrow) of 86box. Said changes are about the horizontal display of the tvp3026-based S3 chips.
IBM/ATI 8514-based:
Temporarily commented out the hblank side of it due to htotal bugs.
TVP3026 side:
When the upper clock selection bits are 0 and when extended VGA modes are set, double the hdisp.