Bug 1629788 [Wayland] Add widget.wayland-dmabuf-video-textures.enabled preference, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Sat, 13 Jun 2020 18:38:45 +0000
changeset 535608 b4fee14fe36ae084fb392de2a40bcbd9a226bec3
parent 535607 8a463700d1698fead0b1804d96fcd59309db6f6e
child 535609 4d39bd6871b85ab99737fb100f246a65ec7f610b
push id37504
push userrmaries@mozilla.com
push dateSun, 14 Jun 2020 09:24:22 +0000
treeherdermozilla-central@ede1c973aa85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1629788
milestone79.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1629788 [Wayland] Add widget.wayland-dmabuf-video-textures.enabled preference, r=jhorak - widget.wayland-dmabuf-video-textures.enabled controls dmabuf texture backend for decoded video frames. Differential Revision: https://phabricator.services.mozilla.com/D78293
gfx/thebes/gfxPlatformGtk.cpp
gfx/thebes/gfxPlatformGtk.h
modules/libpref/init/StaticPrefList.yaml
widget/gtk/nsWaylandDisplay.cpp
widget/gtk/nsWaylandDisplay.h
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -720,16 +720,19 @@ already_AddRefed<gfx::VsyncSource> gfxPl
 }
 
 #endif
 
 #ifdef MOZ_WAYLAND
 bool gfxPlatformGtk::UseWaylandDMABufTextures() {
   return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufTexturesEnabled();
 }
+bool gfxPlatformGtk::UseWaylandDMABufVideoTextures() {
+  return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufVideoTexturesEnabled();
+}
 bool gfxPlatformGtk::UseWaylandDMABufWebGL() {
   return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufWebGLEnabled();
 }
 bool gfxPlatformGtk::UseWaylandHardwareVideoDecoding() {
   return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufVAAPIEnabled() &&
          gfxPlatform::CanUseHardwareVideoDecoding();
 }
 #endif
--- a/gfx/thebes/gfxPlatformGtk.h
+++ b/gfx/thebes/gfxPlatformGtk.h
@@ -83,16 +83,17 @@ class gfxPlatformGtk final : public gfxP
 #endif
 
 #ifdef MOZ_X11
   Display* GetCompositorDisplay() { return mCompositorDisplay; }
 #endif  // MOZ_X11
 
 #ifdef MOZ_WAYLAND
   bool UseWaylandDMABufTextures();
+  bool UseWaylandDMABufVideoTextures();
   bool UseWaylandDMABufWebGL();
   bool UseWaylandHardwareVideoDecoding();
 #endif
 
   bool IsX11Display() { return mIsX11Display; }
   bool IsWaylandDisplay() {
     return !mIsX11Display && !gfxPlatform::IsHeadless();
   }
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -9469,16 +9469,22 @@
   mirror: always
 
 # Use VA-API for video playback on Wayland.
 - name: widget.wayland-dmabuf-vaapi.enabled
   type: RelaxedAtomicBool
   value: false
   mirror: always
 
+# Use DMABuf for video textures.
+- name: widget.wayland-dmabuf-video-textures.enabled
+  type: RelaxedAtomicBool
+  value: true
+  mirror: always
+
 # Use smooth rendering for basic compositor.
 - name: widget.wayland-smooth-rendering
   type: RelaxedAtomicBool
   value: false
   mirror: always
 #endif
 
 #---------------------------------------------------------------------------
--- a/widget/gtk/nsWaylandDisplay.cpp
+++ b/widget/gtk/nsWaylandDisplay.cpp
@@ -493,16 +493,17 @@ bool nsWaylandDisplay::IsDMABufEnabled()
   }
 
   sIsDMABufConfigured = true;
   if (
 #ifdef NIGHTLY_BUILD
       !StaticPrefs::widget_wayland_dmabuf_basic_compositor_enabled() &&
       !StaticPrefs::widget_wayland_dmabuf_textures_enabled() &&
 #endif
+      !StaticPrefs::widget_wayland_dmabuf_video_textures_enabled() &&
       !StaticPrefs::widget_wayland_dmabuf_webgl_enabled() &&
       !StaticPrefs::widget_wayland_dmabuf_vaapi_enabled()) {
     // Disabled by user, just quit.
     LOGDMABUF(("IsDMABufEnabled(): Disabled by preferences."));
     return false;
   }
 
   if (!display->ConfigureGbm()) {
@@ -530,16 +531,20 @@ bool nsWaylandDisplay::IsDMABufBasicEnab
 bool nsWaylandDisplay::IsDMABufTexturesEnabled() {
   return IsDMABufEnabled() &&
          StaticPrefs::widget_wayland_dmabuf_textures_enabled();
 }
 #else
 bool nsWaylandDisplay::IsDMABufBasicEnabled() { return false; }
 bool nsWaylandDisplay::IsDMABufTexturesEnabled() { return false; }
 #endif
+bool nsWaylandDisplay::IsDMABufVideoTexturesEnabled() {
+  return IsDMABufEnabled() &&
+         StaticPrefs::widget_wayland_dmabuf_video_textures_enabled();
+}
 bool nsWaylandDisplay::IsDMABufWebGLEnabled() {
   return IsDMABufEnabled() &&
          StaticPrefs::widget_wayland_dmabuf_webgl_enabled();
 }
 bool nsWaylandDisplay::IsDMABufVAAPIEnabled() {
   return StaticPrefs::widget_wayland_dmabuf_vaapi_enabled();
 }
 
--- a/widget/gtk/nsWaylandDisplay.h
+++ b/widget/gtk/nsWaylandDisplay.h
@@ -86,16 +86,17 @@ class nsWaylandDisplay {
 
   void AddFormat(bool aHasAlpha, int aFormat);
   void AddFormatModifier(bool aHasAlpha, int aFormat, uint32_t mModifierHi,
                          uint32_t mModifierLo);
 
   static bool IsDMABufEnabled();
   static bool IsDMABufBasicEnabled();
   static bool IsDMABufTexturesEnabled();
+  static bool IsDMABufVideoTexturesEnabled();
   static bool IsDMABufWebGLEnabled();
   static bool IsDMABufVAAPIEnabled();
 
  private:
   bool ConfigureGbm();
 
   MessageLoop* mThreadLoop;
   PRThread* mThreadId;