Commit Graph

50 Commits

Author SHA1 Message Date
Simon Ser dc2e640a7d buffer: make enum wlr_buffer_cap public
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.

(cherry picked from commit a38baec1f8)
2021-07-07 19:24:36 +02:00
Simon Ser 44feb832f9 backend/headless: remove swapchain
Rely on wlr_output's generic swapchain support instead of creating our
own. The headless output now simply keeps a reference to the front buffer
and does nothing else.
2021-06-07 15:42:38 +02:00
Simon Ser c82f37542d backend/headless: use common renderer and allocator
Instead of managing our own renderer and allocator, let the common
code do it.

Because wlr_headless_backend_create_with_renderer needs to re-use
the parent renderer, we have to hand-roll some of the renderer
initialization.
2021-05-21 22:13:54 +02:00
Simon Ser 7ec5bf6b10 backend: introduce wlr_backend_finish
This new functions cleans up the common backend state. While this
currently only emits the destroy signal, this will also clean up
the renderer and allocator in upcoming patches.
2021-05-21 22:13:54 +02:00
Simon Ser c85789a3a9 backend/headless: dup DRM FD in wlr_headless_backend_create_with_renderer
We were not dup'ing the DRM FD coming from wlr_renderer_get_drm_fd,
resulting in a double-close on backend destroy.
2021-04-29 19:59:42 +02:00
Simon Zeni cc1b66364c backend: use wlr_allocator_autocreate 2021-04-28 20:55:57 +02:00
Simon Zeni 144189674e backend: introduce backend_get_buffer_caps 2021-04-28 20:55:57 +02:00
Simon Zeni c75aa71816 render/gbm_allocator: make wlr_gbm_allocator_create return a wlr_allocator 2021-04-28 20:55:57 +02:00
Simon Ser 5c699f09cb Log drmGetDevices2 error code 2021-04-26 16:27:24 +02:00
Simon Zeni 84dea55b20 render: rename get_dmabuf_render_formats into get_render_formats 2021-04-15 17:10:06 +02:00
Simon Ser c6c7fccd96
backend/headless: create renderer after wlr_backend_init
We were calling wlr_renderer_autocreate before wlr_backend_init,
which caused a NULL dereference on wlr_backend.impl.
2021-01-17 01:08:40 +01:00
Simon Zeni e128e6c08d render: drop egl parameters from wlr_renderer_autocreate 2021-01-16 08:57:42 +01:00
Simon Ser affc59454e backend/headless: implement get_drm_fd 2021-01-16 08:57:42 +01:00
Simon Ser a6a0568316
backend: remove unnecessary GLES2 includes 2021-01-14 12:36:49 +01:00
Simon Zeni 9192c0480a remove unnecessary egl includes 2021-01-07 17:11:22 +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 4b03bdc3ab Remove wlr_create_renderer_func_t
This callback allowed compositors to customize the EGL config used by
the renderer. However with renderer v6 EGL configs aren't used anymore.
Instead, buffers are allocated via GBM and GL FBOs are rendered to. So
customizing the EGL config is a no-op.
2020-12-30 17:09:40 +01:00
Simon Ser 0aa2ba0c03 backend/headless: select the rendering device ourselves
Backends will eventually stop creating their renderer. To prepare for
this, stop using EGL_PLATFORM_SURFACELESS_MESA in the headless renderer.
Pick a render node using libdrm.

The new allocator/renderer creation logic looks very much like what will
end up in common code.
2020-12-16 12:12:36 +01:00
Simon Ser 87bd718de5
backend: use fcntl(F_DUPFD_CLOEXEC) instead of dup
This makes sure the CLOEXEC flag is set on the dup'ed FD.
2020-12-15 20:52:53 +01:00
Simon Ser bfb59fd4d7 backend/headless: create a config-less EGL context 2020-12-07 11:40:45 +01:00
Simon Ser c045253927 backend/headless: use a format suitable for rendering
When allocating buffers, use a format suitable for rendering. This
avoids picking a format that won't work.
2020-11-30 11:08:44 +01:00
Simon Ser 61f8cdfb9e backend/headless: switch to wlr_swapchain 2020-11-15 22:54:07 +01:00
Simon Ser 46c83cbf3d backend/headless: handle renderer destroy
When the headless backend uses an already-existing renderer, it doesn't
have ownership over the renderer. When the renderer is destroyed, the
headless backend needs to destroy itself.
2020-05-02 19:36:03 +02:00
Simon Ser 6129a6f93e backend/headless: add wlr_headless_backend_create_with_renderer
This allows one to create a headless backend with an existing renderer.
2020-04-22 22:40:54 +02:00
Simon Ser 40513f1a0e backend/headless: use FBOs instead of pbuffers 2020-04-22 22:40:54 +02:00
Simon Ser 9acca4fc73 backend: set EGL_RENDERABLE_TYPE and EGL_SURFACE_TYPE
Ensure these are set to the correct value.
2020-04-09 00:15:25 +00:00
Simon Ser 2b04857343 render/egl: remove SURFACELESS_MESA special case
Users can just pass EGL_DEFAULT_DISPLAY themselves.
2020-01-12 10:10:09 -07:00
Simon Ser 515679e4fe Refactor EGL/GL API loading
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-12-20 01:03:34 +00:00
emersion 09550032b7
render: correctly set EGL_RENDERABLE_TYPE
This should be set to EGL_OPENGL_ES2_BIT.

Also fixes EGL config attributes in the headless and X11 backends.
2018-11-10 13:20:54 +01:00
emersion bc34486c04 backend/headless: add assertions 2018-09-18 11:01:53 +02:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Ilia Bozhinov 24cf70ae96 backends: implement custom EGL and renderer initialization
Compositors now have more control over how the backend creates its
renderer. Currently all backends create an EGL/GLES2 renderer, so
the necessary attributes for creating the context are passed to a
user-provided callback function. It is responsible for initializing
provided wlr_egl and to return a renderer. On fail, return 0.

Fixes #987
2018-05-25 14:56:52 +03:00
emersion cd9f25711c
backend: destroy renderer when destroying backend 2018-04-25 23:53:43 +01:00
emersion d2ebbd103c
backend: remove wlr_backend_get_egl 2018-04-08 11:00:56 -04:00
emersion 33a2eb4b77
Untie wlr_backend from wlr_renderer 2018-03-31 18:49:43 -04:00
Drew DeVault 1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Scott Anderson 86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion 36ead80cd1
Make wlr_signal_emit_safe private 2018-02-12 19:52:47 +01:00
emersion 10ecf871f2
Remove wlr_backend.events.{output_remove,device_remove} 2018-02-12 10:36:43 +01:00
emersion 5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
emersion babdd6ccf7
backend: fix use-after-free when destroying backends
The backend destroy signal is emitted before the output_remove
signal is. When the destroy signal is emitted listeners remove
their output_remove listener, so the output_remove signal is never
received and listeners have an invalid output pointer.

The correct way to solve this would be to remove the output_remove
signal completely and use the wlr_output.events.destroy signal
instead. This isn't yet possible because wl_signal_emit is unsafe
and listeners cannot be removed in listeners.
2018-01-30 19:45:57 +01:00
emersion 4fa90b0511
Backport screenshooter fixes from the renderer redesign v1
This backports some changes to #319 to fix the screenshooter data
format. This also adds wlr_backend_get_renderer which will be
useful to support multiple renderers.
2018-01-23 22:06:54 +01:00
emersion 771263380c
Add wlr_output::enabled 2018-01-04 12:46:15 +01:00
emersion b99d1f4fcc
Refactor wlr_egl_init to accept config_attribs 2017-12-17 23:51:04 +01:00
emersion bc5bdb7793
Add headless input devices 2017-12-17 18:49:20 +01:00
emersion 0256de0002
Add full refresh rate support to custom modes 2017-12-17 18:02:55 +01:00
emersion b852fb9a2b
Minimal working headless output 2017-12-17 13:35:07 +01:00
emersion 3970264ccf
Initialize headless backend 2017-12-17 12:56:42 +01:00