nyorain
9988eb3378
vulkan: Fix imported image layout
2021-12-26 13:21:54 +01:00
Simon Ser
77d811a21b
render: add wlr_renderer_init_wl_shm
...
This allows compositors to initialize wl_shm without initializing
other globals like linux-dmabuf.
2021-12-07 15:15:28 +01:00
Simon Ser
7201aae3d6
render/drm-format-set: add wlr_drm_format_set_intersect
...
This intersects two DRM format sets. This is useful for implementing
DMA-BUF feedback in compositors, see e.g. the Sway PR [1].
[1]: https://github.com/swaywm/sway/pull/6313
2021-12-03 14:42:41 +00:00
Simon Ser
1bf9676e87
render/egl: improve modifier support detection
...
Support for EXT_image_dma_buf_import_modifiers doesn't necessarily
indicate support for modifiers. For instance, Mesa will advertise
EXT_image_dma_buf_import_modifiers for all drivers. This is a trick
to allow EGL clients to enumerate supported formats (something
EXT_image_dma_buf_import is missing). For more information, see [1].
Add a new wlr_egl.has_modifiers flag which indicates whether
modifiers are supported. It's set to true if any
eglQueryDmaBufModifiersEXT query returned a non-empty list.
Use that flag to figure out whether the buffer modifier should be
passed to the EGL implementation on import.
[1]: https://github.com/KhronosGroup/EGL-Registry/issues/142
2021-12-02 14:21:51 +00:00
Simon Ser
de0bc78319
render/pixman: advertise MOD_INVALID instead of MOD_LINEAR
...
The backends and allocators use INVALID, but the renderer uses
LINEAR. Running a compositor with WLR_RENDERER=pixman results in:
00:00:00.744 [types/output/render.c:59] Failed to pick primary buffer format for output 'WL-1'
2021-12-02 14:12:14 +00:00
Simon Ser
051d1ce90e
render/egl: add wlr_egl_create_with_context
...
This allows creating a wlr_egl from an already-existing EGL display
and context. This is useful to allow compositors to choose the exact
EGL initialization parameters.
2021-12-01 14:08:20 +01:00
Simon Ser
ffd4a27714
render/egl: store IMG_context_priority in wlr_egl
...
The next commit will split extension lookup and context
initialization.
2021-12-01 14:03:37 +01:00
Simon Ser
98f2efde98
render/drm_format_set: remove special LINEAR case
...
This was used to make the intersection of INVALID and LINEAR result
in LINEAR. We can now just require LINEAR to be in both lists.
2021-11-26 16:40:53 +00:00
Simon Ser
d5df8d5cbf
render/egl: always add LINEAR to supported modifiers
2021-11-26 16:40:53 +00:00
Simon Ser
affe9eda57
Require INVALID for implicit format modifiers
...
See [1] for the motivation.
[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-11-26 16:40:53 +00:00
Simon Ser
d78cb808b1
render/drm_format_set: add wlr_drm_format_has
2021-11-26 16:40:53 +00:00
Simon Ser
2e33139ef7
render: introduce WLR_RENDER_DRM_DEVICE
...
This env var allows to override the DRM node used by the GLES2 and
Vulkan renderers. It's especially useful to select a DRM node when
running with the headless backend.
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2656
2021-11-25 15:12:32 +00:00
Simon Ser
e4f748c6e9
render/allocator: fallback to renderer DRM FD in autocreate
...
If the backend doesn't have a DRM FD, fallback to the renderer's.
This accomodates for the situation where the headless backend hasn't
picked a DRM FD in particular, but the renderer has picked one.
2021-11-25 15:12:32 +00:00
Simon Ser
bf57825560
render: pick DRM FD in autocreate
...
If the backend hasn't picked a DRM FD but supports DMA-BUF, pick
an arbitrary render node. This will allow removing the DRM device
selection logic from the headless backend.
2021-11-25 15:12:32 +00:00
Joshua Ashton
f132d66816
render/vulkan: Optimize vertex shader
...
This ends up being a horrible global load:
s_getpc_b64 s[4:5] // 000000000000: BE841C80
v_add_u32 v0, s2, v0 // 000000000004: 68000002
v_sub_co_u32 v1, vcc, 0, v0 // 000000000008: 34020080
v_max_i32 v1, v0, v1 // 00000000000C: 1A020300
v_and_b32 v1, 3, v1 // 000000000010: 26020283
v_cmp_lt_i32 s[0:1], v0, 0 // 000000000014: D0C10000 00010100
v_sub_co_u32 v0, vcc, 0, v1 // 00000000001C: 34000280
v_cndmask_b32 v0, v1, v0, s[0:1] // 000000000020: D1000000 00020101
v_lshlrev_b32 v1, 3, v0 // 000000000028: 24020083
v_mad_u32_u24 v0, v0, 8, 4 // 00000000002C: D1C30000 02111100
v_min_u32 v1, 32, v1 // 000000000034: 1C0202A0
v_min_u32 v0, 32, v0 // 000000000038: 1C0000A0
s_getpc_b64 s[0:1] // 00000000003C: BE801C00
s_add_u32 s0, s0, 0x0000003c // 000000000040: 8000FF00 0000003C
s_addc_u32 s1, s1, 0 // 000000000048: 82018001
global_load_dword v1, v[1:2], s[0:1] // 00000000004C: DC508000 01000001
global_load_dword v0, v[0:1], s[0:1] // 000000000054: DC508000 00000000
v_mov_b32 v2, 0 // 00000000005C: 7E040280
v_mov_b32 v3, 1.0 // 000000000060: 7E0602F2
s_waitcnt vmcnt(0) // 000000000064: BF8C0F70
exp pos0, v1, v0, v2, v3 done // 000000000068: C40008CF 03020001
exp param0, off, off, off, off // 000000000070: C4000200 00000000
s_endpgm // 000000000078: BF810000
v_cndmask_b32 v0, s0, v0, vcc // 00000000007C: 00000000
v_cndmask_b32 v0, s0, v0, vcc // 000000000080: 00000000
v_add_f16 v192, s0, v0 // 000000000084: 3F800000
v_cndmask_b32 v0, s0, v0, vcc // 000000000088: 00000000
v_add_f16 v192, s0, v0 // 00000000008C: 3F800000
v_add_f16 v192, s0, v0 // 000000000090: 3F800000
v_cndmask_b32 v0, s0, v0, vcc // 000000000094: 00000000
v_add_f16 v192, s0, v0 // 000000000098: 3F800000
v_cndmask_b32 v0, s0, v0, vcc // 00000000009C: 00000000
With some bit magic, we can get something much nicer:
v_add_u32 v0, s2, v0 // 000000000000: 68000002
v_add_u32 v1, 1, v0 // 000000000004: 68020081
v_and_b32 v1, 2, v1 // 000000000008: 26020282
v_cvt_f32_i32 v1, v1 // 00000000000C: 7E020B01
v_mul_f32 v1, 0.5, v1 // 000000000010: 0A0202F0
v_and_b32 v0, 2, v0 // 000000000014: 26000082
v_cvt_f32_i32 v0, v0 // 000000000018: 7E000B00
v_mul_f32 v0, 0.5, v0 // 00000000001C: 0A0000F0
v_mov_b32 v2, 0 // 000000000020: 7E040280
v_mov_b32 v3, 1.0 // 000000000024: 7E0602F2
exp pos0, v1, v0, v2, v3 done // 000000000028: C40008CF 03020001
exp param0, off, off, off, off // 000000000030: C4000200 00000000
s_endpgm // 000000000038: BF810000
The above output was based on just shoving it in ShaderPlayground -- I was not able to use pipeline feedback as I was unable to get RenderDoc working due to the EXT_physical_device_drm requirement.
I additionally considered using >> 1 instead of * 0.5, but AMD has dedicated modifiers to merge a * 0.5, * 2.0, etc in a single instruction. (Albeit, not taken advantage of in the code above, but might with ACO)
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-11-23 15:46:24 +00:00
Simon Ser
5332935afc
render/vulkan: quiet glslangValidator
...
This suppresses the output filename printed to stdout. Errors and
warnings should still be printed to stderr as usual.
2021-11-23 15:38:56 +00:00
Demi Marie Obenour
b5d4bc3c62
Improve wlr_drm_format documentation
...
A wlroots user can easily get confused and think that `cap` refers to
wlroots buffer capabilities, not array capacity.
2021-11-17 16:35:20 +00:00
Simon Ser
a04cfca4da
Remove support for DMA-BUF flags
...
They are never used in practice, which makes all of our flag
handling effectively dead code. Also, APIs such as KMS don't
provide a good way to deal with the flags. Let's just fail the
DMA-BUF import when clients provide flags.
2021-11-17 16:12:59 +00:00
Cole Mickens
3a685b10b6
egl: use alts for EGL_EXT_device_enum, if missing
2021-11-09 16:47:32 -08:00
Simon Zeni
02a1ae169e
render/allocator: make wlr_allocator part of the public API
2021-11-09 15:26:36 +00:00
Jan Beich
760e166578
render: completely disable gles2 if requested but libEGL is found
...
For `required` to disable search the value needs to be of `feature` type.
Checking `gles2` via `in` keyword returns a `bool` but `required: false`
makes the dependency optional instead of disabled.
2021-11-02 09:36:38 +00:00
Haelwenn (lanodan) Monnier
6666604f17
render/egl.c: Fix memory leaks in egl_create
...
calloc is moved to right before egl is called to avoid requiring to free()
unused memory.
Found via scan-build
2021-10-27 07:30:36 -06:00
Haelwenn (lanodan) Monnier
4fb652c27f
render/pixman/renderer.c: Fix memory-leak in create_buffer
...
Found via scan-build
2021-10-27 07:30:36 -06:00
Simon Ser
36cf387427
render/vulkan: check vulkan-headers dependency
...
There's no pkg-config file we can check for sadly, so check
vulkan/vulkan.h as a fallback.
Closes: https://github.com/swaywm/wlroots/issues/3272
2021-10-19 06:51:14 -06:00
Joshua Ashton
b62ce3c3c8
render/vulkan: Use image view swizzles instead of shader hack
...
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-18 15:57:46 +02:00
nyorain
8e34692250
render/vulkan: add Vulkan renderer
...
This new renderer is implemented with the existing wlr_renderer API
(which is known to be sub-optimal for some operations). It's not
used by default, but users can opt-in by setting WLR_RENDERER=vulkan.
The renderer depends on VK_EXT_image_drm_format_modifier and
VK_EXT_physical_device_drm.
Co-authored-by: Simon Ser <contact@emersion.fr>
Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
2021-10-18 11:51:13 +02:00
Simon Ser
1b65a80e9d
render/allocator: use empty DRM lease to re-open node
...
This allows us to obtain a new DRM file description without relying
on filesystem permissions.
2021-10-14 21:23:41 +02:00
Simon Ser
13cdb84ee8
render/allocator: use render node if available in reopen_drm_node
...
If we aren't trying to create a dumb buffer allocator, and if the
DRM device has a render node (ie, not a split render/display SoC),
then we can use the render node instead of the primary node. This
should allow wlroots to run under seatd when the current user
doesn't have the permission to open primary nodes (logind has a
quirk to allow physically logged in users to open primary nodes).
2021-10-04 12:25:27 +02:00
Simon Ser
323b8498ad
Revert "render/drm_format_set: add wlr_drm_format_has"
...
This reverts commit 833437d592
.
2021-10-01 09:26:05 -06:00
Simon Ser
1d7e438d8a
Revert "Require INVALID for implicit format modifiers"
...
This reverts commit ea7357b703
.
2021-10-01 09:26:05 -06:00
Simon Ser
62be833aef
Revert "render/egl: always add LINEAR to supported modifiers"
...
This reverts commit 780052d4da
.
2021-10-01 09:26:05 -06:00
Simon Ser
42138a073b
Revert "render/drm_format_set: remove special LINEAR case"
...
This reverts commit 6d281d96cb
.
2021-10-01 09:26:05 -06:00
Simon Ser
6d281d96cb
render/drm_format_set: remove special LINEAR case
...
This was used to make the intersection of INVALID and LINEAR result
in LINEAR. We can now just require LINEAR to be in both lists.
2021-10-01 09:21:50 -06:00
Simon Ser
780052d4da
render/egl: always add LINEAR to supported modifiers
2021-10-01 09:21:50 -06:00
Simon Ser
ea7357b703
Require INVALID for implicit format modifiers
...
See [1] for the motivation.
[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-10-01 09:21:50 -06:00
Simon Ser
833437d592
render/drm_format_set: add wlr_drm_format_has
2021-10-01 09:21:50 -06:00
Simon Zeni
9579d62a16
types/buffer: make {begin,end}_data_ptr_access part of the public API
2021-09-15 11:50:44 +02:00
Simon Ser
4e7a8707cc
buffer: add data_ptr access flags
...
This allows callers to specify the operations they'll perform on
the returned data pointer. The motivations for this are:
- The upcoming Linux MAP_NOSIGBUS flag may only be usable on
read-only mappings.
- gbm_bo_map with GBM_BO_TRANSFER_READ hurts performance.
2021-09-10 13:16:10 -04:00
Simon Ser
38cd1b4f4f
render/allocator/gbm: add log message for gbm_bo_get_fd_for_plane
...
Makes it easier to find out which branch is taken when debugging
issues like [1].
[1]: https://github.com/swaywm/wlroots/issues/3156
2021-09-03 22:13:38 +02:00
Simon Ser
7df2ae88fa
render/allocator: use legacy authentication for primary nodes
...
Closes: https://github.com/swaywm/wlroots/issues/3156
2021-09-03 11:44:12 -04:00
Simon Ser
d9d8fc1ab9
render/allocator: re-open GBM FD
...
Using the same DRM file description for the DRM backend and for the
GBM allocator will result in GEM handle ref'counting issues [1].
Re-open the DRM FD to fix these issues.
[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110
2021-09-01 15:17:05 -04:00
Simon Ser
749b3c00f0
render/egl: reopen DRM node for GBM
...
This will be necessary for the next patch, to avoid messing up BO
handles shared between the GL implementation and the DRM backend.
2021-08-25 10:05:37 -04:00
Simon Ser
3ce2ea9e16
Move allocator stuff into new directory
...
Add render/allocator/ and include/render/allocator/ to hold
everything allocator-related.
2021-08-25 09:57:20 -04:00
Simon Ser
ad7651a370
render/gles2: make wlr_gles2_texture a wlr_buffer addon
2021-08-12 10:22:19 +02:00
Simon Ser
ee1156b62b
render/gles2: make wlr_gles2_buffer an addon
...
Saves us from walking a list.
2021-08-12 10:22:19 +02:00
Simon Ser
8a3cd28973
render/pixman/pixel_format: add more formats
...
Add a bunch of new formats for Pixman: a few missing 32-bit ones,
some 16-bit and 32-bit formats as well.
Mostly based on a Weston patch [1].
[1]: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/664
2021-08-03 02:53:03 -04:00
Simon Ser
b913e64f95
render/pixel_format: add more formats for Pixman
...
These will be added to Pixman in the next commit.
2021-08-03 02:53:03 -04:00
Manuel Stoeckl
f5df956c18
render/gles2: add a few 10-bit and FP16 formats
...
The half-float formats depend on GL_OES_texture_half_float_linear,
not just the GL_OES_texture_half_float extension, because the latter
does not include support for linear magni/minification filters.
The new 2101010 and 16161616F formats are only available on little-
endian builds, since their gl_types are larger than a byte and thus
endianness dependent.
2021-07-30 08:29:13 +02:00
Manuel Stoeckl
44e8451cd9
render/gles2: hide shm formats without GL support
...
This change introduces a new function to check whether the renderer
has the needed GL extensions to read a given pixel format.
2021-07-30 08:29:13 +02:00
Manuel Stoeckl
4dc52bcb6c
render/pixel-format: add a few 10-bit and FP16 formats
2021-07-30 08:29:13 +02:00