Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions video/out/opengl/context_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,28 @@ static bool android_reconfig(struct ra_ctx *ctx)
if (!vo_android_surface_size(ctx->vo, &w, &h))
return false;

// Update native window buffer geometry to prevent screen tearing
ANativeWindow *native_window = vo_android_native_window(ctx->vo);
if (native_window) {
ANativeWindow_setBuffersGeometry(native_window, w, h, 0);
}

ctx->vo->dwidth = w;
ctx->vo->dheight = h;
ra_gl_ctx_resize(ctx->swapchain, w, h, 0);

// Force a buffer swap to sync the new geometry
// This ensures the surface is updated even when paused
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks better but I'm still wondering about the paused case.
In my mental model the VO should be redrawing anyway, since the old frame will mismatch the new dimensions.

I'll try to give the code changes some testing later.

struct priv *p = ctx->priv;
if (p->egl_display && p->egl_surface) {
struct ra_fbo fbo;
if (ctx->swapchain->fns->start_frame(ctx->swapchain, &fbo)) {
// Submit an empty frame to force buffer synchronization
ctx->swapchain->fns->submit_frame(ctx->swapchain, NULL);
ctx->swapchain->fns->swap_buffers(ctx->swapchain);
}
}

return true;
}

Expand Down
10 changes: 10 additions & 0 deletions video/out/vulkan/context_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@ static bool android_reconfig(struct ra_ctx *ctx)
if (!vo_android_surface_size(ctx->vo, &w, &h))
return false;

// Update native window buffer geometry to prevent screen tearing
ANativeWindow *native_window = vo_android_native_window(ctx->vo);
if (native_window) {
ANativeWindow_setBuffersGeometry(native_window, w, h, 0);
}

ra_vk_ctx_resize(ctx, w, h);

// Force redraw to sync buffers in paused state
ctx->vo->want_redraw = true;

return true;
}

Expand Down
Loading