Title: [275026] releases/WebKitGTK/webkit-2.32/Source/WebKit
Revision
275026
Author
[email protected]
Date
2021-03-25 07:07:06 -0700 (Thu, 25 Mar 2021)

Log Message

Merge r274937 - [WPE] Build error in ARMv7 invalid 'static_cast' for GLNativeWindowType
https://bugs.webkit.org/show_bug.cgi?id=223684

Fixes this error:

  error: invalid 'static_cast' from type 'uintptr_t' {aka 'unsigned
  int'} to type 'GLNativeWindowType' {aka 'void*'}

; an invalid 'static_cast' from type error for ARMv7 (rpi3 and mesa driver)
by using the same solution chosen in
https://bugs.webkit.org/show_bug.cgi?id=179511:

  EGLNativeWindowType can be aliased to a different type depending (at least) on the EGL
  implementation, its build options, and the libepoxy build options.  Using "static_cast"
  works when it is a numeric value and the width of the value needs to be optionally
  extended to 64 bits (e.g. the EGL type is "int" in a 32-bit CPU) but not for pointers,
  and using "reinterpret_cast" works when the size of a pointer is 64 bits but not in other
  cases. Therefore it seems reasonable to use a plain C cast _expression_ to solve this
  particular situation.

https://trac.webkit.org/changeset/274869/webkit

Reviewed by Philippe Normand.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::createGLContext):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog (275025 => 275026)


--- releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog	2021-03-25 14:07:01 UTC (rev 275025)
+++ releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog	2021-03-25 14:07:06 UTC (rev 275026)
@@ -1,3 +1,32 @@
+2021-03-24  Pablo Saavedra  <[email protected]>
+
+        [WPE] Build error in ARMv7 invalid 'static_cast' for GLNativeWindowType
+        https://bugs.webkit.org/show_bug.cgi?id=223684
+
+        Fixes this error:
+
+          error: invalid 'static_cast' from type 'uintptr_t' {aka 'unsigned
+          int'} to type 'GLNativeWindowType' {aka 'void*'}
+
+        ; an invalid 'static_cast' from type error for ARMv7 (rpi3 and mesa driver)
+        by using the same solution chosen in
+        https://bugs.webkit.org/show_bug.cgi?id=179511:
+
+          EGLNativeWindowType can be aliased to a different type depending (at least) on the EGL
+          implementation, its build options, and the libepoxy build options.  Using "static_cast"
+          works when it is a numeric value and the width of the value needs to be optionally
+          extended to 64 bits (e.g. the EGL type is "int" in a 32-bit CPU) but not for pointers,
+          and using "reinterpret_cast" works when the size of a pointer is 64 bits but not in other
+          cases. Therefore it seems reasonable to use a plain C cast _expression_ to solve this
+          particular situation.
+
+        https://trac.webkit.org/changeset/274869/webkit
+
+        Reviewed by Philippe Normand.
+
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::createGLContext):
+
 2021-03-23  Philippe Normand  <[email protected]>
 
         [GTK] X11 build fixes

Modified: releases/WebKitGTK/webkit-2.32/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (275025 => 275026)


--- releases/WebKitGTK/webkit-2.32/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2021-03-25 14:07:01 UTC (rev 275025)
+++ releases/WebKitGTK/webkit-2.32/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2021-03-25 14:07:06 UTC (rev 275026)
@@ -86,12 +86,12 @@
 
     ASSERT(m_nativeSurfaceHandle);
 
-#if CPU(ADDRESS64)
-    auto windowType = reinterpret_cast<GLNativeWindowType>(m_nativeSurfaceHandle);
-#else
-    // On 32-bit platforms GLNativeWindowType is an integer type, which cannot be casted with reinterpret_cast.
-    auto windowType = static_cast<GLNativeWindowType>(m_nativeSurfaceHandle);
-#endif
+    // GLNativeWindowType depends on the EGL implementation: reinterpret_cast works
+    // for pointers (only if they are 64-bit wide and not for other cases), and static_cast for
+    // numeric types (and when needed they get extended to 64-bit) but not for pointers. Using
+    // a plain C cast _expression_ in this one instance works in all cases.
+    static_assert(sizeof(GLNativeWindowType) <= sizeof(uint64_t), "GLNativeWindowType must not be longer than 64 bits.");
+    auto windowType = (GLNativeWindowType) m_nativeSurfaceHandle;
     m_context = GLContext::createContextForWindow(windowType, &PlatformDisplay::sharedDisplayForCompositing());
     if (m_context)
         m_context->makeContextCurrent();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to