Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Feb 2019 17:06:05 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r493974 - in branches/2019Q1/www/firefox: . files
Message-ID:  <201902261706.x1QH65K8039558@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Tue Feb 26 17:06:05 2019
New Revision: 493974
URL: https://svnweb.freebsd.org/changeset/ports/493974

Log:
  MFH: r493973
  
  www/firefox: backport another Wayland+WebRender fix
  
  Obtained from:	      upstream (Firefox 67)
  Approved by:	ports-secteam blanket

Added:
  branches/2019Q1/www/firefox/files/patch-bug1527804
     - copied unchanged from r493973, head/www/firefox/files/patch-bug1527804
Modified:
  branches/2019Q1/www/firefox/Makefile
Directory Properties:
  branches/2019Q1/   (props changed)

Modified: branches/2019Q1/www/firefox/Makefile
==============================================================================
--- branches/2019Q1/www/firefox/Makefile	Tue Feb 26 17:03:56 2019	(r493973)
+++ branches/2019Q1/www/firefox/Makefile	Tue Feb 26 17:06:05 2019	(r493974)
@@ -3,7 +3,7 @@
 
 PORTNAME=	firefox
 DISTVERSION=	65.0.1
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \

Copied: branches/2019Q1/www/firefox/files/patch-bug1527804 (from r493973, head/www/firefox/files/patch-bug1527804)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2019Q1/www/firefox/files/patch-bug1527804	Tue Feb 26 17:06:05 2019	(r493974, copy of r493973, head/www/firefox/files/patch-bug1527804)
@@ -0,0 +1,218 @@
+commit 1579a88e491f
+Author: sotaro <sotaro.ikeda.g@gmail.com>
+Date:   Mon Feb 25 12:15:50 2019 +0000
+
+    Bug 1527804 - Trigger composite from frame_callback_handler() r=stransky
+    
+    Bug 1514156 expects that nsWindow::OnExposeEvent() is called after frame_callback_handler() called. But it did not happen during opening add-ons(gecko profiler). Then we need to trigger rendering directly from frame_callback_handler() call.
+    
+    Differential Revision: https://phabricator.services.mozilla.com/D20272
+    
+    --HG--
+    extra : moz-landing-system : lando
+---
+ widget/gtk/mozcontainer.cpp | 20 +++++++++----------
+ widget/gtk/mozcontainer.h   |  7 +++++--
+ widget/gtk/nsWindow.cpp     | 48 ++++++++++++++++++++++++++++++---------------
+ widget/gtk/nsWindow.h       |  4 +++-
+ 4 files changed, 50 insertions(+), 29 deletions(-)
+
+diff --git widget/gtk/mozcontainer.cpp widget/gtk/mozcontainer.cpp
+index 77ac02e2a049..efe5f7ba86e3 100644
+--- widget/gtk/mozcontainer.cpp
++++ widget/gtk/mozcontainer.cpp
+@@ -160,7 +160,7 @@ void moz_container_init(MozContainer *container) {
+   // We can draw to x11 window any time.
+   container->ready_to_draw = GDK_IS_X11_DISPLAY(gdk_display_get_default());
+   container->surface_needs_clear = true;
+-  container->egl_surface_needs_update = false;
++  container->inital_draw_cb = nullptr;
+ #endif
+ }
+ 
+@@ -178,12 +178,18 @@ static void frame_callback_handler(void *data, struct wl_callback *callback,
+                                    uint32_t time) {
+   MozContainer *container = MOZ_CONTAINER(data);
+   g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy);
+-  if (!container->ready_to_draw) {
+-    container->egl_surface_needs_update = true;
++  if (!container->ready_to_draw && container->inital_draw_cb) {
++    container->inital_draw_cb();
+   }
+   container->ready_to_draw = true;
+ }
+ 
++void moz_container_set_initial_draw_callback(
++    MozContainer *container,
++    std::function<void(void)> inital_draw_cb) {
++  container->inital_draw_cb = inital_draw_cb;
++}
++
+ static const struct wl_callback_listener frame_listener = {
+     frame_callback_handler};
+ 
+@@ -214,8 +220,8 @@ static void moz_container_unmap_wayland(MozContainer *container) {
+   g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy);
+ 
+   container->surface_needs_clear = true;
+-  container->egl_surface_needs_update = false;
+   container->ready_to_draw = false;
++  container->inital_draw_cb = nullptr;
+ }
+ 
+ static gint moz_container_get_scale(MozContainer *container) {
+@@ -560,12 +566,6 @@ gboolean moz_container_surface_needs_clear(MozContainer *container) {
+   container->surface_needs_clear = false;
+   return state;
+ }
+-
+-gboolean moz_container_egl_surface_needs_update(MozContainer *container){
+-  gboolean state = container->egl_surface_needs_update;
+-  container->egl_surface_needs_update = false;
+-  return state;
+-}
+ #endif
+ 
+ void moz_container_force_default_visual(MozContainer *container) {
+diff --git widget/gtk/mozcontainer.h widget/gtk/mozcontainer.h
+index ae6d656646c8..51be814ef975 100644
+--- widget/gtk/mozcontainer.h
++++ widget/gtk/mozcontainer.h
+@@ -9,6 +9,7 @@
+ #define __MOZ_CONTAINER_H__
+ 
+ #include <gtk/gtk.h>
++#include <functional>
+ 
+ /*
+  * MozContainer
+@@ -77,8 +78,8 @@ struct _MozContainer {
+   struct wl_egl_window *eglwindow;
+   struct wl_callback *frame_callback_handler;
+   gboolean surface_needs_clear;
+-  gboolean egl_surface_needs_update;
+   gboolean ready_to_draw;
++  std::function<void(void)> inital_draw_cb;
+ #endif
+   gboolean force_default_visual;
+ };
+@@ -97,7 +98,9 @@ struct wl_egl_window *moz_container_get_wl_egl_window(
+ 
+ gboolean moz_container_has_wl_egl_window(MozContainer *container);
+ gboolean moz_container_surface_needs_clear(MozContainer *container);
+-gboolean moz_container_egl_surface_needs_update(MozContainer *container);
++void moz_container_set_initial_draw_callback(
++    MozContainer *container,
++    std::function<void(void)> inital_draw_cb);
+ #endif
+ 
+ #endif /* __MOZ_CONTAINER_H__ */
+diff --git widget/gtk/nsWindow.cpp widget/gtk/nsWindow.cpp
+index acb957d3fb55..54b121ec5514 100644
+--- widget/gtk/nsWindow.cpp
++++ widget/gtk/nsWindow.cpp
+@@ -675,6 +675,12 @@ void nsWindow::Destroy() {
+     gFocusWindow = nullptr;
+   }
+ 
++#ifdef MOZ_WAYLAND
++  if (mContainer) {
++    moz_container_set_initial_draw_callback(mContainer, nullptr);
++  }
++#endif
++
+   GtkWidget *owningWidget = GetMozContainerWidget();
+   if (mShell) {
+     gtk_widget_destroy(mShell);
+@@ -1860,6 +1866,23 @@ static bool ExtractExposeRegion(LayoutDeviceIntRegion &aRegion, cairo_t *cr) {
+   return true;
+ }
+ 
++#ifdef MOZ_WAYLAND
++void nsWindow::WaylandEGLSurfaceForceRedraw() {
++  MOZ_RELEASE_ASSERT(NS_IsMainThread());
++
++  if (mIsDestroyed) {
++    return;
++  }
++
++  if (CompositorBridgeChild* remoteRenderer = GetRemoteRenderer()) {
++    if (mCompositorWidgetDelegate) {
++      mCompositorWidgetDelegate->RequestsUpdatingEGLSurface();
++    }
++    remoteRenderer->SendForcePresent();
++  }
++}
++#endif
++
+ gboolean nsWindow::OnExposeEvent(cairo_t *cr) {
+   // Send any pending resize events so that layout can update.
+   // May run event loop.
+@@ -1888,11 +1911,6 @@ gboolean nsWindow::OnExposeEvent(cairo_t *cr) {
+   region.ScaleRoundOut(scale, scale);
+ 
+   if (GetLayerManager()->AsKnowsCompositor() && mCompositorSession) {
+-#ifdef MOZ_WAYLAND
+-    if(mCompositorWidgetDelegate && WaylandRequestsUpdatingEGLSurface()) {
+-      mCompositorWidgetDelegate->RequestsUpdatingEGLSurface();
+-    }
+-#endif
+     // We need to paint to the screen even if nothing changed, since if we
+     // don't have a compositing window manager, our pixels could be stale.
+     GetLayerManager()->SetNeedsComposite(true);
+@@ -3454,6 +3472,15 @@ nsresult nsWindow::Create(nsIWidget *aParent, nsNativeWidget aNativeParent,
+       // Create a container to hold child windows and child GtkWidgets.
+       GtkWidget *container = moz_container_new();
+       mContainer = MOZ_CONTAINER(container);
++#ifdef MOZ_WAYLAND
++      if (!mIsX11Display && ComputeShouldAccelerate()) {
++        RefPtr<nsWindow> self(this);
++        moz_container_set_initial_draw_callback(mContainer,
++            [self]() -> void {
++              self->WaylandEGLSurfaceForceRedraw();
++            });
++      }
++#endif
+ 
+       // "csd" style is set when widget is realized so we need to call
+       // it explicitly now.
+@@ -6564,17 +6591,6 @@ bool nsWindow::WaylandSurfaceNeedsClear() {
+       "nsWindow::WaylandSurfaceNeedsClear(): We don't have any mContainer!");
+   return false;
+ }
+-
+-bool nsWindow::WaylandRequestsUpdatingEGLSurface() {
+-  if (mContainer) {
+-    return moz_container_egl_surface_needs_update(MOZ_CONTAINER(mContainer));
+-  }
+-
+-  NS_WARNING(
+-      "nsWindow::WaylandSurfaceNeedsClear(): We don't have any mContainer!");
+-  return false;
+-}
+-
+ #endif
+ 
+ #ifdef MOZ_X11
+diff --git widget/gtk/nsWindow.h widget/gtk/nsWindow.h
+index 5d119b4911e1..dbced693be1c 100644
+--- widget/gtk/nsWindow.h
++++ widget/gtk/nsWindow.h
+@@ -245,6 +245,9 @@ class nsWindow final : public nsBaseWidget {
+ 
+   void DispatchContextMenuEventFromMouseEvent(uint16_t domButton,
+                                               GdkEventButton* aEvent);
++#ifdef MOZ_WAYLAND
++  void WaylandEGLSurfaceForceRedraw();
++#endif
+ 
+  public:
+   void ThemeChanged(void);
+@@ -342,7 +345,6 @@ class nsWindow final : public nsBaseWidget {
+   wl_display* GetWaylandDisplay();
+   wl_surface* GetWaylandSurface();
+   bool WaylandSurfaceNeedsClear();
+-  bool WaylandRequestsUpdatingEGLSurface();
+ #endif
+   virtual void GetCompositorWidgetInitData(
+       mozilla::widget::CompositorWidgetInitData* aInitData) override;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902261706.x1QH65K8039558>