зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1151611 - Expose DXVA status in about:support. r=cpearce,felipe
--HG-- extra : rebase_source : e65d849641d33218d9ee2b9bb6eeafb602a6f8e6
This commit is contained in:
Родитель
d6da985b93
Коммит
fa7ac228d2
|
@ -25,6 +25,9 @@
|
|||
#include "mozilla/layers/ShadowLayers.h"
|
||||
#include "ClientLayerManager.h"
|
||||
#include "nsQueryObject.h"
|
||||
#ifdef MOZ_FMP4
|
||||
#include "MP4Reader.h"
|
||||
#endif
|
||||
|
||||
#include "nsIScrollableFrame.h"
|
||||
|
||||
|
@ -2236,6 +2239,27 @@ nsDOMWindowUtils::GetLayerManagerRemote(bool* retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetSupportsHardwareH264Decoding(bool* retval)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
#ifdef MOZ_FMP4
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
LayerManager *mgr = widget->GetLayerManager();
|
||||
if (!mgr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*retval = MP4Reader::IsVideoAccelerated(mgr->GetCompositorBackendType());
|
||||
#else
|
||||
*retval = false;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::StartFrameTimeRecording(uint32_t *startIndex)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ interface nsIJSRAIIHelper;
|
|||
interface nsIContentPermissionRequest;
|
||||
interface nsIObserver;
|
||||
|
||||
[scriptable, uuid(7ecfd6e7-120a-4567-85f7-14277f4c6d9f)]
|
||||
[scriptable, uuid(55d6b97f-0717-449d-ac6c-cdaba0a9b698)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
|
@ -1327,6 +1327,13 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
*/
|
||||
readonly attribute boolean layerManagerRemote;
|
||||
|
||||
/**
|
||||
* True if we can initialize a hardware-backed h264 decoder for a simple
|
||||
* test video, does not mean that all h264 video decoding will be done
|
||||
* in hardware.
|
||||
*/
|
||||
readonly attribute boolean supportsHardwareH264Decoding;
|
||||
|
||||
/**
|
||||
* Record (and return) frame-intervals for frames which were presented
|
||||
* between calling StartFrameTimeRecording and StopFrameTimeRecording.
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
using mozilla::layers::Image;
|
||||
using mozilla::layers::LayerManager;
|
||||
using mozilla::layers::ImageContainer;
|
||||
using mozilla::layers::LayersBackend;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -70,6 +71,37 @@ TrackTypeToStr(TrackType aTrack)
|
|||
}
|
||||
#endif
|
||||
|
||||
uint8_t sTestExtraData[40] = { 0x01, 0x64, 0x00, 0x0a, 0xff, 0xe1, 0x00, 0x17, 0x67, 0x64, 0x00, 0x0a, 0xac, 0xd9, 0x44, 0x26, 0x84, 0x00, 0x00, 0x03,
|
||||
0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xc8, 0x3c, 0x48, 0x96, 0x58, 0x01, 0x00, 0x06, 0x68, 0xeb, 0xe3, 0xcb, 0x22, 0xc0 };
|
||||
|
||||
/* static */ bool
|
||||
MP4Reader::IsVideoAccelerated(LayersBackend aBackend)
|
||||
{
|
||||
VideoInfo config;
|
||||
config.mMimeType = "video/avc";
|
||||
config.mId = 1;
|
||||
config.mDuration = 40000;
|
||||
config.mMediaTime = 0;
|
||||
config.mDisplay = config.mImage = nsIntSize(64, 64);
|
||||
config.mExtraData = new MediaByteBuffer();
|
||||
config.mExtraData->AppendElements(sTestExtraData, 40);
|
||||
|
||||
PlatformDecoderModule::Init();
|
||||
|
||||
nsRefPtr<PlatformDecoderModule> platform = PlatformDecoderModule::Create();
|
||||
|
||||
nsRefPtr<MediaDataDecoder> decoder =
|
||||
platform->CreateDecoder(config, nullptr, nullptr, aBackend, nullptr);
|
||||
nsresult rv = decoder->Init();
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
bool result = decoder->IsHardwareAccelerated();
|
||||
|
||||
decoder->Shutdown();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
AccumulateSPSTelemetry(const MediaByteBuffer* aExtradata)
|
||||
{
|
||||
|
|
|
@ -88,6 +88,8 @@ public:
|
|||
|
||||
virtual void DisableHardwareAcceleration() override;
|
||||
|
||||
static bool IsVideoAccelerated(layers::LayersBackend aBackend);
|
||||
|
||||
private:
|
||||
|
||||
bool InitDemuxer();
|
||||
|
|
|
@ -118,8 +118,7 @@ PlatformDecoderModule::CreateCDMWrapper(CDMProxy* aProxy,
|
|||
already_AddRefed<PlatformDecoderModule>
|
||||
PlatformDecoderModule::Create()
|
||||
{
|
||||
// Note: This runs on the decode thread.
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
// Note: This (usually) runs on the decode thread.
|
||||
|
||||
nsRefPtr<PlatformDecoderModule> m(CreatePDM());
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ GonkVideoDecoderManager::GonkVideoDecoderManager(
|
|||
, mNativeWindow(nullptr)
|
||||
, mPendingVideoBuffersLock("GonkVideoDecoderManager::mPendingVideoBuffersLock")
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread.");
|
||||
MOZ_ASSERT(mImageContainer);
|
||||
MOZ_COUNT_CTOR(GonkVideoDecoderManager);
|
||||
mMimeType = aConfig.mMimeType;
|
||||
mVideoWidth = aConfig.mDisplay.width;
|
||||
|
|
|
@ -49,8 +49,12 @@ WMFMediaDataDecoder::Init()
|
|||
nsresult
|
||||
WMFMediaDataDecoder::Shutdown()
|
||||
{
|
||||
mTaskQueue->Dispatch(
|
||||
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown));
|
||||
if (mTaskQueue) {
|
||||
mTaskQueue->Dispatch(
|
||||
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown));
|
||||
} else {
|
||||
ProcessShutdown();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
|
|
|
@ -78,8 +78,6 @@ WMFVideoMFTManager::WMFVideoMFTManager(
|
|||
// mVideoStride, mVideoWidth, mVideoHeight, mUseHwAccel are initialized in
|
||||
// Init().
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread.");
|
||||
MOZ_ASSERT(mImageContainer);
|
||||
MOZ_COUNT_CTOR(WMFVideoMFTManager);
|
||||
|
||||
// Need additional checks/params to check vp8/vp9
|
||||
|
@ -165,7 +163,12 @@ WMFVideoMFTManager::InitializeDXVA()
|
|||
|
||||
// The DXVA manager must be created on the main thread.
|
||||
nsRefPtr<CreateDXVAManagerEvent> event(new CreateDXVAManagerEvent(mLayersBackend));
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_SYNC);
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
event->Run();
|
||||
} else {
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_SYNC);
|
||||
}
|
||||
mDXVA2Manager = event->mDXVA2Manager;
|
||||
|
||||
return mDXVA2Manager != nullptr;
|
||||
|
|
|
@ -37,6 +37,8 @@ pendingReports=All Crash Reports (including #1 pending crash in the given time r
|
|||
# "GPU Accelerated Windows: 0/2"
|
||||
acceleratedWindows = GPU Accelerated Windows
|
||||
|
||||
supportsHardwareH264 = Supports Hardware H264 Decoding
|
||||
|
||||
# LOCALIZATION NOTE (rawDataCopied) Text displayed in a mobile "Toast" to user when the
|
||||
# raw data is successfully copied to the clipboard via button press.
|
||||
rawDataCopied=Raw data copied to clipboard
|
||||
|
|
|
@ -313,6 +313,7 @@ let dataProviders = {
|
|||
try {
|
||||
data.windowLayerManagerType = winUtils.layerManagerType;
|
||||
data.windowLayerManagerRemote = winUtils.layerManagerRemote;
|
||||
data.supportsHardwareH264 = winUtils.supportsHardwareH264Decoding;
|
||||
}
|
||||
catch (e) {
|
||||
continue;
|
||||
|
|
|
@ -199,6 +199,9 @@ const SNAPSHOT_SCHEMA = {
|
|||
windowLayerManagerRemote: {
|
||||
type: "boolean",
|
||||
},
|
||||
supportsHardwareH264: {
|
||||
type: "boolean",
|
||||
},
|
||||
numAcceleratedWindowsMessage: {
|
||||
type: "array",
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче