Changeset View
Changeset View
Standalone View
Standalone View
www/firefox/files/patch-bug1514156
Show All 36 Lines | |||||
+#endif | +#endif | ||||
protected: | protected: | ||||
friend class GLContextProviderEGL; | friend class GLContextProviderEGL; | ||||
friend class GLContextEGLFactory; | friend class GLContextEGLFactory; | ||||
diff --git gfx/gl/GLContextProviderEGL.cpp gfx/gl/GLContextProviderEGL.cpp | diff --git gfx/gl/GLContextProviderEGL.cpp gfx/gl/GLContextProviderEGL.cpp | ||||
index 774eb34a8e87..25aa779a7d64 100644 | index 774eb34a8e87..25aa779a7d64 100644 | ||||
--- gfx/gl/GLContextProviderEGL.cpp | --- gfx/gl/GLContextProviderEGL.cpp | ||||
+++ gfx/gl/GLContextProviderEGL.cpp | +++ gfx/gl/GLContextProviderEGL.cpp | ||||
@@ -295,6 +295,36 @@ already_AddRefed<GLContext> GLContextEGLFactory::Create( | @@ -296,6 +296,36 @@ already_AddRefed<GLContext> GLContextEGLFactory::Create( | ||||
return gl.forget(); | return gl.forget(); | ||||
} | } | ||||
+#if defined(MOZ_WAYLAND) | +#if defined(MOZ_WAYLAND) | ||||
+/* static */ EGLSurface GLContextEGL::CreateEGLSurfaceForCompositorWidget( | +/* static */ EGLSurface GLContextEGL::CreateEGLSurfaceForCompositorWidget( | ||||
+ widget::CompositorWidget* aCompositorWidget, bool aForceAccelerated) { | + widget::CompositorWidget* aCompositorWidget, bool aForceAccelerated) { | ||||
+ nsCString discardFailureId; | + nsCString discardFailureId; | ||||
+ if (!GLLibraryEGL::EnsureInitialized(false, &discardFailureId)) { | + if (!GLLibraryEGL::EnsureInitialized(false, &discardFailureId)) { | ||||
Show All 25 Lines | |||||
GLContextEGL::GLContextEGL(CreateContextFlags flags, const SurfaceCaps& caps, | GLContextEGL::GLContextEGL(CreateContextFlags flags, const SurfaceCaps& caps, | ||||
bool isOffscreen, EGLConfig config, | bool isOffscreen, EGLConfig config, | ||||
EGLSurface surface, EGLContext context) | EGLSurface surface, EGLContext context) | ||||
diff --git gfx/webrender_bindings/RenderCompositor.cpp gfx/webrender_bindings/RenderCompositor.cpp | diff --git gfx/webrender_bindings/RenderCompositor.cpp gfx/webrender_bindings/RenderCompositor.cpp | ||||
index 051482fbabbf..a58268096a89 100644 | index 051482fbabbf..a58268096a89 100644 | ||||
--- gfx/webrender_bindings/RenderCompositor.cpp | --- gfx/webrender_bindings/RenderCompositor.cpp | ||||
+++ gfx/webrender_bindings/RenderCompositor.cpp | +++ gfx/webrender_bindings/RenderCompositor.cpp | ||||
@@ -16,6 +16,10 @@ | @@ -16,6 +16,10 @@ | ||||
#include "mozilla/webrender/RenderCompositorANGLE.h" | # include "mozilla/webrender/RenderCompositorANGLE.h" | ||||
#endif | #endif | ||||
+#ifdef MOZ_WAYLAND | +#ifdef MOZ_WAYLAND | ||||
+#include "mozilla/webrender/RenderCompositorEGL.h" | +#include "mozilla/webrender/RenderCompositorEGL.h" | ||||
+#endif | +#endif | ||||
+ | + | ||||
namespace mozilla { | namespace mozilla { | ||||
namespace wr { | namespace wr { | ||||
▲ Show 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | |||||
+} // namespace wr | +} // namespace wr | ||||
+} // namespace mozilla | +} // namespace mozilla | ||||
+ | + | ||||
+#endif // MOZILLA_GFX_RENDERCOMPOSITOR_EGL_H | +#endif // MOZILLA_GFX_RENDERCOMPOSITOR_EGL_H | ||||
diff --git gfx/webrender_bindings/moz.build gfx/webrender_bindings/moz.build | diff --git gfx/webrender_bindings/moz.build gfx/webrender_bindings/moz.build | ||||
index 4acdfbb817d3..f632bc5d24d9 100644 | index 4acdfbb817d3..f632bc5d24d9 100644 | ||||
--- gfx/webrender_bindings/moz.build | --- gfx/webrender_bindings/moz.build | ||||
+++ gfx/webrender_bindings/moz.build | +++ gfx/webrender_bindings/moz.build | ||||
@@ -67,6 +67,14 @@ if CONFIG['MOZ_ENABLE_D3D10_LAYER']: | @@ -66,6 +66,14 @@ if CONFIG['MOZ_ENABLE_D3D10_LAYER']: | ||||
'RenderCompositorANGLE.cpp', | 'RenderCompositorANGLE.cpp', | ||||
] | ] | ||||
+if CONFIG['MOZ_WAYLAND']: | +if CONFIG['MOZ_WAYLAND']: | ||||
+ EXPORTS.mozilla.webrender += [ | + EXPORTS.mozilla.webrender += [ | ||||
+ 'RenderCompositorEGL.h', | + 'RenderCompositorEGL.h', | ||||
+ ] | + ] | ||||
+ SOURCES += [ | + SOURCES += [ | ||||
+ 'RenderCompositorEGL.cpp', | + 'RenderCompositorEGL.cpp', | ||||
+ ] | + ] | ||||
+ | + | ||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk3'): | if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk3'): | ||||
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] | CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] | ||||
CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] | CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] | ||||
@@ -75,5 +83,7 @@ include('/ipc/chromium/chromium-config.mozbuild') | @@ -92,5 +100,7 @@ include('/ipc/chromium/chromium-config.mozbuild') | ||||
FINAL_LIBRARY = 'xul' | FINAL_LIBRARY = 'xul' | ||||
+CXXFLAGS += CONFIG['TK_CFLAGS'] | +CXXFLAGS += CONFIG['TK_CFLAGS'] | ||||
+ | + | ||||
if CONFIG['CC_TYPE'] == 'clang-cl': | if CONFIG['CC_TYPE'] == 'clang-cl': | ||||
AllowCompilerWarnings() # workaround for bug 1090497 | AllowCompilerWarnings() # workaround for bug 1090497 | ||||
diff --git widget/gtk/CompositorWidgetChild.cpp widget/gtk/CompositorWidgetChild.cpp | diff --git widget/gtk/CompositorWidgetChild.cpp widget/gtk/CompositorWidgetChild.cpp | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | |||||
+ async RequestsUpdatingEGLSurface(); | + async RequestsUpdatingEGLSurface(); | ||||
child: | child: | ||||
diff --git widget/gtk/mozcontainer.cpp widget/gtk/mozcontainer.cpp | diff --git widget/gtk/mozcontainer.cpp widget/gtk/mozcontainer.cpp | ||||
index 8be1f133d39f..8461e7b9d470 100644 | index 8be1f133d39f..8461e7b9d470 100644 | ||||
--- widget/gtk/mozcontainer.cpp | --- widget/gtk/mozcontainer.cpp | ||||
+++ widget/gtk/mozcontainer.cpp | +++ widget/gtk/mozcontainer.cpp | ||||
@@ -159,6 +159,7 @@ void moz_container_init(MozContainer *container) { | @@ -160,6 +160,7 @@ void moz_container_init(MozContainer *container) { | ||||
// We can draw to x11 window any time. | // We can draw to x11 window any time. | ||||
container->ready_to_draw = GDK_IS_X11_DISPLAY(gdk_display_get_default()); | container->ready_to_draw = GDK_IS_X11_DISPLAY(gdk_display_get_default()); | ||||
container->surface_needs_clear = true; | container->surface_needs_clear = true; | ||||
+ container->egl_surface_needs_update = false; | + container->egl_surface_needs_update = false; | ||||
#endif | #endif | ||||
} | } | ||||
@@ -176,6 +177,9 @@ static void frame_callback_handler(void *data, struct wl_callback *callback, | @@ -177,6 +178,9 @@ static void frame_callback_handler(void *data, struct wl_callback *callback, | ||||
uint32_t time) { | uint32_t time) { | ||||
MozContainer *container = MOZ_CONTAINER(data); | MozContainer *container = MOZ_CONTAINER(data); | ||||
g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy); | g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy); | ||||
+ if (!container->ready_to_draw) { | + if (!container->ready_to_draw) { | ||||
+ container->egl_surface_needs_update = true; | + container->egl_surface_needs_update = true; | ||||
+ } | + } | ||||
container->ready_to_draw = true; | container->ready_to_draw = true; | ||||
} | } | ||||
@@ -208,6 +212,7 @@ static void moz_container_unmap_wayland(MozContainer *container) { | @@ -210,6 +214,7 @@ static void moz_container_unmap_wayland(MozContainer *container) { | ||||
g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy); | g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy); | ||||
container->surface_needs_clear = true; | container->surface_needs_clear = true; | ||||
+ container->egl_surface_needs_update = false; | + container->egl_surface_needs_update = false; | ||||
container->ready_to_draw = false; | container->ready_to_draw = false; | ||||
} | } | ||||
@@ -523,4 +528,10 @@ gboolean moz_container_surface_needs_clear(MozContainer *container) { | @@ -555,6 +560,12 @@ gboolean moz_container_surface_needs_clear(MozContainer *container) { | ||||
container->surface_needs_clear = false; | container->surface_needs_clear = false; | ||||
return state; | return state; | ||||
} | } | ||||
+ | + | ||||
+gboolean moz_container_egl_surface_needs_update(MozContainer *container){ | +gboolean moz_container_egl_surface_needs_update(MozContainer *container){ | ||||
+ gboolean state = container->egl_surface_needs_update; | + gboolean state = container->egl_surface_needs_update; | ||||
+ container->egl_surface_needs_update = false; | + container->egl_surface_needs_update = false; | ||||
+ return state; | + return state; | ||||
+} | +} | ||||
#endif | #endif | ||||
void moz_container_force_default_visual(MozContainer *container) { | |||||
diff --git widget/gtk/mozcontainer.h widget/gtk/mozcontainer.h | diff --git widget/gtk/mozcontainer.h widget/gtk/mozcontainer.h | ||||
index e9c218c1bc3e..1ed6f439805d 100644 | index e9c218c1bc3e..1ed6f439805d 100644 | ||||
--- widget/gtk/mozcontainer.h | --- widget/gtk/mozcontainer.h | ||||
+++ widget/gtk/mozcontainer.h | +++ widget/gtk/mozcontainer.h | ||||
@@ -77,6 +77,7 @@ struct _MozContainer { | @@ -77,6 +77,7 @@ struct _MozContainer { | ||||
struct wl_egl_window *eglwindow; | struct wl_egl_window *eglwindow; | ||||
struct wl_callback *frame_callback_handler; | struct wl_callback *frame_callback_handler; | ||||
gboolean surface_needs_clear; | gboolean surface_needs_clear; | ||||
+ gboolean egl_surface_needs_update; | + gboolean egl_surface_needs_update; | ||||
gboolean ready_to_draw; | gboolean ready_to_draw; | ||||
#endif | #endif | ||||
}; | gboolean force_default_visual; | ||||
@@ -96,6 +97,7 @@ struct wl_egl_window *moz_container_get_wl_egl_window(MozContainer *container); | @@ -100,6 +101,7 @@ gboolean moz_container_has_wl_egl_window(MozContainer *container); | ||||
gboolean moz_container_has_wl_egl_window(MozContainer *container); | |||||
gboolean moz_container_surface_needs_clear(MozContainer *container); | gboolean moz_container_surface_needs_clear(MozContainer *container); | ||||
void moz_container_scale_changed(MozContainer *container, | |||||
GtkAllocation *aAllocation); | |||||
+gboolean moz_container_egl_surface_needs_update(MozContainer *container); | +gboolean moz_container_egl_surface_needs_update(MozContainer *container); | ||||
#endif | #endif | ||||
#endif /* __MOZ_CONTAINER_H__ */ | #endif /* __MOZ_CONTAINER_H__ */ | ||||
diff --git widget/gtk/nsWindow.cpp widget/gtk/nsWindow.cpp | diff --git widget/gtk/nsWindow.cpp widget/gtk/nsWindow.cpp | ||||
index 50e6354ea374..ceabbf583a42 100644 | index 50e6354ea374..ceabbf583a42 100644 | ||||
--- widget/gtk/nsWindow.cpp | --- widget/gtk/nsWindow.cpp | ||||
+++ widget/gtk/nsWindow.cpp | +++ widget/gtk/nsWindow.cpp | ||||
@@ -1886,6 +1886,11 @@ gboolean nsWindow::OnExposeEvent(cairo_t *cr) { | @@ -1888,6 +1888,11 @@ gboolean nsWindow::OnExposeEvent(cairo_t *cr) { | ||||
region.ScaleRoundOut(scale, scale); | region.ScaleRoundOut(scale, scale); | ||||
if (GetLayerManager()->AsKnowsCompositor() && mCompositorSession) { | if (GetLayerManager()->AsKnowsCompositor() && mCompositorSession) { | ||||
+#ifdef MOZ_WAYLAND | +#ifdef MOZ_WAYLAND | ||||
+ if(mCompositorWidgetDelegate && WaylandRequestsUpdatingEGLSurface()) { | + if(mCompositorWidgetDelegate && WaylandRequestsUpdatingEGLSurface()) { | ||||
+ mCompositorWidgetDelegate->RequestsUpdatingEGLSurface(); | + mCompositorWidgetDelegate->RequestsUpdatingEGLSurface(); | ||||
+ } | + } | ||||
+#endif | +#endif | ||||
// We need to paint to the screen even if nothing changed, since if we | // 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. | // don't have a compositing window manager, our pixels could be stale. | ||||
GetLayerManager()->SetNeedsComposite(true); | GetLayerManager()->SetNeedsComposite(true); | ||||
@@ -6599,6 +6604,17 @@ bool nsWindow::WaylandSurfaceNeedsClear() { | @@ -6564,6 +6569,17 @@ bool nsWindow::WaylandSurfaceNeedsClear() { | ||||
"nsWindow::WaylandSurfaceNeedsClear(): We don't have any mContainer!"); | "nsWindow::WaylandSurfaceNeedsClear(): We don't have any mContainer!"); | ||||
return false; | return false; | ||||
} | } | ||||
+ | + | ||||
+bool nsWindow::WaylandRequestsUpdatingEGLSurface() { | +bool nsWindow::WaylandRequestsUpdatingEGLSurface() { | ||||
+ if (mContainer) { | + if (mContainer) { | ||||
+ return moz_container_egl_surface_needs_update(MOZ_CONTAINER(mContainer)); | + return moz_container_egl_surface_needs_update(MOZ_CONTAINER(mContainer)); | ||||
+ } | + } | ||||
+ | + | ||||
+ NS_WARNING( | + NS_WARNING( | ||||
+ "nsWindow::WaylandSurfaceNeedsClear(): We don't have any mContainer!"); | + "nsWindow::WaylandSurfaceNeedsClear(): We don't have any mContainer!"); | ||||
+ return false; | + return false; | ||||
+} | +} | ||||
+ | + | ||||
#endif | #endif | ||||
#ifdef MOZ_X11 | #ifdef MOZ_X11 | ||||
diff --git widget/gtk/nsWindow.h widget/gtk/nsWindow.h | diff --git widget/gtk/nsWindow.h widget/gtk/nsWindow.h | ||||
index b528ebfdeccb..ea0be70d7eb2 100644 | index b528ebfdeccb..ea0be70d7eb2 100644 | ||||
--- widget/gtk/nsWindow.h | --- widget/gtk/nsWindow.h | ||||
+++ widget/gtk/nsWindow.h | +++ widget/gtk/nsWindow.h | ||||
@@ -373,6 +373,7 @@ class nsWindow final : public nsBaseWidget { | @@ -342,6 +342,7 @@ class nsWindow final : public nsBaseWidget { | ||||
wl_display* GetWaylandDisplay(); | wl_display* GetWaylandDisplay(); | ||||
wl_surface* GetWaylandSurface(); | wl_surface* GetWaylandSurface(); | ||||
bool WaylandSurfaceNeedsClear(); | bool WaylandSurfaceNeedsClear(); | ||||
+ bool WaylandRequestsUpdatingEGLSurface(); | + bool WaylandRequestsUpdatingEGLSurface(); | ||||
#endif | #endif | ||||
virtual void GetCompositorWidgetInitData( | virtual void GetCompositorWidgetInitData( | ||||
mozilla::widget::CompositorWidgetInitData* aInitData) override; | mozilla::widget::CompositorWidgetInitData* aInitData) override; |