Skip to content

Commit

Permalink
[GTK] Failed to create GBM buffer of size 0x0: Invalid argument
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265154

Reviewed by Michael Catanzaro.

This happens because in some cases we schedule a layer flush before the
drawing area size is initially updated. It's easier to happen in the
case of inspector because we don't delay the web process creation until
the first load in that case. We should just ignore layer flush requests
when the view size is empty since we won't be able to render anything
anyway. Also set the device scale factor before the page is initialized
to avoid sending an IPC message right after web page creation.

* Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseCreateWebPage):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::scheduleLayerFlush):

Canonical link: https://commits.webkit.org/276337@main
  • Loading branch information
carlosgcampos committed Mar 19, 2024
1 parent 20ecbb6 commit c3a0173
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2581,14 +2581,14 @@ void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, Ref<AP
}

priv->pageProxy = processPool->createWebPage(*priv->pageClient, WTFMove(configuration));
priv->pageProxy->setIntrinsicDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webkitWebViewBase)));
priv->acceleratedBackingStore = AcceleratedBackingStore::create(*priv->pageProxy);
priv->pageProxy->initializeWebPage();

if (priv->displayID)
priv->pageProxy->windowScreenDidChange(priv->displayID);

// We attach this here, because changes in scale factor are passed directly to the page proxy.
priv->pageProxy->setIntrinsicDeviceScaleFactor(gtk_widget_get_scale_factor(GTK_WIDGET(webkitWebViewBase)));
g_signal_connect(webkitWebViewBase, "notify::scale-factor", G_CALLBACK(deviceScaleFactorChanged), nullptr);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ void LayerTreeHost::scheduleLayerFlush()
if (!m_layerFlushSchedulingEnabled)
return;

if (m_webPage.size().isEmpty())
return;

if (m_isWaitingForRenderer) {
m_scheduledWhileWaitingForRenderer = true;
return;
Expand Down

0 comments on commit c3a0173

Please sign in to comment.