зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1120128 - Implement blacklist for DXVA and blacklist AMD Radeon HD 5800. r=Bas
--HG-- extra : rebase_source : 782dc73a9f284c7a0d98061f2fe2dfb87e3bb149
This commit is contained in:
Родитель
978bc1c194
Коммит
e0f2ca34db
|
@ -154,7 +154,8 @@ WMFVideoMFTManager::InitializeDXVA()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (gfxWindowsPlatform::GetPlatform()->IsWARP()) {
|
||||
if (gfxWindowsPlatform::GetPlatform()->IsWARP() ||
|
||||
!gfxPlatform::CanUseDXVA()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ EXPORTS += [
|
|||
'AsyncEventRunner.h',
|
||||
'MediaSourceDecoder.h',
|
||||
'MediaSourceReader.h',
|
||||
'ResourceQueue.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
|
|
|
@ -111,7 +111,8 @@ WMFReader::InitializeDXVA()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (gfxWindowsPlatform::GetPlatform()->IsWARP()) {
|
||||
if (gfxWindowsPlatform::GetPlatform()->IsWARP() ||
|
||||
!gfxPlatform::CanUseDXVA()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2164,6 +2164,7 @@ gfxPlatform::OptimalFormatForContent(gfxContentType aContent)
|
|||
*/
|
||||
static bool sLayersSupportsD3D9 = false;
|
||||
static bool sLayersSupportsD3D11 = false;
|
||||
static bool sLayersSupportsDXVA = false;
|
||||
static bool sBufferRotationCheckPref = true;
|
||||
static bool sPrefBrowserTabsRemoteAutostart = false;
|
||||
|
||||
|
@ -2205,6 +2206,11 @@ InitLayersAccelerationPrefs()
|
|||
// Always support D3D11 when WARP is allowed.
|
||||
sLayersSupportsD3D11 = true;
|
||||
}
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DXVA, &status))) {
|
||||
if (status == nsIGfxInfo::FEATURE_STATUS_OK) {
|
||||
sLayersSupportsDXVA = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -2231,6 +2237,15 @@ gfxPlatform::CanUseDirect3D11()
|
|||
return sLayersSupportsD3D11;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::CanUseDXVA()
|
||||
{
|
||||
// this function is called from the compositor thread, so it is not
|
||||
// safe to init the prefs etc. from here.
|
||||
MOZ_ASSERT(sLayersAccelerationPrefsInitialized);
|
||||
return sLayersSupportsDXVA;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::BufferRotationEnabled()
|
||||
{
|
||||
|
|
|
@ -481,6 +481,7 @@ public:
|
|||
|
||||
static bool CanUseDirect3D9();
|
||||
static bool CanUseDirect3D11();
|
||||
static bool CanUseDXVA();
|
||||
|
||||
/**
|
||||
* Is it possible to use buffer rotation. Note that these
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace mp4_demuxer {
|
|||
|
||||
BufferStream::BufferStream()
|
||||
: mStartOffset(0)
|
||||
, mLogicalLength(0)
|
||||
, mStartIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -19,12 +21,33 @@ BufferStream::BufferStream()
|
|||
BufferStream::ReadAt(int64_t aOffset, void* aData, size_t aLength,
|
||||
size_t* aBytesRead)
|
||||
{
|
||||
if (aOffset < mStartOffset || aOffset > mStartOffset + mData.Length()) {
|
||||
if (aOffset < (mStartOffset + mStartIndex) ||
|
||||
mData.IsEmpty() ||
|
||||
aOffset > mStartOffset + mData.LastElement()->Length()) {
|
||||
return false;
|
||||
}
|
||||
*aBytesRead =
|
||||
std::min(aLength, size_t(mStartOffset + mData.Length() - aOffset));
|
||||
memcpy(aData, &mData[aOffset - mStartOffset], *aBytesRead);
|
||||
|
||||
aOffset -= mStartOffset;
|
||||
size_t index = mStartIndex;
|
||||
*aBytesRead = 0;
|
||||
|
||||
uint8_t* dest = (uint8_t*)aData;
|
||||
|
||||
for (uint32_t i = 0; i < mData.Length() && aLength; i++) {
|
||||
ResourceItem* item = mData[i];
|
||||
if (aOffset >= index && aOffset < item->Length()) {
|
||||
size_t count = std::min(item->Length() - aOffset, (uint64_t)aLength);
|
||||
*aBytesRead += count;
|
||||
memcpy(dest, &item->mData[aOffset], count);
|
||||
dest += count;
|
||||
aLength -= count;
|
||||
}
|
||||
aOffset -= item->Length();
|
||||
index = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -38,28 +61,36 @@ BufferStream::CachedReadAt(int64_t aOffset, void* aData, size_t aLength,
|
|||
/*virtual*/ bool
|
||||
BufferStream::Length(int64_t* aLength)
|
||||
{
|
||||
*aLength = mStartOffset + mData.Length();
|
||||
*aLength = mLogicalLength;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
BufferStream::DiscardBefore(int64_t aOffset)
|
||||
{
|
||||
if (aOffset > mStartOffset) {
|
||||
mData.RemoveElementsAt(0, aOffset - mStartOffset);
|
||||
mStartOffset = aOffset;
|
||||
while (!mData.IsEmpty() &&
|
||||
mStartOffset + mData[0]->mData.Length() <= aOffset) {
|
||||
mStartOffset += mData[0]->mData.Length();
|
||||
mData.RemoveElementAt(0);
|
||||
}
|
||||
mStartIndex = aOffset - mStartOffset;
|
||||
}
|
||||
|
||||
void
|
||||
BufferStream::AppendBytes(const uint8_t* aData, size_t aLength)
|
||||
{
|
||||
mData.AppendElements(aData, aLength);
|
||||
mData.AppendElement(new ResourceItem(aData, aLength));
|
||||
}
|
||||
|
||||
void
|
||||
BufferStream::AppendData(ResourceItem* aItem)
|
||||
{
|
||||
mData.AppendElement(aItem);
|
||||
}
|
||||
|
||||
MediaByteRange
|
||||
BufferStream::GetByteRange()
|
||||
{
|
||||
return MediaByteRange(mStartOffset, mStartOffset + mData.Length());
|
||||
return MediaByteRange(mStartOffset + mStartIndex, mLogicalLength);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "mp4_demuxer/mp4_demuxer.h"
|
||||
#include "nsTArray.h"
|
||||
#include "ResourceQueue.h"
|
||||
|
||||
namespace mp4_demuxer {
|
||||
|
||||
|
@ -18,21 +19,23 @@ public:
|
|||
*/
|
||||
BufferStream();
|
||||
|
||||
virtual bool ReadAt(int64_t aOffset, void* aData, size_t aLength,
|
||||
size_t* aBytesRead) MOZ_OVERRIDE;
|
||||
virtual bool CachedReadAt(int64_t aOffset, void* aData, size_t aLength,
|
||||
size_t* aBytesRead) MOZ_OVERRIDE;
|
||||
virtual bool Length(int64_t* aLength) MOZ_OVERRIDE;
|
||||
bool ReadAt(int64_t aOffset, void* aData, size_t aLength,
|
||||
size_t* aBytesRead);
|
||||
bool CachedReadAt(int64_t aOffset, void* aData, size_t aLength,
|
||||
size_t* aBytesRead);
|
||||
bool Length(int64_t* aLength);
|
||||
|
||||
virtual void DiscardBefore(int64_t aOffset) MOZ_OVERRIDE;
|
||||
void DiscardBefore(int64_t aOffset);
|
||||
|
||||
void AppendBytes(const uint8_t* aData, size_t aLength);
|
||||
void AppendData(mozilla::ResourceItem* aItem);
|
||||
|
||||
mozilla::MediaByteRange GetByteRange();
|
||||
|
||||
private:
|
||||
int64_t mStartOffset;
|
||||
nsTArray<uint8_t> mData;
|
||||
int64_t mLogicalLength;
|
||||
int64_t mStartIndex;
|
||||
nsTArray<nsRefPtr<mozilla::ResourceItem>> mData;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -214,6 +214,9 @@ const GfxDeviceFamily* GfxDriverInfo::GetDeviceFamily(DeviceFamily id)
|
|||
case Nvidia310M:
|
||||
APPEND_DEVICE(0x0A70);
|
||||
break;
|
||||
case AMDRadeonHD5800:
|
||||
APPEND_DEVICE(0x6899);
|
||||
break;
|
||||
// This should never happen, but we get a warning if we don't handle this.
|
||||
case DeviceFamilyMax:
|
||||
NS_WARNING("Invalid DeviceFamily id");
|
||||
|
|
|
@ -73,6 +73,7 @@ enum DeviceFamily {
|
|||
RadeonX1000,
|
||||
Geforce7300GT,
|
||||
Nvidia310M,
|
||||
AMDRadeonHD5800,
|
||||
DeviceFamilyMax
|
||||
};
|
||||
|
||||
|
|
|
@ -123,6 +123,9 @@ GetPrefNameForFeature(int32_t aFeature)
|
|||
case nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS:
|
||||
name = BLACKLIST_PREF_BRANCH "layers.direct3d11";
|
||||
break;
|
||||
case nsIGfxInfo::FEATURE_DXVA:
|
||||
name = BLACKLIST_PREF_BRANCH "dxva";
|
||||
break;
|
||||
case nsIGfxInfo::FEATURE_OPENGL_LAYERS:
|
||||
name = BLACKLIST_PREF_BRANCH "layers.opengl";
|
||||
break;
|
||||
|
@ -287,6 +290,8 @@ BlacklistFeatureToGfxFeature(const nsAString& aFeature)
|
|||
return nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS;
|
||||
else if (aFeature.EqualsLiteral("DIRECT3D_11_LAYERS"))
|
||||
return nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS;
|
||||
else if (aFeature.EqualsLiteral("DXVA"))
|
||||
return nsIGfxInfo::FEATURE_DXVA;
|
||||
else if (aFeature.EqualsLiteral("OPENGL_LAYERS"))
|
||||
return nsIGfxInfo::FEATURE_OPENGL_LAYERS;
|
||||
else if (aFeature.EqualsLiteral("WEBGL_OPENGL"))
|
||||
|
@ -842,6 +847,7 @@ GfxInfoBase::EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo)
|
|||
nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS,
|
||||
nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS,
|
||||
nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
|
||||
nsIGfxInfo::FEATURE_DXVA,
|
||||
nsIGfxInfo::FEATURE_OPENGL_LAYERS,
|
||||
nsIGfxInfo::FEATURE_WEBGL_OPENGL,
|
||||
nsIGfxInfo::FEATURE_WEBGL_ANGLE,
|
||||
|
|
|
@ -87,6 +87,8 @@ interface nsIGfxInfo : nsISupports
|
|||
const long FEATURE_WEBRTC_HW_ACCELERATION = 10;
|
||||
/* Whether Direct3D 11 is supported for layers. */
|
||||
const long FEATURE_DIRECT3D_11_LAYERS = 11;
|
||||
/* Whether DXVA is supported for video decoding. */
|
||||
const long FEATURE_DXVA = 12;
|
||||
|
||||
/*
|
||||
* A set of return values from GetFeatureStatus
|
||||
|
|
|
@ -1034,6 +1034,11 @@ GfxInfo::GetGfxDriverInfo()
|
|||
(nsAString&)GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), (GfxDeviceFamily*)GfxDriverInfo::GetDeviceFamily(Nvidia310M),
|
||||
nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
|
||||
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions);
|
||||
|
||||
APPEND_TO_DRIVER_BLOCKLIST2(DRIVER_OS_ALL,
|
||||
(nsAString&)GfxDriverInfo::GetDeviceVendor(VendorATI), (GfxDeviceFamily*)GfxDriverInfo::GetDeviceFamily(AMDRadeonHD5800),
|
||||
nsIGfxInfo::FEATURE_DXVA, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
|
||||
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions);
|
||||
}
|
||||
return *mDriverInfo;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче