update to skia m133

Change-Id: Id12146bfd28003acc146fc45fdea4d9e4323539e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182778
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2025-03-11 15:06:56 +02:00
parent 720983ad53
commit 0ce35e70da
10 changed files with 127 additions and 94 deletions

View File

@@ -631,8 +631,8 @@ RHINO_TARBALL := rhino-1.7.15.zip
# three static lines # three static lines
# so that git cherry-pick # so that git cherry-pick
# will not run into conflicts # will not run into conflicts
SKIA_SHA256SUM := 103f63a8414a506c887cfe788f7653c130df1278b2cc1d1ae6827b2b90e59377 SKIA_SHA256SUM := af3676facdf12d59a9ad5a0f63c60e6bb47f7d6bb243acdd0c6abc8c9b0b3c59
SKIA_TARBALL := skia-m132-ee9db7d1348f76780fd0184b9b0243d653e36411.tar.xz SKIA_TARBALL := skia-m133-ecebe831881cdf52c65df518777210071f7970dd.tar.xz
# three static lines # three static lines
# so that git cherry-pick # so that git cherry-pick
# will not run into conflicts # will not run into conflicts

View File

@@ -317,6 +317,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/codec/SkCodecImageGenerator \ UnpackedTarball/skia/src/codec/SkCodecImageGenerator \
UnpackedTarball/skia/src/codec/SkColorPalette \ UnpackedTarball/skia/src/codec/SkColorPalette \
UnpackedTarball/skia/src/codec/SkExif \ UnpackedTarball/skia/src/codec/SkExif \
UnpackedTarball/skia/src/codec/SkGainmapInfo \
UnpackedTarball/skia/src/codec/SkImageGenerator_FromEncoded \ UnpackedTarball/skia/src/codec/SkImageGenerator_FromEncoded \
UnpackedTarball/skia/src/codec/SkMaskSwizzler \ UnpackedTarball/skia/src/codec/SkMaskSwizzler \
UnpackedTarball/skia/src/codec/SkPixmapUtils \ UnpackedTarball/skia/src/codec/SkPixmapUtils \
@@ -341,6 +342,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
$(eval $(call gb_Library_add_generated_exception_objects,skia,\ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/codec/SkPngCodec \ UnpackedTarball/skia/src/codec/SkPngCodec \
UnpackedTarball/skia/src/codec/SkPngCodecBase \ UnpackedTarball/skia/src/codec/SkPngCodecBase \
UnpackedTarball/skia/src/codec/SkPngCompositeChunkReader \
)) ))
@@ -362,7 +364,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/base/SkQuads \ UnpackedTarball/skia/src/base/SkQuads \
UnpackedTarball/skia/src/base/SkSafeMath \ UnpackedTarball/skia/src/base/SkSafeMath \
UnpackedTarball/skia/src/base/SkSemaphore \ UnpackedTarball/skia/src/base/SkSemaphore \
UnpackedTarball/skia/src/base/SkSharedMutex \
UnpackedTarball/skia/src/base/SkSpinlock \ UnpackedTarball/skia/src/base/SkSpinlock \
UnpackedTarball/skia/src/base/SkTDArray \ UnpackedTarball/skia/src/base/SkTDArray \
UnpackedTarball/skia/src/base/SkTSearch \ UnpackedTarball/skia/src/base/SkTSearch \
@@ -639,7 +640,13 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/encode/SkICC \ UnpackedTarball/skia/src/encode/SkICC \
)) ))
# from file skia/gn/core.gni:792, target "skia_encode_png_srcs" # from file skia/gn/core.gni:792, target "skia_encode_png_base"
#
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/encode/SkPngEncoderBase \
))
# from file skia/gn/core.gni:800, target "skia_encode_png_srcs"
# #
$(eval $(call gb_Library_add_generated_exception_objects,skia,\ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/encode/SkPngEncoderImpl \ UnpackedTarball/skia/src/encode/SkPngEncoderImpl \
@@ -710,6 +717,12 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/effects/imagefilters/SkShaderImageFilter \ UnpackedTarball/skia/src/effects/imagefilters/SkShaderImageFilter \
)) ))
# from file skia/gn/ports.gni:130, target "skia_ports_typeface_proxy_sources"
#
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/ports/SkTypeface_proxy \
))
# from file skia/gn/sksl.gni:42, target "skia_sksl_sources" # from file skia/gn/sksl.gni:42, target "skia_sksl_sources"
# #
$(eval $(call gb_Library_add_generated_exception_objects,skia,\ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
@@ -846,7 +859,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/utils/SkEventTracer \ UnpackedTarball/skia/src/utils/SkEventTracer \
UnpackedTarball/skia/src/utils/SkFloatToDecimal \ UnpackedTarball/skia/src/utils/SkFloatToDecimal \
UnpackedTarball/skia/src/sksl/SkSLModuleDataDefault \ UnpackedTarball/skia/src/sksl/SkSLModuleDataDefault \
UnpackedTarball/skia/src/utils/SkJSON \
UnpackedTarball/skia/src/utils/SkJSONWriter \ UnpackedTarball/skia/src/utils/SkJSONWriter \
UnpackedTarball/skia/src/utils/SkMatrix22 \ UnpackedTarball/skia/src/utils/SkMatrix22 \
UnpackedTarball/skia/src/utils/SkMultiPictureDocument \ UnpackedTarball/skia/src/utils/SkMultiPictureDocument \

View File

@@ -24,8 +24,8 @@ index f143dab013..be3cde0f4f 100644
- virtual void activate(bool isActive) {} - virtual void activate(bool isActive) {}
+ virtual void activate(bool /*isActive*/) {} + virtual void activate(bool /*isActive*/) {}
const DisplayParams& getDisplayParams() { return fDisplayParams; } const DisplayParams* getDisplayParams() { return fDisplayParams.get(); }
virtual void setDisplayParams(const DisplayParams& params) = 0; virtual void setDisplayParams(std::unique_ptr<const DisplayParams>) = 0;
--- skia/include/core/SkSamplingOptions.h.orig 2022-05-22 12:25:06.112544528 +0200 --- skia/include/core/SkSamplingOptions.h.orig 2022-05-22 12:25:06.112544528 +0200
+++ skia/include/core/SkSamplingOptions.h 2022-05-22 12:25:09.207636134 +0200 +++ skia/include/core/SkSamplingOptions.h 2022-05-22 12:25:09.207636134 +0200
@@ -97,7 +97,7 @@ @@ -97,7 +97,7 @@

View File

@@ -8,7 +8,7 @@ diff -ur skia.org/tools/window/WindowContext.h skia/tools/window/WindowContext.h
-class WindowContext { -class WindowContext {
+class SK_API WindowContext { +class SK_API WindowContext {
public: public:
WindowContext(const DisplayParams&); WindowContext(std::unique_ptr<const DisplayParams>);
diff -ur skia.org/tools/window/mac/GaneshMetalWindowContext_mac.h skia/tools/window/mac/GaneshMetalWindowContext_mac.h diff -ur skia.org/tools/window/mac/GaneshMetalWindowContext_mac.h skia/tools/window/mac/GaneshMetalWindowContext_mac.h
--- skia.org/tools/window/mac/GaneshMetalWindowContext_mac.h 2024-10-12 15:57:21 --- skia.org/tools/window/mac/GaneshMetalWindowContext_mac.h 2024-10-12 15:57:21
@@ -21,12 +21,14 @@ diff -ur skia.org/tools/window/mac/GaneshMetalWindowContext_mac.h skia/tools/win
#include <memory> #include <memory>
namespace skwindow { namespace skwindow {
@@ -15,7 +16,7 @@ @@ -15,8 +16,8 @@
struct DisplayParams; class DisplayParams;
struct MacWindowInfo; struct MacWindowInfo;
-std::unique_ptr<WindowContext> MakeGaneshMetalForMac(const MacWindowInfo&, const DisplayParams&); -std::unique_ptr<WindowContext> MakeGaneshMetalForMac(const MacWindowInfo&,
+SK_API std::unique_ptr<WindowContext> MakeGaneshMetalForMac(const MacWindowInfo&, const DisplayParams&); - std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeGaneshMetalForMac(const MacWindowInfo&,
+ std::unique_ptr<const DisplayParams>);
} // namespace skwindow } // namespace skwindow
#endif #endif
@@ -41,12 +43,14 @@ diff -ur skia.org/tools/window/unix/GaneshGLWindowContext_unix.h skia/tools/wind
#include <memory> #include <memory>
namespace skwindow { namespace skwindow {
@@ -15,7 +16,7 @@ @@ -15,8 +16,8 @@
struct DisplayParams; class DisplayParams;
struct XlibWindowInfo; struct XlibWindowInfo;
-std::unique_ptr<WindowContext> MakeGaneshGLForXlib(const XlibWindowInfo&, const DisplayParams&); -std::unique_ptr<WindowContext> MakeGaneshGLForXlib(const XlibWindowInfo&,
+SK_API std::unique_ptr<WindowContext> MakeGaneshGLForXlib(const XlibWindowInfo&, const DisplayParams&); - std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeGaneshGLForXlib(const XlibWindowInfo&,
+ std::unique_ptr<const DisplayParams>);
} // namespace skwindow } // namespace skwindow
#endif #endif
@@ -61,12 +65,14 @@ diff -ur skia.org/tools/window/unix/GaneshVulkanWindowContext_unix.h skia/tools/
#include <memory> #include <memory>
namespace skwindow { namespace skwindow {
@@ -15,7 +16,7 @@ @@ -15,8 +16,8 @@
struct DisplayParams; class DisplayParams;
struct XlibWindowInfo; struct XlibWindowInfo;
-std::unique_ptr<WindowContext> MakeGaneshVulkanForXlib(const XlibWindowInfo&, const DisplayParams&); -std::unique_ptr<WindowContext> MakeGaneshVulkanForXlib(const XlibWindowInfo&,
+SK_API std::unique_ptr<WindowContext> MakeGaneshVulkanForXlib(const XlibWindowInfo&, const DisplayParams&); - std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeGaneshVulkanForXlib(const XlibWindowInfo&,
+ std::unique_ptr<const DisplayParams>);
} // namespace skwindow } // namespace skwindow
#endif #endif
@@ -82,12 +88,12 @@ diff -ur skia.org/tools/window/unix/GraphiteDawnVulkanWindowContext_unix.h skia/
namespace skwindow { namespace skwindow {
@@ -15,7 +16,7 @@ @@ -15,7 +16,7 @@
struct DisplayParams; class DisplayParams;
struct XlibWindowInfo; struct XlibWindowInfo;
-std::unique_ptr<WindowContext> MakeGraphiteDawnVulkanForXlib(const XlibWindowInfo&, -std::unique_ptr<WindowContext> MakeGraphiteDawnVulkanForXlib(const XlibWindowInfo&,
+SK_API std::unique_ptr<WindowContext> MakeGraphiteDawnVulkanForXlib(const XlibWindowInfo&, +SK_API std::unique_ptr<WindowContext> MakeGraphiteDawnVulkanForXlib(const XlibWindowInfo&,
const DisplayParams&); std::unique_ptr<const DisplayParams>);
} // namespace skwindow } // namespace skwindow
diff -ur skia.org/tools/window/unix/RasterWindowContext_unix.h skia/tools/window/unix/RasterWindowContext_unix.h diff -ur skia.org/tools/window/unix/RasterWindowContext_unix.h skia/tools/window/unix/RasterWindowContext_unix.h
@@ -101,12 +107,14 @@ diff -ur skia.org/tools/window/unix/RasterWindowContext_unix.h skia/tools/window
#include <memory> #include <memory>
namespace skwindow { namespace skwindow {
@@ -15,7 +16,7 @@ @@ -15,8 +16,8 @@
struct DisplayParams; class DisplayParams;
struct XlibWindowInfo; struct XlibWindowInfo;
-std::unique_ptr<WindowContext> MakeRasterForXlib(const XlibWindowInfo&, const DisplayParams&); -std::unique_ptr<WindowContext> MakeRasterForXlib(const XlibWindowInfo&,
+SK_API std::unique_ptr<WindowContext> MakeRasterForXlib(const XlibWindowInfo&, const DisplayParams&); - std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeRasterForXlib(const XlibWindowInfo&,
+ std::unique_ptr<const DisplayParams>);
} // namespace skwindow } // namespace skwindow
#endif #endif
@@ -123,29 +131,29 @@ diff -ur skia.org/tools/window/win/WindowContextFactory_win.h skia/tools/window/
namespace skwindow { namespace skwindow {
class WindowContext; class WindowContext;
struct DisplayParams; class DisplayParams;
#ifdef SK_VULKAN #ifdef SK_VULKAN
-std::unique_ptr<WindowContext> MakeVulkanForWin(HWND, const DisplayParams&); -std::unique_ptr<WindowContext> MakeVulkanForWin(HWND, std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeVulkanForWin(HWND, const DisplayParams&); +SK_API std::unique_ptr<WindowContext> MakeVulkanForWin(HWND, std::unique_ptr<const DisplayParams>);
#if defined(SK_GRAPHITE) #if defined(SK_GRAPHITE)
std::unique_ptr<WindowContext> MakeGraphiteVulkanForWin(HWND, const DisplayParams&); std::unique_ptr<WindowContext> MakeGraphiteVulkanForWin(HWND, std::unique_ptr<const DisplayParams>);
#endif #endif
#endif #endif
#ifdef SK_GL #ifdef SK_GL
-std::unique_ptr<WindowContext> MakeGLForWin(HWND, const DisplayParams&); -std::unique_ptr<WindowContext> MakeGLForWin(HWND, std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeGLForWin(HWND, const DisplayParams&); +SK_API std::unique_ptr<WindowContext> MakeGLForWin(HWND, std::unique_ptr<const DisplayParams>);
#endif #endif
#ifdef SK_ANGLE #ifdef SK_ANGLE
-std::unique_ptr<WindowContext> MakeANGLEForWin(HWND, const DisplayParams&); -std::unique_ptr<WindowContext> MakeANGLEForWin(HWND, std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeANGLEForWin(HWND, const DisplayParams&); +SK_API std::unique_ptr<WindowContext> MakeANGLEForWin(HWND, std::unique_ptr<const DisplayParams>);
#endif #endif
#ifdef SK_DIRECT3D #ifdef SK_DIRECT3D
-std::unique_ptr<WindowContext> MakeD3D12ForWin(HWND, const DisplayParams&); -std::unique_ptr<WindowContext> MakeD3D12ForWin(HWND, std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeD3D12ForWin(HWND, const DisplayParams&); +SK_API std::unique_ptr<WindowContext> MakeD3D12ForWin(HWND, std::unique_ptr<const DisplayParams>);
#endif #endif
#ifdef SK_DAWN #ifdef SK_DAWN
@@ -153,8 +161,8 @@ diff -ur skia.org/tools/window/win/WindowContextFactory_win.h skia/tools/window/
#endif #endif
#endif #endif
-std::unique_ptr<WindowContext> MakeRasterForWin(HWND, const DisplayParams&); -std::unique_ptr<WindowContext> MakeRasterForWin(HWND, std::unique_ptr<const DisplayParams>);
+SK_API std::unique_ptr<WindowContext> MakeRasterForWin(HWND, const DisplayParams&); +SK_API std::unique_ptr<WindowContext> MakeRasterForWin(HWND, std::unique_ptr<const DisplayParams>);
} // namespace skwindow } // namespace skwindow

View File

@@ -74,8 +74,8 @@ diff -ur skia.org/tools/window/MetalWindowContext.h skia/tools/window/MetalWindo
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-10 14:11:32.362258108 +0200 --- skia.org/tools/window/MetalWindowContext.mm 2024-10-10 14:11:32.362258108 +0200
+++ skia/tools/window/MetalWindowContext.mm 2024-10-10 14:11:44.341323063 +0200 +++ skia/tools/window/MetalWindowContext.mm 2024-10-10 14:11:44.341323063 +0200
@@ -35,50 +35,84 @@ @@ -33,54 +33,88 @@
} , fDrawableHandle(nil) {}
void MetalWindowContext::initializeContext() { void MetalWindowContext::initializeContext() {
+ fShared = fGlobalShared; + fShared = fGlobalShared;
@@ -93,10 +93,10 @@ diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWind
+ d->fDevice.reset(MTLCreateSystemDefaultDevice()); + d->fDevice.reset(MTLCreateSystemDefaultDevice());
+ d->fQueue.reset([*d->fDevice newCommandQueue]); + d->fQueue.reset([*d->fDevice newCommandQueue]);
if (fDisplayParams.fMSAASampleCount > 1) { if (fDisplayParams->msaaSampleCount() > 1) {
if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) { if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) {
- if (![*fDevice supportsTextureSampleCount:fDisplayParams.fMSAASampleCount]) { - if (![*fDevice supportsTextureSampleCount:fDisplayParams->msaaSampleCount()]) {
+ if (![*d->fDevice supportsTextureSampleCount:fDisplayParams.fMSAASampleCount]) { + if (![*d->fDevice supportsTextureSampleCount:fDisplayParams->msaaSampleCount()]) {
+ fGlobalShared.reset(); + fGlobalShared.reset();
return; return;
} }
@@ -105,7 +105,7 @@ diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWind
return; return;
} }
} }
- fSampleCount = fDisplayParams.fMSAASampleCount; - fSampleCount = fDisplayParams->msaaSampleCount();
- fStencilBits = 8; - fStencilBits = 8;
- -
- fValid = this->onInitializeContext(); - fValid = this->onInitializeContext();
@@ -113,13 +113,17 @@ diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWind
GrMtlBackendContext backendContext = {}; GrMtlBackendContext backendContext = {};
- backendContext.fDevice.retain((GrMTLHandle)fDevice.get()); - backendContext.fDevice.retain((GrMTLHandle)fDevice.get());
- backendContext.fQueue.retain((GrMTLHandle)fQueue.get()); - backendContext.fQueue.retain((GrMTLHandle)fQueue.get());
- fContext = GrDirectContexts::MakeMetal(backendContext, fDisplayParams.fGrContextOptions); - fContext = GrDirectContexts::MakeMetal(backendContext, fDisplayParams->grContextOptions());
- if (!fContext && fDisplayParams.fMSAASampleCount > 1) { - if (!fContext && fDisplayParams->msaaSampleCount() > 1) {
+ backendContext.fDevice.retain((GrMTLHandle)d->fDevice.get()); + backendContext.fDevice.retain((GrMTLHandle)d->fDevice.get());
+ backendContext.fQueue.retain((GrMTLHandle)d->fQueue.get()); + backendContext.fQueue.retain((GrMTLHandle)d->fQueue.get());
+ d->fContext = GrDirectContexts::MakeMetal(backendContext, fDisplayParams.fGrContextOptions); + d->fContext = GrDirectContexts::MakeMetal(backendContext, fDisplayParams->grContextOptions());
+ if (!d->fContext && fDisplayParams.fMSAASampleCount > 1) { + if (!d->fContext && fDisplayParams->msaaSampleCount() > 1) {
fDisplayParams.fMSAASampleCount /= 2; auto newParams = DisplayParamsBuilder(fDisplayParams.get());
newParams.msaaSampleCount(fDisplayParams->msaaSampleCount() / 2);
// Don't call this->setDisplayParams because that also calls
// destroyContext() and initializeContext().
fDisplayParams = newParams.build();
+ fGlobalShared.reset(); + fGlobalShared.reset();
this->initializeContext(); this->initializeContext();
return; return;
@@ -130,7 +134,7 @@ diff -ur skia.org/tools/window/MetalWindowContext.mm skia/tools/window/MetalWind
+ +
+ fContext = fShared->fContext; + fContext = fShared->fContext;
+ +
+ fSampleCount = fDisplayParams.fMSAASampleCount; + fSampleCount = fDisplayParams->msaaSampleCount();
+ fStencilBits = 8; + fStencilBits = 8;
+ +
+ fValid = this->onInitializeContext(); + fValid = this->onInitializeContext();
@@ -224,7 +228,7 @@ diff -ur skia.org/tools/window/unix/GaneshVulkanWindowContext_unix.cpp.orig skia
@@ -68,7 +71,7 @@ @@ -68,7 +71,7 @@
}; };
std::unique_ptr<WindowContext> ctx(new internal::VulkanWindowContext( std::unique_ptr<WindowContext> ctx(new internal::VulkanWindowContext(
displayParams, createVkSurface, canPresent, instProc)); std::move(displayParams), createVkSurface, canPresent, instProc));
- if (!ctx->isValid()) { - if (!ctx->isValid()) {
+ if (!ctx->isValid() && createVkSurface != nullptr) { + if (!ctx->isValid() && createVkSurface != nullptr) {
return nullptr; return nullptr;
@@ -249,7 +253,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
namespace skwindow::internal { namespace skwindow::internal {
@@ -55,32 +59,43 @@ @@ -55,36 +59,47 @@
} }
void VulkanWindowContext::initializeContext() { void VulkanWindowContext::initializeContext() {
@@ -269,11 +273,17 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
+ skgpu::VulkanBackendContext& backendContext = fGlobalShared->backendContext; + skgpu::VulkanBackendContext& backendContext = fGlobalShared->backendContext;
skgpu::VulkanExtensions extensions; skgpu::VulkanExtensions extensions;
VkPhysicalDeviceFeatures2 features; VkPhysicalDeviceFeatures2 features;
if (!sk_gpu_test::CreateVkBackendContext(getInstanceProc, &backendContext, &extensions, if (!sk_gpu_test::CreateVkBackendContext(getInstanceProc,
- &features, &fDebugCallback, &fPresentQueueIndex, &backendContext,
+ &d->features, &d->fDebugCallback, &d->fPresentQueueIndex, &extensions,
- &features,
- &fDebugCallback,
- &fPresentQueueIndex,
+ &d->features,
+ &d->fDebugCallback,
+ &d->fPresentQueueIndex,
fCanPresentFn, fCanPresentFn,
fDisplayParams.fCreateProtectedNativeBackend)) { fDisplayParams->createProtectedNativeBackend())) {
+ sk_gpu_test::FreeVulkanFeaturesStructs(&d->features); + sk_gpu_test::FreeVulkanFeaturesStructs(&d->features);
+ fGlobalShared.reset(); + fGlobalShared.reset();
sk_gpu_test::FreeVulkanFeaturesStructs(&features); sk_gpu_test::FreeVulkanFeaturesStructs(&features);
@@ -330,7 +340,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
- GET_PROC(DestroyInstance); - GET_PROC(DestroyInstance);
- if (fDebugCallback != VK_NULL_HANDLE) { - if (fDebugCallback != VK_NULL_HANDLE) {
- GET_PROC(DestroyDebugReportCallbackEXT); - GET_PROC(DestroyDebugReportCallbackEXT);
+ d->fContext = GrDirectContexts::MakeVulkan(backendContext, fDisplayParams.fGrContextOptions); + d->fContext = GrDirectContexts::MakeVulkan(backendContext, fDisplayParams->grContextOptions());
+ +
+ GET_PROC_GLOBAL(DestroyInstance); + GET_PROC_GLOBAL(DestroyInstance);
+ GET_DEV_PROC_GLOBAL(DestroyDevice); + GET_DEV_PROC_GLOBAL(DestroyDevice);
@@ -364,7 +374,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
GET_DEV_PROC(CreateSwapchainKHR); GET_DEV_PROC(CreateSwapchainKHR);
GET_DEV_PROC(DestroySwapchainKHR); GET_DEV_PROC(DestroySwapchainKHR);
GET_DEV_PROC(GetSwapchainImagesKHR); GET_DEV_PROC(GetSwapchainImagesKHR);
@@ -121,56 +154,44 @@ @@ -121,55 +154,43 @@
GET_DEV_PROC(QueuePresentKHR); GET_DEV_PROC(QueuePresentKHR);
GET_DEV_PROC(GetDeviceQueue); GET_DEV_PROC(GetDeviceQueue);
@@ -378,7 +388,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
- skgpu::ThreadSafe::kNo, - skgpu::ThreadSafe::kNo,
- /*blockSize=*/std::nullopt); - /*blockSize=*/std::nullopt);
- -
- fContext = GrDirectContexts::MakeVulkan(backendContext, fDisplayParams.fGrContextOptions); - fContext = GrDirectContexts::MakeVulkan(backendContext, fDisplayParams->grContextOptions());
+ // No actual window, used just to create the shared GrContext. + // No actual window, used just to create the shared GrContext.
+ if(fCreateVkSurfaceFn == nullptr) + if(fCreateVkSurfaceFn == nullptr)
+ return; + return;
@@ -404,7 +414,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
return; return;
} }
if (!this->createSwapchain(-1, -1, fDisplayParams)) { if (!this->createSwapchain(-1, -1)) {
this->destroyContext(); this->destroyContext();
- sk_gpu_test::FreeVulkanFeaturesStructs(&features); - sk_gpu_test::FreeVulkanFeaturesStructs(&features);
return; return;
@@ -415,8 +425,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
- sk_gpu_test::FreeVulkanFeaturesStructs(&features); - sk_gpu_test::FreeVulkanFeaturesStructs(&features);
} }
bool VulkanWindowContext::createSwapchain(int width, int height, bool VulkanWindowContext::createSwapchain(int width, int height) {
const DisplayParams& params) {
// check for capabilities // check for capabilities
VkSurfaceCapabilitiesKHR caps; VkSurfaceCapabilitiesKHR caps;
- VkResult res = fGetPhysicalDeviceSurfaceCapabilitiesKHR(fPhysicalDevice, fSurface, &caps); - VkResult res = fGetPhysicalDeviceSurfaceCapabilitiesKHR(fPhysicalDevice, fSurface, &caps);
@@ -520,7 +529,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
info.fLevelCount = 1; info.fLevelCount = 1;
- info.fCurrentQueueFamily = fPresentQueueIndex; - info.fCurrentQueueFamily = fPresentQueueIndex;
+ info.fCurrentQueueFamily = fShared->fPresentQueueIndex; + info.fCurrentQueueFamily = fShared->fPresentQueueIndex;
info.fProtected = skgpu::Protected(fDisplayParams.fCreateProtectedNativeBackend); info.fProtected = skgpu::Protected(fDisplayParams->createProtectedNativeBackend());
info.fSharingMode = sharingMode; info.fSharingMode = sharingMode;
@@ -418,8 +438,8 @@ @@ -418,8 +438,8 @@
@@ -642,7 +651,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.cpp skia/tools/window/VulkanW
} }
if (VK_ERROR_OUT_OF_DATE_KHR == res) { if (VK_ERROR_OUT_OF_DATE_KHR == res) {
// tear swapchain down and try again // tear swapchain down and try again
if (!this->createSwapchain(-1, -1, fDisplayParams)) { if (!this->createSwapchain(-1, -1)) {
- GR_VK_CALL(fInterface, DestroySemaphore(fDevice, semaphore, nullptr)); - GR_VK_CALL(fInterface, DestroySemaphore(fDevice, semaphore, nullptr));
+ GR_VK_CALL(fShared->fInterface, DestroySemaphore(fShared->fDevice, semaphore, nullptr)); + GR_VK_CALL(fShared->fInterface, DestroySemaphore(fShared->fDevice, semaphore, nullptr));
return nullptr; return nullptr;
@@ -704,10 +713,10 @@ diff -ur skia.org/tools/window/VulkanWindowContext.h skia/tools/window/VulkanWin
- bool isValid() override { return fDevice != VK_NULL_HANDLE; } - bool isValid() override { return fDevice != VK_NULL_HANDLE; }
+ bool isValid() override { return fSurface != VK_NULL_HANDLE; } + bool isValid() override { return fSurface != VK_NULL_HANDLE; }
void resize(int w, int h) override { void resize(int w, int h) override { this->createSwapchain(w, h); }
this->createSwapchain(w, h, fDisplayParams);
@@ -45,9 +49,15 @@ @@ -45,9 +49,15 @@
VulkanWindowContext(const DisplayParams&, CreateVkSurfaceFn, CanPresentFn, CanPresentFn,
PFN_vkGetInstanceProcAddr); PFN_vkGetInstanceProcAddr);
+ static const VkPhysicalDeviceProperties& getPhysDeviceProperties() { + static const VkPhysicalDeviceProperties& getPhysDeviceProperties() {
@@ -810,8 +819,8 @@ diff -ur skia.org/tools/window/win/VulkanWindowContext_win.cpp skia/tools/window
uint32_t queueFamilyIndex) { uint32_t queueFamilyIndex) {
@@ -66,7 +69,7 @@ @@ -66,7 +69,7 @@
std::unique_ptr<WindowContext> ctx( std::unique_ptr<WindowContext> ctx(new internal::VulkanWindowContext(
new internal::VulkanWindowContext(params, createVkSurface, canPresent, instProc)); std::move(params), createVkSurface, canPresent, instProc));
- if (!ctx->isValid()) { - if (!ctx->isValid()) {
+ if (!ctx->isValid() && createVkSurface != nullptr) { + if (!ctx->isValid() && createVkSurface != nullptr) {
return nullptr; return nullptr;

View File

@@ -26,7 +26,7 @@ diff -ur skia.org/tools/window/unix/RasterWindowContext_unix.cpp skia/tools/wind
--- 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
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
void setDisplayParams(const DisplayParams& params) override; void setDisplayParams(std::unique_ptr<const DisplayParams> params) override;
protected: protected:
- void onSwapBuffers() override; - void onSwapBuffers() override;
@@ -70,7 +70,7 @@ diff -ur skia.org/tools/window/VulkanWindowContext.h skia/tools/window/VulkanWin
--- skia.org/tools/window/VulkanWindowContext.h 2024-10-05 18:16:04.521814026 +0200 --- skia.org/tools/window/VulkanWindowContext.h 2024-10-05 18:16:04.521814026 +0200
+++ skia/tools/window/VulkanWindowContext.h 2024-10-05 18:19:54.713202674 +0200 +++ skia/tools/window/VulkanWindowContext.h 2024-10-05 18:19:54.713202674 +0200
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
bool createSwapchain(int width, int height, const DisplayParams& params); bool createSwapchain(int width, int height);
bool createBuffers(VkFormat format, VkImageUsageFlags, SkColorType colorType, VkSharingMode); bool createBuffers(VkFormat format, VkImageUsageFlags, SkColorType colorType, VkSharingMode);
void destroyBuffers(); void destroyBuffers();
- void onSwapBuffers() override; - void onSwapBuffers() override;
@@ -83,7 +83,7 @@ diff -ur skia.org/tools/window/win/RasterWindowContext_win.cpp skia/tools/window
--- skia.org/tools/window/win/RasterWindowContext_win.cpp 2024-10-05 18:16:04.521814026 +0200 --- skia.org/tools/window/win/RasterWindowContext_win.cpp 2024-10-05 18:16:04.521814026 +0200
+++ skia/tools/window/win/RasterWindowContext_win.cpp 2024-10-05 18:20:58.138561375 +0200 +++ skia/tools/window/win/RasterWindowContext_win.cpp 2024-10-05 18:20:58.138561375 +0200
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
void setDisplayParams(const DisplayParams& params) override; void setDisplayParams(std::unique_ptr<const DisplayParams> params) override;
protected: protected:
- void onSwapBuffers() override; - void onSwapBuffers() override;
@@ -125,7 +125,7 @@ diff -ur skia.org/tools/window/WindowContext.cpp skia/tools/window/WindowContext
+ this->onSwapBuffers(rect); + this->onSwapBuffers(rect);
} }
#if defined(SK_GRAPHITE) bool WindowContext::supportsGpuTimer() const {
diff -ur skia.org/tools/window/WindowContext.h skia/tools/window/WindowContext.h diff -ur skia.org/tools/window/WindowContext.h skia/tools/window/WindowContext.h
--- skia.org/tools/window/WindowContext.h 2024-10-05 18:16:04.521814026 +0200 --- skia.org/tools/window/WindowContext.h 2024-10-05 18:16:04.521814026 +0200
+++ skia/tools/window/WindowContext.h 2024-10-05 18:22:12.945998819 +0200 +++ skia/tools/window/WindowContext.h 2024-10-05 18:22:12.945998819 +0200

View File

@@ -18,8 +18,8 @@ diff -ur skia.org/tools/window/win/RasterWindowContext_win.cpp skia/tools/window
+ // Do not use a packed DIB bitmap, SkSurface_Raster::onNewImageSnapshot() does + // Do not use a packed DIB bitmap, SkSurface_Raster::onNewImageSnapshot() does
+ // a deep copy if it does not own the pixels. + // a deep copy if it does not own the pixels.
SkImageInfo info = SkImageInfo::Make(w, h, fDisplayParams.fColorType, kPremul_SkAlphaType, SkImageInfo info = SkImageInfo::Make(
fDisplayParams.fColorSpace); w, h, fDisplayParams->colorType(), kPremul_SkAlphaType, fDisplayParams->colorSpace());
- fBackbufferSurface = SkSurfaces::WrapPixels(info, pixels, sizeof(uint32_t) * w); - fBackbufferSurface = SkSurfaces::WrapPixels(info, pixels, sizeof(uint32_t) * w);
+ fBackbufferSurface = SkSurfaces::Raster(info); + fBackbufferSurface = SkSurfaces::Raster(info);
} }

View File

@@ -72,8 +72,8 @@ void AquaSkiaSalGraphicsImpl::createWindowSurfaceInternal(bool forceRaster)
assert(!mWindowContext); assert(!mWindowContext);
assert(!mSurface); assert(!mSurface);
SkiaZone zone; SkiaZone zone;
skwindow::DisplayParams displayParams; skwindow::DisplayParamsBuilder displayParams;
displayParams.fColorType = kN32_SkColorType; displayParams.colorType(kN32_SkColorType);
skwindow::MacWindowInfo macWindow; skwindow::MacWindowInfo macWindow;
macWindow.fMainView = mrShared.mpFrame->mpNSView; macWindow.fMainView = mrShared.mpFrame->mpNSView;
mScaling = getWindowScaling(); mScaling = getWindowScaling();
@@ -86,7 +86,7 @@ void AquaSkiaSalGraphicsImpl::createWindowSurfaceInternal(bool forceRaster)
mSurface = createSkSurface(GetWidth() * mScaling, GetHeight() * mScaling); mSurface = createSkSurface(GetWidth() * mScaling, GetHeight() * mScaling);
break; break;
case RenderMetal: case RenderMetal:
mWindowContext = skwindow::MakeGaneshMetalForMac(macWindow, displayParams); mWindowContext = skwindow::MakeGaneshMetalForMac(macWindow, displayParams.build());
// Like with other GPU contexts, create a proxy offscreen surface (see // Like with other GPU contexts, create a proxy offscreen surface (see
// flushSurfaceToWindowContext()). Here it's additionally needed because // flushSurfaceToWindowContext()). Here it's additionally needed because
// it appears that Metal surfaces cannot be read from, which would break things // it appears that Metal surfaces cannot be read from, which would break things
@@ -411,10 +411,10 @@ namespace
{ {
std::unique_ptr<skwindow::WindowContext> createMetalWindowContext(bool /*temporary*/) std::unique_ptr<skwindow::WindowContext> createMetalWindowContext(bool /*temporary*/)
{ {
skwindow::DisplayParams displayParams; skwindow::DisplayParamsBuilder displayParams;
skwindow::MacWindowInfo macWindow; skwindow::MacWindowInfo macWindow;
macWindow.fMainView = nullptr; macWindow.fMainView = nullptr;
return skwindow::MakeGaneshMetalForMac(macWindow, displayParams); return skwindow::MakeGaneshMetalForMac(macWindow, displayParams.build());
} }
} }

View File

@@ -104,18 +104,20 @@ void WinSkiaSalGraphicsImpl::createWindowSurfaceInternal(bool forceRaster)
assert(!mWindowContext); assert(!mWindowContext);
assert(!mSurface); assert(!mSurface);
SkiaZone zone; SkiaZone zone;
skwindow::DisplayParams displayParams;
assert(GetWidth() > 0 && GetHeight() > 0); assert(GetWidth() > 0 && GetHeight() > 0);
displayParams.fSurfaceProps = *surfaceProps(); skwindow::DisplayParamsBuilder aDispParamBuilder;
aDispParamBuilder.surfaceProps(*surfaceProps());
switch (forceRaster ? RenderRaster : renderMethodToUse()) switch (forceRaster ? RenderRaster : renderMethodToUse())
{ {
case RenderRaster: case RenderRaster:
mWindowContext = skwindow::MakeRasterForWin(mWinParent.gethWnd(), displayParams); mWindowContext
= skwindow::MakeRasterForWin(mWinParent.gethWnd(), aDispParamBuilder.build());
if (mWindowContext) if (mWindowContext)
mSurface = mWindowContext->getBackbufferSurface(); mSurface = mWindowContext->getBackbufferSurface();
break; break;
case RenderVulkan: case RenderVulkan:
mWindowContext = skwindow::MakeVulkanForWin(mWinParent.gethWnd(), displayParams); mWindowContext
= skwindow::MakeVulkanForWin(mWinParent.gethWnd(), aDispParamBuilder.build());
// See flushSurfaceToWindowContext(). // See flushSurfaceToWindowContext().
if (mWindowContext) if (mWindowContext)
mSurface = createSkSurface(GetWidth(), GetHeight()); mSurface = createSkSurface(GetWidth(), GetHeight());
@@ -416,8 +418,8 @@ namespace
std::unique_ptr<skwindow::WindowContext> createVulkanWindowContext(bool /*temporary*/) std::unique_ptr<skwindow::WindowContext> createVulkanWindowContext(bool /*temporary*/)
{ {
SkiaZone zone; SkiaZone zone;
skwindow::DisplayParams displayParams; skwindow::DisplayParamsBuilder displayParams;
return skwindow::MakeVulkanForWin(nullptr, displayParams); return skwindow::MakeVulkanForWin(nullptr, displayParams.build());
} }
} }

View File

@@ -67,14 +67,14 @@ X11SkiaSalGraphicsImpl::createWindowContext(Display* display, Drawable drawable,
RenderMethod renderMethod, bool temporary) RenderMethod renderMethod, bool temporary)
{ {
SkiaZone zone; SkiaZone zone;
skwindow::DisplayParams displayParams; skwindow::DisplayParamsBuilder displayParamsBuilder;
displayParams.fColorType = kN32_SkColorType; displayParamsBuilder.colorType(kN32_SkColorType);
#if defined LINUX #if defined LINUX
// WORKAROUND: VSync causes freezes that can even temporarily freeze the entire desktop. // WORKAROUND: VSync causes freezes that can even temporarily freeze the entire desktop.
// This happens even with the latest 450.66 drivers despite them claiming a fix for vsync. // This happens even with the latest 450.66 drivers despite them claiming a fix for vsync.
// https://forums.developer.nvidia.com/t/hangs-freezes-when-vulkan-v-sync-vk-present-mode-fifo-khr-is-enabled/67751 // https://forums.developer.nvidia.com/t/hangs-freezes-when-vulkan-v-sync-vk-present-mode-fifo-khr-is-enabled/67751
if (getVendor() == DriverBlocklist::VendorNVIDIA) if (getVendor() == DriverBlocklist::VendorNVIDIA)
displayParams.fDisableVsync = true; displayParamsBuilder.disableVsync(true);
#endif #endif
skwindow::XlibWindowInfo winInfo; skwindow::XlibWindowInfo winInfo;
assert(display); assert(display);
@@ -103,17 +103,19 @@ X11SkiaSalGraphicsImpl::createWindowContext(Display* display, Drawable drawable,
switch (renderMethod) switch (renderMethod)
{ {
case RenderRaster: case RenderRaster:
{
// Make sure we ask for color type that matches the X11 visual. If red mask // Make sure we ask for color type that matches the X11 visual. If red mask
// is larger value than blue mask, then on little endian this means blue is first. // is larger value than blue mask, then on little endian this means blue is first.
// This should also preferably match SK_R32_SHIFT set in config_skia.h, as that // This should also preferably match SK_R32_SHIFT set in config_skia.h, as that
// improves performance, the common setup seems to be BGRA (possibly because of // improves performance, the common setup seems to be BGRA (possibly because of
// choosing OpenGL-capable visual). // choosing OpenGL-capable visual).
displayParams.fColorType displayParamsBuilder.colorType(visual->red_mask > visual->blue_mask
= (visual->red_mask > visual->blue_mask ? kBGRA_8888_SkColorType ? kBGRA_8888_SkColorType
: kRGBA_8888_SkColorType); : kRGBA_8888_SkColorType);
return skwindow::MakeRasterForXlib(winInfo, displayParams); return skwindow::MakeRasterForXlib(winInfo, displayParamsBuilder.build());
}
case RenderVulkan: case RenderVulkan:
return skwindow::MakeGaneshVulkanForXlib(winInfo, displayParams); return skwindow::MakeGaneshVulkanForXlib(winInfo, displayParamsBuilder.build());
case RenderMetal: case RenderMetal:
abort(); abort();
break; break;