Bug 1616680 [Wayland] Use widget.wayland_dmabuf_vaapi.enabled to enable VAAPI / dmabuf video playback, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D63381

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2020-02-24 09:50:23 +00:00
Родитель b5b6473a6d
Коммит b929ff1886
4 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -733,4 +733,8 @@ bool gfxPlatformGtk::UseWaylandDMABufTextures() {
bool gfxPlatformGtk::UseWaylandDMABufWebGL() {
return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufWebGLEnabled();
}
bool gfxPlatformGtk::UseWaylandHardwareVideoDecoding() {
return IsWaylandDisplay() && nsWaylandDisplay::IsDMABufVAAPIEnabled() &&
gfxPlatform::CanUseHardwareVideoDecoding();
}
#endif

Просмотреть файл

@ -95,6 +95,7 @@ class gfxPlatformGtk : public gfxPlatform {
#ifdef MOZ_WAYLAND
bool UseWaylandDMABufTextures();
bool UseWaylandDMABufWebGL();
bool UseWaylandHardwareVideoDecoding();
#endif
bool IsX11Display() { return mIsX11Display; }

Просмотреть файл

@ -26,6 +26,8 @@ namespace widget {
#define DMABUF_BASIC_PREF "widget.wayland_dmabuf_basic_compositor.enabled"
// Enable dmabuf for WebGL backend
#define DMABUF_WEBGL_PREF "widget.wayland_dmabuf_webgl.enabled"
// Enable dmabuf for VA-API backend
#define DMABUF_VAAPI_PREF "widget.wayland_dmabuf_vaapi.enabled"
// See WindowSurfaceWayland::RenderingCacheMode for details.
#define CACHE_MODE_PREF "widget.wayland_cache_mode"
@ -33,6 +35,7 @@ bool nsWaylandDisplay::sIsDMABufEnabled = false;
int nsWaylandDisplay::sIsDMABufPrefTextState = false;
int nsWaylandDisplay::sIsDMABufPrefBasicCompositorState = false;
int nsWaylandDisplay::sIsDMABufPrefWebGLState = false;
int nsWaylandDisplay::sIsDMABufPrefVAAPIState = false;
bool nsWaylandDisplay::sIsDMABufConfigured = false;
int nsWaylandDisplay::sRenderingCacheModePref = -1;
bool nsWaylandDisplay::sIsPrefLoaded = false;
@ -423,6 +426,7 @@ nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay)
sIsDMABufPrefBasicCompositorState =
Preferences::GetBool(DMABUF_BASIC_PREF, false);
sIsDMABufPrefWebGLState = Preferences::GetBool(DMABUF_WEBGL_PREF, false);
sIsDMABufPrefVAAPIState = Preferences::GetBool(DMABUF_VAAPI_PREF, false);
sRenderingCacheModePref = Preferences::GetInt(CACHE_MODE_PREF, 0);
sIsPrefLoaded = true;
}
@ -505,6 +509,9 @@ bool nsWaylandDisplay::IsDMABufTexturesEnabled() {
bool nsWaylandDisplay::IsDMABufWebGLEnabled() {
return IsDMABufEnabled() && sIsDMABufPrefWebGLState;
}
bool nsWaylandDisplay::IsDMABufVAAPIEnabled() {
return IsDMABufEnabled() && sIsDMABufPrefVAAPIState;
}
void* nsGbmLib::sGbmLibHandle = nullptr;
void* nsGbmLib::sXf86DrmLibHandle = nullptr;

Просмотреть файл

@ -90,6 +90,7 @@ class nsWaylandDisplay {
static bool IsDMABufBasicEnabled();
static bool IsDMABufTexturesEnabled();
static bool IsDMABufWebGLEnabled();
static bool IsDMABufVAAPIEnabled();
// See WindowSurfaceWayland::CacheMode for details.
int GetRenderingCacheModePref() { return sRenderingCacheModePref; };
@ -121,6 +122,7 @@ class nsWaylandDisplay {
static int sIsDMABufPrefTextState;
static int sIsDMABufPrefBasicCompositorState;
static int sIsDMABufPrefWebGLState;
static int sIsDMABufPrefVAAPIState;
static bool sIsDMABufConfigured;
static int sRenderingCacheModePref;
static bool sIsPrefLoaded;