summaryrefslogtreecommitdiffstats
path: root/video/out/vulkan
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vulkan')
-rw-r--r--video/out/vulkan/context.c5
-rw-r--r--video/out/vulkan/context.h3
-rw-r--r--video/out/vulkan/context_wayland.c23
3 files changed, 25 insertions, 6 deletions
diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c
index 4d94c6fb77..3518d3efd2 100644
--- a/video/out/vulkan/context.c
+++ b/video/out/vulkan/context.c
@@ -229,6 +229,11 @@ static bool start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
{
struct priv *p = sw->priv;
struct pl_swapchain_frame frame;
+ bool start = true;
+ if (p->params.start_frame)
+ start = p->params.start_frame(sw->ctx);
+ if (!start)
+ return false;
if (!pl_swapchain_start_frame(p->swapchain, &frame))
return false;
if (!mppl_wrap_tex(sw->ctx->ra, frame.fbo, &p->proxy_tex))
diff --git a/video/out/vulkan/context.h b/video/out/vulkan/context.h
index 0b420e2daa..6ae64bb0f5 100644
--- a/video/out/vulkan/context.h
+++ b/video/out/vulkan/context.h
@@ -7,6 +7,9 @@ struct ra_vk_ctx_params {
// See ra_swapchain_fns.get_vsync.
void (*get_vsync)(struct ra_ctx *ctx, struct vo_vsync_info *info);
+ // In case something special needs to be done when starting a frame.
+ bool (*start_frame)(struct ra_ctx *ctx);
+
// In case something special needs to be done on the buffer swap.
void (*swap_buffers)(struct ra_ctx *ctx);
};
diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c
index ab295152dd..481c1005e1 100644
--- a/video/out/vulkan/context_wayland.c
+++ b/video/out/vulkan/context_wayland.c
@@ -63,7 +63,6 @@ static void feedback_presented(void *data, struct wp_presentation_feedback *fbac
index = 0;
}
int64_t sec = (uint64_t) tv_sec_lo + ((uint64_t) tv_sec_hi << 32);
- wl->sync[index].sbc = wl->user_sbc;
wl->sync[index].ust = sec * 1000000LL + (uint64_t) tv_nsec / 1000;
wl->sync[index].msc = (uint64_t) seq_lo + ((uint64_t) seq_hi << 32);
wl->sync[index].filled = true;
@@ -103,6 +102,21 @@ static const struct wl_callback_listener frame_listener = {
frame_callback,
};
+static bool wayland_vk_start_frame(struct ra_ctx *ctx)
+{
+ struct vo_wayland_state *wl = ctx->vo->wl;
+
+ bool render = !wl->frame_wait || wl->opts->disable_vsync;
+
+ if (wl->frame_wait && wl->presentation)
+ vo_wayland_sync_clear(wl);
+
+ if (render)
+ wl->frame_wait = true;
+
+ return render;
+}
+
static void wayland_vk_swap_buffers(struct ra_ctx *ctx)
{
struct vo_wayland_state *wl = ctx->vo->wl;
@@ -110,12 +124,8 @@ static void wayland_vk_swap_buffers(struct ra_ctx *ctx)
if (!wl->opts->disable_vsync)
vo_wayland_wait_frame(wl);
- if (wl->presentation) {
- wl->user_sbc += 1;
+ if (wl->presentation)
wayland_sync_swap(wl);
- }
-
- wl->frame_wait = true;
}
static void wayland_vk_get_vsync(struct ra_ctx *ctx, struct vo_vsync_info *info)
@@ -156,6 +166,7 @@ static bool wayland_vk_init(struct ra_ctx *ctx)
};
struct ra_vk_ctx_params params = {
+ .start_frame = wayland_vk_start_frame,
.swap_buffers = wayland_vk_swap_buffers,
.get_vsync = wayland_vk_get_vsync,
};