Bug 1632059 [Wayland] Use wayland display directly for va-api, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D72122
This commit is contained in:
Martin Stransky 2020-04-23 16:06:54 +00:00
parent 3b6afcca6f
commit 59c99a1b8c
2 changed files with 10 additions and 3 deletions

View File

@ -178,7 +178,12 @@ bool FFmpegVideoDecoder<LIBAV_VER>::CreateVAAPIDeviceContext() {
AVHWDeviceContext* hwctx = (AVHWDeviceContext*)mVAAPIDeviceContext->data;
AVVAAPIDeviceContext* vactx = (AVVAAPIDeviceContext*)hwctx->hwctx;
mDisplay = mLib->vaGetDisplayWl(widget::WaylandDisplayGet()->GetDisplay());
wl_display* display = widget::WaylandDisplayGetWLDisplay();
if (!display) {
FFMPEG_LOG("Can't get default wayland display.");
return false;
}
mDisplay = mLib->vaGetDisplayWl(display);
hwctx->user_opaque = new VAAPIDisplayHolder(mLib, mDisplay);
hwctx->free = VAAPIDisplayReleaseCallback;

View File

@ -35,6 +35,9 @@ bool nsWaylandDisplay::sIsDMABufConfigured = false;
wl_display* WaylandDisplayGetWLDisplay(GdkDisplay* aGdkDisplay) {
if (!aGdkDisplay) {
aGdkDisplay = gdk_display_get_default();
if (!aGdkDisplay || GDK_IS_X11_DISPLAY(aGdkDisplay)) {
return nullptr;
}
}
// Available as of GTK 3.8+
@ -537,8 +540,7 @@ bool nsWaylandDisplay::IsDMABufWebGLEnabled() {
StaticPrefs::widget_wayland_dmabuf_webgl_enabled();
}
bool nsWaylandDisplay::IsDMABufVAAPIEnabled() {
return IsDMABufEnabled() &&
StaticPrefs::widget_wayland_dmabuf_vaapi_enabled();
return StaticPrefs::widget_wayland_dmabuf_vaapi_enabled();
}
void* nsGbmLib::sGbmLibHandle = nullptr;