tdf#163945 present drawable immediately

It seems that -[MTLCommandBuffer presentDrawable:] doesn't
immediately replace the previous drawable on screen so I
assume that there is some default minimum display time for
drawables.

LibreOffice only invokes this method in a timer so let
LibreOffice control the rate of window updates by presenting
the drawable right now.

Change-Id: Ibd8d72bd6ea0303f9582264791cc4356bda62c13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176879
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Patrick Luby 2024-11-20 20:16:30 -05:00 committed by Patrick Luby
parent fbfbd2f51e
commit 32eb29377c

View file

@ -11,9 +11,9 @@ diff -ur skia.org/tools/window/MetalWindowContext.h skia/tools/window/MetalWindo
bool fValid; bool fValid;
diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWindowContext.mm diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWindowContext.mm
--- skia.org/tools/window/MetalWindowContext.mm 2024-10-05 18:16:04.521814026 +0200 --- skia.org/tools/window/MetalWindowContext.mm 2024-11-15 19:32:58
+++ skia/tools/window/MetalWindowContext.mm 2024-10-05 18:17:31.670443188 +0200 +++ skia/tools/window/MetalWindowContext.mm 2024-11-20 19:02:09
@@ -193,7 +193,7 @@ @@ -153,13 +153,21 @@
return surface; return surface;
} }
@ -22,6 +22,21 @@ diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWind
id<CAMetalDrawable> currentDrawable = (id<CAMetalDrawable>)fDrawableHandle; id<CAMetalDrawable> currentDrawable = (id<CAMetalDrawable>)fDrawableHandle;
id<MTLCommandBuffer> commandBuffer([*fShared->fQueue commandBuffer]); id<MTLCommandBuffer> commandBuffer([*fShared->fQueue commandBuffer]);
commandBuffer.label = @"Present";
- [commandBuffer presentDrawable:currentDrawable];
+ // tdf#163945 present drawable immediately
+ // It seems that -[MTLCommandBuffer presentDrawable:] doesn't
+ // immediately replace the previous drawable on screen so I
+ // assume that there is some default minimum display time for
+ // drawables.
+ // LibreOffice only invokes this method in a timer so let
+ // LibreOffice control the rate of window updates by presenting
+ // the drawable right now.
+ [commandBuffer presentDrawable:currentDrawable atTime:CACurrentMediaTime()];
[commandBuffer commit];
// ARC is off in sk_app, so we need to release the CF ref manually
CFRelease(fDrawableHandle);
diff -ur skia.org/tools/window/unix/RasterWindowContext_unix.cpp skia/tools/window/unix/RasterWindowContext_unix.cpp diff -ur skia.org/tools/window/unix/RasterWindowContext_unix.cpp skia/tools/window/unix/RasterWindowContext_unix.cpp
--- skia.org/tools/window/unix/RasterWindowContext_unix.cpp 2024-10-05 18:16:04.521814026 +0200 --- skia.org/tools/window/unix/RasterWindowContext_unix.cpp 2024-10-05 18:16:04.521814026 +0200
+++ skia/tools/window/unix/RasterWindowContext_unix.cpp 2024-10-05 18:18:49.554847490 +0200 +++ skia/tools/window/unix/RasterWindowContext_unix.cpp 2024-10-05 18:18:49.554847490 +0200