scene: send surface preferred transform alongside DMA-BUF feedback

wl_surface.preferred_buffer_transform is mainly useful to make
direct scan-out more likely. It shouldn't make a difference with
GL/Vulkan rendering.
This commit is contained in:
Simon Ser 2025-06-05 12:42:12 +02:00 committed by Kenny Levinsen
parent 6204fc3278
commit c6133f9912
2 changed files with 8 additions and 5 deletions

View file

@ -44,11 +44,6 @@ static void handle_scene_buffer_outputs_update(
double scale = get_surface_preferred_buffer_scale(surface->surface);
wlr_fractional_scale_v1_notify_scale(surface->surface, scale);
wlr_surface_set_preferred_buffer_scale(surface->surface, ceil(scale));
if (surface->buffer->primary_output != NULL) {
wlr_surface_set_preferred_buffer_transform(surface->surface,
surface->buffer->primary_output->output->transform);
}
}
static void handle_scene_buffer_output_enter(

View file

@ -1867,6 +1867,14 @@ static void scene_buffer_send_dmabuf_feedback(const struct wlr_scene *scene,
return;
}
enum wl_output_transform preferred_buffer_transform = WL_OUTPUT_TRANSFORM_NORMAL;
if (options->scanout_primary_output != NULL) {
preferred_buffer_transform = options->scanout_primary_output->transform;
}
// TODO: also send wl_surface.preferred_buffer_transform when running with
// pure software rendering
wlr_surface_set_preferred_buffer_transform(surface->surface, preferred_buffer_transform);
wlr_linux_dmabuf_v1_set_surface_feedback(scene->linux_dmabuf_v1,
surface->surface, &feedback);