scene: add support for linux-drm-syncobj-v1

This commit is contained in:
Simon Ser 2024-04-03 14:37:12 +02:00
parent 850dd7a792
commit 9e9636f675

View File

@ -4,6 +4,7 @@
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_scene.h> #include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_fractional_scale_v1.h> #include <wlr/types/wlr_fractional_scale_v1.h>
#include <wlr/types/wlr_linux_drm_syncobj_v1.h>
#include <wlr/types/wlr_presentation_time.h> #include <wlr/types/wlr_presentation_time.h>
#include <wlr/util/transform.h> #include <wlr/util/transform.h>
#include "types/wlr_scene.h" #include "types/wlr_scene.h"
@ -164,8 +165,29 @@ static void surface_reconfigure(struct wlr_scene_surface *scene_surface) {
if (surface->buffer) { if (surface->buffer) {
client_buffer_mark_next_can_damage(surface->buffer); client_buffer_mark_next_can_damage(surface->buffer);
wlr_scene_buffer_set_buffer_with_damage(scene_buffer, struct wlr_linux_drm_syncobj_surface_v1_state *syncobj_surface_state =
&surface->buffer->base, &surface->buffer_damage); wlr_linux_drm_syncobj_v1_get_surface_state(surface);
struct wlr_drm_syncobj_timeline *wait_timeline = NULL;
uint64_t wait_point = 0;
if (syncobj_surface_state != NULL) {
wait_timeline = syncobj_surface_state->acquire_timeline;
wait_point = syncobj_surface_state->acquire_point;
}
struct wlr_scene_buffer_set_buffer_options options = {
.damage = &surface->buffer_damage,
.wait_timeline = wait_timeline,
.wait_point = wait_point,
};
wlr_scene_buffer_set_buffer_with_options(scene_buffer,
&surface->buffer->base, &options);
if (syncobj_surface_state != NULL &&
(surface->current.committed & WLR_SURFACE_STATE_BUFFER)) {
wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state,
&surface->buffer->base);
}
} else { } else {
wlr_scene_buffer_set_buffer(scene_buffer, NULL); wlr_scene_buffer_set_buffer(scene_buffer, NULL);
} }