On Tue, 10 Nov 2020 07:50:26 +0100
Charlene Wendling wrote:
> Hi,
>
> The below diff brings two fixes, and are exclusive to powerpc, with
> no impact on other archs.
>
> > Fix javascript runtime
>
> It appears that a Void-PPC developer managed to fix JavascriptCore
> crashes [1]. There are a lot of 'ifs' and 'buts' in the bug report but
> it fixes that problem nonetheless. That's why i'm keeping it only on
> powerpc, and as-is so it can be synced with their patch.
>
> > Fix colors
>
> Then i had these funny colors [2]. It appears that disabling context
> GL (only on powerpc) helps. While building, i had to do a second patch
> to fix a missing header. I've reduced the size of the haystack about
> this issue, but i may not be able to fix the code myself, which is sad
> since it impacts performances. Yet this provides a better user
> experience indeed.
>
> With that fixed, i'm now able to browse as seen on amd64 with my
> PowerBook using midori [3] and surf.
>
> To potential testers, note that media playback may not work due to
> missing gstreamer plugins either because they're not marked as
> depends, or some of them requiring pulseaudio -- that means rust. If
> you have freezes or panics with a radeon video card you'll need a
> kernel with that commit in [4].
>
> Comments/feedback are welcome,
>
> Charlène.
>
>
> [1] https://bugs.webkit.org/show_bug.cgi?id=211592
> [2] https://bsd.network/web/statuses/105180314092646514
> [3] https://bsd.network/web/statuses/105182198093311767
> [4] https://marc.info/?l=openbsd-cvs&m=160496603105486&w=2
New diff with aja's and sthen's suggestions. I tested on macppc and, even
if it has no impact there, amd64.
Index: Makefile
===================================================================
RCS file: /cvs/ports/www/webkitgtk4/Makefile,v
retrieving revision 1.129
diff -u -p -u -p -r1.129 Makefile
--- Makefile 24 Oct 2020 09:22:18 -0000 1.129
+++ Makefile 10 Nov 2020 23:44:02 -0000
@@ -14,6 +14,7 @@ PORTROACH = limitw:1,even
COMMENT = GTK+ port of the WebKit rendering engine
V = 2.30.2
+REVISION = 0
DISTNAME = webkitgtk-${V}
PKGNAME = webkitgtk4-${V}
EXTRACT_SUFX = .tar.xz
@@ -116,9 +117,12 @@ LDFLAGS += -Wl,--no-keep-memory
.endif
.if ${MACHINE_ARCH} == "powerpc"
+# XXX fix colors being off, it would be nice to fix the code
+CONFIGURE_ARGS += -DENABLE_GRAPHICS_CONTEXT_GL=OFF
CFLAGS += -mlongcall
CXXFLAGS += -mlongcall
LDFLAGS += -Wl,--relax
+PATCH_LIST = patch-* powerpc-patch-*
.endif
post-extract:
Index: patches/patch-Source_WebCore_platform_graphics_x11_PlatformDisplayX11_cpp
===================================================================
RCS file:
patches/patch-Source_WebCore_platform_graphics_x11_PlatformDisplayX11_cpp
diff -N
patches/patch-Source_WebCore_platform_graphics_x11_PlatformDisplayX11_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Source_WebCore_platform_graphics_x11_PlatformDisplayX11_cpp
10 Nov 2020 23:44:02 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Missing include for XVisualInfo(3), this code is only trigerred when
+`-DENABLE_GRAPHICS_CONTEXT_GL=OFF' is given to CONFIGURE_ARGS, currently
+only needed on powerpc.
+
+Index: Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp
+--- Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp.orig
++++ Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp
+@@ -32,6 +32,7 @@
+ #include <X11/Xlib.h>
+ #include <X11/extensions/Xcomposite.h>
+ #if PLATFORM(GTK)
++#include <X11/Xutil.h>
+ #include <X11/extensions/Xdamage.h>
+ #endif
+
Index:
patches/powerpc-patch-Source_JavaScriptCore_llint_LowLevelInterpreter32_64_asm
===================================================================
RCS file:
patches/powerpc-patch-Source_JavaScriptCore_llint_LowLevelInterpreter32_64_asm
diff -N
patches/powerpc-patch-Source_JavaScriptCore_llint_LowLevelInterpreter32_64_asm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++
patches/powerpc-patch-Source_JavaScriptCore_llint_LowLevelInterpreter32_64_asm
10 Nov 2020 23:44:02 -0000
@@ -0,0 +1,58 @@
+$OpenBSD$
+
+Fix Javascript runtime on powerpc, from
+https://bugs.webkit.org/show_bug.cgi?id=211592
+
+Index: Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
+--- Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm.orig
++++ Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
+@@ -1552,13 +1552,21 @@ llintOpWithMetadata(op_put_by_id, OpPutById, macro (si
+ loadp StructureChain::m_vector[t3], t3
+ assert(macro (ok) btpnz t3, ok end)
+
+- loadp Structure::m_prototype[t2], t2
++ if JSVALUE64
++ loadp Structure::m_prototype[t2], t2
++ else
++ loadp Structure::m_prototype + PayloadOffset[t2], t2
++ end
+ btpz t2, .opPutByIdTransitionChainDone
+ .opPutByIdTransitionChainLoop:
+ loadp [t3], t1
+ bineq t1, JSCell::m_structureID[t2], .opPutByIdSlow
+ addp 4, t3
+- loadp Structure::m_prototype[t1], t2
++ if JSVALUE64
++ loadp Structure::m_prototype[t1], t2
++ else
++ loadp Structure::m_prototype + PayloadOffset[t1], t2
++ end
+ btpnz t2, .opPutByIdTransitionChainLoop
+
+ .opPutByIdTransitionChainDone:
+@@ -2182,7 +2190,11 @@ end)
+
+
+ op(llint_throw_from_slow_path_trampoline, macro()
+- loadp Callee[cfr], t1
++ if JSVALUE64
++ loadp Callee[cfr], t1
++ else
++ loadp Callee + PayloadOffset[cfr], t1
++ end
+ convertCalleeToVM(t1)
+ copyCalleeSavesToVMEntryFrameCalleeSavesBuffer(t1, t2)
+
+@@ -2191,7 +2203,11 @@ op(llint_throw_from_slow_path_trampoline, macro()
+ # When throwing from the interpreter (i.e. throwing from LLIntSlowPaths),
so
+ # the throw target is not necessarily interpreted code, we come to here.
+ # This essentially emulates the JIT's throwing protocol.
+- loadp Callee[cfr], t1
++ if JSVALUE64
++ loadp Callee[cfr], t1
++ else
++ loadp Callee + PayloadOffset[cfr], t1
++ end
+ convertCalleeToVM(t1)
+ jmp VM::targetMachinePCForThrow[t1]
+ end)