aboutsummaryrefslogtreecommitdiff
path: root/render/gles2/renderer.c
AgeCommit message (Collapse)Author
2021-08-12render/gles2: make wlr_gles2_buffer an addonSimon Ser
Saves us from walking a list.
2021-07-30render/gles2: add a few 10-bit and FP16 formatsManuel Stoeckl
The half-float formats depend on GL_OES_texture_half_float_linear, not just the GL_OES_texture_half_float extension, because the latter does not include support for linear magni/minification filters. The new 2101010 and 16161616F formats are only available on little- endian builds, since their gl_types are larger than a byte and thus endianness dependent.
2021-07-30render/gles2: hide shm formats without GL supportManuel Stoeckl
This change introduces a new function to check whether the renderer has the needed GL extensions to read a given pixel format.
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-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: 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-06move wlr_box from /types to /utilSimon Zeni
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: drop wlr_renderer_impl.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/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-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-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/gles2: remove unnecessary EGL import ext checksSimon Ser
We require the ext in the renderer init function.
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-28render: introduce renderer_get_render_buffer_capsSimon Zeni
2021-04-22render/gles2: destroy textures on renderer teardownSimon Ser
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/gles2: introduce wlr_gles2_renderer_create_with_drm_fdSimon Zeni
2021-04-15render: rename get_dmabuf_render_formats into get_render_formatsSimon Zeni
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.
2021-04-08render: drop support for ellipsesSimon Ser
For anything more complicated than quads, compositors can easily ship their own shaders. Closes: https://github.com/swaywm/wlroots/issues/2759
2021-04-08render: drop wlr_renderer_blit_dmabufSimon Ser
It can be replaced with wlr_renderer_bind_buffer. blit_dmabuf is broken as-is (dies on an assertion).
2021-03-25render/gles2: remove depth and bpp gles2_pixel_format, use drm pixel formatSimon Zeni
2021-03-10output: improve transform matrix calculationSimon Zeni
Compute only the transform matrix in the output. The projection matrix will be calculated inside the gles2 renderer when we start rendering. The goal is to help the pixman rendering process.
2021-02-23render: use DRM formats in wlr_texture_from_pixelsSimon Ser
2021-02-23render: use DRM formats in wlr_renderer_read_pixelsSimon Ser
2021-02-23output: use DRM format in wlr_output_preferred_read_formatSimon Ser
2021-02-23render: use DRM formats in wlr_renderer_get_shm_texture_formatsSimon Ser
2021-02-23render/gles2: replace wlr_gles2_texture.wl_format with drm_formatSimon Ser
2021-02-23render/gles2: convert format table to DRM formatsSimon Ser
2021-02-19render/gles2: remove current_buffer checksSimon Ser
All backends now use wlr_swapchain. This means the renderer is guaranteed to have a current_buffer bound. Remove the legacy code used for EGLSurface.
2021-01-29render/egl: remove *config_attribs and wlr_egl->configBrandon Dowdy
Breaking changes: Both "EGLint *config_attribs" and "wlr_egl->config" no longer exist.
2021-01-16render/gles2: make EGL context current in bind_bufferSimon Ser
Instead of requiring callers to manually make the EGL context current before binding a buffer and unsetting it after unbinding a buffer, do it inside wlr_renderer_bind_buffer. This hides renderer-specific implementation details inside the wlr_renderer interface. Non-GLES2 renderers may not use EGL. This removes all EGL dependencies from the backends. References: https://github.com/swaywm/wlroots/issues/2618 References: https://github.com/swaywm/wlroots/pull/2615#issuecomment-756687006
2021-01-14render/gles2: save/restore EGL context in destroy_bufferSimon Ser
It can be surprising that destroying a buffer changes the EGL context, especially since this can be triggered from anywhere wlr_buffer_unlock is called. Prevent this from happening by saving and restoring the EGL context.
2021-01-12render/egl: remove surface and buffer age args from make_currentSimon Ser
These aren't used anymore.
2021-01-12render/egl: replace init/finish with create/destroySimon Ser
This ensures wlr_gles2_renderer can properly take ownership of the wlr_egl. Closes: https://github.com/swaywm/wlroots/issues/2612
2021-01-12render/gles2: fix EGL use-after-freeSimon Ser
The wlr_egl was cleaned up too early. While at it, also fix a memory leak. Fixes: b899a412e3eb ("backend: remove wlr_egl from all backends")
2021-01-07backend: remove wlr_egl from all backendsSimon Zeni
2020-12-15render/gles2: require GL_EXT_unpack_subimageSimon Ser
We implicitly depended on this extension.
2020-12-09render/gles2: query alpha size from render bufferSimon Ser
If we're using a render buffer, query the alpha size from it. Closes: https://github.com/swaywm/wlroots/issues/2527
2020-12-09render/gles2: don't eglGetConfigAttrib on EGL_NO_CONFIG_KHRSimon Ser
If we don't have an EGL config, don't try to query anything from it.
2020-11-30render: rename wlr_renderer_get_formatsSimon Ser
Rename wlr_renderer_get_formats to wlr_renderer_get_shm_texture_formats. This makes it clear those formats are only suitable for shm import.
2020-11-30render: rename wlr_renderer_get_dmabuf_formatsSimon Ser
Rename wlr_renderer_get_dmabuf_formats to wlr_renderer_get_dmabuf_texture_formats. This makes it clear the formats are only suitable for creating wlr_textures.