Bug 1557265 - Remove HAVE_LIBDRM defines as libdrm is mandatory now, r=glandium

Depends on D33918

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2019-06-19 21:55:35 +00:00
Родитель fd9e6a9a28
Коммит 6d7a459e88
5 изменённых файлов: 9 добавлений и 52 удалений

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

@ -415,7 +415,6 @@ already_AddRefed<gfx::DrawTarget> WindowBackBufferShm::Lock() {
BUFFER_BPP * mWidth, GetSurfaceFormat());
}
#ifdef HAVE_LIBDRM
WindowBackBufferDMABuf::WindowBackBufferDMABuf(
nsWaylandDisplay* aWaylandDisplay, int aWidth, int aHeight)
: WindowBackBuffer(aWaylandDisplay) {
@ -478,7 +477,6 @@ void WindowBackBufferDMABuf::Detach(wl_buffer* aBuffer) {
}
void WindowBackBufferDMABuf::Clear() { mDMAbufSurface.Clear(); }
#endif
static void frame_callback_handler(void* data, struct wl_callback* callback,
uint32_t time) {
@ -534,12 +532,10 @@ WindowSurfaceWayland::~WindowSurfaceWayland() {
bool WindowSurfaceWayland::UseDMABufBackend() {
if (!mUseDMABufInitialized) {
#ifdef HAVE_LIBDRM
if (WaylandDMABufSurface::IsAvailable()) {
mUseDMABuf = nsWaylandDisplay::IsDMABufEnabled();
LOGWAYLAND(("%s DMABuf state %d\n", __PRETTY_FUNCTION__, mUseDMABuf));
}
#endif
mUseDMABufInitialized = true;
}
return mUseDMABuf;
@ -547,7 +543,6 @@ bool WindowSurfaceWayland::UseDMABufBackend() {
WindowBackBuffer* WindowSurfaceWayland::CreateWaylandBuffer(int aWidth,
int aHeight) {
#ifdef HAVE_LIBDRM
if (UseDMABufBackend()) {
static bool sDMABufBufferCreated = false;
WindowBackBuffer* buffer =
@ -567,7 +562,6 @@ WindowBackBuffer* WindowSurfaceWayland::CreateWaylandBuffer(int aWidth,
mUseDMABuf = false;
}
}
#endif
return new WindowBackBufferShm(mWaylandDisplay, aWidth, aHeight);
}

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

@ -10,9 +10,7 @@
#include <prthread.h>
#include "mozilla/gfx/Types.h"
#include "nsWaylandDisplay.h"
#ifdef HAVE_LIBDRM
#include "WaylandDMABufSurface.h"
#endif
#define BACK_BUFFER_NUM 2
@ -121,7 +119,6 @@ class WindowBackBufferShm : public WindowBackBuffer {
bool mIsLocked;
};
#ifdef HAVE_LIBDRM
class WindowBackBufferDMABuf : public WindowBackBuffer {
public:
WindowBackBufferDMABuf(nsWaylandDisplay* aWaylandDisplay, int aWidth,
@ -148,7 +145,6 @@ class WindowBackBufferDMABuf : public WindowBackBuffer {
private:
WaylandDMABufSurface mDMAbufSurface;
};
#endif
class WindowImageSurface {
public:

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

@ -99,17 +99,11 @@ if CONFIG['MOZ_WAYLAND']:
UNIFIED_SOURCES += [
'nsClipboardWayland.cpp',
'nsWaylandDisplay.cpp',
'WaylandDMABufSurface.cpp',
'WindowSurfaceWayland.cpp',
]
EXPORTS.mozilla.widget += [
'nsWaylandDisplay.h',
]
if CONFIG['MOZ_WAYLAND'] and CONFIG['HAVE_LIBDRM']:
SOURCES += [
'WaylandDMABufSurface.cpp',
]
EXPORTS.mozilla.widget += [
'WaylandDMABufSurface.h',
]

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

@ -13,10 +13,8 @@ namespace widget {
#define GBMLIB_NAME "libgbm.so.1"
#define DRMLIB_NAME "libdrm.so.2"
#ifdef HAVE_LIBDRM
bool nsWaylandDisplay::mIsDMABufEnabled;
bool nsWaylandDisplay::mIsDMABufPrefLoaded;
#endif
// nsWaylandDisplay needs to be created for each calling thread(main thread,
// compositor thread and render thread)
@ -116,7 +114,6 @@ void nsWaylandDisplay::SetPrimarySelectionDeviceManager(
mPrimarySelectionDeviceManager = aPrimarySelectionDeviceManager;
}
#ifdef HAVE_LIBDRM
void nsWaylandDisplay::SetDmabuf(zwp_linux_dmabuf_v1* aDmabuf) {
mDmabuf = aDmabuf;
}
@ -166,7 +163,6 @@ static void dmabuf_format(void* data,
static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
dmabuf_format, dmabuf_modifiers};
#endif
static void global_registry_handler(void* data, wl_registry* registry,
uint32_t id, const char* interface,
@ -205,15 +201,12 @@ static void global_registry_handler(void* data, wl_registry* registry,
wl_proxy_set_queue((struct wl_proxy*)subcompositor,
display->GetEventQueue());
display->SetSubcompositor(subcompositor);
}
#ifdef HAVE_LIBDRM
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*>(
wl_registry_bind(registry, id, &zwp_linux_dmabuf_v1_interface, 3));
display->SetDmabuf(dmabuf);
zwp_linux_dmabuf_v1_add_listener(dmabuf, &dmabuf_listener, data);
}
#endif
}
static void global_registry_remover(void* data, wl_registry* registry,
@ -231,7 +224,6 @@ bool nsWaylandDisplay::Matches(wl_display* aDisplay) {
return mThreadId == PR_GetCurrentThread() && aDisplay == mDisplay;
}
#ifdef HAVE_LIBDRM
bool nsWaylandDisplay::ConfigureGbm() {
if (!nsGbmLib::IsAvailable()) {
return false;
@ -279,7 +271,6 @@ int nsWaylandDisplay::GetGbmDeviceFd() {
}
return mGbmFd;
}
#endif
nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay)
: mDispatcherThreadLoop(nullptr),
@ -291,28 +282,22 @@ nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay)
mSeat(nullptr),
mShm(nullptr),
mPrimarySelectionDeviceManager(nullptr),
mRegistry(nullptr)
#ifdef HAVE_LIBDRM
,
mRegistry(nullptr),
mGbmDevice(nullptr),
mGbmFd(-1),
mXRGBFormat({false, false, -1, nullptr, 0}),
mARGBFormat({false, false, -1, nullptr, 0}),
mGdmConfigured(false),
mExplicitSync(false)
#endif
{
mExplicitSync(false) {
mRegistry = wl_display_get_registry(mDisplay);
wl_registry_add_listener(mRegistry, &registry_listener, this);
if (NS_IsMainThread()) {
#ifdef HAVE_LIBDRM
if (!mIsDMABufPrefLoaded) {
mIsDMABufPrefLoaded = true;
mIsDMABufEnabled =
Preferences::GetBool("widget.wayland_dmabuf_backend.enabled", false);
}
#endif
// Use default event queue in main thread operated by Gtk+.
mEventQueue = nullptr;
wl_display_roundtrip(mDisplay);
@ -341,7 +326,6 @@ nsWaylandDisplay::~nsWaylandDisplay() {
}
}
#ifdef HAVE_LIBDRM
void* nsGbmLib::sGbmLibHandle = nullptr;
void* nsGbmLib::sXf86DrmLibHandle = nullptr;
bool nsGbmLib::sLibLoaded = false;
@ -422,7 +406,6 @@ bool nsGbmLib::Load() {
return sGbmLibHandle;
}
#endif
} // namespace widget
} // namespace mozilla

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

@ -15,12 +15,10 @@
#include "base/task.h" // for NewRunnableMethod, etc
#include "mozilla/StaticMutex.h"
#ifdef HAVE_LIBDRM
#include <drm/drm_fourcc.h>
#include <xf86drm.h>
#include <gbm.h>
#include "mozilla/widget/linux-dmabuf-unstable-v1-client-protocol.h"
#endif
namespace mozilla {
namespace widget {
@ -65,7 +63,6 @@ class nsWaylandDisplay {
void Shutdown();
#ifdef HAVE_LIBDRM
void SetDmabuf(zwp_linux_dmabuf_v1* aDmabuf);
zwp_linux_dmabuf_v1* GetDmabuf() { return mDmabuf; };
gbm_device* GetGbmDevice();
@ -76,12 +73,9 @@ class nsWaylandDisplay {
void AddFormatModifier(bool aHasAlpha, int aFormat, uint32_t mModifierHi,
uint32_t mModifierLo);
static bool IsDMABufEnabled() { return mIsDMABufEnabled; };
#endif
private:
#ifdef HAVE_LIBDRM
bool ConfigureGbm();
#endif
MessageLoop* mDispatcherThreadLoop;
PRThread* mThreadId;
@ -93,7 +87,6 @@ class nsWaylandDisplay {
wl_shm* mShm;
gtk_primary_selection_device_manager* mPrimarySelectionDeviceManager;
wl_registry* mRegistry;
#ifdef HAVE_LIBDRM
zwp_linux_dmabuf_v1* mDmabuf;
gbm_device* mGbmDevice;
int mGbmFd;
@ -103,14 +96,12 @@ class nsWaylandDisplay {
bool mExplicitSync;
static bool mIsDMABufEnabled;
static bool mIsDMABufPrefLoaded;
#endif
};
void WaylandDispatchDisplays();
void WaylandDisplayShutdown();
nsWaylandDisplay* WaylandDisplayGet(GdkDisplay* aGdkDisplay = nullptr);
#ifdef HAVE_LIBDRM
typedef struct gbm_device* (*CreateDeviceFunc)(int);
typedef struct gbm_bo* (*CreateFunc)(struct gbm_device*, uint32_t, uint32_t,
uint32_t, uint32_t);
@ -199,7 +190,6 @@ class nsGbmLib {
static void* sXf86DrmLibHandle;
static bool sLibLoaded;
};
#endif
} // namespace widget
} // namespace mozilla