Commit Graph

157 Commits

Author SHA1 Message Date
Quantum
164dd00490 [common] rects: fix typo in rectContains 2021-08-20 17:13:04 +10:00
Quantum
ccda264648 [common] windebug: pass FORMAT_MESSAGE_IGNORE_INSERTS to FormatMessage
This avoids problems when the error message we are told to format contains
inserts like %1.

See https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353 for
details (or for fun).
2021-08-17 19:07:41 +10:00
Quantum
2de9e3e9be [common] remove all casts around malloc 2021-08-16 16:26:58 +10:00
Quantum
4d907cecab [common] use correct argument order for calloc
The signature for calloc is void *calloc(size_t num, size_t size), where num
is the number of elements to allocate, and size is the size. Therefore, to
allocate a single struct, we should pass 1 for num and the size of the struct
as size.

In some places, we use the opposite order, and we should flip it.
2021-08-16 16:25:59 +10:00
Tudor Brindus
1c5620ba25 [common] use variable-relative sizeof where possible 2021-08-16 16:22:55 +10:00
Quantum
c89518ead4 [common] option: use isspace from <ctype.h> 2021-08-15 18:00:52 +10:00
Quantum
b2630024a7 [common] all: switch asserts to DEBUG_ASSERT 2021-08-14 12:19:07 +10:00
Quantum
e5d252290d [common] array: add ALIGN_PAD macro for common logic
ALIGN_PAD(x, a) returns x rounded up to the nearest multiple of a.
2021-08-14 08:05:29 +10:00
Quantum
717b90366b [common] ivshmem: use correct page alignment logic
Before, if the size is exactly the multiple of the page size, an extra padding
page is added for no reason. This commit fixes the logic and also uses the
page size obtained dynamically.
2021-08-13 20:24:15 +10:00
Quantum
e945955d13 [common] rects: add rectsRejectContained function
This function will remove rectangles in a list that are entirely contained
in another rectangle in the same list.
2021-08-13 20:21:27 +10:00
Quantum
604b44d6d8 [common] rects: add rectsMergeOverlapping helper function
This is based on the client's util_mergeOverlappingRects.
2021-08-11 19:01:52 +10:00
Quantum
9f4afcd944 [common] crash: use DEBUG_WINERROR on windows 2021-08-11 02:41:33 +10:00
Geoffrey McRae
e41cbf5f32 [common] option: option_get_float should return a float 2021-08-10 01:36:12 +10:00
Geoffrey McRae
88eada3494 [common] option: add support for float option types 2021-08-10 01:09:40 +10:00
Geoffrey McRae
92de467edc [client] egl: add ffx_cas post process filter 2021-08-09 23:12:58 +10:00
Quantum
87a21f5f5e [host] windows: use DEBUG_WINERROR for CallNtPowerInformation
We need to use the function RtlNtStatusToDosError to convert NTSTATUS to
Windows error codes.
2021-08-09 17:07:25 +10:00
Geoffrey McRae
69f6532b8d [common] ringbuffer: allow reverse iteration 2021-08-09 14:06:32 +10:00
Quantum
0462cee9db [common] rects: implement routine to copy rectangles from framebuffer 2021-08-08 08:30:11 +10:00
Quantum
cab95c5eed [common] rects: refactor rect buffer copy code to common module
This also fixes a bug of accidentally multiplying the stride by 4 when
the stride is already in bytes and not pixels.
2021-08-08 08:30:11 +10:00
Quantum
4205e49786 [common] appstrings: add blurb for quantum 2021-08-07 08:54:56 +10:00
Quantum
2f8ebc29e8 [common] open: implement opening URLs in browser
This is currently only implemented for Linux.

On Windows, ShellExecute should be used, but that should be done when it's
actually needed so it could be tested.
2021-08-05 22:43:46 +10:00
Quantum
51b9cd4e5a [all] copyright: use unicode copyright sign ©
This is done for consistency with the license strings in appstrings.c.
2021-08-04 21:16:35 +10:00
Geoffrey McRae
1885e2093b [client] imgui: added missed files from the last commit 2021-08-04 10:29:48 +10:00
Geoffrey McRae
90b90e667a [common] event: lgResetEvent should return the last state of the event 2021-08-01 17:14:58 +10:00
Geoffrey McRae
a094fb8104 [common] events/linux: fix failure to call pthread_cond_broadcast 2021-08-01 17:13:31 +10:00
Quantum
3369536cb8 [common] paths: add library to manage platform-specific paths
This abstracts away stuff like XDG base directory specification.
Currently, this is implemented for Linux only.
2021-07-31 21:11:09 +10:00
Quantum
1104bd821b [common] option: make options case insensitive
It is not obvious that [DXGI] and [dxgi] are different sections in the ini file,
and only the latter works. We should just eliminate the difference.
2021-07-31 15:00:49 +10:00
Quantum
aff3bff8b0 [common] framebuffer: fix copy when source and dest pitch differs
We used to increment the source buffer index by width * bpp, not by pitch.
This is incorrect and the root cause behind #670.

This is a regression that appeared in 196050bd23.
2021-07-29 10:18:35 +10:00
Quantum
2ea84cd07e [common] ivshmem: use consistent device numbering on Windows
We now enumerate all IVSHMEM devices, sort them based on PCI bus, slot,
and function numbers, then index from the resulting order. This should
be consistent across boots.

To help the user identify the correct IVSHMEM device, we also print the
list of IVSHMEM devices on startup.
2021-07-29 10:17:33 +10:00
Geoffrey McRae
5f5f497cbd [host/common] windows: provide delayExecution via nsleep
This change moves this platform specific sleep to `common` as the OS
agnostic `nsleep` function.

Ref PR #661
2021-07-26 16:36:56 +10:00
Quantum
3cf0257f34 [host] windows: do not complain about failed timer destruction at exit
When our window is destroyed, our timers are also destroyed. This causes our
attempt at destruction to fail. Instead, set MessageHWND to NULL in the
WM_DESTROY handler and don't try destroying the timers if the window is gone.
2021-07-23 15:52:45 +10:00
Quantum
26f16a3734 [common] windows: declare WINVER and _WIN32_WINNT
This is done for consistency with the Windows-specific portions of the host.
2021-07-20 12:45:29 +10:00
Quantum
2bb0602ebb [common] windebug: remove custom-rolled Windows 8 detector
Just use <versionhelpers.h> from Windows SDK.
2021-07-20 11:34:57 +10:00
Geoffrey McRae
2038517861 [common] linux: review and fix event logic, events should not be counted 2021-07-19 13:19:59 +10:00
Geoffrey McRae
2736e37e4a [common] timer: fix timespec parameters when interval >= 1000 2021-07-19 10:58:10 +10:00
Geoffrey McRae
45e1b5bce0 [common] ringbuffer: add pre value overwrite callback
This allows us to set a callback to read a value out before it's about
to be overwritten which can be useful for things like calculating a
running average.
2021-07-18 20:42:29 +10:00
Quantum
ad974cfa0a [common] dpi: remove no longer used library 2021-07-18 10:50:57 +10:00
Quantum
ef2da1902e [common] framebuffer: allow custom framebuffer write implementations
This is helpful for only copying damaged areas.
2021-07-18 10:41:50 +10:00
Geoffrey McRae
23f9855768 [common] ringbuffer: add forEach iterator 2021-07-17 21:09:51 +10:00
Geoffrey McRae
41403286d1 [common] ringbuffer: add getLength method 2021-07-17 21:09:51 +10:00
Geoffrey McRae
94ae9a95d7 [common] added new ringbuffer helper for metrics collection 2021-07-17 21:09:51 +10:00
Geoffrey McRae
041b95507d [host] windows/nvfbc/common: strip out broken "enhanced" event logic
This so called "enhanced" event logic is completely flawed and can never
work correctly, better to strip it out and put our faith in windows to
handle the events for us.

And yes, I am fully aware I wrote the utter trash in the first place :)
2021-07-09 10:22:03 +10:00
Geoffrey McRae
bfb47a0ae4 [common] windows: update event fast path to use atomics
Due to a failure to understand atomics when this code was originally
written it has a critical flaw with the fast path where an event could
be signalled when it should not be. This change set corrects this issue
by using atomic operations.
2021-07-09 04:50:14 +10:00
Geoffrey McRae
0acce0737f [common] debug: output to stdout and reset the the color at the end 2021-07-08 07:18:06 +10:00
Geoffrey McRae
1effd5fddc [common] debug: add color support to debug messages
People often miss the warnings about invalid arguments in their command
line, this last minute patch attempts to address this by making
warnings, errors, fixme's and fatal errors stand out if stdout is a TTY.
2021-07-07 23:05:46 +10:00
Quantum
d385b49f5f [common] runningavg: avoid integer overflows
We receive values as int64_t, but when we compute the sum, we store it as
int. This doesn't make sense as we eventually cast it to double when
computing the average. We should instead store the sum as int64_t.
2021-06-28 14:47:19 +10:00
Geoffrey McRae
d20e4d1de5 [common] framebuffer: make use of framebuffer_wait 2021-06-08 16:10:34 +10:00
Geoffrey McRae
e87d2f1a20 [common] framebuffer: add additional profiling support 2021-06-08 16:08:44 +10:00
Geoffrey McRae
4a75cc3bcf [common] framebuffer: simplify the remaining calculation
The pitches match so there is no need for the added complexity of this
calculation.
2021-06-08 15:14:54 +10:00
Geoffrey McRae
196050bd23 [common] framebuffer: improve client framebuffer read performance
Extensive profiling reveals that the glibc memcpy performs up to 2x
faster then the existing SIMD implementation that was in use here. This
patch also will copy large 1MB chunks if the pitch of the source and
destination match further increasing throughput.
2021-06-08 15:08:13 +10:00