Kenny Levinsen
73dd934794
render/drm_format_set: Clean up on union failure
...
If drm_format_set_extend fails, we need to make sure each wlr_drm_format
is cleaned up together with the formats array. Finish the set to take
care of it.
9 months ago
Kirill Primak
20b99ed854
render/drm_format_set: fix possible leak on realloc error
11 months ago
Simon Ser
7a9f8d8d6b
Use struct initializers instead of memset()
...
This is a bit more type-safe.
1 year ago
Tobias Predel
e449c1dec8
wlr_drm_format_set_copy: Do not allocate heap
...
Address Sanitizer reported two memory leaks because of
fmt not being freed in wlr_drm_format_set_copy.
This commit fixes the memory leak by removing the
allocation to the heap. The struct is allocated to the
stack anyway.
2 years ago
Alexander Orzechowski
47e175ae7f
wlr_drm_format_set_intersect: Clear destination before trying to write to it
2 years ago
Alexander Orzechowski
300bd80772
wlr_drm_format_set: Store formats on array
2 years ago
Alexander Orzechowski
90d08f8f1c
wlr_drm_format: Rework wlr_drm_format_intersect
...
Now it takes a reference to a destination format
2 years ago
Alexander Orzechowski
340700cb70
wlr_drm_format: Change wlr_drm_format_dup to copy
2 years ago
Alexander Orzechowski
099a147439
wlr_drm_format: Change wlr_drm_format_create to init
2 years ago
Alexander Orzechowski
e427e019c4
wlr_drm_format: Don't take double pointer in wlr_drm_format_add
2 years ago
Alexander Orzechowski
e6879616e7
wlr_drm_format: Make structure constant length
...
Don't store modifiers as part of the struct.
2 years ago
Alexander Orzechowski
b45396c790
wlr_drm_format: Introduce drm_format_finish
2 years ago
Alexander Orzechowski
5adb1be3a7
drm_format_set_intersect: Require initialized dst and remove assert
...
The usages in linux_dmabuf zero out the dst before passing it so this
change should be fine.
2 years ago
Alexander Orzechowski
1ee75786b4
drm_format_set_union: Require initialized dst and remove assert
2 years ago
Austin Shafer
ec37d55a5e
Add union function for format sets
2 years ago
Brett Ernst
7d9938c957
drm_format_set: fix realloc size
2 years ago
Simon Zeni
4b3bbb0c4f
render/drm_format_set: fill dst in wlr_drm_format_set_copy
2 years ago
Simon Ser
c9b378d21a
render/drm-format-set: add wlr_drm_format_set_copy()
2 years ago
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
3 years ago
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.
3 years ago
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
3 years ago
Simon Ser
d78cb808b1
render/drm_format_set: add wlr_drm_format_has
3 years ago
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.
3 years ago
Simon Ser
323b8498ad
Revert "render/drm_format_set: add wlr_drm_format_has"
...
This reverts commit 833437d592
.
3 years ago
Simon Ser
1d7e438d8a
Revert "Require INVALID for implicit format modifiers"
...
This reverts commit ea7357b703
.
3 years ago
Simon Ser
42138a073b
Revert "render/drm_format_set: remove special LINEAR case"
...
This reverts commit 6d281d96cb
.
3 years ago
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.
3 years ago
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
3 years ago
Simon Ser
833437d592
render/drm_format_set: add wlr_drm_format_has
3 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
d37214cb16
render/drm_format_set: add wlr_drm_format_{create,add}
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
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
7c6212a0f7
render/drm_format_set: introduce wlr_drm_format_dup
4 years ago
Simon Ser
01d4506253
render/drm_format_set: disallow DRM_FORMAT_INVALID
...
It doesn't make sense to add DRM_FORMAT_INVALID to a format set. Adding
an assertion allows us to safely query the format set with
DRM_FORMAT_INVALID. See [1].
[1]: https://github.com/swaywm/wlroots/pull/2021#discussion_r385839668
5 years ago
Drew DeVault
540e23d102
Revert "render/drm: keep old drm_format if realloc fails"
...
This reverts commit c1be9b6945
.
5 years ago
Antonin Décimo
c1be9b6945
render/drm: keep old drm_format if realloc fails
5 years ago
Simon Ser
e516ea4c79
backend/drm: check format when scanning out DMA-BUF
6 years ago
Scott Anderson
c01b81c99c
render: introduce wlr_drm_format_set
...
This types adds a container for formats + modifiers.
A list that is of [format [modifier]] was chosen instead of
[format modifer] because that is how GBM accepts them.
Co-Authored-By: emersion <contact@emersion.fr>
6 years ago