diff options
author | Simon Ser <contact@emersion.fr> | 2022-05-26 10:28:21 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-05-26 13:45:24 +0000 |
commit | 4d7f1aeb734cd2c9d75a59a0793941d5bb012749 (patch) | |
tree | 713c95d7023572d19e379ac6198308a9c270ccc3 | |
parent | be86145322e6157994b348711b7bedd209b565ea (diff) |
linux-dmabuf-v1: fix MOD_INVALID handling in feedback tranches
[1] has changed wlr_drm_format to remove the assumption that
MOD_INVALID is always implicitly enabled. MOD_INVALID is now part
of the modifier list just like any other modifier.
The patch adding support for linux-dmabuf-v1 feedback has been
written a lot of time before [1], and hasn't been updated accordingly
when merged. This results in MOD_INVALID being advertised twice [2] and
other index bugs.
Fix these issues by removing special-casing for MOD_INVALID.
[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3231
[2]: https://github.com/swaywm/sway/issues/7028
-rw-r--r-- | types/wlr_linux_dmabuf_v1.c | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/types/wlr_linux_dmabuf_v1.c b/types/wlr_linux_dmabuf_v1.c index 69aa64b7..a124d521 100644 --- a/types/wlr_linux_dmabuf_v1.c +++ b/types/wlr_linux_dmabuf_v1.c @@ -475,16 +475,12 @@ static ssize_t get_drm_format_set_index(const struct wlr_drm_format_set *set, format_found = true; break; } - idx += 1 + fmt->len; + idx += fmt->len; } if (!format_found) { return -1; } - if (modifier == DRM_FORMAT_MOD_INVALID) { - return idx; - } - for (size_t i = 0; i < fmt->len; i++) { if (fmt->modifiers[i] == modifier) { return idx; @@ -506,7 +502,7 @@ static struct wlr_linux_dmabuf_feedback_v1_compiled *feedback_compile( size_t table_len = 0; for (size_t i = 0; i < fallback_tranche->formats->len; i++) { const struct wlr_drm_format *fmt = fallback_tranche->formats->formats[i]; - table_len += 1 + fmt->len; + table_len += fmt->len; } assert(table_len > 0); @@ -533,12 +529,6 @@ static struct wlr_linux_dmabuf_feedback_v1_compiled *feedback_compile( for (size_t i = 0; i < fallback_tranche->formats->len; i++) { const struct wlr_drm_format *fmt = fallback_tranche->formats->formats[i]; - table[n] = (struct wlr_linux_dmabuf_feedback_v1_table_entry){ - .format = fmt->format, - .modifier = DRM_FORMAT_MOD_INVALID, - }; - n++; - for (size_t k = 0; k < fmt->len; k++) { table[n] = (struct wlr_linux_dmabuf_feedback_v1_table_entry){ .format = fmt->format, @@ -584,20 +574,6 @@ static struct wlr_linux_dmabuf_feedback_v1_compiled *feedback_compile( uint16_t *indices = compiled_tranche->indices.data; for (size_t j = 0; j < tranche->formats->len; j++) { const struct wlr_drm_format *fmt = tranche->formats->formats[j]; - - ssize_t index = get_drm_format_set_index( - fallback_tranche->formats, fmt->format, - DRM_FORMAT_MOD_INVALID); - if (index < 0) { - wlr_log(WLR_ERROR, "Format 0x%" PRIX32 " and modifier " - "INVALID are in tranche #%zu but are missing " - "from the fallback tranche", - fmt->format, i); - goto error_compiled; - } - indices[n] = index; - n++; - for (size_t k = 0; k < fmt->len; k++) { ssize_t index = get_drm_format_set_index( fallback_tranche->formats, fmt->format, fmt->modifiers[k]); |