aboutsummaryrefslogtreecommitdiff
path: root/render
AgeCommit message (Collapse)Author
2021-06-07render/pixman: implement texture_from_bufferSimon Ser
2021-06-07render/gles2: add support for DATA_PTR buffers in texture_from_bufferSimon Ser
2021-06-07buffer: replace get_data_ptr with {begin,end}_data_ptr_accessSimon Ser
This new API allows buffer implementations to know when a user is actively accessing the buffer's underlying storage. This is important for the upcoming client-backed wlr_buffer implementation.
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-05-31render/allocator: add wlr_allocator.buffer_capsSimon Ser
This allows users to know the capabilities of the buffers that will be allocated. The buffer capability is important to know when negotiating buffer formats.
2021-05-31render/drm_dumb_allocator: check for DRM masterSimon Ser
If we aren't the DRM master, allocating dumb buffers will fail with EPERM.
2021-05-30render/gles2: fix texture cleanup on destroySimon Ser
When importing a DMA-BUF wlr_buffer as a wlr_texture, the GLES2 renderer caches the result, in case the buffer is used for texturing again in the future. When the wlr_texture is destroyed by the caller, the wlr_buffer is unref'ed, but the wlr_gles2_texture is kept around. This is fine because wlr_gles2_texture listens for wlr_buffer's destroy event to avoid any use-after-free. However, with this logic wlr_texture_destroy doesn't "really" destroy the wlr_gles2_texture. It just decrements the wlr_buffer ref'count. Each wlr_texture_destroy call must have a matching prior wlr_texture_create_from_buffer call or the ref'counting will go south. Wehn destroying the renderer, we don't want to decrement any wlr_buffer ref'count. Instead, we want to go through any cached wlr_gles2_texture and destroy our GL state. So instead of calling wlr_texture_destroy, we need to call our internal gles2_texture_destroy function. Closes: https://github.com/swaywm/wlroots/issues/2941
2021-05-19render: relax stride check in wlr_texture_from_pixelsSimon Ser
Some formats have a byte-per-pixel lower than 1. Let's not encode an arbitrary limitation into the wlr_renderer API.
2021-05-19render/pixman: avoid sqrt() in render_quad without rotationSimon Ser
When the matrix doesn't have a rotation, we can avoid a sqrt() call. Tested with Sway's tabbed containers.
2021-05-19render/gbm_allocator: add support for gbm_bo_get_fd_for_planeSimon Ser
See [1]. This allows us to remove the workaround for GBM API limitations. [1]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5442
2021-05-17render/gles2: implement texture_from_bufferSimon Ser
Make it so wlr_gles2_texture is ref'counted (via wlr_buffer). This is similar to wlr_gles2_buffer or wlr_drm_fb work. When creating a wlr_texture from a wlr_buffer, first check if we already have a texture for the buffer. If so, increase the wlr_buffer ref'count and make sure any changes made by an external process are made visible (by invalidating the texture). When destroying a wlr_texture created from a wlr_buffer, decrease the ref'count, but keep the wlr_texture around in case the caller uses it again. When the wlr_buffer is destroyed, cleanup the wlr_texture.
2021-05-17render: introduce wlr_texture_from_bufferSimon Ser
This adds a a function to create a wlr_texture from a wlr_buffer. The main motivation for this is to allow the renderer to create a single wlr_texture per wlr_buffer. This can avoid needless imports by re-using existing textures.
2021-05-17render/gles2: add gles2_texture_createSimon Ser
This centralizes the wlr_texture initialization. In future commits, more fields will need to get initialized.
2021-05-17render/gles2: remove unnecessary EGL import ext checksSimon Ser
We require the ext in the renderer init function.
2021-05-17render: remove wlr_texture_get_sizeSimon Ser
Users can just access the width/height fields directly.
2021-05-11render/egl: query and display EGL driver nameSimon Ser
GL_RENDERER typically displays a human-readable string for the name of the GPU, and EGL_VENDOR typically displays a human-readable string for the GPU manufacturer. EGL_DRIVER_NAME_EXT should give the name of the driver in use. References: https://github.com/KhronosGroup/EGL-Registry/commit/e8baa0bf39120803505c6e360e1e33af0d9b9745
2021-05-05render: add DRM dumb buffer allocatorSimon Zeni
2021-05-05render/gbm_allocator: duplicate drm fd during creation processSimon Zeni
2021-04-29render/gles2: assert texture comes from the same rendererSimon Ser
Rendering a wlr_texture with a different wlr_renderer is invalid. Add an assert to make sure this doesn't happen.
2021-04-29render/allocator: add allocator_autocreate_with_drm_fdSimon Ser
Same as wlr_allocator_autocreate, but allows the caller to force a DRM FD. Similar to renderer_autocreate_with_drm_fd.
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/allocator: introduce wlr_allocator_autocreateSimon Zeni
2021-04-28render: introduce renderer_get_render_buffer_capsSimon Zeni
2021-04-28render/shm_allocator: make wlr_shm_allocator_create return a wlr_allocatorSimon Zeni
2021-04-28render/gbm_allocator: make wlr_gbm_allocator_create return a wlr_allocatorSimon Zeni
2021-04-27render/pixman: check format is supported in create_bufferSimon Ser
2021-04-27buffer: add format param to get_data_ptrSimon Ser
Allow wlr_buffer_impl.get_data_ptr to return a format. This allows the Pixman renderer to not care about get_dmabuf/get_shm, and only care about get_data_ptr. This will also help with [1], because client wl_shm buffers can't implement get_shm. [1]: https://github.com/swaywm/wlroots/pull/2892 References: https://github.com/swaywm/wlroots/issues/2864
2021-04-27pixman: implement read pixelsSimon Zeni
2021-04-27render/pixman: implement preferred_read_formatSimon Zeni
2021-04-26Log drmGetDevices2 error codeSimon Ser
2021-04-26render: unconditionally read WLR_RENDERERSimon Ser
Prior to this commit, WLR_RENDERER was only looked up when the backend returned a DRM FD. Make it so WLR_RENDERER is always looked up, so that running wlroots on a system without a GPU and with WLR_RENDERER=gles2 fails as expected instead of falling back to the Pixman renderer.
2021-04-26render/egl: fail on EGL_MESA_device_softwareSimon Zeni
2021-04-22render: remove NULL checks in wlr_texture_impl.destroySimon Ser
The NULL check already exists in wlr_texture_destroy, no need to duplicate it in each impl
2021-04-22render/pixman: destroy textures on renderer teardownSimon Ser
2021-04-22render/gles2: destroy textures on renderer teardownSimon Ser
2021-04-22render/pixman: cleanup when renderer is destroyedSimon Ser
We were leaking wlr_pixman_buffers and a wlr_drm_format_set.
2021-04-21render/gles2: log when creating rendererSimon Ser
Make it clear GLES2 is being used. Before this commit, various GL-related information was printed, but not an easy-to-find line about which renderer is being picked up.
2021-04-20render: introduce WLR_RENDERER in wlr_renderer_autocreate_with_drm_fdSimon Zeni
This env var forces the creation of a specific renderer. If no renderer is specified, the function will try to create all of the renderers one by one until one is created successfuly.
2021-04-20render/gles2: introduce wlr_gles2_renderer_create_with_drm_fdSimon Zeni
2021-04-20render: Assert that texture dimensions are > 0nyorain
2021-04-17render: make GLES2 renderer optionalayaka
Allow selecting whether the GLES2 renderer gets enabled. Co-authored-by: Simon Ser <contact@emersion.fr>
2021-04-17renderer: create pixman renderer if getting drm fd failedSimon Zeni
2021-04-17render: introduce pixman rendererSimon Zeni
2021-04-17render: introduce shared memory allocatorSimon Ser
It allocates in local main memory via shm_open, and provides a FD to allow sharing with other processes. This is suitable for software rendering under the Wayland and X11 backends.
2021-04-15render: rename get_dmabuf_render_formats into get_render_formatsSimon Zeni
2021-04-15render/gles2: prevent imported DMA-BUF textures from being mutatedSimon Ser
The compositor shouldn't write to client buffers if the client attaches a DMA-BUF to a wl_surface, then attaches a shm buffer. Make gles2_texture_write_pixels return an error to prevent this from happening.
2021-04-12backend: move get_drm_fd to public interfaceRoman Gilg
The get_drm_fd was made available in an internal header with a53ab146f. Move it now to the public header so consumers opting in to the unstable interfaces can make use of it.
2021-04-10drm: check for PRIME supportStephan Hilb
PRIME support for buffer sharing has become mandatory since the renderer rewrite. Make sure we check for the appropriate capabilities in backend, allocator and renderer. See also #2819.