PCSX2: IPU end of video freeze fixes
Fixes end of video freeze in Enthusia - Professional Racing.
Fixes end of video freeze with IPU Normal error in games like Enter The Matrix(#1494), Rygar, Freestyle Metal X, etc. Also fixes The Incredible Hulk and Bolt (thanks to @prafullpcsx2 for testing).
My reasoning was off. The -m flag does avoid the clang-tidy startup
cost (which isn't large), but it also increases tail latency because it
allows a straggler command to run much longer. Suppose that many heavy
.cpp files are bundled into one clang-tidy invocation.
Bench from Greg
with -m
./build.sh --dbg --clean --no-simd --clang-tidy 3886.45s user 12.04s system 1066% cpu 6:05.71 total
without
./build.sh --dbg --clean --no-simd --clang-tidy 4297.51s user 41.70s system 1497% cpu 4:49.86 total
* More accurate to PS2 behavior and avoids an useless SMODE write function, it makes sense to also move this as video mode specific colorburst detection was already moved to SetGsCrt.
The vast majority of PCSX2 files use tabs for indentations, and all new
commits also use tabs for indents and not spaces. Therefore, having space
.editorConfig makes it extremely hard to work on PCSX2 files with editors
which support this config file.
There were some concerns that github will make things harder for us
with tabs at .editorConfig, and if that indeed becomes an issue then
we'll have to address it somehow. For now, let's hope it won't.
Also, commented out the line which automatically removes trailing
spaces, since it affects the entire file and therefore makes changes
which the committer did not intend to make at places unrelated to the
commit.
At higher resolutions it takes too much time to save a screenshot at the
maximum compression level. So let's allow the user to set the
compression level.
This re-uses the png_compression_level setting. The default compression
level is 1 for speed, but if the user wishes to increase the compression
level (without using an external tool) and doesn't mind if the
screenshot takes more time to save then they can increase the
compression level up to a maximum of 9 (which can take quite a while).
Fixes#1527.
1. All POSIX shells support $(...) syntax [1], including /bin/sh. shellcheck
warns about it.
2. [[ won't work in /bin/sh [2], so use [ everywhere. I wonder why it worked
now, perhaps the test was running on a system where /bin/sh -> /bin/bash.
3. In POSIX sh, string indexing is undefined. [SC2039]. Unfortunately, this
means we require a subprocess: https://wiki.ubuntu.com/DashAsBinSh. Very
ugly.
4. In POSIX sh, arrays are undefined. We seem to use $flags as an array
after constructing it by string concatenation. I tried to verify that
this has the same effect as just passing the quoted string in bash:
bash-3.2$ flags="-DCMAKE_GOOK"
bash-3.2$ flags="$flags -DCMAKE_MOARMA"
bash-3.2$ flags="$flags -DCMAKE_URURURUR"
bash-3.2$ ./argv $flags
0: ./argv
1: -DCMAKE_GOOK
2: -DCMAKE_MOARMA
3: -DCMAKE_URURURUR
bash-3.2$ ./argv "${flags[@]}"
0: ./argv
1: -DCMAKE_GOOK -DCMAKE_MOARMA -DCMAKE_URURURUR
bash-3.2$ ./argv "$flags"
0: ./argv
1: -DCMAKE_GOOK -DCMAKE_MOARMA -DCMAKE_URURURUR
bash-3.2$
5. Enable exit on unknown variable (-u). All variables should be known,
otherwise we have an error in the script. shellcheck doesn't warn so I
think it's fine.
Apart from shellcheck(1), I also ran checkbashisms(1). The latter only
reported that "command -v" might not be available in other shells.
Apparently only ash(1) doesn't understand it.
NOTE: Why are we even trying to support pre-Mavericks (Darwin < 13) OSX? We
don't even support the most modern OSX (El Capitan) fully yet. OSX upgrades
are free and generally don't leave old machines behind. Most machines made
after 2009 can upgrade to El Capitan, AFAIK. I also believe that systems
that have all the utilities and libraries necessary to build PCSX2 will have
/bin/bash >= 3.x.
NOTE 2: Does cmake/ninja generate the same type of output in
compile_commands.json?
[1]: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03
[2]: http://serverfault.com/a/52050
Quick benchmark. GCC debug mode
Full build: 6 second better, it can 2 additional cores :)
make : ./build.sh --dbg --clean 213.25s user 22.35s system 881% cpu 26.739 total
ninja: ./build.sh --dbg --clean 203.94s user 18.31s system 1085% cpu 20.474 total
No change build:: 1 second better :)
make -C build_dbg -j 16 install 1.51s user 0.34s system 206% cpu 0.898 total
ninja -C build_dbg -j 16 install 0.05s user 0.02s system 98% cpu 0.074 total
If the dev/verbose logging option is enabled and the game requires
automatic gamefixes, the console log will always scroll to the bottom
when the scrollbar is released since a new log message will be output
when emulation unpauses.
This could be quite annoying when checking a log while the game is
running. The behaviour doesn't seem to be all that useful anymore
(previously it was useful to work around a GUI bug where the automatic
gamefixes/widescreen patches/cheats menu options didn't apply
immediately) and only works on Windows, so let's remove it.
MIPSAnalyst.cpp:124:9: warning: ‘takeBranch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
else if (sure && !takeBranch)
False positive as sure will be false but safer this way
Templace is nicer but give a hard time to compiler.
New version compile in both gcc&clang without hack
v2: add an uptr cast too for VS2013 sigh...
v3: use an ugly function pointer cast to please VS2013
PNG_LIBRARIES adds both libpng and zlib to the command line.
PNG_LIBRARY only adds libpng to the linker command line, and the cmake
documentation also suggests not to use it.
Value seems wrongly rounded and you can't distinguish 0xFFFF from 0xFFFE
Instead check that depth is constant for the draw call and the value from the vertex buffer
Fix recent regression on GTA (and likely various games)