WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-236607-20220215202148.patch (text/plain), 3.63 KB, created by
Alejandro G. Castro
on 2022-02-15 11:21:49 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alejandro G. Castro
Created:
2022-02-15 11:21:49 PST
Size:
3.63 KB
patch
obsolete
>Subversion Revision: 289737 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f8e76531ef93eb0c9f1b16c535099d1e0751658f..84b55bb44146cfaf04ddf679487f16bce04233ff 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2022-02-15 Alejandro G. Castro <alex@igalia.com> >+ >+ [GTK][WPE] Use drm render nodes in GbmDevice and make the fd global to the process >+ https://bugs.webkit.org/show_bug.cgi?id=236607 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We are creating a global static variable to handle the fd of the >+ device in the process, to make sure we search and open once for >+ the graphics device. Also we are using the DRM_NODE_RENDER because >+ we do not need the primary device for the operations we expect to >+ use. >+ >+ No new tests, already covered in the tests. >+ >+ * platform/graphics/gbm/GBMDevice.cpp: >+ (WebCore::GBMDevice::GBMDevice): Use a new global fd. >+ * platform/graphics/gbm/GBMDevice.h: Ditto. >+ > 2022-02-14 Frédéric Wang <fwang@igalia.com> > > Nullptr crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply >diff --git a/Source/WebCore/platform/graphics/gbm/GBMDevice.cpp b/Source/WebCore/platform/graphics/gbm/GBMDevice.cpp >index d3f6c31e30c559b97e639fe48c73a9967c3ebc56..559dba240ef2c35d13ae86dc03f26821252b63d3 100644 >--- a/Source/WebCore/platform/graphics/gbm/GBMDevice.cpp >+++ b/Source/WebCore/platform/graphics/gbm/GBMDevice.cpp >@@ -55,9 +55,31 @@ const GBMDevice& GBMDevice::get() > > GBMDevice::GBMDevice() > { >- int fd = getDeviceFd(); >- if (fd >= 0) >- m_device = gbm_create_device(fd); >+ static int s_globalFd { -1 }; >+ static std::once_flag s_onceFlag; >+ std::call_once(s_onceFlag, [] { >+ drmDevicePtr devices[64]; >+ memset(devices, 0, sizeof(devices)); >+ >+ int numDevices = drmGetDevices2(0, devices, WTF_ARRAY_LENGTH(devices)); >+ if (numDevices <= 0) >+ return; >+ >+ for (int i = 0; i < numDevices; ++i) { >+ drmDevice* device = devices[i]; >+ if (!(device->available_nodes & (1 << DRM_NODE_RENDER))) >+ continue; >+ >+ s_globalFd = open(device->nodes[DRM_NODE_RENDER], O_RDWR | O_CLOEXEC); >+ if (s_globalFd >= 0) >+ break; >+ } >+ >+ drmFreeDevices(devices, numDevices); >+ }); >+ >+ if (s_globalFd >= 0) >+ m_device = gbm_create_device(s_globalFd); > } > > GBMDevice::~GBMDevice() >@@ -68,29 +90,6 @@ GBMDevice::~GBMDevice() > } > } > >-int GBMDevice::getDeviceFd() >-{ >- drmDevicePtr devices[64]; >- memset(devices, 0, sizeof(devices)); >- >- int numDevices = drmGetDevices2(0, devices, WTF_ARRAY_LENGTH(devices)); >- if (numDevices <=0) >- return -1; >- >- int fd = -1; >- for (int i = 0; i < numDevices; ++i) { >- drmDevice* device = devices[i]; >- if (!(device->available_nodes & (1 << DRM_NODE_PRIMARY))) >- continue; >- >- fd = open(device->nodes[DRM_NODE_PRIMARY], O_RDWR); >- if (fd < 0) >- continue; >- } >- >- return fd; >-} >- > } // namespace WebCore > > #endif // USE(ANGLE) && USE(NICOSIA) >diff --git a/Source/WebCore/platform/graphics/gbm/GBMDevice.h b/Source/WebCore/platform/graphics/gbm/GBMDevice.h >index 5ce52fea76825d3c7a04b3fb32383df5cc54eae6..250e07fc9d7d616c84c1acc786497ebe949d976e 100644 >--- a/Source/WebCore/platform/graphics/gbm/GBMDevice.h >+++ b/Source/WebCore/platform/graphics/gbm/GBMDevice.h >@@ -44,8 +44,6 @@ public: > struct gbm_device* device() const { return m_device; } > > private: >- int getDeviceFd(); >- > struct gbm_device* m_device { nullptr }; > }; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 236607
:
451937
| 452063