fix Skia CPU instruction set support (tdf#129546)
It was a mistake to compile the SkOpts.cpp file with the highest
CPU set available. I got confused by what SK_CPU_SSE_LEVEL means.
That setting is the lowest set supported, so we should leave
it at whatever Skia's SkPreConfig.h detects it to be from the actual
compiler flags (the ones used for building everything).
SkOpts::init() does runtime checks only for sets _lower_ than what
SK_CPU_SSE_LEVEL says, so by compiling the file with the highest set
all these runtime checks got disabled and it was assumed that
the set defined by SK_CPU_SSE_LEVEL is always available.
Change-Id: I839370645a9cafbede2d37017b9332cc739fc317
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86682
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index ecebc4a..9a619a9 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -208,6 +208,7 @@
UnpackedTarball/skia/src/core/SkNormalFlatSource \
UnpackedTarball/skia/src/core/SkNormalMapSource \
UnpackedTarball/skia/src/core/SkNormalSource \
UnpackedTarball/skia/src/core/SkOpts \
UnpackedTarball/skia/src/core/SkOverdrawCanvas \
UnpackedTarball/skia/src/core/SkPaint \
UnpackedTarball/skia/src/core/SkPaintPriv \
@@ -815,15 +816,6 @@
UnpackedTarball/skia/src/opts/SkOpts_ssse3, $(CXXFLAGS_INTRINSICS_SSSE3) \
))
# Compile this file with the best intrinsics available.
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/core/SkOpts, \
$(CXXFLAGS_INTRINSICS_SSSE3) \
$(CXXFLAGS_INTRINSICS_SSE41) $(CXXFLAGS_INTRINSICS_SSE42) \
$(CXXFLAGS_INTRINSICS_AVX) \
$(CXXFLAGS_INTRINSICS_AVX2) $(CXXFLAGS_INTRINSICS_F16C) $(CXXFLAGS_INTRINSICS_FMA) \
))
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/tools/gpu/vk/VkTestUtils \
UnpackedTarball/skia/tools/sk_app/GLWindowContext \
diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk
index e050b98..6ad0bdc 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -26,6 +26,7 @@
Wdeprecated-copy-dtor.patch.0 \
fix-msvc.patch.1 \
fix-gcc-x86.patch.1 \
msvc-vectorcall-sse.patch.1 \
$(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))
diff --git a/external/skia/msvc-vectorcall-sse.patch.1 b/external/skia/msvc-vectorcall-sse.patch.1
new file mode 100644
index 0000000..f06dca4
--- /dev/null
+++ b/external/skia/msvc-vectorcall-sse.patch.1
@@ -0,0 +1,25 @@
From 9a75d6249ed5c5eff36d70db2a9b87000437fc09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@centrum.cz>
Date: Mon, 13 Jan 2020 14:34:12 +0100
Subject: [PATCH] MSVC's __vectorcall does not work with /arch:SSE
---
src/opts/SkRasterPipeline_opts.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
index 692530828f..7f2b473d82 100644
--- a/src/opts/SkRasterPipeline_opts.h
+++ b/src/opts/SkRasterPipeline_opts.h
@@ -1047,7 +1047,7 @@ static const size_t N = sizeof(F) / sizeof(float);
// TODO: crashes during compilation :(
#define ABI __attribute__((sysv_abi))
#define JUMPER_NARROW_STAGES 0
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
// Even if not vectorized, this lets us pass {r,g,b,a} as registers,
// instead of {b,a} on the stack. Narrow stages work best for __vectorcall.
#define ABI __vectorcall
--
2.16.4