aboutsummaryrefslogtreecommitdiff
path: root/render/allocator
AgeCommit message (Collapse)Author
2024-02-15Define _POSIX_C_SOURCE globallySimon Ser
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-02allocator: remove backend parameter in allocator_autocreate_with_drm_fdAustin Shafer
Since we only use the backend capabilities here we can simply pass them in directly. This allows other locations to create an allocator even if they don't have a backend. They can simply specify the caps they want instead.
2023-10-06render/allocator: log message when GBM is disabledSimon Ser
When the backend and renderer would need GBM but it's disabled at compile-time, log a message to make this situation easier to debug.
2023-08-03Avoid using memcpy() to copy structsSimon Ser
We can just use a regular assignment instead. This is more type-safe since there is no need to provide the struct size. The remaining memcpy() calls perform array copies or copies from void pointers (which may be unaligned).
2023-07-11Use wl_container_of() instead of castsSimon Ser
This slightly improves type safety. The culprits were found with: git grep -E '\([a-z0-9_ ]+ \*\)\W?[a-z]'
2023-07-07Use struct initializers instead of memset()Simon Ser
This is a bit more type-safe.
2023-06-19allocator: only use DRM auth if we are masterSimon Ser
Legacy DRM auth will only work if we are DRM master. Keep using an unauthenticated DRM FD if we are not DRM master. This should be enough for GBM. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3674
2023-05-21render/pixel-format: add support for block-based formatsSimon Ser
Some formats like sub-sampled YCbCr use a block of bytes to store the color values for more than one pixel. Update our format table to be able to handle such formats.
2022-12-06build: unify naming for HAVE_* definesSimon Ser
We sometimes used HAS_, sometimes polluted the LIBINPUT_ namespace, etc.
2022-12-06render/allocator/gbm: use internal_configSimon Ser
Removes a project argument.
2022-11-17allocator/drm_dumb: use libdrm dumb buffer helpersSimon Ser
References: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/272
2022-10-01render/allocator/drm_dumb: drop finish_buffer()Simon Ser
Simplify things a bit.
2022-10-01render/allocator/drm_dumb: fix error handlingSimon Ser
In the CREATE_DUMB error code-path, we'd only free() the buffer, however it's already inserted in the alloc->buffers list at this point. Instead, make sure finish_buffer() is safe to call (by populating drm_fd) and call that function.
2022-10-01render/allocator/drm_dumb: get format info before allocatingSimon Ser
Simplifies error handling a bit.
2022-10-01render/allocator/drm_dumb: check modifier listSimon Ser
Check that the modifier list passed as input contains either INVALID or LINEAR. We don't support others.
2022-10-01render/allocator/drm_dumb: advertise LINEAR instead of INVALID modifierSimon Ser
INVALID means that the modifier is implicit. However dumb buffers are guaranteed to be LINEAR, so let's just advertise this. Fixes cursors with the DRM backend: cursor planes usually only support LINEAR.
2022-09-14render/allocator/gbm: log human-readable format and modifierSimon Ser
2022-08-18Use wl_signal_emit_mutableAlexander Orzechowski
2022-06-29build: fix enabled GBM when allocators=auto and auto_features=disabledSimon Ser
2022-06-05Remove remaining wl_signal_emit callsSimon Ser
Replace them with wlr_signal_emit_safe, which correctly handles cases where a listener removes another listener. Reported-by: Isaac Freund <ifreund@ifreund.xyz>
2022-05-30build: make GBM optionalSimon Ser
Now that the DRM backend no longer depends on GBM, we can make it optional. The GLES2 renderer still depends on it because of our EGL device selection. This is useful for compositors with their own renderers, and for compositors using the Vulkan renderer.
2022-04-28Zero-initialize structs in init functionsSimon Ser
Ensures there is no field left to its previous undefined value after calling an init function.
2022-03-13Pass O_CLOEXEC to drmModeCreateLease callsSamuel Čavoj
The lease_fd is currently being leaked to child processes Link: https://github.com/swaywm/sway/issues/4286#issuecomment-1065987957
2022-03-03buffer: extract interface to separate headerSimon Ser
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3389
2021-11-26Require INVALID for implicit format modifiersSimon Ser
See [1] for the motivation. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-11-25render/allocator: fallback to renderer DRM FD in autocreateSimon Ser
If the backend doesn't have a DRM FD, fallback to the renderer's. This accomodates for the situation where the headless backend hasn't picked a DRM FD in particular, but the renderer has picked one.
2021-11-09render/allocator: make wlr_allocator part of the public APISimon Zeni
2021-10-14render/allocator: use empty DRM lease to re-open nodeSimon Ser
This allows us to obtain a new DRM file description without relying on filesystem permissions.
2021-10-04render/allocator: use render node if available in reopen_drm_nodeSimon Ser
If we aren't trying to create a dumb buffer allocator, and if the DRM device has a render node (ie, not a split render/display SoC), then we can use the render node instead of the primary node. This should allow wlroots to run under seatd when the current user doesn't have the permission to open primary nodes (logind has a quirk to allow physically logged in users to open primary nodes).
2021-10-01Revert "Require INVALID for implicit format modifiers"Simon Ser
This reverts commit ea7357b70366588069c83f158e6a4eb2d3a702b3.
2021-10-01Require INVALID for implicit format modifiersSimon Ser
See [1] for the motivation. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-09-10buffer: add data_ptr access flagsSimon Ser
This allows callers to specify the operations they'll perform on the returned data pointer. The motivations for this are: - The upcoming Linux MAP_NOSIGBUS flag may only be usable on read-only mappings. - gbm_bo_map with GBM_BO_TRANSFER_READ hurts performance.
2021-09-03render/allocator/gbm: add log message for gbm_bo_get_fd_for_planeSimon Ser
Makes it easier to find out which branch is taken when debugging issues like [1]. [1]: https://github.com/swaywm/wlroots/issues/3156
2021-09-03render/allocator: use legacy authentication for primary nodesSimon Ser
Closes: https://github.com/swaywm/wlroots/issues/3156
2021-09-01render/allocator: re-open GBM FDSimon Ser
Using the same DRM file description for the DRM backend and for the GBM allocator will result in GEM handle ref'counting issues [1]. Re-open the DRM FD to fix these issues. [1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110
2021-08-25Move allocator stuff into new directorySimon Ser
Add render/allocator/ and include/render/allocator/ to hold everything allocator-related.