Now LG uses a 25Hz tick timer it is an issue that `create_timer` spawns
a new thread for every single timer event, so instead multiplex all the
timers into a single thread with a 1ms resolution.
This change allows the host to provide information to the client about
how the VM is configured, information such as the UUID, CPU
configuration and capture method both for informational display in the
client as well as debugging in the client's logs.
The format of the records allows this to be extended later with new
record types without needing to bump the KVMFR version.
As the ringbuffer is now in use for audio it makes sense to provide bulk
append and consume functions that are thread safe instead of adding
locking over all of the functions. This partially reverts the prior
commit that added the extra locking.
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>
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).
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.
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.
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.
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.
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.
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.
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.
This replaces the scaled `destRect` with a version that uses doubles
correcting the rounding error that is causing a failure to properly
clear the black bar areas.
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.
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.
We implement nanotime by converting QueryPerformanceTimer output with
floating point arithmetic. This is necessary to preserve precision on
platforms where each tick is not an integer number of nanoseconds.
Furthermore, struct timespec is included C11 and appears to be supported
on Windows, so we no longer need to #ifdef it out.
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.
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.