зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288618 - Part 1: Use gfxVars for CanUseHardwareVideoDecoding so we can access it in the GPU process. r=dvander
This commit is contained in:
Родитель
0b8211b299
Коммит
0cd90578a4
|
@ -30,7 +30,7 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
|
||||
struct JSContext;
|
||||
|
@ -78,7 +78,7 @@ IsWebMForced(DecoderDoctorDiagnostics* aDiagnostics)
|
|||
bool mp4supported =
|
||||
DecoderTraits::IsMP4TypeAndEnabled(NS_LITERAL_CSTRING("video/mp4"),
|
||||
aDiagnostics);
|
||||
bool hwsupported = gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
|
||||
bool hwsupported = gfx::gfxVars::CanUseHardwareVideoDecoding();
|
||||
return !mp4supported || !hwsupported || VP9Benchmark::IsVP9DecodeFast();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ TEST_DIRS += [
|
|||
if CONFIG['MOZ_GONK_MEDIACODEC']:
|
||||
DEFINES['MOZ_GONK_MEDIACODEC'] = True
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "MediaPrefs.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -53,7 +54,7 @@ AppleDecoderModule::Init()
|
|||
sIsVTHWAvailable = AppleVTLinker::skPropEnableHWAccel != nullptr;
|
||||
|
||||
sCanUseHardwareVideoDecoder = loaded &&
|
||||
gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
|
||||
gfx::gfxVars::CanUseHardwareVideoDecoding();
|
||||
|
||||
sInitialized = true;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "nsIGfxInfo.h"
|
||||
#include "nsWindowsHelpers.h"
|
||||
#include "GfxDriverInfo.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "MediaInfo.h"
|
||||
#include "MediaPrefs.h"
|
||||
#include "prsystem.h"
|
||||
|
@ -49,7 +49,7 @@ WMFDecoderModule::~WMFDecoderModule()
|
|||
void
|
||||
WMFDecoderModule::Init()
|
||||
{
|
||||
sDXVAEnabled = gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
|
||||
sDXVAEnabled = gfx::gfxVars::CanUseHardwareVideoDecoding();
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -29,6 +29,7 @@ class gfxVarReceiver;
|
|||
_(UseXRender, bool, false) \
|
||||
_(OffscreenFormat, gfxImageFormat, mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32) \
|
||||
_(RequiresAcceleratedGLContextForCompositorOGL, bool, false) \
|
||||
_(CanUseHardwareVideoDecoding, bool, false) \
|
||||
|
||||
/* Add new entries above this line. */
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "mozilla/layers/SharedPlanarYCbCrImage.h"
|
||||
#include "mozilla/layers/SharedRGBImage.h"
|
||||
#include "mozilla/layers/TextureClientRecycleAllocator.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "nsISupportsUtils.h" // for NS_IF_ADDREF
|
||||
#include "YCbCrUtils.h" // for YCbCr conversions
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
|
@ -503,7 +504,7 @@ gfxImageFormat
|
|||
PlanarYCbCrImage::GetOffscreenFormat()
|
||||
{
|
||||
return mOffscreenFormat == SurfaceFormat::UNKNOWN ?
|
||||
gfxPlatform::GetPlatform()->GetOffscreenFormat() :
|
||||
gfxVars::OffscreenFormat() :
|
||||
mOffscreenFormat;
|
||||
}
|
||||
|
||||
|
|
|
@ -2092,6 +2092,18 @@ static bool sBufferRotationCheckPref = true;
|
|||
|
||||
static mozilla::Atomic<bool> sLayersAccelerationPrefsInitialized(false);
|
||||
|
||||
void VideoDecodingFailedChangedCallback(const char* aPref, void*)
|
||||
{
|
||||
sLayersHardwareVideoDecodingFailed = Preferences::GetBool(aPref, false);
|
||||
gfxPlatform::GetPlatform()->UpdateCanUseHardareVideoDecoding();
|
||||
}
|
||||
|
||||
void
|
||||
gfxPlatform::UpdateCanUseHardareVideoDecoding()
|
||||
{
|
||||
gfxVars::SetCanUseHardwareVideoDecoding(CanUseHardwareVideoDecoding());
|
||||
}
|
||||
|
||||
void
|
||||
gfxPlatform::InitAcceleration()
|
||||
{
|
||||
|
@ -2131,11 +2143,14 @@ gfxPlatform::InitAcceleration()
|
|||
}
|
||||
}
|
||||
|
||||
Preferences::AddBoolVarCache(&sLayersHardwareVideoDecodingFailed,
|
||||
"media.hardware-video-decoding.failed",
|
||||
false);
|
||||
sLayersAccelerationPrefsInitialized = true;
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
Preferences::RegisterCallbackAndCall(VideoDecodingFailedChangedCallback,
|
||||
"media.hardware-video-decoding.failed",
|
||||
nullptr,
|
||||
Preferences::ExactMatch);
|
||||
|
||||
FeatureState& gpuProc = gfxConfig::GetFeature(Feature::GPU_PROCESS);
|
||||
if (gfxPrefs::GPUProcessDevEnabled()) {
|
||||
// We want to hide this from about:support, so only set a default if the
|
||||
|
@ -2161,8 +2176,6 @@ gfxPlatform::InitAcceleration()
|
|||
gpu->EnableGPUProcess();
|
||||
}
|
||||
}
|
||||
|
||||
sLayersAccelerationPrefsInitialized = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -456,7 +456,7 @@ public:
|
|||
|
||||
static bool OffMainThreadCompositingEnabled();
|
||||
|
||||
virtual bool CanUseHardwareVideoDecoding();
|
||||
void UpdateCanUseHardareVideoDecoding();
|
||||
|
||||
// Returns a prioritized list of all available compositor backends.
|
||||
void GetCompositorBackends(bool useAcceleration, nsTArray<mozilla::layers::LayersBackend>& aBackends);
|
||||
|
@ -752,6 +752,8 @@ protected:
|
|||
static already_AddRefed<mozilla::gfx::ScaledFont>
|
||||
GetScaledFontForFontWithCairoSkia(mozilla::gfx::DrawTarget* aTarget, gfxFont* aFont);
|
||||
|
||||
virtual bool CanUseHardwareVideoDecoding();
|
||||
|
||||
int8_t mAllowDownloadableFonts;
|
||||
int8_t mGraphiteShapingEnabled;
|
||||
int8_t mOpenTypeSVGEnabled;
|
||||
|
|
|
@ -380,6 +380,9 @@ bool
|
|||
gfxWindowsPlatform::CanUseHardwareVideoDecoding()
|
||||
{
|
||||
DeviceManagerDx* dm = DeviceManagerDx::Get();
|
||||
if (!dm) {
|
||||
return false;
|
||||
}
|
||||
if (!gfxPrefs::LayersPreferD3D9() && !dm->TextureSharingWorks()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2021,6 +2024,10 @@ gfxWindowsPlatform::ImportGPUDeviceData(const mozilla::gfx::GPUDeviceData& aData
|
|||
}
|
||||
}
|
||||
|
||||
// CanUseHardwareVideoDecoding depends on d3d11 state, so update
|
||||
// the cached value now.
|
||||
UpdateCanUseHardareVideoDecoding();
|
||||
|
||||
// For completeness (and messaging in about:support). Content recomputes this
|
||||
// on its own, and we won't use ANGLE in the UI process if we're using a GPU
|
||||
// process.
|
||||
|
|
Загрузка…
Ссылка в новой задаче