aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-05-03 12:38:28 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-05-03 12:38:28 -0400
commitcbe887605096330f1e262651d8629e6dc7a6e058 (patch)
treeb17e16358bd1aefe03d2dd5620da6a4ade07495a
parentec37d55a5eb76d6ac516f14ebfead7bfffb6426a (diff)
linux_dmabuf_v1: Use wlr_drm_format_set_union
-rw-r--r--types/wlr_linux_dmabuf_v1.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/types/wlr_linux_dmabuf_v1.c b/types/wlr_linux_dmabuf_v1.c
index 09f1d356..6eaff98c 100644
--- a/types/wlr_linux_dmabuf_v1.c
+++ b/types/wlr_linux_dmabuf_v1.c
@@ -916,14 +916,13 @@ static bool set_default_feedback(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
struct wlr_drm_format_set formats = {0};
for (size_t i = 0; i < tranches_len; i++) {
const struct wlr_linux_dmabuf_feedback_v1_tranche *tranche = &tranches[i];
- for (size_t j = 0; j < tranche->formats.len; j++) {
- const struct wlr_drm_format *fmt = tranche->formats.formats[j];
- for (size_t k = 0; k < fmt->len; k++) {
- if (!wlr_drm_format_set_add(&formats, fmt->format, fmt->modifiers[k])) {
- goto error_formats;
- }
- }
+
+ struct wlr_drm_format_set uni;
+ if (!wlr_drm_format_set_union(&uni, &formats, &tranche->formats)) {
+ goto error_formats;
}
+ wlr_drm_format_set_finish(&formats);
+ formats = uni;
}
compiled_feedback_destroy(linux_dmabuf->default_feedback);