vo/context_android: fix surface tearing on resize

It's not clear why this is needed, but it works (on my device).

fixes https://github.com/mpv-android/mpv-android/issues/991

Co-authored-by: 茶茶 <[email protected]>
This commit is contained in:
sfan5and茶茶 committed 2025-10-27 23:30:04 +01:00
1 parent 1fec44cc6c
commit e23e72bd49
2 files changed
+14

No files matched your search

+7
View File
@@ -109,6 +109,13 @@ static bool android_reconfig(struct ra_ctx *ctx)
if (!vo_android_surface_size(ctx->vo, &w, &h))
return false;
// Update window geometry to prevent screen tearing
ANativeWindow *native_window = vo_android_native_window(ctx->vo);
if (native_window) {
int32_t current_format = ANativeWindow_getFormat(native_window);
ANativeWindow_setBuffersGeometry(native_window, w, h, current_format);
}
ctx->vo->dwidth = w;
ctx->vo->dheight = h;
ra_gl_ctx_resize(ctx->swapchain, w, h, 0);
+7
View File
@@ -77,6 +77,13 @@ static bool android_reconfig(struct ra_ctx *ctx)
if (!vo_android_surface_size(ctx->vo, &w, &h))
return false;
// Update window geometry to prevent screen tearing
ANativeWindow *native_window = vo_android_native_window(ctx->vo);
if (native_window) {
int32_t current_format = ANativeWindow_getFormat(native_window);
ANativeWindow_setBuffersGeometry(native_window, w, h, current_format);
}
ra_vk_ctx_resize(ctx, w, h);
return true;
}