Bug 1809162 [Linux] Implement GetAndConfigureDMABufDevice() to configure dmabuf backend without gfxPlatform on RDD process r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D166328
This commit is contained in:
stransky 2023-01-19 10:44:43 +00:00
Родитель 06853768b6
Коммит 0cfbaddb9d
2 изменённых файлов: 19 добавлений и 16 удалений

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

@ -12,12 +12,17 @@
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/gfx/gfxVars.h"
#include "WidgetUtilsGtk.h"
#include "gfxConfig.h"
#include "nsIGfxInfo.h"
#include "mozilla/Components.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dlfcn.h>
using namespace mozilla::gfx;
namespace mozilla {
namespace widget {
@ -224,24 +229,13 @@ nsDMABufDevice::~nsDMABufDevice() {
int nsDMABufDevice::GetDRMFd() { return mDRMFd; }
bool nsDMABufDevice::Configure(nsACString& aFailureId) {
LOGDMABUF(("nsDMABufDevice::Configure()"));
MOZ_ASSERT(!mInitialized);
mInitialized = true;
bool isDMABufUsed = (
#ifdef NIGHTLY_BUILD
StaticPrefs::widget_dmabuf_textures_enabled() ||
#endif
StaticPrefs::widget_dmabuf_webgl_enabled());
if (!isDMABufUsed) {
// Disabled by user, just quit.
LOGDMABUF(("IsDMABufEnabled(): Disabled by preferences."));
aFailureId = "FEATURE_FAILURE_NO_PREFS_ENABLED";
return false;
if (mInitialized) {
return true;
}
LOGDMABUF(("nsDMABufDevice::Configure()"));
mInitialized = true;
if (!nsGbmLib::IsAvailable()) {
LOGDMABUF(("nsGbmLib is not available!"));
aFailureId = "FEATURE_FAILURE_NO_LIBGBM";
@ -327,5 +321,13 @@ nsDMABufDevice* GetDMABufDevice() {
return &dmaBufDevice;
}
nsDMABufDevice* GetAndConfigureDMABufDevice() {
nsCString failureId;
if (GetDMABufDevice()->Configure(failureId)) {
return GetDMABufDevice();
}
return nullptr;
}
} // namespace widget
} // namespace mozilla

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

@ -215,6 +215,7 @@ class nsDMABufDevice {
};
nsDMABufDevice* GetDMABufDevice();
nsDMABufDevice* GetAndConfigureDMABufDevice();
} // namespace widget
} // namespace mozilla