aboutsummaryrefslogtreecommitdiff
path: root/render/wlr_renderer.c
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-01-03render: stop auto-creating wl_drmSimon Ser
wl_drm is a legacy interface superseded by the linux-dmabuf protocol. All clients should migrate. As a first step, stop creating the wl_drm global by default. This should let us discover any remaining issues in clients. Compositors can still manually create the global if they want to. As a second step, we can completely drop our implementation.
2023-12-04render: disable linux-dmabuf without DRM FDSimon Ser
linux-dmabuf used to not need a DRM FD, however since v4 a DRM FD is required for the main_device event.
2023-11-30renderer: Drop buffer bindingAlexander Orzechowski
2023-11-30render: Nuke old read pixels APIAlexander Orzechowski
Sadly, the new API is not backwards compatible with the old API. Since we have already switched all users in wlroots to the new API compositors are already practically mandated to implement the new API. Let's get rid of the old one since there is no point.
2023-11-29render: Drop rendering_with_bufferAlexander Orzechowski
This is always true now that we can only render with a buffer.
2023-11-29renderer: Drop wlr_renderer_beginAlexander Orzechowski
2023-11-25Cleanup wlr_matrix.h includesSimon Ser
Many files used to require wlr_matrix but no longer do.
2023-11-22render: drop legacy rendering APISimon Ser
2023-11-22render: drop legacy render passSimon Ser
All built-in renderers now implement the new API.
2023-10-06render: log error when requested renderer is compile-time disabledSimon Ser
It can be a bit confusing to debug when the user requests an explicit renderer but it's disabled at build-time. Log an error when that happens.
2023-10-05renderer: Don't crash when trying to fallback to pixmanAlexander Orzechowski
Pixman won't be chosen by default if the system has a valid render node but gles2 and vulkan creation failed.
2023-10-05renderer_autocreate_with_drm_fd: Ensure fd isn't bogusAlexander Orzechowski
2023-10-03treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practicalAlexander Orzechowski
2023-08-23render: only open DRM render node if necessarySimon Ser
Only open a render node if we actually need one (ie, if we're about to attempt GLES2 or Vulkan).
2023-07-11render: constify struct wlr_buffer_pass_optionsSimon Ser
Let's not allow renderer implementations to mutate the passed in options.
2023-07-07Use struct initializers instead of memset()Simon Ser
This is a bit more type-safe.
2023-06-06renderer: Don't pass NULL optionsAlexander Orzechowski
2023-06-05add render timer APIRose Hudson
Based on five calls: wlr_render_timer_create - creates a timer which can be reused across frames on the same renderer wlr_renderer_begin_buffer_pass - now takes a timer so that backends can record when the rendering starts and finishes wlr_render_timer_get_time - should be called as late as possible so that queries can make their way back from the GPU wlr_render_timer_destroy - self-explanatory The timer is exposed as an opaque `struct wlr_render_timer` so that backends can store whatever they want in there.
2023-04-25render/pass: add legacy render pass implementationSimon Ser
Add a render pass implementation which leverages the legacy rendering API. This is helpful during the migration.
2023-04-25Add a new renderer APISimon Ser
Goals: - Extensibility: we need to be able to add new params to the calls to render a texture/rect. For instance we'll need to add fences to the render texture operation for explicit sync purposes. - No implicit state: no more bind_buffer, begin, end. - No matrices: these hurt Pixman and we don't need them. - Clip regions for optimized damage repainting. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3188
2022-12-06render: simplify renderer_autocreate_with_drm_fd()Simon Ser
Use early returns to remove the !renderer checks.
2022-12-01wlr_texture: Expose owning rendererAlexander Orzechowski
2022-11-30linux-dmabuf-v1: add version arg to create()Simon Ser
To be able to add support for newer versions without breaking changes.
2022-11-30linux-dmabuf-v1: add "_with_renderer" suffix to create() functionSimon Ser
Make it clear this is a helper consuming a wlr_renderer. We'll add a lower-level create() function which doesn't take it in the next commit.
2022-11-15render: use wlr_shm in wlr_renderer_init_wl_shm()Simon Ser
2022-11-15render: add wlr_renderer.events.lostSimon Ser
2022-11-15render: make wlr_renderer_begin return a boolSimon Ser
2022-10-04render: drop wlr_renderer_read_pixels() flagsSimon Ser
These are unused.
2022-10-01render: don't fall back to Pixman if we have a render nodeSimon Ser
If we have a render node, it means there is a GPU which could be used. We probably failed GL because of a kernel or Mesa issue. Instead of automatically falling back to Pixman, error out. This makes it more obvious to users when something goes wrong, instead of silently exposing a slow unaccelerated desktop. References: https://github.com/swaywm/sway/issues/7194
2022-10-01render: don't automatically fall back to VulkanSimon Ser
The Vulkan renderer is still experimental. If GL fails, we don't want to automatically fall back to it by default. Fixes: 8bd7170fd95a ("Use env helpers")
2022-09-23render: drop trailing whitespaceSimon Ser
2022-08-22Use env helpersAlexander Orzechowski
2022-08-18Use wl_signal_emit_mutableAlexander Orzechowski
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.
2021-12-07render: add wlr_renderer_init_wl_shmSimon Ser
This allows compositors to initialize wl_shm without initializing other globals like linux-dmabuf.
2021-11-25render: introduce WLR_RENDER_DRM_DEVICESimon Ser
This env var allows to override the DRM node used by the GLES2 and Vulkan renderers. It's especially useful to select a DRM node when running with the headless backend. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2656
2021-11-25render: pick DRM FD in autocreateSimon Ser
If the backend hasn't picked a DRM FD but supports DMA-BUF, pick an arbitrary render node. This will allow removing the DRM device selection logic from the headless backend.
2021-10-18render/vulkan: add Vulkan renderernyorain
This new renderer is implemented with the existing wlr_renderer API (which is known to be sub-optimal for some operations). It's not used by default, but users can opt-in by setting WLR_RENDERER=vulkan. The renderer depends on VK_EXT_image_drm_format_modifier and VK_EXT_physical_device_drm. Co-authored-by: Simon Ser <contact@emersion.fr> Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
2021-07-22render: drop wlr_renderer_impl.init_wl_displaySimon Ser
Now that we have our own wl_drm implementation, there's no reason to provide custom renderer hooks to init a wl_display in the interface. We can just initialize the wl_display generically, depending on the renderer capabilities.
2021-07-06move wlr_box from /types to /utilSimon Zeni
2021-07-05render: remove wl_drm support from wlr_rendererSimon Ser
Everything needs to go through the unified wlr_buffer interface now. If necessary, there are two ways support for EGL_WL_bind_wayland_display could be restored by compositors: - Either by using GBM to convert back EGL Wayland buffers to DMA-BUFs, then wrap the DMA-BUF into a wlr_buffer. - Or by wrapping the EGL Wayland buffer into a special wlr_buffer that doesn't implement any wlr_buffer_impl hook, and special-case that buffer type in the renderer.
2021-07-01render: drop wlr_renderer_impl.texture_from_pixelsSimon Ser
2021-06-09render: add missing arg to wlr_renderer_impl.get_buffer_capsSimon Ser
The types of buffers supported by the renderer might depend on the renderer's instance. For instance, a renderer might only support DMA-BUFs if the necessary EGL extensions are available. Pass the wlr_renderer to get_buffer_caps so that the renderer can perform such checks. Fixes: 982498fab3c4 ("render: introduce renderer_get_render_buffer_caps")
2021-06-09render: drop wlr_ prefix from wlr_renderer_bind_bufferSimon Ser
Make it clear this function is a private wlroots API and will stay that way.
2021-06-01render: add wlr_renderer_begin_with_bufferSimon Ser
This allows compositors to choose a wlr_buffer to render to. This is a less awkward interface than having to call bind_buffer() before and after begin() and end(). Closes: https://github.com/swaywm/wlroots/issues/2618
2021-06-01render: disallow wlr_renderer_destroy while renderingSimon Ser
This probably already felt apart, but let's make it explicit that this is not allowed.
2021-04-29render: remove wlr_ prefix from wlr_renderer_autocreate_with_drm_fdSimon Ser
This function is only required because the DRM backend still needs to perform multi-GPU magic under-the-hood. Remove the wlr_ prefix to make it clear it's not a candidate for being made public.
2021-04-28Log when WLR_BACKENDS/WLR_RENDERER is setSimon Ser
Makes it easier to figure out why a backend/renderer is picked.
2021-04-28render: introduce renderer_get_render_buffer_capsSimon Zeni