Backed out 14 changesets (bug 1833855) for causing build bustages in SharedSurface.cpp CLOSED TREE

Backed out changeset c3f7d1963902 (bug 1833855)
Backed out changeset 347c47f5542a (bug 1833855)
Backed out changeset 2c0807d0b39a (bug 1833855)
Backed out changeset 013d1d16194d (bug 1833855)
Backed out changeset 2e49d43a627c (bug 1833855)
Backed out changeset ea21e90a71dd (bug 1833855)
Backed out changeset 8d5d0690668c (bug 1833855)
Backed out changeset 4eb11068275d (bug 1833855)
Backed out changeset 15120d9c5b24 (bug 1833855)
Backed out changeset b75750bb7596 (bug 1833855)
Backed out changeset 6f94e3f002ed (bug 1833855)
Backed out changeset 3235825211f9 (bug 1833855)
Backed out changeset 47a6e9ed8828 (bug 1833855)
Backed out changeset b8013c43aa20 (bug 1833855)
This commit is contained in:
Cristian Tuns 2023-06-22 05:29:12 -04:00
parent 4793228629
commit 684fec2fef
60 changed files with 214 additions and 244 deletions

View File

@ -636,7 +636,7 @@ RefPtr<WebGLContext> WebGLContext::Create(HostWebGLContext& host,
if (kIsAndroid) {
types[layers::SurfaceDescriptor::TSurfaceTextureDescriptor] = true;
}
if (kIsLinux) {
if (kIsX11 || kIsWayland) {
types[layers::SurfaceDescriptor::TSurfaceDescriptorDMABuf] = true;
}
return types;

View File

@ -62,8 +62,8 @@ TEST(MediaDataDecoder, H264)
}
}
// Decoding AV1 via. ffvpx is supported on Linux only.
#if defined(MOZ_AV1) && defined(MOZ_WIDGET_GTK) && defined(MOZ_FFVPX) && \
// Decoding AV1 via. ffvpx is supported on Linux/Wayland only.
#if defined(MOZ_AV1) && defined(MOZ_WAYLAND) && defined(MOZ_FFVPX) && \
!defined(MOZ_FFVPX_AUDIOONLY)
TEST(MediaDataDecoder, AV1)
{

View File

@ -291,7 +291,7 @@ AVFrame* FFmpegDataDecoder<LIBAV_VER>::PrepareFrame() {
return aLib->avcodec_find_decoder(aCodec);
}
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
/* static */ AVCodec* FFmpegDataDecoder<LIBAV_VER>::FindHardwareAVCodec(
FFmpegLibWrapper* aLib, AVCodecID aCodec) {
void* opaque = nullptr;

View File

@ -41,7 +41,7 @@ class FFmpegDataDecoder<LIBAV_VER>
RefPtr<ShutdownPromise> Shutdown() override;
static AVCodec* FindAVCodec(FFmpegLibWrapper* aLib, AVCodecID aCodec);
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
static AVCodec* FindHardwareAVCodec(FFmpegLibWrapper* aLib, AVCodecID aCodec);
#endif

View File

@ -11,7 +11,7 @@
#include "mozilla/Types.h"
#include "PlatformDecoderModule.h"
#include "prlink.h"
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# include "mozilla/gfx/gfxVars.h"
# include "mozilla/widget/DMABufLibWrapper.h"
#endif
@ -200,7 +200,7 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 |
AV_FUNC_60)
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
AV_FUNC_OPTION_SILENT(avcodec_get_hw_config,
AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
AV_FUNC_OPTION_SILENT(av_codec_iterate, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
@ -236,7 +236,7 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
#undef AV_FUNC
#undef AV_FUNC_OPTION
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# define VA_FUNC_OPTION_SILENT(func) \
if (!(func = (decltype(func))PR_FindSymbol(mVALib, #func))) { \
func = (decltype(func))nullptr; \
@ -294,7 +294,7 @@ void FFmpegLibWrapper::Unlink() {
PR_UnloadLibrary(mAVCodecLib);
}
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
if (mVALib) {
PR_UnloadLibrary(mVALib);
}
@ -305,7 +305,7 @@ void FFmpegLibWrapper::Unlink() {
PodZero(this);
}
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
void FFmpegLibWrapper::LinkVAAPILibs() {
if (!gfx::gfxVars::CanUseHardwareVideoDecoding() || !XRE_IsRDDProcess()) {
return;
@ -335,7 +335,7 @@ void FFmpegLibWrapper::LinkVAAPILibs() {
}
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
bool FFmpegLibWrapper::IsVAAPIAvailable() {
# define VA_FUNC_LOADED(func) (func != nullptr)
return VA_FUNC_LOADED(avcodec_get_hw_config) &&

View File

@ -17,7 +17,7 @@ struct AVPacket;
struct AVDictionary;
struct AVCodecParserContext;
struct PRLibrary;
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
struct AVCodecHWConfig;
struct AVVAAPIHWConfig;
struct AVHWFramesConstraints;
@ -56,7 +56,7 @@ struct MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS FFmpegLibWrapper {
// Reset the wrapper and unlink all attached libraries.
void Unlink();
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
// Check if mVALib are available and we can use HW decode.
bool IsVAAPIAvailable();
void LinkVAAPILibs();
@ -138,7 +138,7 @@ struct MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS FFmpegLibWrapper {
int (*av_frame_get_colorspace)(const AVFrame* frame);
int (*av_frame_get_color_range)(const AVFrame* frame);
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
const AVCodecHWConfig* (*avcodec_get_hw_config)(const AVCodec* codec,
int index);
AVBufferRef* (*av_hwdevice_ctx_alloc)(int);
@ -170,7 +170,7 @@ struct MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS FFmpegLibWrapper {
PRLibrary* mAVCodecLib;
PRLibrary* mAVUtilLib;
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
PRLibrary* mVALib;
PRLibrary* mVALibDrm;
#endif

View File

@ -60,7 +60,7 @@ bool FFmpegRuntimeLinker::Init() {
return sLinkStatus == LinkStatus_SUCCEEDED;
}
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
sLibAV.LinkVAAPILibs();
#endif

View File

@ -28,7 +28,7 @@
# include "va/va.h"
#endif
#if defined(MOZ_AV1) && defined(MOZ_WIDGET_GTK) && \
#if defined(MOZ_AV1) && defined(MOZ_WAYLAND) && \
(defined(FFVPX_VERSION) || LIBAVCODEC_VERSION_MAJOR >= 59)
# define FFMPEG_AV1_DECODE 1
# include "AOMDecoder.h"
@ -1752,7 +1752,7 @@ nsTArray<AVCodecID> FFmpegVideoDecoder<LIBAV_VER>::GetAcceleratedFormats() {
FFMPEG_LOG(" vaQueryConfigProfiles() failed %s", vaErrorStr(status));
return supportedHWCodecs;
}
numProfiles = std::min(numProfiles, maxProfiles);
numProfiles = MIN(numProfiles, maxProfiles);
entryPoints = new VAEntrypoint[maxEntryPoints];
for (int p = 0; p < numProfiles; p++) {
@ -1771,7 +1771,7 @@ nsTArray<AVCodecID> FFmpegVideoDecoder<LIBAV_VER>::GetAcceleratedFormats() {
vaErrorStr(status), (int)profile);
continue;
}
numEntryPoints = std::min(numEntryPoints, maxEntryPoints);
numEntryPoints = MIN(numEntryPoints, maxEntryPoints);
FFMPEG_LOG(" Profile %s:", VAProfileName(profile));
for (int e = 0; e < numEntryPoints; e++) {

View File

@ -26,7 +26,7 @@ if CONFIG['CC_TYPE'] == 'gcc':
CXXFLAGS += [
'-Wno-attributes',
]
if CONFIG['MOZ_WIDGET_GTK']:
if CONFIG['MOZ_WAYLAND']:
CXXFLAGS += CONFIG['MOZ_GTK3_CFLAGS']
if CONFIG['MOZ_ENABLE_VAAPI'] or CONFIG['MOZ_ENABLE_V4L2']:
UNIFIED_SOURCES += ['../FFmpegVideoFramePool.cpp']

View File

@ -26,7 +26,7 @@ if CONFIG["CC_TYPE"] == "gcc":
CXXFLAGS += [
"-Wno-attributes",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
if CONFIG["MOZ_WAYLAND"]:
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
if CONFIG["MOZ_ENABLE_VAAPI"] or CONFIG["MOZ_ENABLE_V4L2"]:
UNIFIED_SOURCES += ["../FFmpegVideoFramePool.cpp"]

View File

@ -26,7 +26,7 @@ if CONFIG["CC_TYPE"] == "gcc":
CXXFLAGS += [
"-Wno-attributes",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
if CONFIG["MOZ_WAYLAND"]:
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
if CONFIG["MOZ_ENABLE_VAAPI"] or CONFIG["MOZ_ENABLE_V4L2"]:
UNIFIED_SOURCES += ["../FFmpegVideoFramePool.cpp"]

View File

@ -59,7 +59,7 @@ bool FFVPXRuntimeLinker::Init() {
MOZ_ASSERT(NS_IsMainThread());
sLinkStatus = LinkStatus_FAILED;
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
sFFVPXLib.LinkVAAPILibs();
#endif

View File

@ -37,7 +37,7 @@ if CONFIG["CC_TYPE"] == "gcc":
DEFINES["FFVPX_VERSION"] = 46465650
DEFINES["USING_MOZFFVPX"] = True
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
if CONFIG["MOZ_WAYLAND"]:
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
if CONFIG["MOZ_ENABLE_VAAPI"] or CONFIG["MOZ_ENABLE_V4L2"]:
UNIFIED_SOURCES += ["../FFmpegVideoFramePool.cpp"]

View File

@ -22,7 +22,7 @@ UNIFIED_SOURCES += [
"FFmpegRuntimeLinker.cpp",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
if CONFIG["MOZ_WAYLAND"]:
include("/ipc/chromium/chromium-config.mozbuild")
FINAL_LIBRARY = "xul"

View File

@ -30,5 +30,5 @@ DEFINES['ANGLE_SKIP_DXGI_1_2_CHECK'] = True
DEFINES['ANGLE_ENABLE_KEYEDMUTEX'] = True
DEFINES['ANGLE_TRANSLATOR_ESSL_ONLY'] = True
if CONFIG["MOZ_WIDGET_GTK"]:
if CONFIG["MOZ_WAYLAND"]:
CXXFLAGS += [ "-DWL_EGL_PLATFORM" ]

View File

@ -41,10 +41,9 @@
# include "mozilla/layers/D3D11YCbCrImage.h"
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# include "mozilla/layers/DMABUFSurfaceImage.h"
# include "mozilla/widget/DMABufSurface.h"
# include "mozilla/widget/DMABufLibWrapper.h"
#endif
using mozilla::layers::PlanarYCbCrData;
@ -877,7 +876,7 @@ bool GLBlitHelper::BlitSdToFramebuffer(const layers::SurfaceDescriptor& asd,
return Blit(surfaceTexture, destSize, destOrigin);
}
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
case layers::SurfaceDescriptor::TSurfaceDescriptorDMABuf: {
const auto& sd = asd.get_SurfaceDescriptorDMABuf();
RefPtr<DMABufSurface> surface = DMABufSurface::CreateDMABufSurface(sd);
@ -947,7 +946,7 @@ bool GLBlitHelper::BlitImageToFramebuffer(layers::Image* const srcImage,
return false;
#endif
case ImageFormat::DMABUF:
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
return BlitImage(static_cast<layers::DMABUFSurfaceImage*>(srcImage),
destSize, destOrigin);
#else
@ -1426,7 +1425,7 @@ bool GLBlitHelper::BlitImage(layers::GPUVideoImage* const srcImage,
const auto& subdescUnion =
desc.get_SurfaceDescriptorRemoteDecoder().subdesc();
switch (subdescUnion.type()) {
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
case layers::RemoteDecoderVideoSubDescriptor::TSurfaceDescriptorDMABuf: {
const auto& subdesc = subdescUnion.get_SurfaceDescriptorDMABuf();
RefPtr<DMABufSurface> surface =
@ -1469,7 +1468,7 @@ bool GLBlitHelper::BlitImage(layers::GPUVideoImage* const srcImage,
}
// -------------------------------------
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
bool GLBlitHelper::Blit(DMABufSurface* surface, const gfx::IntSize& destSize,
OriginPos destOrigin) const {
const auto& srcOrigin = OriginPos::BottomLeft;

View File

@ -44,7 +44,7 @@ class MacIOSurface;
# include "mozilla/java/GeckoSurfaceTextureWrappers.h"
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
class DMABufSurface;
#endif
@ -74,7 +74,7 @@ class SurfaceTextureDescriptor;
class MacIOSurfaceImage;
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
class DMABUFSurfaceImage;
#endif
} // namespace layers
@ -235,7 +235,7 @@ class GLBlitHelper final {
bool BlitImage(layers::MacIOSurfaceImage* srcImage,
const gfx::IntSize& destSize, OriginPos destOrigin) const;
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
bool Blit(DMABufSurface* surface, const gfx::IntSize& destSize,
OriginPos destOrigin) const;
bool BlitImage(layers::DMABUFSurfaceImage* srcImage,

View File

@ -3543,7 +3543,7 @@ class GLContext : public GenericAtomicRefCounted, public SupportsWeakPtr {
virtual GLenum GetPreferredARGB32Format() const { return LOCAL_GL_RGBA; }
virtual GLenum GetPreferredEGLImageTextureTarget() const {
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
return LOCAL_GL_TEXTURE_2D;
#else
return IsExtensionSupported(OES_EGL_image_external)

View File

@ -255,7 +255,7 @@ already_AddRefed<GLContext> GLContextEGLFactory::CreateImpl(
gfxCriticalNote << "Failed to create EGLConfig for WebRender ANGLE!";
return nullptr;
}
} else if (kIsLinux) {
} else if (kIsWayland || kIsX11) {
const int bpp = 32;
if (!CreateConfig(*egl, &config, bpp, false, aUseGles)) {
gfxCriticalNote << "Failed to create EGLConfig for WebRender!";
@ -968,7 +968,7 @@ bool CreateConfig(EglDisplay& aEgl, EGLConfig* aConfig, int32_t aDepth,
}
}
if (kIsLinux && fallbackConfig) {
if (kIsX11 && fallbackConfig) {
*aConfig = fallbackConfig.value();
return true;
}

View File

@ -37,9 +37,9 @@
#include "ScopedGLHelpers.h"
#ifdef MOZ_WIDGET_GTK
# include "mozilla/WidgetUtilsGtk.h"
# include "mozilla/widget/DMABufLibWrapper.h"
# ifdef MOZ_WAYLAND
# include "mozilla/widget/nsWaylandDisplay.h"
# include "mozilla/widget/DMABufLibWrapper.h"
# endif // MOZ_WIDGET_GTK
# include <gdk/gdk.h>
#endif // MOZ_WAYLAND
@ -163,7 +163,7 @@ static std::shared_ptr<EglDisplay> GetAndInitDisplay(
return EglDisplay::Create(egl, display, false, aProofOfLock);
}
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
static std::shared_ptr<EglDisplay> GetAndInitDeviceDisplay(
GLLibraryEGL& egl, const StaticMutexAutoLock& aProofOfLock) {
nsAutoCString drmRenderDevice(gfx::gfxVars::DrmRenderDevice());
@ -897,15 +897,13 @@ std::shared_ptr<EglDisplay> GLLibraryEGL::CreateDisplayLocked(
}
} else {
void* nativeDisplay = EGL_DEFAULT_DISPLAY;
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
if (!gdk_display_get_default()) {
ret = GetAndInitDeviceDisplay(*this, aProofOfLock);
if (!ret) {
ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
}
}
# ifdef MOZ_WAYLAND
else if (widget::GdkIsWaylandDisplay()) {
} else if (widget::GdkIsWaylandDisplay()) {
// Wayland does not support EGL_DEFAULT_DISPLAY
nativeDisplay = widget::WaylandDisplayGetWLDisplay();
if (!nativeDisplay) {
@ -913,7 +911,6 @@ std::shared_ptr<EglDisplay> GLLibraryEGL::CreateDisplayLocked(
return nullptr;
}
}
# endif
#endif
if (!ret) {
ret = GetAndInitDisplay(*this, nativeDisplay, aProofOfLock);

View File

@ -31,7 +31,7 @@
# include "SharedSurfaceIO.h"
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# include "gfxPlatformGtk.h"
# include "SharedSurfaceDMABUF.h"
#endif
@ -98,7 +98,7 @@ UniquePtr<SurfaceFactory> SurfaceFactory::Create(
#endif
case layers::TextureType::DMABUF:
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
if (gl.GetContextType() == GLContextType::EGL &&
widget::DMABufDevice::IsDMABufWebGLEnabled()) {
return SurfaceFactory_DMABUF::Create(gl);

View File

@ -10,7 +10,6 @@
#include "MozFramebuffer.h"
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/widget/DMABufLibWrapper.h"
namespace mozilla::gl {

View File

@ -110,12 +110,14 @@ elif gl_provider == "Linux":
# as it includes X11 headers which cause conflicts.
SOURCES += [
"GLContextProviderLinux.cpp",
"SharedSurfaceDMABUF.cpp",
]
EXPORTS += ["GLContextGLX.h", "GLXLibrary.h"]
if CONFIG["MOZ_X11"]:
SOURCES += ["GLContextProviderGLX.cpp"]
if CONFIG["MOZ_WAYLAND"]:
SOURCES += ["SharedSurfaceDMABUF.cpp"]
UNIFIED_SOURCES += [
"AndroidSurfaceTexture.cpp",
"Colorspaces.cpp",

View File

@ -38,8 +38,15 @@ constexpr bool kIsMacOS =
false;
#endif
constexpr bool kIsLinux =
#ifdef MOZ_WIDGET_GTK
constexpr bool kIsX11 =
#ifdef MOZ_X11
true;
#else
false;
#endif
constexpr bool kIsWayland =
#ifdef MOZ_WAYLAND
true;
#else
false;

View File

@ -14,9 +14,8 @@
#include "PersistentBufferProvider.h"
#include "WebGLTypes.h"
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# include "mozilla/widget/DMABufSurface.h"
# include "mozilla/widget/DMABufLibWrapper.h"
#endif
namespace mozilla {
@ -111,8 +110,8 @@ TextureType TexTypeForWebgl(KnowsCompositor* const knowsCompositor) {
return TextureType::MacIOSurface;
}
#ifdef MOZ_WIDGET_GTK
if (kIsLinux) {
#ifdef MOZ_WAYLAND
if (kIsWayland) {
if (!knowsCompositor->UsingSoftwareWebRender() &&
widget::DMABufDevice::IsDMABufWebGLEnabled()) {
return TextureType::DMABUF;

View File

@ -79,7 +79,7 @@ class SharedRGBImage;
class SurfaceTextureImage;
#elif defined(XP_MACOSX)
class MacIOSurfaceImage;
#elif MOZ_WIDGET_GTK
#elif MOZ_WAYLAND
class DMABUFSurfaceImage;
#endif
@ -147,7 +147,7 @@ class Image {
virtual MacIOSurfaceImage* AsMacIOSurfaceImage() { return nullptr; }
#endif
virtual PlanarYCbCrImage* AsPlanarYCbCrImage() { return nullptr; }
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
virtual DMABUFSurfaceImage* AsDMABUFSurfaceImage() { return nullptr; }
#endif

View File

@ -46,13 +46,11 @@
# include "mozilla/gfx/DeviceManagerDx.h"
# include "mozilla/layers/TextureD3D11.h"
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# include <gtk/gtkx.h>
# include "gfxPlatformGtk.h"
# include "mozilla/layers/DMABUFTextureClientOGL.h"
# include "mozilla/widget/DMABufLibWrapper.h"
#endif
#ifdef MOZ_WAYLAND
# include "mozilla/widget/nsWaylandDisplay.h"
#endif
@ -274,7 +272,7 @@ static TextureType GetTextureType(gfx::SurfaceFormat aFormat,
}
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
if ((layersBackend == LayersBackend::LAYERS_WR &&
!aKnowsCompositor->UsingSoftwareWebRender()) &&
widget::DMABufDevice::IsDMABufTexturesEnabled() &&
@ -340,7 +338,7 @@ TextureData* TextureData::Create(TextureForwarder* aAllocator,
textureType = TextureType::Unknown;
}
#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
#if defined(XP_MACOSX) || defined(MOZ_WAYLAND)
gfx::BackendType moz2DBackend = BackendTypeForBackendSelector(
aKnowsCompositor->GetCompositorBackendType(), aSelector);
#endif
@ -351,7 +349,7 @@ TextureData* TextureData::Create(TextureForwarder* aAllocator,
return D3D11TextureData::Create(aSize, aFormat, aAllocFlags);
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
case TextureType::DMABUF:
return DMABUFTextureData::Create(aSize, aFormat, moz2DBackend);
#endif

View File

@ -231,27 +231,23 @@ EXPORTS.mozilla.layers += [
"ZoomConstraints.h",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
EXPORTS.mozilla.layers += [
"DMABUFSurfaceImage.h",
"opengl/DMABUFTextureClientOGL.h",
"opengl/DMABUFTextureHostOGL.h",
]
SOURCES += [
"DMABUFSurfaceImage.cpp",
"opengl/DMABUFTextureClientOGL.cpp",
"opengl/DMABUFTextureHostOGL.cpp",
]
if CONFIG["MOZ_WAYLAND"]:
EXPORTS.mozilla.layers += [
"DMABUFSurfaceImage.h",
"NativeLayerWayland.h",
"opengl/DMABUFTextureClientOGL.h",
"opengl/DMABUFTextureHostOGL.h",
"SurfacePoolWayland.h",
]
UNIFIED_SOURCES += [
"NativeLayerWayland.cpp",
"SurfacePoolWayland.cpp",
]
SOURCES += [
"DMABUFSurfaceImage.cpp",
"opengl/DMABUFTextureClientOGL.cpp",
"opengl/DMABUFTextureHostOGL.cpp",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
EXPORTS.mozilla.layers += [

View File

@ -50,7 +50,7 @@
#include "HeapCopyOfStackArray.h"
#include "GLBlitHelper.h"
#include "mozilla/gfx/Swizzle.h"
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# include "mozilla/widget/GtkCompositorWidget.h"
#endif
#if MOZ_WIDGET_ANDROID
@ -745,7 +745,7 @@ Maybe<IntRect> CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
MakeCurrent(ForceMakeCurrent);
mWidgetSize = LayoutDeviceIntSize::FromUnknownSize(rect.Size());
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
if (mWidget && mWidget->AsGTK()) {
mWidget->AsGTK()->SetEGLNativeWindowSize(mWidgetSize);
}
@ -1636,7 +1636,7 @@ void CompositorOGL::Pause() {
if (!gl() || gl()->IsDestroyed()) return;
// ReleaseSurface internally calls MakeCurrent
gl()->ReleaseSurface();
#elif defined(MOZ_WIDGET_GTK)
#elif defined(MOZ_WAYLAND)
// ReleaseSurface internally calls MakeCurrent
gl()->ReleaseSurface();
#endif
@ -1644,7 +1644,7 @@ void CompositorOGL::Pause() {
bool CompositorOGL::Resume() {
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_UIKIT) || \
defined(MOZ_WIDGET_GTK)
defined(MOZ_WAYLAND)
if (!gl() || gl()->IsDestroyed()) return false;
// RenewSurface internally calls MakeCurrent.

View File

@ -111,7 +111,7 @@ void ShaderConfigOGL::SetColorMultiplier(uint32_t aMultiplier) {
void ShaderConfigOGL::SetNV12(bool aEnabled) {
SetFeature(ENABLE_TEXTURE_NV12, aEnabled);
MOZ_ASSERT(!(mFeatures & ENABLE_TEXTURE_YCBCR));
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
SetFeature(ENABLE_TEXTURE_NV12_GA_SWITCH, aEnabled);
#endif
}

View File

@ -32,7 +32,7 @@
# include "mozilla/webrender/RenderAndroidSurfaceTextureHost.h"
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# include "mozilla/layers/DMABUFTextureHostOGL.h"
#endif
@ -88,7 +88,7 @@ already_AddRefed<TextureHost> CreateTextureHostOGL(
break;
}
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
case SurfaceDescriptor::TSurfaceDescriptorDMABuf: {
result = new DMABUFTextureHostOGL(aFlags, aDesc);
break;

View File

@ -3046,7 +3046,7 @@ void gfxPlatform::InitWebGLConfig() {
}
}
if (kIsLinux) {
if (kIsWayland || kIsX11) {
nsCString discardFailureId;
int32_t status;
FeatureState& feature =

View File

@ -66,8 +66,6 @@
#ifdef MOZ_WAYLAND
# include <gdk/gdkwayland.h>
# include "mozilla/widget/nsWaylandDisplay.h"
#endif
#ifdef MOZ_WIDGET_GTK
# include "mozilla/widget/DMABufLibWrapper.h"
# include "mozilla/StaticPrefs_widget.h"
#endif
@ -185,6 +183,7 @@ void gfxPlatformGtk::InitX11EGLConfig() {
void gfxPlatformGtk::InitDmabufConfig() {
FeatureState& feature = gfxConfig::GetFeature(Feature::DMABUF);
#ifdef MOZ_WAYLAND
feature.EnableByDefault();
if (StaticPrefs::widget_dmabuf_force_enabled_AtStartup()) {
@ -218,6 +217,11 @@ void gfxPlatformGtk::InitDmabufConfig() {
failureId);
}
}
#else
feature.DisableByDefault(FeatureStatus::Unavailable,
"Wayland support missing",
"FEATURE_FAILURE_NO_WAYLAND"_ns);
#endif
}
bool gfxPlatformGtk::InitVAAPIConfig(bool aForceEnabledByUser) {
@ -227,6 +231,7 @@ bool gfxPlatformGtk::InitVAAPIConfig(bool aForceEnabledByUser) {
if (!XRE_IsParentProcess()) {
return feature.IsEnabled();
}
#ifdef MOZ_WAYLAND
feature.EnableByDefault();
int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
@ -286,6 +291,11 @@ bool gfxPlatformGtk::InitVAAPIConfig(bool aForceEnabledByUser) {
gfxVars::SetHwDecodedVideoZeroCopy(true);
}
}
#else
feature.DisableByDefault(FeatureStatus::Unavailable,
"Wayland support missing",
"FEATURE_FAILURE_NO_WAYLAND"_ns);
#endif
return feature.IsEnabled();
}

View File

@ -23,7 +23,7 @@
# include "mozilla/widget/WinCompositorWidget.h"
#endif
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GTK)
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WAYLAND) || defined(MOZ_X11)
# include "mozilla/webrender/RenderCompositorEGL.h"
#endif
@ -205,7 +205,7 @@ UniquePtr<RenderCompositor> RenderCompositor::Create(
}
#endif
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GTK)
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WAYLAND) || defined(MOZ_X11)
UniquePtr<RenderCompositor> eglCompositor =
RenderCompositorEGL::Create(aWidget, aError);
if (eglCompositor) {

View File

@ -17,7 +17,7 @@
#include "mozilla/webrender/RenderThread.h"
#include "mozilla/widget/CompositorWidget.h"
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
# include "mozilla/WidgetUtilsGtk.h"
# include "mozilla/widget/GtkCompositorWidget.h"
#endif
@ -38,7 +38,7 @@ extern LazyLogModule gRenderThreadLog;
/* static */
UniquePtr<RenderCompositor> RenderCompositorEGL::Create(
const RefPtr<widget::CompositorWidget>& aWidget, nsACString& aError) {
if (kIsLinux && !gfx::gfxVars::UseEGL()) {
if ((kIsWayland || kIsX11) && !gfx::gfxVars::UseEGL()) {
return nullptr;
}
RefPtr<gl::GLContext> gl = RenderThread::Get()->SingletonGL(aError);
@ -83,12 +83,12 @@ RenderCompositorEGL::~RenderCompositorEGL() {
}
bool RenderCompositorEGL::BeginFrame() {
if (kIsLinux && mEGLSurface == EGL_NO_SURFACE) {
if ((kIsWayland || kIsX11) && mEGLSurface == EGL_NO_SURFACE) {
gfxCriticalNote
<< "We don't have EGLSurface to draw into. Called too early?";
return false;
}
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
if (mWidget->AsGTK()) {
mWidget->AsGTK()->SetEGLNativeWindowSize(GetBufferSize());
}
@ -127,7 +127,7 @@ RenderedFrameId RenderCompositorEGL::EndFrame(
#endif
RenderedFrameId frameId = GetNextRenderFrameId();
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
if (mWidget->IsHidden()) {
return frameId;
}
@ -192,7 +192,7 @@ bool RenderCompositorEGL::Resume() {
mHandlingNewSurfaceError = false;
gl::GLContextEGL::Cast(gl())->SetEGLSurfaceOverride(mEGLSurface);
} else if (kIsLinux) {
} else if (kIsWayland || kIsX11) {
// Destroy EGLSurface if it exists and create a new one. We will set the
// swap interval after MakeCurrent() has been called.
DestroyEGLSurface();

View File

@ -58,7 +58,7 @@ bool RenderCompositorSWGL::MakeCurrent() {
bool RenderCompositorSWGL::BeginFrame() {
mRenderWidgetSize = Some(mWidget->GetClientSize());
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
if (mLastRenderWidgetSize != mRenderWidgetSize.value()) {
mLastRenderWidgetSize = mRenderWidgetSize.value();
mRequestFullRender = true;
@ -269,7 +269,7 @@ bool RenderCompositorSWGL::RequestFullRender() {
// XXX Add partial present support.
return true;
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
// We're requested to do full render after Resume() on Wayland.
if (mRequestFullRender) {
mRequestFullRender = false;
@ -282,7 +282,7 @@ bool RenderCompositorSWGL::RequestFullRender() {
void RenderCompositorSWGL::Pause() {}
bool RenderCompositorSWGL::Resume() {
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
mRequestFullRender = true;
#endif
return true;

View File

@ -69,7 +69,7 @@ class RenderCompositorSWGL : public RenderCompositor {
RefPtr<gfx::DataSourceSurface> mSurface;
uint8_t* mMappedData = nullptr;
int32_t mMappedStride = 0;
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WAYLAND
// On Wayland we need to request full render if widget size is changed
// because SW rendering backend reallocates and clears target surface.
LayoutDeviceIntSize mLastRenderWidgetSize;

View File

@ -50,6 +50,9 @@
#ifdef MOZ_WIDGET_GTK
# include "mozilla/WidgetUtilsGtk.h"
#endif
#ifdef MOZ_WAYLAND
# include "GLLibraryEGL.h"
#endif
@ -1531,7 +1534,7 @@ static already_AddRefed<gl::GLContext> CreateGLContextANGLE(
}
#endif
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GTK)
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WAYLAND) || defined(MOZ_X11)
static already_AddRefed<gl::GLContext> CreateGLContextEGL() {
// Create GLContext with dummy EGLSurface.
bool forHardwareWebRender = true;
@ -1570,7 +1573,7 @@ static already_AddRefed<gl::GLContext> CreateGLContext(nsACString& aError) {
}
#elif defined(MOZ_WIDGET_ANDROID)
gl = CreateGLContextEGL();
#elif defined(MOZ_WIDGET_GTK)
#elif defined(MOZ_WAYLAND) || defined(MOZ_X11)
if (gfx::gfxVars::UseEGL()) {
gl = CreateGLContextEGL();
}

View File

@ -90,20 +90,14 @@ if CONFIG["MOZ_ENABLE_D3D10_LAYER"]:
"RenderDcompSurfaceTextureHost.cpp",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
EXPORTS.mozilla.webrender += [
"RenderDMABUFTextureHost.h",
]
SOURCES += [
"RenderDMABUFTextureHost.cpp",
]
if CONFIG["MOZ_WAYLAND"]:
EXPORTS.mozilla.webrender += [
"RenderCompositorNative.h",
"RenderDMABUFTextureHost.h",
]
SOURCES += [
"RenderCompositorNative.cpp",
"RenderDMABUFTextureHost.cpp",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("android", "gtk"):

View File

@ -20,7 +20,7 @@
#undef CONFIG_VP9_VAAPI_HWACCEL
#undef CONFIG_AV1_VAAPI_HWACCEL
#if defined(MOZ_WIDGET_GTK) && !defined(MOZ_FFVPX_AUDIOONLY)
#if defined(MOZ_WAYLAND) && !defined(MOZ_FFVPX_AUDIOONLY)
#define CONFIG_VAAPI 1
#define CONFIG_VAAPI_1 1
#define CONFIG_VP8_VAAPI_HWACCEL 1

View File

@ -113,7 +113,7 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
'dav1d',
'media_libdav1d_asm',
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
if CONFIG['MOZ_WAYLAND']:
LOCAL_INCLUDES += ['/media/mozva']
SOURCES += [
'vaapi_av1.c',

View File

@ -63,7 +63,7 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
'timecode.c',
'video_enc_params.c'
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
if CONFIG["MOZ_WAYLAND"]:
LOCAL_INCLUDES += ['/media/mozva']
SOURCES += [
'hwcontext_vaapi.c',

View File

@ -15374,6 +15374,30 @@
mirror: always
#ifdef MOZ_WAYLAND
# Whether to override the DMABuf blocklist.
- name: widget.dmabuf.force-enabled
type: bool
value: false
mirror: once
#ifdef NIGHTLY_BUILD
# Keep those pref hidden on non-nightly builds to avoid people accidentally
# turning it on.
# Use DMABuf for content textures.
# For testing purposes only.
- name: widget.dmabuf-textures.enabled
type: RelaxedAtomicBool
value: false
mirror: always
#endif
# Use DMABuf backend for WebGL.
- name: widget.dmabuf-webgl.enabled
type: RelaxedAtomicBool
value: true
mirror: always
# Force fractional scaling using wp_viewporter. Valid values: 0.5 - 8
- name: widget.wayland.fractional_buffer_scale
type: float
@ -15401,29 +15425,6 @@
#endif
#ifdef MOZ_WIDGET_GTK
# Whether to override the DMABuf blocklist.
- name: widget.dmabuf.force-enabled
type: bool
value: false
mirror: once
#ifdef NIGHTLY_BUILD
# Keep those pref hidden on non-nightly builds to avoid people accidentally
# turning it on.
# Use DMABuf for content textures.
# For testing purposes only.
- name: widget.dmabuf-textures.enabled
type: RelaxedAtomicBool
value: false
mirror: always
#endif
# Use DMABuf backend for WebGL.
- name: widget.dmabuf-webgl.enabled
type: RelaxedAtomicBool
value: true
mirror: always
# Use gdk_window_move_to_rect to move Wayland popups when available.
- name: widget.wayland.use-move-to-rect

View File

@ -430,15 +430,11 @@ def toolkit_choices(target):
elif target.os == "Android":
return ("cairo-android",)
else:
# cairo-gtk3 - X11 backend with optional Wayland backend (auto detected)
# cairo-gtk3-wayland - Wayland backend with optional X11 backend (auto detected)
# cairo-gtk3-x11-wayland - builds explicitly with X11 & Wayland backends
return (
"cairo-gtk3",
"cairo-gtk3-wayland",
"cairo-gtk3-x11-wayland",
"cairo-gtk3-wayland-only",
"cairo-gtk3-x11-only",
"cairo-gtk3-x11-wayland",
)
@ -489,40 +485,18 @@ def toolkit_gtk(toolkit):
return toolkit == "gtk"
@depends(toolkit_gtk, full_toolkit)
def toolkit_gtk_x11(toolkit_gtk, full_toolkit):
return toolkit_gtk and full_toolkit != "cairo-gtk3-wayland-only"
@depends(full_toolkit)
def toolkit_gtk_x11_optional(full_toolkit):
return full_toolkit == "cairo-gtk3-wayland"
@depends(toolkit_gtk, full_toolkit)
def toolkit_gtk_wayland(toolkit_gtk, full_toolkit):
return toolkit_gtk and full_toolkit != "cairo-gtk3-x11-only"
@depends(full_toolkit)
def toolkit_gtk_wayland_optional(full_toolkit):
return full_toolkit == "cairo-gtk3"
# Wayland support
# ==============================================================
wayland_headers = pkg_check_modules(
"MOZ_WAYLAND",
"gtk+-wayland-3.0 >= 3.14 xkbcommon >= 0.4.1",
allow_missing=toolkit_gtk_wayland_optional,
when=toolkit_gtk_wayland,
allow_missing=depends(full_toolkit)(lambda t: t == "cairo-gtk3"),
when=toolkit_gtk,
)
@depends(wayland_headers, toolkit_gtk, artifact_builds, toolkit_gtk_wayland)
def wayland_headers(wayland, toolkit_gtk, artifacts, toolkit_gtk_wayland):
if not toolkit_gtk_wayland:
return False
@depends(wayland_headers, toolkit_gtk, artifact_builds)
def wayland_headers(wayland, toolkit_gtk, artifacts):
if toolkit_gtk and artifacts:
return True
return wayland
@ -531,20 +505,22 @@ def wayland_headers(wayland, toolkit_gtk, artifacts, toolkit_gtk_wayland):
set_config("MOZ_WAYLAND", depends_if(wayland_headers)(lambda _: True))
set_define("MOZ_WAYLAND", depends_if(wayland_headers)(lambda _: True))
# Hardware-accelerated video decode with VAAPI and V4L2 on Linux
# Hardware-accelerated video decode with VAAPI and V4L2
# ==============================================================
@depends(target, wayland_headers)
def vaapi(target, wayland_headers):
# VAAPI is mostly used on x86(-64) but is sometimes used on ARM/ARM64 SOCs.
# VAAPI is only used in Wayland. It's mostly used on x86(-64) but is
# sometimes used on ARM/ARM64 SOCs. Wayland implies GTK and Linux.
if target.cpu in ("arm", "aarch64", "x86", "x86_64") and wayland_headers:
return True
@depends(target, wayland_headers)
def v4l2(target, wayland_headers):
# V4L2 decode is only used in GTK/Linux and generally only appears on
# embedded SOCs.
# V4L2 decode is only used in Wayland, and generally only appears on
# embedded SOCs. Wayland implies GTK and Linux.
if target.cpu in ("arm", "aarch64", "riscv64") and wayland_headers:
return True
@ -554,7 +530,6 @@ set_config("MOZ_ENABLE_V4L2", True, when=v4l2)
set_define("MOZ_ENABLE_VAAPI", True, when=vaapi)
set_define("MOZ_ENABLE_V4L2", True, when=v4l2)
# GL Provider
# ==============================================================
option("--with-gl-provider", nargs=1, help="Set GL provider backend type")
@ -1474,8 +1449,10 @@ def x11_libs(webrtc):
x11_headers = pkg_check_modules(
"MOZ_X11",
x11_libs,
allow_missing=toolkit_gtk_x11_optional,
when=toolkit_gtk_x11,
allow_missing=depends(full_toolkit)(lambda t: t == "cairo-gtk3-wayland"),
when=depends(full_toolkit)(
lambda t: t in ("cairo-gtk3", "cairo-gtk3-wayland", "cairo-gtk3-x11-wayland")
),
)
@ -1486,8 +1463,10 @@ pkg_check_modules(
"MOZ_X11_SM",
["ice", "sm"],
cflags_only=True,
allow_missing=toolkit_gtk_x11_optional,
when=toolkit_gtk_x11,
allow_missing=depends(full_toolkit)(lambda t: t == "cairo-gtk3-wayland"),
when=depends(full_toolkit)(
lambda t: t in ("cairo-gtk3", "cairo-gtk3-wayland", "cairo-gtk3-x11-wayland")
),
)

View File

@ -145,7 +145,6 @@ DIRS += [
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
DIRS += [
'/media/mozva',
'/toolkit/system/gnome',
]
@ -188,3 +187,6 @@ if CONFIG['ENABLE_TESTS']:
if CONFIG['FUZZING']:
DIRS += ['/tools/fuzzing']
if CONFIG['MOZ_WAYLAND']:
DIRS += ['/media/mozva']

View File

@ -29,7 +29,10 @@
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <gdk/gdk.h>
#ifdef MOZ_WAYLAND
# include <gdk/gdk.h>
#endif
#if defined(MOZ_ASAN) || defined(FUZZING)
# include <signal.h>
@ -276,6 +279,7 @@ static void get_pci_status() {
log("GLX_TEST: get_pci_status finished\n");
}
#ifdef MOZ_WAYLAND
static void set_render_device_path(const char* render_device_path) {
record_value("DRM_RENDERDEVICE\n%s\n", render_device_path);
}
@ -382,6 +386,7 @@ static bool get_render_name(const char* name) {
free(devices);
return result;
}
#endif
static bool get_egl_gl_status(EGLDisplay dpy,
PFNEGLGETPROCADDRESS eglGetProcAddress) {
@ -534,6 +539,7 @@ static bool get_egl_gl_status(EGLDisplay dpy,
strstr(deviceExtensions, "EGL_MESA_device_software")) {
record_value("MESA_ACCELERATED\nFALSE\n");
} else {
#ifdef MOZ_WAYLAND
const char* deviceString =
eglQueryDeviceStringEXT(device, EGL_DRM_DEVICE_FILE_EXT);
if (!deviceString || !get_render_name(deviceString)) {
@ -543,6 +549,7 @@ static bool get_egl_gl_status(EGLDisplay dpy,
set_render_device_path(renderNodeString);
}
}
#endif
}
}

View File

@ -179,7 +179,7 @@ include("/ipc/chromium/chromium-config.mozbuild")
FINAL_LIBRARY = "xul"
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]:
DEFINES["USE_GLX_TEST"] = True
DIRS += ["glxtest"]

View File

@ -4745,18 +4745,6 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
else {
gdk_display_manager_open_display(gdk_display_manager_get(), nullptr);
}
# endif
// Check that Wayland only and X11 only builds
// use appropriate displays.
# if defined(MOZ_WAYLAND) && !defined(MOZ_X11)
if (!GdkIsWaylandDisplay()) {
Output(true, "Wayland only build is missig Wayland display!\n");
}
# endif
# if !defined(MOZ_WAYLAND) && defined(MOZ_X11)
if (!GdkIsX11Display()) {
Output(true, "X11 only build is missig X11 display!\n");
}
# endif
}
#endif

View File

@ -5,11 +5,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DMABufLibWrapper.h"
#ifdef MOZ_WAYLAND
# include "nsWaylandDisplay.h"
#endif
#include "base/message_loop.h" // for MessageLoop
#include "nsWaylandDisplay.h"
#include "DMABufLibWrapper.h"
#include "mozilla/StaticPrefs_widget.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/gfx/gfxVars.h"
@ -23,7 +21,6 @@
#include <fcntl.h>
#include <dlfcn.h>
#include <mutex>
#include "gbm.h"
using namespace mozilla::gfx;
@ -199,9 +196,7 @@ void DMABufDevice::Configure() {
return;
}
#ifdef MOZ_WAYLAND
LoadFormatModifiers();
#endif
LOGDMABUF(("DMABuf is enabled"));
}
@ -225,7 +220,6 @@ bool DMABufDevice::IsDMABufWebGLEnabled() {
StaticPrefs::widget_dmabuf_webgl_enabled();
}
#ifdef MOZ_WAYLAND
void DMABufDevice::SetModifiersToGfxVars() {
gfxVars::SetDMABufModifiersXRGB(mXRGBFormat.mModifiers);
gfxVars::SetDMABufModifiersARGB(mARGBFormat.mModifiers);
@ -235,7 +229,6 @@ void DMABufDevice::GetModifiersFromGfxVars() {
mXRGBFormat.mModifiers = gfxVars::DMABufModifiersXRGB().Clone();
mARGBFormat.mModifiers = gfxVars::DMABufModifiersARGB().Clone();
}
#endif
void DMABufDevice::DisableDMABufWebGL() { sUseWebGLDmabufBackend = false; }
@ -244,7 +237,6 @@ GbmFormat* DMABufDevice::GetGbmFormat(bool aHasAlpha) {
return format->mIsSupported ? format : nullptr;
}
#ifdef MOZ_WAYLAND
void DMABufDevice::AddFormatModifier(bool aHasAlpha, int aFormat,
uint32_t mModifierHi,
uint32_t mModifierLo) {
@ -323,7 +315,6 @@ void DMABufDevice::LoadFormatModifiers() {
GetModifiersFromGfxVars();
}
}
#endif
DMABufDevice* GetDMABufDevice() {
static DMABufDevice dmaBufDevice;

View File

@ -198,19 +198,16 @@ class DMABufDevice {
static bool IsDMABufWebGLEnabled();
static void DisableDMABufWebGL();
#ifdef MOZ_WAYLAND
void AddFormatModifier(bool aHasAlpha, int aFormat, uint32_t mModifierHi,
uint32_t mModifierLo);
#endif
GbmFormat* GetGbmFormat(bool aHasAlpha);
private:
void Configure();
#ifdef MOZ_WAYLAND
void LoadFormatModifiers();
void SetModifiersToGfxVars();
void GetModifiersFromGfxVars();
#endif
private:
GbmFormat mXRGBFormat;

View File

@ -355,12 +355,11 @@ DMABufSurfaceRGBA::DMABufSurfaceRGBA()
mGmbFormat(nullptr),
mEGLImage(LOCAL_EGL_NO_IMAGE),
mTexture(0),
mGbmBufferFlags(0) {}
mGbmBufferFlags(0),
mWlBuffer(nullptr) {}
DMABufSurfaceRGBA::~DMABufSurfaceRGBA() {
#ifdef MOZ_WAYLAND
ReleaseWlBuffer();
#endif
ReleaseSurface();
}
@ -730,7 +729,6 @@ void DMABufSurfaceRGBA::ReleaseSurface() {
ReleaseDMABuf();
}
#ifdef MOZ_WAYLAND
bool DMABufSurfaceRGBA::CreateWlBuffer() {
MutexAutoLock lockFD(mSurfaceLock);
if (!OpenFileDescriptors(lockFD)) {
@ -760,7 +758,6 @@ bool DMABufSurfaceRGBA::CreateWlBuffer() {
void DMABufSurfaceRGBA::ReleaseWlBuffer() {
MozClearPointer(mWlBuffer, wl_buffer_destroy);
}
#endif
// We should synchronize DMA Buffer object access from CPU to avoid potential
// cache incoherency and data loss.

View File

@ -8,6 +8,7 @@
#define DMABufSurface_h__
#include <stdint.h>
#include "mozilla/widget/nsWaylandDisplay.h"
#include "mozilla/widget/va_drmcommon.h"
#include "GLTypes.h"
@ -52,11 +53,6 @@ typedef enum {
class DMABufSurfaceRGBA;
class DMABufSurfaceYUV;
struct wl_buffer;
namespace mozilla::widget {
struct GbmFormat;
}
class DMABufSurface {
public:
@ -248,11 +244,9 @@ class DMABufSurfaceRGBA : public DMABufSurface {
GLuint GetTexture(int aPlane = 0) { return mTexture; };
EGLImageKHR GetEGLImage(int aPlane = 0) { return mEGLImage; };
#ifdef MOZ_WAYLAND
bool CreateWlBuffer();
void ReleaseWlBuffer();
wl_buffer* GetWlBuffer() { return mWlBuffer; };
#endif
int GetTextureCount() { return 1; };
@ -289,9 +283,7 @@ class DMABufSurfaceRGBA : public DMABufSurface {
EGLImageKHR mEGLImage;
GLuint mTexture;
uint32_t mGbmBufferFlags;
#ifdef MOZ_WAYLAND
wl_buffer* mWlBuffer = nullptr;
#endif
wl_buffer* mWlBuffer;
};
class DMABufSurfaceYUV : public DMABufSurface {

View File

@ -132,14 +132,14 @@ EGLNativeWindowType GtkCompositorWidget::GetEGLNativeWindow() {
return window;
}
#if defined(MOZ_WAYLAND)
void GtkCompositorWidget::SetEGLNativeWindowSize(
const LayoutDeviceIntSize& aEGLWindowSize) {
#if defined(MOZ_WAYLAND)
if (mWidget) {
mWidget->SetEGLNativeWindowSize(aEGLWindowSize);
}
#endif
}
#endif
LayoutDeviceIntRegion GtkCompositorWidget::GetTransparentRegion() {
// We need to clear target buffer alpha values of popup windows as

View File

@ -79,12 +79,11 @@ class GtkCompositorWidget : public CompositorWidget,
// Resume rendering with to given aXWindow (X11) or nsWindow (Wayland).
void EnableRendering(const uintptr_t aXWindow, const bool aShaped) override;
void SetEGLNativeWindowSize(const LayoutDeviceIntSize& aEGLWindowSize);
#if defined(MOZ_X11)
Window XWindow() const { return mXWindow; }
#endif
#if defined(MOZ_WAYLAND)
void SetEGLNativeWindowSize(const LayoutDeviceIntSize& aEGLWindowSize);
RefPtr<mozilla::layers::NativeLayerRoot> GetNativeLayerRoot() override;
#endif

View File

@ -47,29 +47,16 @@ EXPORTS.mozilla += [
]
EXPORTS.mozilla.widget += [
"CompositorWidgetChild.h",
"CompositorWidgetParent.h",
"DMABufLibWrapper.h",
"DMABufSurface.h",
"gbm.h",
"GtkCompositorWidget.h",
"InProcessGtkCompositorWidget.h",
"va_drmcommon.h",
"WindowSurface.h",
"WindowSurfaceProvider.h",
]
UNIFIED_SOURCES += [
"AsyncGtkClipboardRequest.cpp",
"CompositorWidgetChild.cpp",
"CompositorWidgetParent.cpp",
"DMABufLibWrapper.cpp",
"DMABufSurface.cpp",
"GfxInfo.cpp",
"gtk3drawing.cpp",
"GtkCompositorWidget.cpp",
"IMContextWrapper.cpp",
"InProcessGtkCompositorWidget.cpp",
"MozContainer.cpp",
"MPRISServiceHandler.cpp",
"NativeKeyBindings.cpp",
@ -87,7 +74,6 @@ UNIFIED_SOURCES += [
"nsLookAndFeel.cpp",
"nsSound.cpp",
"nsToolkit.cpp",
"nsUserIdleServiceGTK.cpp",
"nsWidgetFactory.cpp",
"ScreenHelperGTK.cpp",
"TaskbarProgress.cpp",
@ -107,6 +93,8 @@ SOURCES += [
if CONFIG["MOZ_WAYLAND"]:
UNIFIED_SOURCES += [
"DMABufLibWrapper.cpp",
"DMABufSurface.cpp",
"MozContainerWayland.cpp",
"nsClipboardWayland.cpp",
"nsWaylandDisplay.cpp",
@ -114,11 +102,27 @@ if CONFIG["MOZ_WAYLAND"]:
"WindowSurfaceWaylandMultiBuffer.cpp",
]
EXPORTS.mozilla.widget += [
"DMABufLibWrapper.h",
"DMABufSurface.h",
"MozContainerWayland.h",
"nsWaylandDisplay.h",
"WaylandBuffer.h",
]
if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]:
UNIFIED_SOURCES += [
"CompositorWidgetChild.cpp",
"CompositorWidgetParent.cpp",
"InProcessGtkCompositorWidget.cpp",
"nsUserIdleServiceGTK.cpp",
]
EXPORTS.mozilla.widget += [
"CompositorWidgetChild.h",
"CompositorWidgetParent.h",
"GtkCompositorWidget.h",
"InProcessGtkCompositorWidget.h",
]
if CONFIG["MOZ_X11"]:
UNIFIED_SOURCES += [
"nsClipboardX11.cpp",
@ -153,9 +157,13 @@ LOCAL_INCLUDES += [
"/third_party/cups/include",
"/widget",
"/widget/headless",
"/widget/x11",
]
if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]:
LOCAL_INCLUDES += [
"/widget/x11",
]
DEFINES["CAIRO_GFX"] = True
DEFINES["MOZ_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"]

View File

@ -16,5 +16,10 @@ CXXFLAGS += CONFIG["MOZ_PANGO_CFLAGS"]
OS_LIBS += CONFIG["MOZ_X11_LIBS"]
OS_LIBS += CONFIG["MOZ_GTK3_LIBS"]
USE_LIBS += ["mozva"]
LOCAL_INCLUDES += ["/media/mozva"]
if CONFIG["MOZ_WAYLAND"]:
USE_LIBS += [
"mozva",
]
LOCAL_INCLUDES += [
"/media/mozva",
]

View File

@ -14,7 +14,6 @@
#include <unistd.h>
#include <getopt.h>
#include <stdint.h>
#include <stdarg.h>
#if defined(MOZ_ASAN) || defined(FUZZING)
# include <signal.h>
@ -26,6 +25,7 @@
# include <stdio.h>
#endif
#include "mozilla/widget/mozwayland.h"
#include "prlink.h"
#include "va/va.h"
@ -34,8 +34,6 @@
// Print VA-API test results to stdout and logging to stderr
#define OUTPUT_PIPE 1
#define MIN(a, b) ((a) < (b) ? (a) : (b))
// bits to use decoding vaapitest() return values.
constexpr int CODEC_HW_H264 = 1 << 4;
constexpr int CODEC_HW_VP8 = 1 << 5;

View File

@ -18,10 +18,12 @@ SOURCES += [
]
EXPORTS.mozilla.widget += [
"gbm.h",
"idle-inhibit-unstable-v1-client-protocol.h",
"linux-dmabuf-unstable-v1-client-protocol.h",
"pointer-constraints-unstable-v1-client-protocol.h",
"relative-pointer-unstable-v1-client-protocol.h",
"va_drmcommon.h",
"viewporter-client-protocol.h",
"xdg-activation-v1-client-protocol.h",
"xdg-output-unstable-v1-client-protocol.h",