Commit Graph

50 Commits

Author SHA1 Message Date
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
Simon Ser 6ca82087b1 backend/drm: fix segfault in init_drm_surface
When surf->gbm was previously set, we destroy it without setting it to
NULL. Later on, we only create the GBM surface if surf->gbm is NULL.
This result in a use-after-free when we start using surf->gbm.

Closes: https://github.com/swaywm/wlroots/issues/1868
Closes: https://github.com/swaywm/wlroots/issues/1874
Closes: https://github.com/swaywm/sway/issues/4785
Closes: https://github.com/swaywm/sway/issues/4717
Closes: https://github.com/swaywm/sway/issues/4730
Fixes: 2bdd1d0896 ("backend/drm: use modifiers for our GBM buffers")
2019-12-05 10:49:04 -05:00
Simon Ser e97c2c3639 backend/drm: retry without modifiers for the primary plane
On some Intel cards using modifiers can fill the FIFO and prevent
hotplugged outputs from being properly enabled.

Add a fallback without modifiers.

Fixes: 2bdd1d0896 ("backend/drm: use modifiers for our GBM buffers")
References: https://github.com/swaywm/wlroots/issues/1840
Closes: https://github.com/swaywm/wlroots/issues/1852
2019-10-23 09:36:50 +00:00
Simon Ser 2bdd1d0896 backend/drm: use modifiers for our GBM buffers 2019-10-11 08:11:48 -04:00
Ivan Molodetskikh 5f78ea20fa drm: use IMPORT_FD for INVALID modifier
GBM_BO_IMPORT_FD_MODIFIER doesn't accept the INVALID modifier.
2019-09-26 23:26:40 +03:00
emersion 96d6fde5dc backend/drm: add basic support for direct scan-out 2019-06-07 09:06:11 -04:00
Alyssa Ross 95b22619e0 Fix missing headers when building without X11
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-22 00:04:08 +03:00
Vincent Vanlaer bc048b22fb Copy cursor surface to secondary gpu if necessary 2019-02-14 12:31:54 +01:00
emersion 75371d2c88
Require libdrm >= 2.4.95 2019-01-29 19:33:38 +01:00
emersion ee293fab58
backend/drm: fix GBM format mismatch
We create the EGL config with GBM_FORMAT_ARGB8888, but then initialize GBM BOs
with GBM_FORMAT_XRGB8888. This mismatch confuses Mesa.

Instead, we can always use GBM_FORMAT_ARGB8888, and use DRM_FORMAT_XRGB8888
when calling drmModeAddFB2.

Fixes https://github.com/swaywm/wlroots/issues/1438
2019-01-29 12:04:12 +01:00
emersion b5125ff328
backend/drm: specify minimum config attributes
Since the format used by DRM is GBM_FORMAT_ARGB8888, we need at least a R, G, B
and A channel.
2018-11-04 09:00:55 +01:00
Scott Anderson 1a2b3445dc Remove unused data from gbm_bo userdata
These aren't used anymore and crashes when the gbm_bo tries to get
destroyed (e.g. on hotplug).
2018-08-04 17:02:53 +12:00
Mariusz Bialonczyk e547e55be0 multi-gpu: do not flip screens on secondary GPU
All screens on secondary GPU in multiple GPU configurations
was flipped 180.

The flipped screens was always on secondary card (the primary card
was always correct).

Tested on nouveau with:
WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card2
WLR_DRM_DEVICES=/dev/dri/card2:/dev/dri/card1

The commit is fixing this problem. Now all screens are "normal".
2018-08-03 07:43:22 +02:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
emersion 21928cbe61
Merge branch 'master' into screencontent 2018-05-31 12:33:27 +01:00
emersion 28020ff577
Only allow one modifier per DMA-BUF, split attributes struct in render/ 2018-05-30 09:29:12 +01:00
emersion bd430b8620
backend/drm: support multi-planar DMA-BUFs when exporting 2018-05-29 18:47:17 +01:00
emersion 9e26808c28
output, backend/drm: add wlr_output_export_dmabuf 2018-05-29 18:45:45 +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 71ca45e2c0
Make sure we don't use others' prefixes 2018-04-25 23:24:58 +01:00
emersion b0d99f5c67
Remove wlr_ prefix from local symbols 2018-04-25 23:00:46 +01:00
emersion 018b82c01e
render/egl: allow passing NULL to surface and image destructors 2018-04-25 08:28:48 +01:00
emersion eaed6bd03b
render/egl: add wlr_egl_destroy_surface 2018-04-24 23:44:43 +01:00
emersion 33a2eb4b77
Untie wlr_backend from wlr_renderer 2018-03-31 18:49:43 -04:00
emersion 3bda7e2ef8
Use DRM_FORMAT_MOD_LINEAR instead of a hardcoded constant 2018-03-26 12:00:08 -04:00
emersion c63d94483b
Redesign wlr_texture
- Textures are now immutable (apart from those created from raw
  pixels), no more invalid textures
- Move all wl_drm stuff in wlr_renderer
- Most of wlr_texture fields are now private
- Remove some duplicated DMA-BUF code in the DRM backend
- Add more assertions
- Stride is now always given as bytes rather than pixels
- Drop wl_shm functions

Fun fact: this patch has been written 10,000 meters up in the air.
2018-03-24 23:48:32 -04:00
emersion a854c2f246
Merge branch 'master' into gles2-renderer-redesign 2018-03-23 00:55:55 +01:00
emersion b1f93bc5cc
render/egl: use EGL_KHR_debug 2018-03-21 10:42:43 +01:00
emersion 3581573bdc
render/gles2: make wlr_renderer_begin take viewport size
This allows raw GL calls outside wlr_renderer to be removed.
2018-03-21 07:37:09 +01:00
emersion c41de2d1be
render: split render.h into wlr_renderer.h and wlr_texture.h 2018-03-19 23:16:29 +01:00
emersion 6227da96b1
backend/drm: don't hardcode matrix 2018-03-18 11:34:23 +01:00
emersion 824a95ad19
matrix: use 2D matrices 2018-03-15 15:33:58 +01:00
emersion d26b67cb06
matrix: unify API, don't use array pointers 2018-03-15 11:10:56 +01:00
emersion b6a3f240c7
matrix: move to types/ 2018-03-15 09:11:27 +01:00
Guido Günther d08792bfff Add alpha to wlr_render_with_matrix
so we can use the alpha channel to e.g. blend in textures
2018-02-25 13:47:48 +01:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion bf6d245400
Swap buffers with damage 2018-02-09 22:54:14 +01:00
emersion 3d3ea32137
Merge remote-tracking branch 'upstream/master' into output-damage 2018-02-03 00:15:44 +01:00
Markus Ongyerth cde0f454b3 Clean up the gbm/egl as well 2018-01-29 11:49:31 +01:00
Markus Ongyerth 2cdb646531 relases gbm buffers on init
The wlr_drm_surface_init function is called (upon others) when the drm
mode is changed.
When the surface was used previously this replaced the gbm_surface, but
did not replace the gbm buffers (front/back).
With this, wlr_drm_surface_get_from never set up the new buffers with
the new glViewport because surf->front existed.

This frees the buffers to get new buffers on the new surface with the
new viewport.
2018-01-29 11:29:54 +01:00
emersion 0365b587f0
output: add damage tracking via buffer age 2018-01-21 00:06:35 +01:00
emersion b99d1f4fcc
Refactor wlr_egl_init to accept config_attribs 2017-12-17 23:51:04 +01:00
emersion 18eb1eee3f
Listen to display destroy in xwayland, rename wlr_egl_free 2017-12-08 00:59:37 +01:00
Scott Anderson bc113c16aa Use correct include path for glapi.h 2017-11-30 10:32:55 +13:00
Scott Anderson 9b984253e2 Move egl.h to render/egl.h 2017-10-22 10:36:07 +13:00
Scott Anderson c0e5feea37 Add GL/EGL extension loader generator 2017-10-08 13:23:41 +13:00
Scott Anderson f6f9c40965 Minor fixes 2017-10-01 22:44:24 +13:00
Scott Anderson 009c3747a8 Multi-GPU DRM 2017-10-01 22:29:25 +13:00
Scott Anderson eaef028976 Add renderer pointer inside drm_surface 2017-10-01 15:55:25 +13:00
Scott Anderson 096249a2a1 Split DRM rendering to its own file 2017-09-30 20:52:58 +13:00