Skip to content

Commit

Permalink
[GTK][WPE] Show DRM device and render node files when available in we…
Browse files Browse the repository at this point in the history
…bkit://gpu

https://bugs.webkit.org/show_bug.cgi?id=255445

Reviewed by Adrian Perez de Castro.

* Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp:
(WebKit::WebKitProtocolHandler::handleGPU):

Canonical link: https://commits.webkit.org/262958@main
  • Loading branch information
carlosgcampos committed Apr 14, 2023
1 parent 7cc28df commit b835f52
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp
Expand Up @@ -58,6 +58,9 @@

#if USE(GBM)
#include "AcceleratedBackingStoreDMABuf.h"
#ifndef EGL_DRM_RENDER_NODE_FILE_EXT
#define EGL_DRM_RENDER_NODE_FILE_EXT 0x3377
#endif
#endif

#if PLATFORM(X11)
Expand Down Expand Up @@ -278,6 +281,24 @@ void WebKitProtocolHandler::handleGPU(WebKitURISchemeRequest* request)
addTableRow(hardwareAccelerationObject, "GL_VERSION"_s, makeString(reinterpret_cast<const char*>(glGetString(GL_VERSION))));
addTableRow(hardwareAccelerationObject, "GL_SHADING_LANGUAGE_VERSION"_s, makeString(reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION))));

auto eglDisplay = PlatformDisplay::sharedDisplay().eglDisplay();
#if USE(GBM)
if (GLContext::isExtensionSupported(eglQueryString(nullptr, EGL_EXTENSIONS), "EGL_EXT_device_query")) {
EGLDeviceEXT eglDevice;
if (eglQueryDisplayAttribEXT(eglDisplay, EGL_DEVICE_EXT, reinterpret_cast<EGLAttrib*>(&eglDevice))) {
const char* deviceExtensions = eglQueryDeviceStringEXT(eglDevice, EGL_EXTENSIONS);
if (GLContext::isExtensionSupported(deviceExtensions, "EGL_EXT_device_drm")) {
if (const char* deviceFile = eglQueryDeviceStringEXT(eglDevice, EGL_DRM_DEVICE_FILE_EXT))
addTableRow(hardwareAccelerationObject, "DRM Device"_s, makeString(deviceFile));
}
if (GLContext::isExtensionSupported(deviceExtensions, "EGL_EXT_device_drm_render_node")) {
if (const char* renderNode = eglQueryDeviceStringEXT(eglDevice, EGL_DRM_RENDER_NODE_FILE_EXT))
addTableRow(hardwareAccelerationObject, "DRM Render Node"_s, makeString(renderNode));
}
}
}
#endif

#if USE(OPENGL_ES)
addTableRow(hardwareAccelerationObject, "GL_EXTENSIONS"_s, makeString(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))));
#else
Expand All @@ -292,7 +313,6 @@ void WebKitProtocolHandler::handleGPU(WebKitURISchemeRequest* request)
addTableRow(hardwareAccelerationObject, "GL_EXTENSIONS"_s, extensionsBuilder.toString());
#endif

auto eglDisplay = PlatformDisplay::sharedDisplay().eglDisplay();
addTableRow(hardwareAccelerationObject, "EGL_VERSION"_s, makeString(eglQueryString(eglDisplay, EGL_VERSION)));
addTableRow(hardwareAccelerationObject, "EGL_VENDOR"_s, makeString(eglQueryString(eglDisplay, EGL_VENDOR)));
addTableRow(hardwareAccelerationObject, "EGL_EXTENSIONS"_s, makeString(eglQueryString(nullptr, EGL_EXTENSIONS), ' ', eglQueryString(eglDisplay, EGL_EXTENSIONS)));
Expand Down

0 comments on commit b835f52

Please sign in to comment.