Commit Graph

283 Commits

Author SHA1 Message Date
Quantum
57d220a43b [common] open: detach xdg-open instead of waiting for it
Sometimes, e.g. when xdg-open has to start the browser, the xdg-open
process can stay around until the browser exits, which freezes the
client. Instead, we should not wait for xdg-open to exit.

However, we can't simply not call wait, as that would leave the
xdg-open process around as a zombie. We could turn off the SIGCHLD
handler, but that's a global solution to a local problem. Instead, we
call setsid and fork again to detach the xdg-open process as if it's a
daemon, and let init take care of the reaping process.

Co-Authored-By: Tudor Brindus <me@tbrindus.ca>
2021-09-27 13:35:08 +10:00
Geoffrey McRae
2aa236e1f9 [common] options: check for realloc failure 2021-09-11 10:38:07 +10:00
Quantum
43b0e80f93 [common] ivshmem: use e.g. instead of incorrect ie for example 2021-09-04 13:28:34 +10:00
Quantum
ab033d84b1 [common] cpuinfo: handle more than 64 threads on Windows
The old code will not correctly report the number of threads on CPUs with
more than one processor group, i.e. when there are more than 64 logical
processors (threads).
2021-09-04 13:25:24 +10:00
Quantum
ffabdd348c [common] cpuinfo: trim trailing whitespace from model name on Windows 2021-08-31 20:57:34 +10:00
Geoffrey McRae
5fc561fa63 [common] cpuinfo: trim any trailing whitespace from CPU model 2021-08-31 20:20:11 +10:00
Quantum
8514f35474 [common] windebug: handle FormatMessage failure 2021-08-31 20:14:29 +10:00
Quantum
0faafbff47 [common] cpuinfo: implement for Windows 2021-08-31 20:14:10 +10:00
Quantum
34fb2f9076 [common] cpuinfo: implement lgDebugCPU
This is a helper function that can be run at startup to quickly generate
a debug print containing CPU information.
2021-08-31 20:14:10 +10:00
Quantum
a6112feddb [common] cpuinfo: implement for linux by parsing /proc/cpuinfo 2021-08-31 20:14:10 +10:00
Quantum
815aac28fb [common] cpuinfo: add common library 2021-08-31 20:14:10 +10:00
Quantum
39e42ba735 [common] option: change option_dump to option_dump_preset
This new function dumps all options marked as preset instead of dumping
individual sections. This should allow filter options to not be all grouped
into the [eglFilter] section.
2021-08-30 18:32:16 +10:00
Quantum
44850f1699 [common] option: add preset-only options that don't show up in help 2021-08-30 18:21:54 +10:00
Quantum
e11246d46e [common] stringlist: implement item removal 2021-08-30 18:21:54 +10:00
Quantum
f0beedb5ba [common] vector: implement item removal 2021-08-30 18:21:54 +10:00
Quantum
bbd39b8185 [common] option: implement the ability to set option values
This can then be used to update the options from EGL filters, and then
dumping them to files.
2021-08-30 18:21:54 +10:00
Quantum
f0624ccf89 [common] option: implement ability to dump config into ini
This is intended to be used for saving filter options into an ini file.
2021-08-30 18:21:54 +10:00
Tudor Brindus
e22a070dd3 [common] appstrings: add blurb for xyene 2021-08-30 17:46:24 +10:00
Quantum
0c27111260 [common] option: return NAN when float option doesn't exist
false is not a float value.
2021-08-30 17:40:35 +10:00
Quantum
e5f2b3079e [common] stringlist: use vector for storage 2021-08-28 19:17:15 +10:00
Quantum
e6df0acad9 [common] vector: eliminate double allocation when possible
This commit creates two constructor/destructor pairs for vector:
* vector_alloc/vector_free dynamically allocates the vector itself
* vector_create/vector_destroy uses existing Vector objects
2021-08-28 19:17:15 +10:00
Quantum
ba527761ef [common] vector: inline common operations 2021-08-28 19:17:15 +10:00
Quantum
e040b88bf0 [common] ivshmem: switch to using vectors 2021-08-24 22:10:36 +10:00
Quantum
377757e743 [common] vector: add indexed iteration modes 2021-08-24 22:10:36 +10:00
Quantum
53b4b4818b [common] vector: allow inplace construction with vector_push
This makes vector_push return a pointer to the pushed element.

It also allows the user to push a NULL pointer, which means allocating the
memory for the element but do not copy anything into it.
2021-08-24 22:10:36 +10:00
Quantum
07d3d6cbe7 [common] vector: implement a clear operation 2021-08-24 22:10:36 +10:00
Quantum
b71838a530 [common] vector: allow vector_free to be used with NULL
This is done for consistency with free.
2021-08-24 22:10:36 +10:00
Quantum
24e0343156 [common] vector: add new data structure 2021-08-22 21:36:13 +10:00
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
a9241f6710 [common] debug: add DEBUG_UNREACHABLE() macro
This lets us mark code as unreachable and signals the compiler that this
is the case with __builtin_unreachable().

We also mark DEBUG_FATAL as unreachable.
2021-08-14 12:19:07 +10:00
Quantum
be1306f91a [common] debug: add DEBUG_ASSERT macro
This, unlike the standard assert macro, is guaranteed to print the failed
assertion to our log file, and tests the assertion even with NDEBUG defined
so we can more easily catch failures in production binaries without crashing
the program.

The motivation of this is how MinGW handles assertion failures: it creates a
dialog window that the headless user will not be able to see, and blocks the
program from being restarted by the service. Since the failed assertion is
displayed in the dialog, it doesn't print anything to the log, making it
impossible to diagnose issues.
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
30ad28ffd1 [common] CountedBuffer: cosmetics 2021-08-09 14:07:39 +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