Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcom Nexus API support for ANGLE WebGL #1343

Draft
wants to merge 55 commits into
base: main-next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
090ff40
[PSON] Disable PSON for the WPE port
magomez Aug 18, 2023
e496014
Ensure we check for WEBKIT_EXEC_PATH even without developer mode
pgorszkowski-igalia Nov 29, 2022
ae62fcc
Allow WEBKIT_INJECTED_BUNDLE_PATH even in non developer mode
pgorszkowski-igalia Nov 30, 2022
abc5ee3
Relax user agent validation
pgorszkowski-igalia Nov 16, 2022
2523172
Use API version 1.1 instead of 2.0
magomez Aug 28, 2023
695c76a
Add web extensions API to allowlist access to a security origin
pgorszkowski-igalia Aug 23, 2023
3fd2ed5
Implement mixed content whitelist
jacek-manko-red Jul 20, 2023
1dd3034
[API] Add webkit_web_context_garbage_collect_javascript_objects method
pgorszkowski-igalia Dec 7, 2022
3050220
Add did-start-provisional-load-for-frame signal
magomez Aug 31, 2023
8830313
[Responsiveness] Add API to manually check WebProcess responsiveness
magomez Jan 25, 2023
7bf8a30
[Responsiveness] Add API to get the WebProcess ID
magomez Jan 25, 2023
e846875
Expose JSC "C" API
emutavchi Dec 22, 2021
7508775
Add a setting to allow closing windows from scripts
magomez Jan 25, 2023
fb00101
Add setting to enable/disable directory upload
magomez Jan 27, 2023
7a2e741
Add provision to allow insecure content
pgorszkowski-igalia Feb 16, 2023
a979873
Add a property to WebKitWebsiteDataManager to set the LocalStorage qu…
magomez Mar 2, 2023
7789c4b
provision wal_autocheckpoint to prevent the log file growing to large…
abstractmachines Mar 1, 2023
14527e9
Control on-disk cache size with env var WPE_DISK_CACHE_SIZE
abstractmachines Mar 13, 2023
f4aae52
Add configuration option to allow moving window to background when wi…
jakub-gocol-red Jun 29, 2023
c6fa543
Add env var to allow keeping the existent navigation on a fragment load
magomez Jan 10, 2023
c3b13d6
Add API to send memory pressure events
magomez Sep 27, 2023
0e9a5f8
[MemoryPressure] Add WPE_RAM_SIZE env var to define a custom RAM size
magomez Jan 17, 2023
926d994
Disable caching of XHR ArrayBuffer and/or env variable
abstractmachines Feb 1, 2023
df304d0
Jettison on top level navigation
pgorszkowski-igalia Feb 15, 2023
627a2f5
[JSC] Enable SharedArrayBuffer feature by default
magomez Aug 31, 2023
ee25625
Do not try to swap navigation as we're not using PSON
magomez Feb 1, 2023
b77f822
[JSC] Add option to disable console logging
magomez Aug 31, 2023
edb2da8
[Network] Add TCPKeepAlive option
pgorszkowski-igalia Dec 15, 2022
9915aa1
[soup] Add env var to allow reusing POST connections
magomez Jul 26, 2023
74eb1c6
OptionsWPE: compile with -ffunction-sections -fdata-sections, link wi…
zdobersek May 23, 2017
44b1aa5
Use -ffunction-sections/-fdata-sections/--gc-sections with clang too
blino Jun 8, 2017
ce6e581
OptionWPE: Optimize binary size of debug build
pgorszkowski-igalia Feb 14, 2023
a606907
Condition section anchoring to ARM/ARM64 platforms
charlie-ht Mar 5, 2018
679f867
Added option to enable logs
varumugam123 May 19, 2022
858cbe9
Disable systemd logging by default
pgorszkowski-igalia Feb 9, 2023
b6ebe42
[INSPECTOR] Wait a max of 60s before failing on loading libWPEWebInsp…
magomez Jun 22, 2022
c4b8d7e
[INSPECTOR] Never destroy RemoteInspectorHTTPServer singleton
asurdej-comcast Sep 14, 2022
57c8b7b
[INSPECTOR] Listen on both ipv4 and ipv6
emutavchi May 19, 2022
d4efa23
Use static port for internal webinspector communication
jacek-manko-red Jun 28, 2023
932e27e
Take into account scaling operations when deciding backingStore scale…
magomez Mar 9, 2023
62ba6db
Handle all types of headers for accessibility read out
asurdej-comcast Mar 31, 2022
9fdc992
Add Generic, Cell, GridCell and Caption roles for visibleText computa…
asurdej-comcast Mar 29, 2022
daa496d
Voice Guidance reads iframe when added to DOM.
pgorszkowski-igalia Mar 15, 2023
a8b1182
Adapt speech synthesis changes from 2.28
Scony Mar 21, 2023
fbb355f
Add support for triggering notifications on WPE
filipe-norte-red Oct 3, 2023
61b6e2a
[OIPF] Add window.KeyEvent interface with VK keys mapping
magomez Nov 10, 2023
039ccfe
Add logging for loading failures
magomez Nov 30, 2023
30f2909
Support unrestricted ports usage for custom URI schemes
filipe-norte-red Dec 21, 2023
903aacc
Add support to enable/disable service workers at runtime
filipe-norte-red Apr 15, 2024
ac6b407
Enable MemoryPressureHandler for MALLOC_HEAP_BREAKDOWN
asurdej-comcast Apr 12, 2024
d675935
Fix remaining !ENABLE(VIDEO) build failures https://bugs.webkit.org/s…
q66 Apr 26, 2024
7e675fd
[suspend/resume][hide/show] Implement features
magomez May 8, 2024
2e6058c
Add a provision in WebKitURIResponse to check if the response is from…
varumugam123 May 8, 2024
ca63a1c
Remove unneeded this captures causing build fail
q66 May 22, 2024
36c6ef6
Implement Broadcom Nexus API for ANGLE WebGL
zdobersek May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/API/glib/JSCContextPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef const struct OpaqueJSValue* JSValueRef;
typedef struct OpaqueJSValue* JSObjectRef;

JS_EXPORT_PRIVATE GRefPtr<JSCContext> jscContextGetOrCreate(JSGlobalContextRef);
JS_EXPORT_PRIVATE JSGlobalContextRef jscContextGetJSContext(JSCContext*);
G_BEGIN_DECLS JSC_API JS_EXPORT_PRIVATE JSGlobalContextRef jscContextGetJSContext(JSCContext*); G_END_DECLS
JS_EXPORT_PRIVATE GRefPtr<JSCValue> jscContextGetOrCreateValue(JSCContext*, JSValueRef);
void jscContextValueDestroyed(JSCContext*, JSValueRef);
JSC::JSObject* jscContextGetJSWrapper(JSCContext*, gpointer);
Expand Down
4 changes: 4 additions & 0 deletions Source/JavaScriptCore/PlatformWPE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ list(APPEND JavaScriptCore_PRIVATE_DEFINITIONS
PKGLIBDIR="${CMAKE_INSTALL_FULL_LIBDIR}/wpe-webkit-${WPE_API_VERSION}"
)

install(FILES ${JavaScriptCore_PUBLIC_FRAMEWORK_HEADERS}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-webkit-${WPE_API_VERSION}/JavaScriptCore"
)

install(FILES ${JavaScriptCore_INSTALLED_HEADERS}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wpe-webkit-${WPE_API_VERSION}/jsc"
COMPONENT "Development"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ GVariant* RemoteInspectorServer::setupInspectorClient(SocketConnection& clientCo
m_clientConnection = &clientConnection;

GVariant* backendCommands;
if (strcmp(clientBackendCommandsHash, backendCommandsHash().data())) {
if (!backendCommandsHash().isNull() && strcmp(clientBackendCommandsHash, backendCommandsHash().data())) {
auto bytes = Inspector::backendCommands();
backendCommands = g_variant_new_bytestring(static_cast<const char*>(g_bytes_get_data(bytes.get(), nullptr)));
} else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,18 @@ namespace Inspector {
GRefPtr<GBytes> backendCommands()
{
#if PLATFORM(WPE)
static std::once_flag flag;
std::call_once(flag, [] {
const char* libDir = PKGLIBDIR;
#if ENABLE(DEVELOPER_MODE)
// Probably no need for a specific env var here. Assume the inspector resources.so file is
// in the same directory as the injected bundle lib, for developer builds.
const char* path = g_getenv("WEBKIT_INJECTED_BUNDLE_PATH");
if (path && g_file_test(path, G_FILE_TEST_IS_DIR))
libDir = path;
#endif
GUniquePtr<char> bundleFilename(g_build_filename(libDir, "libWPEWebInspectorResources.so", nullptr));
GModule* resourcesModule = g_module_open(bundleFilename.get(), G_MODULE_BIND_LAZY);
static bool moduleLoaded = false;

if (!moduleLoaded) {
GModule* resourcesModule = g_module_open(PKGLIBDIR G_DIR_SEPARATOR_S "libWPEWebInspectorResources.so", G_MODULE_BIND_LAZY);
if (!resourcesModule) {
WTFLogAlways("Error loading libWPEWebInspectorResources.so: %s", g_module_error());
return;
return nullptr;
}

g_module_make_resident(resourcesModule);
});
moduleLoaded = true;
}
#endif
GRefPtr<GBytes> bytes = adoptGRef(g_resources_lookup_data(INSPECTOR_BACKEND_COMMANDS_PATH, G_RESOURCE_LOOKUP_FLAGS_NONE, nullptr));
ASSERT(bytes);
Expand All @@ -70,6 +63,9 @@ const CString& backendCommandsHash()
static CString hexDigest;
if (hexDigest.isNull()) {
auto bytes = backendCommands();
if (!bytes)
return hexDigest;

size_t dataSize;
gconstpointer data = g_bytes_get_data(bytes.get(), &dataSize);
ASSERT(dataSize);
Expand Down
4 changes: 4 additions & 0 deletions Source/JavaScriptCore/runtime/ConsoleObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "ConsoleClient.h"
#include "JSCInlines.h"
#include "Options.h"
#include "ScriptArguments.h"
#include "ScriptCallStackFactory.h"

Expand Down Expand Up @@ -133,6 +134,9 @@ static EncodedJSValue consoleLogWithLevel(JSGlobalObject* globalObject, CallFram
if (!client)
return JSValue::encode(jsUndefined());

if (Options::disableConsoleLog())
return JSValue::encode(jsUndefined());

client->logWithLevel(globalObject, Inspector::createScriptArguments(globalObject, callFrame, 0), level);
return JSValue::encode(jsUndefined());
}
Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/runtime/OptionsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ bool hasCapacityToUseLargeGigacage();
v(Bool, usePromiseTryMethod, false, Normal, "Expose the Promise.try() method.") \
v(Bool, useRegExpEscape, false, Normal, "Expose RegExp.escape feature.") \
v(Bool, useResizableArrayBuffer, true, Normal, "Expose ResizableArrayBuffer feature.") \
v(Bool, useSharedArrayBuffer, false, Normal, nullptr) \
v(Bool, useSharedArrayBuffer, true, Normal, nullptr) \
v(Bool, useShadowRealm, false, Normal, "Expose the ShadowRealm object.") \
v(Bool, useStringWellFormed, true, Normal, "Expose the String well-formed methods.") \
v(Bool, useTemporal, false, Normal, "Expose the Temporal object.") \
Expand All @@ -605,7 +605,7 @@ bool hasCapacityToUseLargeGigacage();
v(Bool, useWebAssemblyRelaxedSIMD, false, Normal, "Allow the relaxed simd instructions and types from the wasm relaxed simd spec.") \
v(Bool, useWebAssemblyTailCalls, false, Normal, "Allow the new instructions from the wasm tail calls spec.") \
v(Bool, useWebAssemblyExtendedConstantExpressions, true, Normal, "Allow the use of global, element, and data init expressions from the extended constant expressions proposal.") \

v(Bool, disableConsoleLog, false, Normal, "Disable printing of JS console logs.") \


enum OptionEquivalence {
Expand Down
1 change: 1 addition & 0 deletions Source/ThirdParty/ANGLE/src/common/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,7 @@ bool IsExternalImageTarget(EGLenum target)
case EGL_LINUX_DMA_BUF_EXT:
case EGL_METAL_TEXTURE_ANGLE:
case EGL_VULKAN_IMAGE_ANGLE:
case EGL_NATIVE_PIXMAP_KHR:
return true;

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,8 +842,7 @@ void DisplayEGL::generateExtensions(egl::DisplayExtensions *outExtensions) const

outExtensions->image = mEGL->hasExtension("EGL_KHR_image");
outExtensions->imageBase = mEGL->hasExtension("EGL_KHR_image_base");
// Pixmaps are not supported in ANGLE's EGL implementation.
// outExtensions->imagePixmap = mEGL->hasExtension("EGL_KHR_image_pixmap");
outExtensions->imagePixmap = mEGL->hasExtension("EGL_KHR_image_pixmap");
outExtensions->glTexture2DImage = mEGL->hasExtension("EGL_KHR_gl_texture_2D_image");
outExtensions->glTextureCubemapImage = mEGL->hasExtension("EGL_KHR_gl_texture_cubemap_image");
outExtensions->glTexture3DImage = mEGL->hasExtension("EGL_KHR_gl_texture_3D_image");
Expand Down Expand Up @@ -1023,6 +1022,9 @@ ExternalImageSiblingImpl *DisplayEGL::createExternalImageSibling(const gl::Conte
ASSERT(buffer == nullptr);
return new DmaBufImageSiblingEGL(attribs);

case EGL_NATIVE_PIXMAP_KHR:
return new PixmapImageSiblingEGL(buffer, attribs);

default:
return DisplayGL::createExternalImageSibling(context, target, buffer, attribs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,66 @@ void DmaBufImageSiblingEGL::getImageCreationAttributes(std::vector<EGLint> *outA
}
}

PixmapImageSiblingEGL::PixmapImageSiblingEGL(EGLClientBuffer buffer, const egl::AttributeMap &attribs)
: mBuffer(buffer), mAttribs(attribs), mFormat(GL_NONE)
{
ASSERT(mAttribs.contains(EGL_WIDTH));
mSize.width = mAttribs.getAsInt(EGL_WIDTH);
ASSERT(mAttribs.contains(EGL_HEIGHT));
mSize.height = mAttribs.getAsInt(EGL_HEIGHT);

mFormat = gl::Format(GL_RGBA8);
}

PixmapImageSiblingEGL::~PixmapImageSiblingEGL() {}

egl::Error PixmapImageSiblingEGL::initialize(const egl::Display *display)
{
return egl::NoError();
}

gl::Format PixmapImageSiblingEGL::getFormat() const
{
return mFormat;
}

bool PixmapImageSiblingEGL::isRenderable(const gl::Context *context) const
{
return true;
}

bool PixmapImageSiblingEGL::isTexturable(const gl::Context *context) const
{
return true;
}

bool PixmapImageSiblingEGL::isYUV() const
{
return false;
}

bool PixmapImageSiblingEGL::hasProtectedContent() const
{
return false;
}

gl::Extents PixmapImageSiblingEGL::getSize() const
{
return mSize;
}

size_t PixmapImageSiblingEGL::getSamples() const
{
return 0;
}

EGLClientBuffer PixmapImageSiblingEGL::getBuffer() const
{
return mBuffer;
}

void PixmapImageSiblingEGL::getImageCreationAttributes(std::vector<EGLint> *outAttributes) const
{
}

} // namespace rx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ class DmaBufImageSiblingEGL : public ExternalImageSiblingEGL
bool mHasProtectedContent;
};

class PixmapImageSiblingEGL : public ExternalImageSiblingEGL
{
public:
PixmapImageSiblingEGL(EGLClientBuffer buffer, const egl::AttributeMap &attribs);
~PixmapImageSiblingEGL() override;

egl::Error initialize(const egl::Display *display) override;

// ExternalImageSiblingImpl interface
gl::Format getFormat() const override;
bool isRenderable(const gl::Context *context) const override;
bool isTexturable(const gl::Context *context) const override;
bool isYUV() const override;
bool hasProtectedContent() const override;
gl::Extents getSize() const override;
size_t getSamples() const override;

// ExternalImageSiblingEGL interface
EGLClientBuffer getBuffer() const override;
void getImageCreationAttributes(std::vector<EGLint> *outAttributes) const override;

private:
EGLClientBuffer mBuffer;
egl::AttributeMap mAttribs;
gl::Extents mSize;
gl::Format mFormat;
};

} // namespace rx

#endif // LIBANGLE_RENDERER_GL_EGL_DMABUFIMAGESIBLINGEGL_H_
21 changes: 20 additions & 1 deletion Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3525,7 +3525,7 @@ bool ValidateCreateImage(const ValidationContext *val,

case EGL_WIDTH:
case EGL_HEIGHT:
if (target != EGL_LINUX_DMA_BUF_EXT)
if (target != EGL_LINUX_DMA_BUF_EXT && target != EGL_NATIVE_PIXMAP_KHR)
{
val->setError(
EGL_BAD_PARAMETER,
Expand Down Expand Up @@ -4080,6 +4080,25 @@ bool ValidateCreateImage(const ValidationContext *val,
display->validateImageClientBuffer(context, target, buffer, attributes),
val->entryPoint, val->labeledObject, false);
break;
case EGL_NATIVE_PIXMAP_KHR:
if (!displayExtensions.imagePixmap)
{
val->setError(EGL_BAD_PARAMETER, "EGL_KHR_image_pixmap not supported.");
return false;
}

if (context != nullptr)
{
val->setError(EGL_BAD_PARAMETER, "ctx must be EGL_NO_CONTEXT.");
return false;
}

if (buffer == nullptr)
{
val->setError(EGL_BAD_PARAMETER, "buffer must not be NULL.");
return false;
}
break;
default:
val->setError(EGL_BAD_PARAMETER, "invalid target: 0x%X", target);
return false;
Expand Down
28 changes: 28 additions & 0 deletions Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@ AllowMediaContentTypesRequiringHardwareSupportAsFallback:
WebCore:
default: false

AllowMoveToSuspendOnWindowClose:
type: bool
status: embedder
humanReadableName: "Allow move to suspend on window.close()"
humanReadableDescription: "Allow to suspend browser instead of closing window on window.close()"
condition: PLATFORM(WPE)
defaultValue:
WebKitLegacy:
default: false
WebKit:
default: false
WebCore:
default: false

AllowMultiElementImplicitSubmission:
type: bool
status: embedder
Expand All @@ -291,6 +305,20 @@ AllowRunningOfInsecureContent:
WebCore:
default: false

AllowScriptsToCloseWindows:
type: bool
status: embedder
humanReadableName: "Allow scripts to close windows"
humanReadableDescription: "Allow scripts to close windows"
condition: PLATFORM(WPE)
defaultValue:
WebKitLegacy:
default: false
WebKit:
default: false
WebCore:
default: false

AllowSettingAnyXHRHeaderFromFileURLs:
type: bool
status: embedder
Expand Down
Loading