mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
linux-dmabuf-v1: don't use wlr_renderer to send legacy format list
The wlr_renderer field will go away in a subsequent commit. Build the legacy device list from the default feedback instead.
This commit is contained in:
parent
d45cffb865
commit
88493d1f7c
2 changed files with 23 additions and 8 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <wayland-server-core.h>
|
||||
#include <wlr/types/wlr_buffer.h>
|
||||
#include <wlr/render/dmabuf.h>
|
||||
#include <wlr/render/drm_format_set.h>
|
||||
|
||||
struct wlr_surface;
|
||||
|
||||
|
@ -65,6 +66,7 @@ struct wlr_linux_dmabuf_v1 {
|
|||
// private state
|
||||
|
||||
struct wlr_linux_dmabuf_feedback_v1_compiled *default_feedback;
|
||||
struct wlr_drm_format_set default_formats; // for legacy clients
|
||||
struct wl_list surfaces; // wlr_linux_dmabuf_v1_surface.link
|
||||
|
||||
int main_device_fd; // to sanity check FDs sent by clients
|
||||
|
|
|
@ -844,14 +844,8 @@ static void linux_dmabuf_send_modifiers(struct wl_resource *resource,
|
|||
|
||||
static void linux_dmabuf_send_formats(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
|
||||
struct wl_resource *resource) {
|
||||
const struct wlr_drm_format_set *formats =
|
||||
wlr_renderer_get_dmabuf_texture_formats(linux_dmabuf->renderer);
|
||||
if (formats == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < formats->len; i++) {
|
||||
const struct wlr_drm_format *fmt = formats->formats[i];
|
||||
for (size_t i = 0; i < linux_dmabuf->default_formats.len; i++) {
|
||||
const struct wlr_drm_format *fmt = linux_dmabuf->default_formats.formats[i];
|
||||
linux_dmabuf_send_modifiers(resource, fmt);
|
||||
}
|
||||
}
|
||||
|
@ -895,6 +889,7 @@ static void linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf) {
|
|||
}
|
||||
|
||||
compiled_feedback_destroy(linux_dmabuf->default_feedback);
|
||||
wlr_drm_format_set_finish(&linux_dmabuf->default_formats);
|
||||
close(linux_dmabuf->main_device_fd);
|
||||
|
||||
wl_list_remove(&linux_dmabuf->display_destroy.link);
|
||||
|
@ -947,6 +942,19 @@ static bool set_default_feedback(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
|
|||
goto error_compiled;
|
||||
}
|
||||
|
||||
struct wlr_drm_format_set formats = {0};
|
||||
for (size_t i = 0; i < feedback->tranches_len; i++) {
|
||||
const struct wlr_linux_dmabuf_feedback_v1_tranche *tranche = &feedback->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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compiled_feedback_destroy(linux_dmabuf->default_feedback);
|
||||
linux_dmabuf->default_feedback = compiled;
|
||||
|
||||
|
@ -955,8 +963,13 @@ static bool set_default_feedback(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
|
|||
}
|
||||
linux_dmabuf->main_device_fd = main_device_fd;
|
||||
|
||||
wlr_drm_format_set_finish(&linux_dmabuf->default_formats);
|
||||
linux_dmabuf->default_formats = formats;
|
||||
|
||||
return true;
|
||||
|
||||
error_formats:
|
||||
wlr_drm_format_set_finish(&formats);
|
||||
error_compiled:
|
||||
compiled_feedback_destroy(compiled);
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue