aboutsummaryrefslogtreecommitdiff
path: root/render
AgeCommit message (Collapse)Author
2020-06-18render/egl: print error nameSimon Ser
Allows for easier debugging.
2020-06-17render: add wlr_render_subtexture_with_matrixSimon Ser
This renders only a subset of the texture, instead of the full texture.
2020-06-17render/gles2: use .x/.y instead of .s/.tSimon Ser
texcoord is a vector of coordinates, with the first member being the X axis value and the second member being the Y axis value. It makes more sense to use the accessors with the same names.
2020-06-16render: assert sane values for box functionsRouven Czerwinski
Width and height should always be > 0 for render functions which take a wlr_box. References https://github.com/swaywm/wlroots/issues/2281
2020-06-10render/egl: explicit client extension handlingSimon Ser
Prior to this commit, wlr_egl_init seemed to assume the extension string queried via EGL_NO_DISPLAY was a subset of the extension string queried via an initialized display. This isn't correct. EGL_EXT_client_extensions [1] defines two types of extensions: client extensions and display extensions. The set of supported client and display extensions are disjoint (ie. an extension is either a client or a display extension, not both). Client extensions are queried via EGL_NO_DISPLAY, display extensions are queried via an initialized display. Rename the variables to make this clear. Remove the misleading comment. Log both client and display extensions. [1]: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_client_extensions.txt
2020-06-08render: Fix blit_dmabuf() breakage due to API changeAndri Yngvason
2020-06-08render: Add wlr_renderer_blit_dmabuf()Andri Yngvason
2020-06-08render: egl: Add utility functions for saving/restoring contextAndri Yngvason
2020-06-06render: choose DMA-BUF texture target via eglQueryDmaBufModifiersEXTSimon Ser
EGL_EXT_image_dma_buf_import_modifiers tells us whether we should use GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES. Using the right texture target can fix some failures and/or improve performance on some drivers. This does the same as a Weston commit [1]. [1]: https://gitlab.freedesktop.org/wayland/weston/commit/40c519a3e613 Closes: https://github.com/swaywm/wlroots/issues/2173
2020-06-02render: stop making EGL context current in wlr_egl_initSimon Ser
This leaves an EGL context current behind. wlr_gles2_renderer_create was assuming the EGL context was already current because of this (because it called a GL function right off the bat).
2020-05-20render/egl: unset current context after swapping buffersSimon Ser
After swapping buffers, it doesn't make sense to perform more rendering operations. Unset the context to reflect this. This commit makes it so the context is always only current between wlr_egl_make_current and wlr_egl_swap_buffers. This is an alternative to [1]. [1]: https://github.com/swaywm/wlroots/pull/2212
2020-05-19render/egl: introduce wlr_egl_unset_currentSimon Ser
This function can be called after wlr_egl_make_current to cleanup the EGL context. This avoids having lingering EGL contexts that make things work by chance. Closes: https://github.com/swaywm/wlroots/issues/2197
2020-04-28render/texture: make write_pixels optionalSimon Ser
2020-04-28render/texture: add width and height fieldsSimon Ser
Instead of requiring compositors to call wlr_texture_get_size each time they want to access the texture's size, expose this information as wlr_texture fields.
2020-04-22render/gles2: add wlr_gles2_renderer_check_extSimon Ser
2020-04-22render/drm_format_set: disallow DRM_FORMAT_INVALIDSimon Ser
It doesn't make sense to add DRM_FORMAT_INVALID to a format set. Adding an assertion allows us to safely query the format set with DRM_FORMAT_INVALID. See [1]. [1]: https://github.com/swaywm/wlroots/pull/2021#discussion_r385839668
2020-04-09render: only expose linux-dmabuf if EGL extension is supportedSimon Ser
Only expose linux-dmabuf extension if EGL_EXT_image_dmabuf_import_ext is supported. Closes: https://github.com/swaywm/wlroots/issues/2076
2020-04-09render/gles2: only call wlr_egl_bind_display if supportedSimon Ser
This allows us to hard-fail if the extension is advertised but we fail to enable it.
2020-04-09render/egl: make config attribs constSimon Ser
wlr_egl_init is not allowed to mutate these attribs.
2020-03-23Return failure of wlr_renderer_init_wl_display()Isaac Freund
This makes it easier for the user of this library to properly handle failure of this function. The signature of wlr_renderer_impl.init_wl_display was also modified to allow for proper error propagation.
2020-03-09render/gles2: remove duplicated format listSimon Ser
2020-01-13render/gles2: unbind textures after useSimon Ser
Keeping textures bound results in hard-to-debug situations where some GL operations incorrectly affect the texture.
2020-01-12render/egl: remove SURFACELESS_MESA special caseSimon Ser
Users can just pass EGL_DEFAULT_DISPLAY themselves.
2019-12-31render: guard rendering operations between begin() and end()Simon Ser
Add a wlr_renderer.rendering bool, set it to true between wlr_renderer_begin() and wlr_renderer_end(). Assert we're rendering when calling functions that render.
2019-12-23meson: Various improvementsScott Anderson
Bumps minimum version to 0.51.0 - Remove all intermediate static libraries. They serve no purpose and are just add a bunch of boilerplate for managing dependencies and options. It's now managed as a list of files which are compiled into libwlroots directly. - Use install_subdir instead of installing headers individually. I've changed my mind since I did that. Listing them out is annoying as hell, and it's easy to forget to do it. - Add not_found_message for all of our optional dependencies that have a meson option. It gives some hints about what option to pass and what the optional dependency is for. - Move all backend subdirectories into their own meson.build. This keeps some of the backend-specific build logic (especially rdp and session) more neatly separated off. - Don't overlink example clients with code they're not using. This was done by merging the protocol dictionaries and setting some variables containing the code and client header file. Example clients now explicitly mention what extension protocols they want to link to. - Split compositor example logic from client example logic. - Minor formatting changes
2019-12-21render: fix EGL extensions not loadedSimon Ser
Some extensions are only advertised by the EGL implementation with a non-zero EGLDisplay. That's the case when the extension can only be enabled when the hardware/driver supports it for instance. Instead of checking for all extensions without a display, check only for EGL_EXT_platform_base and EGL_KHR_debug which are used before eglGetDisplay. Check for all other extensions when we have a display. Closes: https://github.com/swaywm/wlroots/issues/1955
2019-12-20Refactor EGL/GL API loadingSimon Ser
Remove glapi.sh code generation, replace it with hand-written loading code that checks extension strings before calling eglGetProcAddress. The GLES2 renderer still uses global state because of: - {PUSH,POP}_GLES2_DEBUG macros - wlr_gles2_texture_from_* taking a wlr_egl instead of the renderer
2019-11-26render/gles2: do not set GL_TEXTURE_MAG_FILTERRonan Pigott
2019-11-25render: remove return in wlr_texture_get_sizeSimon Ser
Otherwise this error happens: ../subprojects/wlroots/render/wlr_texture.c: In function ‘wlr_texture_get_size’: ../subprojects/wlroots/render/wlr_texture.c:47:9: error: ISO C forbids ‘return’ with expression, in function returning void [-Werror=pedantic] 47 | return texture->impl->get_size(texture, width, height); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../subprojects/wlroots/render/wlr_texture.c:45:6: note: declared here 45 | void wlr_texture_get_size(struct wlr_texture *texture, int *width, | ^~~~~~~~~~~~~~~~~~~~
2019-11-20Add -Wmissing-prototypesSimon Ser
This requires functions without a prototype definition to be static. This allows to detect dead code, export less symbols and put shared functions in headers.
2019-11-11Introduce wlr_renderer_get_eglDrew DeVault
2019-11-07render/gles2: provide public API to access GL textureSimon Ser
Prior to this commit, compositors needed to render the texture to an intermediate off-screen buffer using wlr_renderer APIs if they wanted to use a custom rendering path (e.g. render to a 3D scene). A new wlr_gles2_texture_get_attribs exposes the GL texture target and ID so that compositors can render wlr_textures with their own shaders. An example of a compositor doing so is available at [1]. [1]: https://git.sr.ht/~sircmpwn/wxrc/tree/3db905b7842ac42cf1878876e647005b41f00a52/src/render.c#L227
2019-11-06render/gles: Simplify textures a bitScott Anderson
We don't need our own enum for types. Instead we just use GL_TEXTURE_{2D,EXTERNAL_OES}, which already describes usage. Also fixes a situation where we were using GL_TEXTURE_2D in a situation we should not have. wl_drm buffers are always GL_TEXTURE_EXTERNAL_OES, no matter if they're RGB or any other format.
2019-10-23render/egl: prevent use-after-free when destroying current surfaceSimon Ser
2019-10-16render/gles2: don't unset the current EGL surface when destroying textureSimon Ser
When a texture is destroyed between wlr_egl_make_current and wlr_egl_swap_buffers, it resets the current EGL surface to NULL. This makes wlr_egl_swap_buffers fail. If the EGL context is already current, there's no need to reset it.
2019-10-11render/egl: support formats with zero modifiersSimon Ser
2019-09-15render/egl: Change KHR_debug log to include error codeScott Anderson
2019-08-31render/gles2: fix calculation for partial gles2 pixel read (#1809)Filip Sandborg
2019-08-12Revert "render/drm: keep old drm_format if realloc fails"Drew DeVault
This reverts commit c1be9b6945f9c664fe694a09620758db9ca695e9.
2019-08-12render/drm: keep old drm_format if realloc failsAntonin Décimo
2019-06-07render/dmabuf: add wlr_dmabuf_attributes_copySimon Ser
2019-06-07backend/drm: check format when scanning out DMA-BUFSimon Ser
2019-05-07render/gles2: print GL_RENDERERSimon Ser
This is often the name of the GPU and can help debugging graphics issues.
2019-04-26render/egl: fix swapping with no damageSimon Ser
According to the spec: > If <n_rects> is 0 then <rects> is ignored and the entire > surface is implicitly damaged and the behaviour is equivalent > to calling eglSwapBuffers. When we want to swap with an empty damage region, set the damage to a single empty rectangle.
2019-04-23render/egl: fix zero-length VLASimon Ser
2019-04-22Fix missing headers when building without X11Alyssa Ross
The deleted includes are redundant, because other headers will include the necessary files. Additionally, they cause build failures, because including EGL/egl.h or EGL/eglext.h directly, instead of through wlr/render/egl.h or wlr/render/interface.h, will mean that MESA_EGL_NO_X11_HEADERS will not have been defined, and so the EGL headers will attempt to pull in unnecessary X11 headers that may not exist on the system. For the headers produced by glgen.sh, the includes couldn't simply be deleted, because no other header would include the EGL headers. Neither wlr/render/egl.h or wlr/render/interface.h felt appropriate to include, so I opted instead to copy the MESA_EGL_NO_X11_HEADERS definition before the EGL includes.
2019-04-01render: switch wlr_renderer to wlr_drm_format_setemersion
2019-04-01render: introduce wlr_drm_format_setScott Anderson
This types adds a container for formats + modifiers. A list that is of [format [modifier]] was chosen instead of [format modifer] because that is how GBM accepts them. Co-Authored-By: emersion <contact@emersion.fr>
2019-03-01meson: enable more compiler warningsemersion
2019-01-29Require libdrm >= 2.4.95emersion