[Libreoffice-commits] core.git: Branch 'feature/skia' - 3 commits - external/skia vcl/skia

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 22 14:16:07 UTC 2019


 external/skia/UnpackedTarball_skia.mk |    1 +
 external/skia/libvulkan-name.patch.1  |   13 +++++++++++++
 vcl/skia/gdiimpl.cxx                  |   32 ++++++++++++++------------------
 vcl/skia/x11/gdiimpl.cxx              |   11 +++++------
 4 files changed, 33 insertions(+), 24 deletions(-)

New commits:
commit c6e30abde890f050afce1e42800b6d906a67ae4e
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 22 15:12:57 2019 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Nov 22 15:15:22 2019 +0100

    don't fall back to raster if Skia is first asked for offscreen surface
    
    This is rare, but it may happen. Since now the code shared just one
    GrContext properly, this is not really a problem anymore (and the extra
    WindowContext creation shouldn't be hopefully noticeable either).
    
    Change-Id: I50887b7512e778b70870690a3f672b27cc7f2d21

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index dfa7eb7a7320..b109b698914b 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -245,26 +245,22 @@ void SkiaSalGraphicsImpl::createOffscreenSurface()
         {
             mOffscreenGrContext = sk_app::VulkanWindowContext::getSharedGrContext();
             GrContext* grContext = mOffscreenGrContext.getGrContext();
-            // We may not get a GrContext if called before any onscreen window is created,
-            // but that happens very early, so this should be rare and insignificant.
-            // Unittests are an exception, they usually do not create any windows,
-            // so in that case do create GrContext that has no window associated.
+            // We may not get a GrContext if called before any onscreen window is created.
             if (!grContext)
             {
-                static bool isUnitTest = (getenv("LO_TESTNAME") != nullptr);
-                if (isUnitTest)
-                {
-                    // Create temporary WindowContext with no window. That will fail,
-                    // but it will initialize the shared GrContext.
-                    createWindowContext();
-                    // Keep a reference.
-                    sk_app::VulkanWindowContext::SharedGrContext context
-                        = sk_app::VulkanWindowContext::getSharedGrContext();
-                    // Destroy the temporary WindowContext.
-                    destroySurface();
-                    mOffscreenGrContext = context;
-                    grContext = mOffscreenGrContext.getGrContext();
-                }
+                SAL_INFO("vcl.skia",
+                         "creating Vulkan offscreen GPU surface before any window exists");
+                // Create temporary WindowContext with no window. That will fail,
+                // but it will initialize the shared GrContext.
+                createWindowContext();
+                // Keep a reference.
+                sk_app::VulkanWindowContext::SharedGrContext context
+                    = sk_app::VulkanWindowContext::getSharedGrContext();
+                // Destroy the temporary WindowContext.
+                destroySurface();
+                // Keep a reference until the surface is destroyed.
+                mOffscreenGrContext = context;
+                grContext = mOffscreenGrContext.getGrContext();
             }
             if (grContext)
             {
commit f44dd1bb80d0018500385fb385f941e92573837c
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 22 12:36:31 2019 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Nov 22 15:15:12 2019 +0100

    do not require Vulkan devel package for Skia
    
    I don't see why this should use libvulkan.so, using libvulkan.so.1
    should do as well, and quite possibly any future libvulkan.so.2
    could be binary-incompatible anyway.
    
    Change-Id: I46be40da7fbfdcb59c947e6d088820e580cf4c44

diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk
index aabb1149a3ae..1d2da19c2b5b 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -20,6 +20,7 @@ skia_patches := \
     fix-shader-locale.patch.1 \
     no-trace-resources-on-exit.patch.1 \
     fix-alpha-difference-copy.patch.1 \
+    libvulkan-name.patch.1 \
     share-grcontext.patch.1
 
 $(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))
diff --git a/external/skia/libvulkan-name.patch.1 b/external/skia/libvulkan-name.patch.1
new file mode 100644
index 000000000000..265d8daa11df
--- /dev/null
+++ b/external/skia/libvulkan-name.patch.1
@@ -0,0 +1,13 @@
+diff --git a/tools/gpu/vk/VkTestUtils.cpp b/tools/gpu/vk/VkTestUtils.cpp
+index 5b7e8c29ae..1580136b5c 100644
+--- a/tools/gpu/vk/VkTestUtils.cpp
++++ b/tools/gpu/vk/VkTestUtils.cpp
+@@ -13,7 +13,7 @@
+     #if defined _WIN32
+         #define SK_GPU_TOOLS_VK_LIBRARY_NAME "vulkan-1.dll"
+     #else
+-        #define SK_GPU_TOOLS_VK_LIBRARY_NAME "libvulkan.so"
++        #define SK_GPU_TOOLS_VK_LIBRARY_NAME "libvulkan.so.1"
+     #endif
+ #endif
+ 
commit 92ea97278df59da583a95f26465e43e7a30dccc9
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 22 12:30:16 2019 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Nov 22 15:15:03 2019 +0100

    use the native Skia color Type when using Vulkan
    
    Change-Id: Ie46d7d89b9aa149f48617ccdbe3a8c492759880f

diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx
index 3f706399f136..04e2586e7f7a 100644
--- a/vcl/skia/x11/gdiimpl.cxx
+++ b/vcl/skia/x11/gdiimpl.cxx
@@ -41,12 +41,7 @@ void X11SkiaSalGraphicsImpl::Init()
 void X11SkiaSalGraphicsImpl::createWindowContext()
 {
     sk_app::DisplayParams displayParams;
-    // Use a macro to hide an unreachable code warning.
-    // TODO The Skia Xlib code actually requires the non-native color type to work properly.
-#define GET_FORMAT                                                                                 \
-    kN32_SkColorType == kBGRA_8888_SkColorType ? kRGBA_8888_SkColorType : kBGRA_8888_SkColorType
-    displayParams.fColorType = GET_FORMAT;
-#undef GET_FORMAT
+    displayParams.fColorType = kN32_SkColorType;
     sk_app::window_context_factory::XlibWindowInfo winInfo;
     winInfo.fDisplay = mX11Parent.GetXDisplay();
     winInfo.fWindow = mX11Parent.GetDrawable();
@@ -68,6 +63,10 @@ void X11SkiaSalGraphicsImpl::createWindowContext()
     switch (SkiaHelper::renderMethodToUse())
     {
         case SkiaHelper::RenderRaster:
+            // TODO The Skia Xlib code actually requires the non-native color type to work properly.
+            displayParams.fColorType
+                = (displayParams.fColorType == kBGRA_8888_SkColorType ? kRGBA_8888_SkColorType
+                                                                      : kBGRA_8888_SkColorType);
             mWindowContext
                 = sk_app::window_context_factory::MakeRasterForXlib(winInfo, displayParams);
             mIsGPU = false;


More information about the Libreoffice-commits mailing list