Simon Ser
c73a8cde83
render/gbm_allocator: fix gbm_device use-after-free
...
We need to destroy any gbm_bo we've created before gbm_device_destroy.
Closes: https://github.com/swaywm/wlroots/issues/2601
2021-01-15 19:27:49 +01:00
Simon Ser
f0303978e3
render/gbm_allocator: log GBM backend name
2021-01-15 11:18:17 +01:00
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.
2021-01-15 10:19:31 +01:00
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.
2021-01-14 12:00:06 +01:00
Simon Ser
3f7e0cf5f0
render/egl: remove surface and buffer age args from make_current
...
These aren't used anymore.
2021-01-12 11:31:04 +01:00
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
2021-01-12 11:31:04 +01:00
Simon Ser
50b120927d
render/egl: remove wlr_egl_swap_buffers
2021-01-12 11:31:04 +01:00
Simon Ser
76ed2255ef
render/egl: remove support for EGL_NATIVE_VISUAL_ID
...
Nobody uses it anymore.
2021-01-12 11:31:04 +01:00
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")
2021-01-12 10:45:14 +01:00
Simon Zeni
b899a412e3
backend: remove wlr_egl from all backends
2021-01-07 17:11:22 +01:00
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.
2021-01-06 12:05:51 +01:00
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.
2020-12-30 11:17:43 +01:00
Simon Ser
b9460ab724
Stop using wlr_texture_get_size
...
Just use wlr_texture.{width,height} directly.
2020-12-25 12:21:29 +01:00
Simon Ser
d37214cb16
render/drm_format_set: add wlr_drm_format_{create,add}
2020-12-18 09:41:12 +01:00
Simon Ser
bdf26f87d5
render/allocator: ignore NULL in wlr_allocator_destroy
2020-12-17 20:34:19 +01:00
Simon Ser
3fd8098881
render/gles2: require GL_EXT_unpack_subimage
...
We implicitly depended on this extension.
2020-12-15 14:55:18 +01:00
Ilia Bozhinov
12ede67c62
egl: fix memory leak
...
I have noticed this with LeakSanitizer, I hope these are all occurrences.
2020-12-10 23:29:59 +01:00
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
2020-12-09 21:45:28 +01:00
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.
2020-12-09 21:45:28 +01:00
Simon Ser
8a6930c138
render/drm_format_set: assert len <= cap when duplicating
2020-12-08 23:35:05 +01:00
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).
2020-12-08 16:02:44 +01:00
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.
2020-12-07 11:40:45 +01:00
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.
2020-12-03 10:52:25 +01:00
Simon Ser
83a5d03bf3
render/egl: remove wlr_egl.external_only_dmabuf_formats
...
Replace it with wlr_egl.dmabuf_render_formats.
2020-11-30 11:08:44 +01:00
Simon Ser
1f15dd093d
render: assert {X,A}RGB8888 are supported
...
The Wayland protocol requires those to be supported.
2020-11-30 11:08:44 +01:00
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.
2020-11-30 11:08:44 +01:00
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.
2020-11-30 11:08:44 +01:00
Simon Ser
5d008d9030
render: introduce wlr_renderer_get_dmabuf_render_formats
...
It describes which DMA-BUF formats can be used to render.
2020-11-30 11:08:44 +01:00
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.
2020-11-30 11:08:44 +01:00
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
2020-11-28 19:21:36 +01:00
Ronan Pigott
dc7c6c4860
render/egl: recognize EGL_BAD_DEVICE_EXT error
2020-11-19 00:42:37 +01:00
Simon Ser
eb8360bda3
render: introduce wlr_renderer_get_drm_fd
2020-11-15 22:54:07 +01:00
Simon Ser
c8d95acc37
render/egl: introduce wlr_egl_dup_drm_fd
2020-11-15 22:54:07 +01:00
Simon Ser
c11c6c4568
render/swapchain: add support for buffer age
2020-11-15 22:48:42 +01:00
Simon Ser
1245730ea2
render/gles2: fix y-inverted output when rendering to buffer
2020-11-15 22:48:42 +01:00
Simon Ser
6136fe87d1
render/gles2: implement wlr_renderer_bind_buffer
2020-11-15 22:48:42 +01:00
Simon Ser
c88c54fb38
render: introduce wlr_renderer_bind_buffer
2020-11-15 22:48:42 +01:00
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
2020-11-15 22:48:42 +01:00
Simon Ser
7c6212a0f7
render/drm_format_set: introduce wlr_drm_format_dup
2020-11-15 22:48:42 +01:00
Simon Ser
5913040110
render: introduce wlr_gbm_allocator
2020-11-15 22:48:42 +01:00
Simon Ser
f47445f142
render: introduce wlr_allocator
2020-11-15 22:48:42 +01:00
Isaac Freund
0724b3c453
Use uint32_t in wlr_renderer_begin signature
...
This matches the signature of wlr_renderer_impl.begin
2020-11-11 11:01:46 +01:00
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 ).
2020-08-27 17:39:31 +02:00
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.
2020-07-28 06:59:07 -06:00
Simon Ser
62da61716f
render/gles2: make push/pop debug functions take a wlr_renderer
2020-07-28 06:59:07 -06:00
Simon Ser
e8872d9ed7
render/gles2: keep ref to wlr_gles2_renderer in wlr_gles2_texture
2020-07-28 06:59:07 -06:00
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
2020-07-28 06:59:07 -06:00
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
2020-07-14 19:55:20 +02:00
Andri Yngvason
e05a85327f
render: gles2: Fix y-inversion in gles2_blit_dmabuf()
2020-07-01 11:43:02 +02:00
Simon Zeni
4a4da256dd
render/gles2: use glGetAttribLocation instead of hardcoded indices
2020-06-24 20:01:19 +02:00