Simon Ser
f0303978e3
render/gbm_allocator: log GBM backend name
4 years ago
Simon Ser
642b349e94
render/gles2: restore EGL context after texture operations
...
It can be surprising and unexpected that texture operations (such as
texture upload and import) change the current EGL context, especially
when it's done under-the-hood by wlroots in response to wl_surface
requests.
To prevent surprises, save and restore the previous EGL context.
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
50b120927d
render/egl: remove wlr_egl_swap_buffers
4 years ago
Simon Ser
76ed2255ef
render/egl: remove support for EGL_NATIVE_VISUAL_ID
...
Nobody uses it anymore.
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
07d75c99db
render: remove EGL config and visual from wlr_renderer_autocreate
...
This isn't used anymore by any backend.
Some examples still provide an EGL config to wlr_egl_init, so we can't
drop it yet there.
4 years ago
Simon Ser
c4635c68d2
render/drm_format_set: add special case for LINEAR-only formats
...
Our wlr_format_set structs don't hold GBM usage flags. Instead, users
who want to get a LINEAR buffer can use the DRM_FORMAT_MOD_LINEAR
modifier even if the kernel driver doesn't support modifiers.
Add a special case to wlr_drm_format_intersect to properly handle this
situation.
4 years ago
Simon Ser
b9460ab724
Stop using wlr_texture_get_size
...
Just use wlr_texture.{width,height} directly.
4 years ago
Simon Ser
d37214cb16
render/drm_format_set: add wlr_drm_format_{create,add}
4 years ago
Simon Ser
bdf26f87d5
render/allocator: ignore NULL in wlr_allocator_destroy
4 years ago
Simon Ser
3fd8098881
render/gles2: require GL_EXT_unpack_subimage
...
We implicitly depended on this extension.
4 years ago
Ilia Bozhinov
12ede67c62
egl: fix memory leak
...
I have noticed this with LeakSanitizer, I hope these are all occurrences.
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
8a6930c138
render/drm_format_set: assert len <= cap when duplicating
4 years ago
Simon Ser
29da97c185
render/drm_format_set: allocate using cap when duplicating
...
In wlr_drm_format_dup, allocate the new wlr_drm_format using cap instead
of len. This makes it so the cap field is up-to-date and the chunk of
memory isn't too small if we append new modifiers (we don't allow this
yet but might in the future).
4 years ago
Simon Ser
037710b1d4
render/egl: support config-less wlr_egl
...
When using wlr_swapchain, there's no need to select an EGLConfig. Add
support for creating config-less EGL contexts.
4 years ago
Simon Ser
82443ea46b
render/drm_format_set: introduce wlr_drm_format_intersect
...
Intersects modifiers from two wlr_drm_format structs. If either format
doesn't support modifiers, the resulting format won't support modifiers.
4 years ago
Simon Ser
83a5d03bf3
render/egl: remove wlr_egl.external_only_dmabuf_formats
...
Replace it with wlr_egl.dmabuf_render_formats.
4 years ago
Simon Ser
1f15dd093d
render: assert {X,A}RGB8888 are supported
...
The Wayland protocol requires those to be supported.
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
44cea53e72
render/egl: don't rely on being able to open primary node
...
On some setups (e.g. remote access via SSH) the current user won't have
the permission to open the primary node at all. It's still possible to
use drmGetDevices to match the primary node name returned by EGL.
Closes: https://github.com/swaywm/wlroots/issues/2488
4 years ago
Ronan Pigott
dc7c6c4860
render/egl: recognize EGL_BAD_DEVICE_EXT error
4 years ago
Simon Ser
eb8360bda3
render: introduce wlr_renderer_get_drm_fd
4 years ago
Simon Ser
c8d95acc37
render/egl: introduce wlr_egl_dup_drm_fd
4 years ago
Simon Ser
c11c6c4568
render/swapchain: add support for buffer age
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
c88c54fb38
render: introduce wlr_renderer_bind_buffer
4 years ago
Simon Ser
b0a663d39d
render: introduce wlr_swapchain
...
The swapchain maximum capacity is set to 4, so that we have enough room
for:
- A buffer currently displayed on screen
- A buffer queued for display (e.g. to KMS)
- A pending buffer that'll be queued next commit
- An additional pending buffer in case we want to invalidate the
currently pending one
4 years ago
Simon Ser
7c6212a0f7
render/drm_format_set: introduce wlr_drm_format_dup
4 years ago
Simon Ser
5913040110
render: introduce wlr_gbm_allocator
4 years ago
Simon Ser
f47445f142
render: introduce wlr_allocator
4 years ago
Isaac Freund
0724b3c453
Use uint32_t in wlr_renderer_begin signature
...
This matches the signature of wlr_renderer_impl.begin
4 years ago
Guido Cella
6949d0fd38
render: Don't crash on 0 dimensions
...
Don't force compositors to check when an empty shape is being renderered.
References #2282 . This was motivated by dwl crashing when setting window
borders to 0 (djpohly/dwl#51 ).
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
e8872d9ed7
render/gles2: keep ref to wlr_gles2_renderer in wlr_gles2_texture
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
6ef5d18757
render: egl: Use current display to restore NULL context
...
eglGetCurrentDisplay() returns EGL_NO_DISPLAY when there is no context current
and eglMakeCurrent() needs a display argument.
Fixes #2327
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
58df3eda9f
render/egl: print error name
...
Allows for easier debugging.
5 years ago