aboutsummaryrefslogtreecommitdiff
path: root/render
AgeCommit message (Collapse)Author
2021-07-12render/gles2: disable blending opportunisticallySimon Ser
We don't always need to enable blending: when the texture doesn't have alpha or when the color is opaque, we can disable it.
2021-07-12render/gles2: set has_alpha for DMA-BUFsSimon Ser
Use our internal pixel format table to figure out whether an imported DMA-BUF has alpha.
2021-07-12render/gles2: rename wlr_egl.exts to better match KhronosSimon Ser
Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier.
2021-07-12render/egl: rename wlr_egl.exts to better match KhronosSimon Ser
Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier.
2021-07-09render/pixman: fix texture_is_opaque()Vyivel
A texture is opaque when it does *not* have alpha. Fixes https://github.com/swaywm/wlroots/issues/2907
2021-07-06move wlr_box from /types to /utilSimon Zeni
2021-07-05render/egl: remove EGL_WL_bind_wayland_display supportSimon Ser
Our GLES2 renderer doesn't use it anymore, so we can drop it.
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-05render/gles2: use wlr_drm for wl_drm implementationSimon Ser
This allows use to remove all of our special wl_drm support code.
2021-07-01buffer: make enum wlr_buffer_cap publicSimon Ser
Custom backends and renderers need to implement wlr_backend_impl.get_buffer_caps and wlr_renderer_impl.get_render_buffer_caps. They can't if enum wlr_buffer_cap isn't made public.
2021-07-01render: drop wlr_renderer_impl.texture_from_dmabufSimon Ser
2021-07-01render: use wlr_dmabuf_buffer in wlr_texture_from_dmabufSimon Ser
2021-07-01render: drop wlr_renderer_impl.texture_from_pixelsSimon Ser
2021-07-01render: use wlr_readonly_data_buffer in wlr_texture_from_pixelsSimon Ser
2021-06-30render/egl: replace wlr_egl_create with wlr_egl_create_with_drm_fdSimon Ser
We never create an EGL context with the platform set to something other than EGL_PLATFORM_GBM_KHR. Let's simplify wlr_egl_create by taking a DRM FD instead of a (platform, remote_display) tuple. This hides the internal details of creating an EGL context for a specific device. This will allow us to transparently use the device platform [1] when the time comes. [1]: https://github.com/swaywm/wlroots/pull/2671
2021-06-24render/egl: make most functions privateSimon Ser
The wlr_egl functions are mostly used internally by the GLES2 renderer. Let's reduce our API surface a bit by hiding them. If there are good use-cases for one of these, we can always make them public again. The functions mutating the current EGL context are not made private because e.g. Wayfire uses them.
2021-06-19render: add get native paint target of rendererzccrs
Add wlr_pixman_buffer_get_current_image for wlr_pixman_renderer. Add wlr_gles2_buffer_get_current_fbo for wlr_gles2_renderer. Allow get the FBO/pixman_image_t, the compositor can be add some action for FBO(for eg, attach a depth buffer), or without pixman render to pixman_image_t(for eg, use QPainter of Qt instead of pixman).
2021-06-19render/pixman: add wlr_*_is_pixman and wlr_pixman_texture_get_imagezccrs
Add the following functions: - wlr_renderer_is_pixman - wlr_texture_is_pixman - wlr_pixman_texture_get_image
2021-06-19render/gles2: add wlr_renderer_is_gles2zccrs
Export the interface used to determine whether the wlr_renderer object is gles2.
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-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