Simon Ser
69d4cf19b5
render/gles2: assert texture comes from the same renderer
...
Rendering a wlr_texture with a different wlr_renderer is invalid.
Add an assert to make sure this doesn't happen.
4 years ago
Simon Zeni
982498fab3
render: introduce renderer_get_render_buffer_caps
4 years ago
Simon Ser
661ba49564
render/gles2: destroy textures on renderer teardown
4 years ago
Simon Ser
8e375ae340
render/gles2: log when creating renderer
...
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.
4 years ago
Simon Zeni
10c5199d85
render/gles2: introduce wlr_gles2_renderer_create_with_drm_fd
4 years ago
Simon Zeni
84dea55b20
render: rename get_dmabuf_render_formats into get_render_formats
4 years ago
Stephan Hilb
9f012cac2f
drm: check for PRIME support
...
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 .
4 years ago
Simon Ser
a109a80dca
render: drop support for ellipses
...
For anything more complicated than quads, compositors can easily
ship their own shaders.
Closes: https://github.com/swaywm/wlroots/issues/2759
4 years ago
Simon Ser
1cdef8da57
render: drop wlr_renderer_blit_dmabuf
...
It can be replaced with wlr_renderer_bind_buffer. blit_dmabuf is
broken as-is (dies on an assertion).
4 years ago
Simon Zeni
78d21fa131
render/gles2: remove depth and bpp gles2_pixel_format, use drm pixel format
4 years ago
Simon Zeni
9601a2abf0
output: improve transform matrix calculation
...
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.
4 years ago
Simon Ser
27fba3df43
render: use DRM formats in wlr_texture_from_pixels
4 years ago
Simon Ser
b54ef3372d
render: use DRM formats in wlr_renderer_read_pixels
4 years ago
Simon Ser
00bf6674b3
output: use DRM format in wlr_output_preferred_read_format
4 years ago
Simon Ser
ddfee63055
render: use DRM formats in wlr_renderer_get_shm_texture_formats
4 years ago
Simon Ser
549435aee5
render/gles2: replace wlr_gles2_texture.wl_format with drm_format
4 years ago
Simon Ser
fab396f149
render/gles2: convert format table to DRM formats
4 years ago
Simon Ser
bfd020047d
render/gles2: remove current_buffer checks
...
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.
4 years ago
Brandon Dowdy
8aa38fe73e
render/egl: remove *config_attribs and wlr_egl->config
...
Breaking changes:
Both "EGLint *config_attribs" and "wlr_egl->config" no longer exist.
4 years ago
Simon Ser
afdf4dc890
render/gles2: make EGL context current in bind_buffer
...
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
4 years ago
Simon Ser
02a086599c
render/gles2: save/restore EGL context in destroy_buffer
...
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.
4 years ago
Simon Ser
3f7e0cf5f0
render/egl: remove surface and buffer age args from make_current
...
These aren't used anymore.
4 years ago
Simon Ser
1d461687d2
render/egl: replace init/finish with create/destroy
...
This ensures wlr_gles2_renderer can properly take ownership of the
wlr_egl.
Closes: https://github.com/swaywm/wlroots/issues/2612
4 years ago
Simon Ser
2585f322cb
render/gles2: fix EGL use-after-free
...
The wlr_egl was cleaned up too early.
While at it, also fix a memory leak.
Fixes: b899a412e3
("backend: remove wlr_egl from all backends")
4 years ago
Simon Zeni
b899a412e3
backend: remove wlr_egl from all backends
4 years ago
Simon Ser
3fd8098881
render/gles2: require GL_EXT_unpack_subimage
...
We implicitly depended on this extension.
4 years ago
Simon Ser
f91e89fd9f
render/gles2: query alpha size from render buffer
...
If we're using a render buffer, query the alpha size from it.
Closes: https://github.com/swaywm/wlroots/issues/2527
4 years ago
Simon Ser
be8403e73d
render/gles2: don't eglGetConfigAttrib on EGL_NO_CONFIG_KHR
...
If we don't have an EGL config, don't try to query anything from it.
4 years ago
Simon Ser
c94ab99ae2
render: rename wlr_renderer_get_formats
...
Rename wlr_renderer_get_formats to wlr_renderer_get_shm_texture_formats.
This makes it clear those formats are only suitable for shm import.
4 years ago
Simon Ser
49115e9d5d
render: rename wlr_renderer_get_dmabuf_formats
...
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.
4 years ago
Simon Ser
5d008d9030
render: introduce wlr_renderer_get_dmabuf_render_formats
...
It describes which DMA-BUF formats can be used to render.
4 years ago
Simon Ser
61612ecb36
render: remove wlr_renderer_format_supported
...
Instead, callers can just use wlr_renderer_get_formats and iterate over
the list.
This function was unused in wlroots.
4 years ago
Simon Ser
eb8360bda3
render: introduce wlr_renderer_get_drm_fd
4 years ago
Simon Ser
1245730ea2
render/gles2: fix y-inverted output when rendering to buffer
4 years ago
Simon Ser
6136fe87d1
render/gles2: implement wlr_renderer_bind_buffer
4 years ago
Simon Ser
1dbcfdaf81
render/gles2: remove gles2_procs
...
Move the global into wlr_gles2_renderer. This removes global state and
allows us to have multiple renderers with different GL loaders.
4 years ago
Simon Ser
62da61716f
render/gles2: make push/pop debug functions take a wlr_renderer
4 years ago
Simon Ser
26af316b3b
render/gles2: make wlr_gles2_texture_from_* private
...
These functions are unused by compositors (see e.g. [1]) and prevent
wlr_gles2_texture from accessing wlr_gles2_renderer state. This is an
issue for proper teardown [2] and for accessing GLES2 extensions.
[1]: https://github.com/swaywm/wlroots/pull/1962#issuecomment-569511830
[2]: https://github.com/swaywm/wlroots/pull/1962
4 years ago
Andri Yngvason
e05a85327f
render: gles2: Fix y-inversion in gles2_blit_dmabuf()
4 years ago
Simon Zeni
4a4da256dd
render/gles2: use glGetAttribLocation instead of hardcoded indices
4 years ago
Simon Ser
315bf08733
render: add wlr_render_subtexture_with_matrix
...
This renders only a subset of the texture, instead of the full texture.
5 years ago
Andri Yngvason
78d6eed6b3
render: Fix blit_dmabuf() breakage due to API change
5 years ago
Andri Yngvason
b64a8a7f98
render: Add wlr_renderer_blit_dmabuf()
5 years ago
Simon Ser
e91417ea8d
render: stop making EGL context current in wlr_egl_init
...
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).
5 years ago
Simon Ser
1edc42157b
render/egl: introduce wlr_egl_unset_current
...
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
5 years ago
Simon Ser
5dc3a9c754
render/gles2: add wlr_gles2_renderer_check_ext
5 years ago
Simon Ser
d10f8a98ec
render: only expose linux-dmabuf if EGL extension is supported
...
Only expose linux-dmabuf extension if EGL_EXT_image_dmabuf_import_ext is
supported.
Closes: https://github.com/swaywm/wlroots/issues/2076
5 years ago
Simon Ser
4a1015faff
render/gles2: only call wlr_egl_bind_display if supported
...
This allows us to hard-fail if the extension is advertised but we fail
to enable it.
5 years ago
Isaac Freund
c682d97841
Return failure of wlr_renderer_init_wl_display()
...
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.
5 years ago
Simon Ser
6d3f3b9300
render/gles2: unbind textures after use
...
Keeping textures bound results in hard-to-debug situations where some GL
operations incorrectly affect the texture.
5 years ago