Commit Graph

11 Commits

Author SHA1 Message Date
Simon Ser 842093bb84 Define _POSIX_C_SOURCE globally
Stop trying to maintain a per-file _POSIX_C_SOURCE. Instead,
require POSIX.1-2008 globally. A lot of core source files depend
on that already.

Some care must be taken on a few select files where we need a bit
more than POSIX. Some files need XSI extensions (_XOPEN_SOURCE) and
some files need BSD extensions (_DEFAULT_SOURCE). In both cases,
these feature test macros imply _POSIX_C_SOURCE. Make sure to not
define both these macros and _POSIX_C_SOURCE explicitly to avoid
POSIX requirement conflicts (e.g. _POSIX_C_SOURCE says POSIX.1-2001
but _XOPEN_SOURCE says POSIX.1-2008).

Additionally, there is one special case in render/vulkan/vulkan.c.
That file needs major()/minor(), and these are system-specific.
On FreeBSD, _POSIX_C_SOURCE hides system-specific symbols so we need
to make sure it's not defined for this file. On Linux, we can
explicitly include <sys/sysmacros.h> and ensure that apart from
symbols defined there the file only uses POSIX toys.
2024-02-15 15:41:12 +01:00
eri c46d3da976
drm: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:38 +02:00
Simon Ser fe06e5f49a Use wl_container_of() instead of casts
This slightly improves type safety.

The culprits were found with:

    git grep -E '\([a-z0-9_ ]+ \*\)\W?[a-z]'
2023-07-11 20:16:17 +02:00
Alexander Orzechowski 300bd80772 wlr_drm_format_set: Store formats on array 2023-05-11 18:25:52 +02:00
Simon Ser d92f92f2d3 wl-drm: only advertise formats supporting implicit modifiers
With the Vulkan renderer we don't support implicit modifiers.
However wl_drm only supports implicit modifiers.

Stop advertising wl_drm formats when implicit modifiers are
unsupported.
2022-12-02 14:27:07 +00:00
Simon Ser f36a5915da wl-drm: don't store wlr_renderer
Query the formats at init time, then forget about the renderer.
This will allow wl_drm to be created with a list of formats instead
of a renderer, and will behave better after a GPU reset.
2022-12-02 14:27:07 +00:00
Simon Ser f84f7c7710 wl-drm: use resource interface
Instead of hardcoding builtin resource types in
wlr_buffer_from_resource(), use the modular resource interface.
2022-11-17 19:55:19 +00:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Simon Ser 39b68ea47a buffer: extract interface to separate header
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3389
2022-03-03 15:39:05 +01:00
Simon Ser c868e509b7 drm: add support for DMA-BUFs
Mesa's Vulkan WSI still uses wl_drm when modifiers aren't supported.
This has been fixed in [1] but will take some time to be propagated
to users. In the meantime, add a fallback.

[1]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4942
2021-07-05 11:13:41 -04:00
Simon Ser f7e3d325fe Add a stub wl_drm implementation
This will allow us to remove all of our EGL wl_drm support code
and remove some weird stuff we need just for wl_drm support. In
particular, wl_drm buffers coming from the EGL implementation
can't easily be wrapped into a wlr_buffer properly.
2021-07-05 11:13:41 -04:00