зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset f96f7b534cbd (bug 1619907) for causing build bustages CLOSED TREE
This commit is contained in:
Родитель
e0555318cb
Коммит
4a6e05a3d7
|
@ -44,7 +44,6 @@ LazyLogModule gWidgetFocusLog("WidgetFocus");
|
||||||
LazyLogModule gWidgetDragLog("WidgetDrag");
|
LazyLogModule gWidgetDragLog("WidgetDrag");
|
||||||
LazyLogModule gWidgetDrawLog("WidgetDraw");
|
LazyLogModule gWidgetDrawLog("WidgetDraw");
|
||||||
LazyLogModule gWidgetWaylandLog("WidgetWayland");
|
LazyLogModule gWidgetWaylandLog("WidgetWayland");
|
||||||
LazyLogModule gWaylandDmabufLog("WaylandDmabuf");
|
|
||||||
LazyLogModule gClipboardLog("WidgetClipboard");
|
LazyLogModule gClipboardLog("WidgetClipboard");
|
||||||
|
|
||||||
static GPollFunc sPollFunc;
|
static GPollFunc sPollFunc;
|
||||||
|
|
|
@ -12,17 +12,6 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifdef MOZ_LOGGING
|
|
||||||
# include "mozilla/Logging.h"
|
|
||||||
# include "nsTArray.h"
|
|
||||||
# include "Units.h"
|
|
||||||
extern mozilla::LazyLogModule gWaylandDmabufLog;
|
|
||||||
# define LOGDMABUF(args) \
|
|
||||||
MOZ_LOG(gWaylandDmabufLog, mozilla::LogLevel::Debug, args)
|
|
||||||
#else
|
|
||||||
# define LOGDMABUF(args)
|
|
||||||
#endif /* MOZ_LOGGING */
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace widget {
|
namespace widget {
|
||||||
|
|
||||||
|
@ -263,7 +252,6 @@ static void global_registry_handler(void* data, wl_registry* registry,
|
||||||
} else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0 && version > 2) {
|
} else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0 && version > 2) {
|
||||||
auto dmabuf = static_cast<zwp_linux_dmabuf_v1*>(
|
auto dmabuf = static_cast<zwp_linux_dmabuf_v1*>(
|
||||||
wl_registry_bind(registry, id, &zwp_linux_dmabuf_v1_interface, 3));
|
wl_registry_bind(registry, id, &zwp_linux_dmabuf_v1_interface, 3));
|
||||||
LOGDMABUF(("zwp_linux_dmabuf_v1 is available."));
|
|
||||||
display->SetDmabuf(dmabuf);
|
display->SetDmabuf(dmabuf);
|
||||||
zwp_linux_dmabuf_v1_add_listener(dmabuf, &dmabuf_listener, data);
|
zwp_linux_dmabuf_v1_add_listener(dmabuf, &dmabuf_listener, data);
|
||||||
}
|
}
|
||||||
|
@ -341,7 +329,6 @@ bool nsWaylandDisplay::Matches(wl_display* aDisplay) {
|
||||||
|
|
||||||
bool nsWaylandDisplay::ConfigureGbm() {
|
bool nsWaylandDisplay::ConfigureGbm() {
|
||||||
if (!nsGbmLib::IsAvailable()) {
|
if (!nsGbmLib::IsAvailable()) {
|
||||||
LOGDMABUF(("nsGbmLib is not available!"));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,23 +340,22 @@ bool nsWaylandDisplay::ConfigureGbm() {
|
||||||
|
|
||||||
mGbmFd = open(drm_render_node, O_RDWR);
|
mGbmFd = open(drm_render_node, O_RDWR);
|
||||||
if (mGbmFd < 0) {
|
if (mGbmFd < 0) {
|
||||||
LOGDMABUF(
|
NS_WARNING(
|
||||||
(nsPrintfCString("Failed to open drm render node %s\n", drm_render_node)
|
nsPrintfCString("Failed to open drm render node %s\n", drm_render_node)
|
||||||
.get()));
|
.get());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mGbmDevice = nsGbmLib::CreateDevice(mGbmFd);
|
mGbmDevice = nsGbmLib::CreateDevice(mGbmFd);
|
||||||
if (mGbmDevice == nullptr) {
|
if (mGbmDevice == nullptr) {
|
||||||
LOGDMABUF((nsPrintfCString("Failed to create drm render device %s\n",
|
NS_WARNING(nsPrintfCString("Failed to create drm render device %s\n",
|
||||||
drm_render_node)
|
drm_render_node)
|
||||||
.get()));
|
.get());
|
||||||
close(mGbmFd);
|
close(mGbmFd);
|
||||||
mGbmFd = -1;
|
mGbmFd = -1;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGDMABUF(("GBM device initialized"));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +455,6 @@ bool nsWaylandDisplay::IsDMABufEnabled() {
|
||||||
// WaylandDisplayGet() loads dmabuf config prefs
|
// WaylandDisplayGet() loads dmabuf config prefs
|
||||||
nsWaylandDisplay* display = WaylandDisplayGet();
|
nsWaylandDisplay* display = WaylandDisplayGet();
|
||||||
if (!display) {
|
if (!display) {
|
||||||
LOGDMABUF(("IsDMABufEnabled(): Failed to get Wayland display!"));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,20 +464,18 @@ bool nsWaylandDisplay::IsDMABufEnabled() {
|
||||||
!StaticPrefs::widget_wayland_dmabuf_webgl_enabled() &&
|
!StaticPrefs::widget_wayland_dmabuf_webgl_enabled() &&
|
||||||
!StaticPrefs::widget_wayland_dmabuf_vaapi_enabled()) {
|
!StaticPrefs::widget_wayland_dmabuf_vaapi_enabled()) {
|
||||||
// Disabled by user, just quit.
|
// Disabled by user, just quit.
|
||||||
LOGDMABUF(("IsDMABufEnabled(): Disabled by preferences."));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!display->ConfigureGbm()) {
|
if (!display->ConfigureGbm()) {
|
||||||
LOGDMABUF(("Failed to create GbmDevice, DMABUF/DRM won't be available!"));
|
NS_WARNING("Failed to create GbmDevice, DMABUF/DRM won't be available!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!display->GetGbmFormat(/* aHasAlpha */ false) ||
|
if (!display->GetGbmFormat(/* aHasAlpha */ false) ||
|
||||||
!display->GetGbmFormat(/* aHasAlpha */ true)) {
|
!display->GetGbmFormat(/* aHasAlpha */ true)) {
|
||||||
LOGDMABUF(
|
NS_WARNING(
|
||||||
("Failed to create obtain pixel format, DMABUF/DRM won't be "
|
"Failed to create obtain pixel format, DMABUF/DRM won't be available!");
|
||||||
"available!"));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,28 +523,25 @@ GetOffsetFunc nsGbmLib::sGetOffset;
|
||||||
DeviceIsFormatSupportedFunc nsGbmLib::sDeviceIsFormatSupported;
|
DeviceIsFormatSupportedFunc nsGbmLib::sDeviceIsFormatSupported;
|
||||||
DrmPrimeHandleToFDFunc nsGbmLib::sDrmPrimeHandleToFD;
|
DrmPrimeHandleToFDFunc nsGbmLib::sDrmPrimeHandleToFD;
|
||||||
|
|
||||||
bool nsGbmLib::IsLoaded() {
|
bool nsGbmLib::IsAvailable() {
|
||||||
|
if (!Load()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return sCreateDevice != nullptr && sCreate != nullptr &&
|
return sCreateDevice != nullptr && sCreate != nullptr &&
|
||||||
sCreateWithModifiers != nullptr && sImport != nullptr &&
|
sCreateWithModifiers != nullptr && sImport != nullptr &&
|
||||||
sGetModifier != nullptr && sGetStride != nullptr &&
|
sGetModifier != nullptr && sGetStride != nullptr &&
|
||||||
sGetFd != nullptr && sDestroy != nullptr && sMap != nullptr &&
|
sGetFd != nullptr && sDestroy != nullptr && sMap != nullptr &&
|
||||||
sUnmap != nullptr && sGetPlaneCount != nullptr &&
|
sUnmap != nullptr && sGetPlaneCount != nullptr &&
|
||||||
sGetHandleForPlane != nullptr && sGetStrideForPlane != nullptr &&
|
sGetHandleForPlane != nullptr && sGetStrideForPlane != nullptr &&
|
||||||
sGetOffset != nullptr && sDeviceIsFormatSupported != nullptr;
|
sGetOffset != nullptr && sDeviceIsFormatSupported != nullptr &&
|
||||||
}
|
sDrmPrimeHandleToFD != nullptr;
|
||||||
|
|
||||||
bool nsGbmLib::IsAvailable() {
|
|
||||||
if (!Load()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return IsLoaded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsGbmLib::IsModifierAvailable() {
|
bool nsGbmLib::IsModifierAvailable() {
|
||||||
if (!Load()) {
|
if (!Load()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return IsLoaded() && sDrmPrimeHandleToFD != nullptr;
|
return sDrmPrimeHandleToFD != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsGbmLib::Load() {
|
bool nsGbmLib::Load() {
|
||||||
|
@ -570,9 +550,9 @@ bool nsGbmLib::Load() {
|
||||||
|
|
||||||
sGbmLibHandle = dlopen(GBMLIB_NAME, RTLD_LAZY | RTLD_LOCAL);
|
sGbmLibHandle = dlopen(GBMLIB_NAME, RTLD_LAZY | RTLD_LOCAL);
|
||||||
if (!sGbmLibHandle) {
|
if (!sGbmLibHandle) {
|
||||||
LOGDMABUF((nsPrintfCString("Failed to load %s, dmabuf isn't available.\n",
|
NS_WARNING(nsPrintfCString("Failed to load %s, dmabuf isn't available.\n",
|
||||||
GBMLIB_NAME)
|
GBMLIB_NAME)
|
||||||
.get()));
|
.get());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,21 +577,15 @@ bool nsGbmLib::Load() {
|
||||||
sDeviceIsFormatSupported = (DeviceIsFormatSupportedFunc)dlsym(
|
sDeviceIsFormatSupported = (DeviceIsFormatSupportedFunc)dlsym(
|
||||||
sGbmLibHandle, "gbm_device_is_format_supported");
|
sGbmLibHandle, "gbm_device_is_format_supported");
|
||||||
|
|
||||||
if (!IsLoaded()) {
|
|
||||||
LOGDMABUF(
|
|
||||||
(nsPrintfCString("Failed to load all symbols from %s\n", GBMLIB_NAME)
|
|
||||||
.get()));
|
|
||||||
}
|
|
||||||
|
|
||||||
sXf86DrmLibHandle = dlopen(DRMLIB_NAME, RTLD_LAZY | RTLD_LOCAL);
|
sXf86DrmLibHandle = dlopen(DRMLIB_NAME, RTLD_LAZY | RTLD_LOCAL);
|
||||||
if (sXf86DrmLibHandle) {
|
if (sXf86DrmLibHandle) {
|
||||||
sDrmPrimeHandleToFD = (DrmPrimeHandleToFDFunc)dlsym(sXf86DrmLibHandle,
|
sDrmPrimeHandleToFD = (DrmPrimeHandleToFDFunc)dlsym(sXf86DrmLibHandle,
|
||||||
"drmPrimeHandleToFD");
|
"drmPrimeHandleToFD");
|
||||||
if (!sDrmPrimeHandleToFD) {
|
if (!sDrmPrimeHandleToFD) {
|
||||||
LOGDMABUF((nsPrintfCString(
|
NS_WARNING(nsPrintfCString(
|
||||||
"Failed to load %s, gbm modifiers are not available.\n",
|
"Failed to load %s, gbm modifiers are not available.\n",
|
||||||
DRMLIB_NAME)
|
DRMLIB_NAME)
|
||||||
.get()));
|
.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,6 @@ typedef int (*DrmPrimeHandleToFDFunc)(int, uint32_t, uint32_t, int*);
|
||||||
class nsGbmLib {
|
class nsGbmLib {
|
||||||
public:
|
public:
|
||||||
static bool Load();
|
static bool Load();
|
||||||
static bool IsLoaded();
|
|
||||||
static bool IsAvailable();
|
static bool IsAvailable();
|
||||||
static bool IsModifierAvailable();
|
static bool IsModifierAvailable();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче