mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-05 05:05:57 +01:00
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
This commit is contained in:
parent
be86145322
commit
4d7f1aeb73
1 changed files with 2 additions and 26 deletions
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue