mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1833855 [Linux] Build VA-API support on Linux/Gtk3 and don't request Wayland support for it r=alwu
- VA-API doesn't need Wayland so enable it for Linux/Gtk3 target. Differential Revision: https://phabricator.services.mozilla.com/D178633
This commit is contained in:
parent
52a33a403d
commit
7c32b58cd1
@ -62,8 +62,8 @@ TEST(MediaDataDecoder, H264)
|
||||
}
|
||||
}
|
||||
|
||||
// Decoding AV1 via. ffvpx is supported on Linux/Wayland only.
|
||||
#if defined(MOZ_AV1) && defined(MOZ_WAYLAND) && defined(MOZ_FFVPX) && \
|
||||
// Decoding AV1 via. ffvpx is supported on Linux only.
|
||||
#if defined(MOZ_AV1) && defined(MOZ_WIDGET_GTK) && defined(MOZ_FFVPX) && \
|
||||
!defined(MOZ_FFVPX_AUDIOONLY)
|
||||
TEST(MediaDataDecoder, AV1)
|
||||
{
|
||||
|
@ -291,7 +291,7 @@ AVFrame* FFmpegDataDecoder<LIBAV_VER>::PrepareFrame() {
|
||||
return aLib->avcodec_find_decoder(aCodec);
|
||||
}
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
/* static */ AVCodec* FFmpegDataDecoder<LIBAV_VER>::FindHardwareAVCodec(
|
||||
FFmpegLibWrapper* aLib, AVCodecID aCodec) {
|
||||
void* opaque = nullptr;
|
||||
|
@ -41,7 +41,7 @@ class FFmpegDataDecoder<LIBAV_VER>
|
||||
RefPtr<ShutdownPromise> Shutdown() override;
|
||||
|
||||
static AVCodec* FindAVCodec(FFmpegLibWrapper* aLib, AVCodecID aCodec);
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
static AVCodec* FindHardwareAVCodec(FFmpegLibWrapper* aLib, AVCodecID aCodec);
|
||||
#endif
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "mozilla/Types.h"
|
||||
#include "PlatformDecoderModule.h"
|
||||
#include "prlink.h"
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
# 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_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
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_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
# 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_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
if (mVALib) {
|
||||
PR_UnloadLibrary(mVALib);
|
||||
}
|
||||
@ -305,7 +305,7 @@ void FFmpegLibWrapper::Unlink() {
|
||||
PodZero(this);
|
||||
}
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
void FFmpegLibWrapper::LinkVAAPILibs() {
|
||||
if (!gfx::gfxVars::CanUseHardwareVideoDecoding() || !XRE_IsRDDProcess()) {
|
||||
return;
|
||||
@ -335,7 +335,7 @@ void FFmpegLibWrapper::LinkVAAPILibs() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
bool FFmpegLibWrapper::IsVAAPIAvailable() {
|
||||
# define VA_FUNC_LOADED(func) (func != nullptr)
|
||||
return VA_FUNC_LOADED(avcodec_get_hw_config) &&
|
||||
|
@ -17,7 +17,7 @@ struct AVPacket;
|
||||
struct AVDictionary;
|
||||
struct AVCodecParserContext;
|
||||
struct PRLibrary;
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
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_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
// 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_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
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_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
PRLibrary* mVALib;
|
||||
PRLibrary* mVALibDrm;
|
||||
#endif
|
||||
|
@ -60,7 +60,7 @@ bool FFmpegRuntimeLinker::Init() {
|
||||
return sLinkStatus == LinkStatus_SUCCEEDED;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
sLibAV.LinkVAAPILibs();
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
# include "va/va.h"
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_AV1) && defined(MOZ_WAYLAND) && \
|
||||
#if defined(MOZ_AV1) && defined(MOZ_WIDGET_GTK) && \
|
||||
(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 = MIN(numProfiles, maxProfiles);
|
||||
numProfiles = std::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 = MIN(numEntryPoints, maxEntryPoints);
|
||||
numEntryPoints = std::min(numEntryPoints, maxEntryPoints);
|
||||
|
||||
FFMPEG_LOG(" Profile %s:", VAProfileName(profile));
|
||||
for (int e = 0; e < numEntryPoints; e++) {
|
||||
|
@ -26,7 +26,7 @@ if CONFIG['CC_TYPE'] == 'gcc':
|
||||
CXXFLAGS += [
|
||||
'-Wno-attributes',
|
||||
]
|
||||
if CONFIG['MOZ_WAYLAND']:
|
||||
if CONFIG['MOZ_WIDGET_GTK']:
|
||||
CXXFLAGS += CONFIG['MOZ_GTK3_CFLAGS']
|
||||
if CONFIG['MOZ_ENABLE_VAAPI'] or CONFIG['MOZ_ENABLE_V4L2']:
|
||||
UNIFIED_SOURCES += ['../FFmpegVideoFramePool.cpp']
|
||||
|
@ -26,7 +26,7 @@ if CONFIG["CC_TYPE"] == "gcc":
|
||||
CXXFLAGS += [
|
||||
"-Wno-attributes",
|
||||
]
|
||||
if CONFIG["MOZ_WAYLAND"]:
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
||||
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
|
||||
if CONFIG["MOZ_ENABLE_VAAPI"] or CONFIG["MOZ_ENABLE_V4L2"]:
|
||||
UNIFIED_SOURCES += ["../FFmpegVideoFramePool.cpp"]
|
||||
|
@ -26,7 +26,7 @@ if CONFIG["CC_TYPE"] == "gcc":
|
||||
CXXFLAGS += [
|
||||
"-Wno-attributes",
|
||||
]
|
||||
if CONFIG["MOZ_WAYLAND"]:
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
||||
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
|
||||
if CONFIG["MOZ_ENABLE_VAAPI"] or CONFIG["MOZ_ENABLE_V4L2"]:
|
||||
UNIFIED_SOURCES += ["../FFmpegVideoFramePool.cpp"]
|
||||
|
@ -59,7 +59,7 @@ bool FFVPXRuntimeLinker::Init() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
sLinkStatus = LinkStatus_FAILED;
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
sFFVPXLib.LinkVAAPILibs();
|
||||
#endif
|
||||
|
||||
|
@ -37,7 +37,7 @@ if CONFIG["CC_TYPE"] == "gcc":
|
||||
DEFINES["FFVPX_VERSION"] = 46465650
|
||||
DEFINES["USING_MOZFFVPX"] = True
|
||||
|
||||
if CONFIG["MOZ_WAYLAND"]:
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
||||
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
|
||||
if CONFIG["MOZ_ENABLE_VAAPI"] or CONFIG["MOZ_ENABLE_V4L2"]:
|
||||
UNIFIED_SOURCES += ["../FFmpegVideoFramePool.cpp"]
|
||||
|
@ -22,7 +22,7 @@ UNIFIED_SOURCES += [
|
||||
"FFmpegRuntimeLinker.cpp",
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_WAYLAND"]:
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
||||
include("/ipc/chromium/chromium-config.mozbuild")
|
||||
|
||||
FINAL_LIBRARY = "xul"
|
||||
|
Loading…
Reference in New Issue
Block a user