Skip to content

Commit

Permalink
Bug 1263249 - Bubble up unique failureId in GetFeatureStatus. r=mconl…
Browse files Browse the repository at this point in the history
…ey,milan

MozReview-Commit-ID: JveFLuIcbaN
  • Loading branch information
bgirard committed Apr 13, 2016
1 parent b36e24e commit 439aea6
Show file tree
Hide file tree
Showing 30 changed files with 322 additions and 178 deletions.
10 changes: 9 additions & 1 deletion dom/canvas/WebGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ static bool
IsFeatureInBlacklist(const nsCOMPtr<nsIGfxInfo>& gfxInfo, int32_t feature)
{
int32_t status;
if (!NS_SUCCEEDED(gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo, feature, &status)))
nsCString discardFailureId;
if (!NS_SUCCEEDED(gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo, feature,
discardFailureId, &status)))
return false;

return status != nsIGfxInfo::FEATURE_STATUS_OK;
Expand All @@ -444,28 +446,34 @@ HasAcceleratedLayers(const nsCOMPtr<nsIGfxInfo>& gfxInfo)
{
int32_t status;

nsCString discardFailureId;
gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo,
nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS,
discardFailureId,
&status);
if (status)
return true;
gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo,
nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS,
discardFailureId,
&status);
if (status)
return true;
gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo,
nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS,
discardFailureId,
&status);
if (status)
return true;
gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo,
nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
discardFailureId,
&status);
if (status)
return true;
gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo,
nsIGfxInfo::FEATURE_OPENGL_LAYERS,
discardFailureId,
&status);
if (status)
return true;
Expand Down
3 changes: 2 additions & 1 deletion dom/ipc/ContentParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4971,6 +4971,7 @@ ContentParent::RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
bool
ContentParent::RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
int32_t* aStatus,
nsCString* aFailureId,
bool* aSuccess)
{
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
Expand All @@ -4979,7 +4980,7 @@ ContentParent::RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
return true;
}

*aSuccess = NS_SUCCEEDED(gfxInfo->GetFeatureStatus(aFeature, aStatus));
*aSuccess = NS_SUCCEEDED(gfxInfo->GetFeatureStatus(aFeature, *aFailureId, aStatus));
return true;
}

Expand Down
1 change: 1 addition & 0 deletions dom/ipc/ContentParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ class ContentParent final : public PContentParent

virtual bool RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
int32_t* aStatus,
nsCString* aFailureId,
bool* aSuccess) override;

virtual bool RecvGraphicsError(const nsCString& aError) override;
Expand Down
3 changes: 2 additions & 1 deletion dom/ipc/PContent.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,8 @@ parent:
bool isAudio,
bool isVideo);

sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, bool aSuccess);
sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, nsCString aFailureCode,
bool aSuccess);

// Graphics errors
async GraphicsError(nsCString aError);
Expand Down
3 changes: 2 additions & 1 deletion dom/media/android/AndroidMediaPluginHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ static bool IsOmxSupported()
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_STAGEFRIGHT, &status))) {
nsCString discardFailure;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_STAGEFRIGHT, discardFailure, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
NS_WARNING("XXX stagefright blacklisted\n");
return false;
Expand Down
3 changes: 2 additions & 1 deletion dom/media/platforms/android/AndroidDecoderModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ GetFeatureStatus(int32_t aFeature)
{
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
if (!gfxInfo || NS_FAILED(gfxInfo->GetFeatureStatus(aFeature, &status))) {
nsCString discardFailureId;
if (!gfxInfo || NS_FAILED(gfxInfo->GetFeatureStatus(aFeature, discardFailureId, &status))) {
return false;
}
return status == nsIGfxInfo::FEATURE_STATUS_OK;
Expand Down
2 changes: 2 additions & 0 deletions gfx/gl/GLLibraryEGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ static bool
IsAccelAngleSupported(const nsCOMPtr<nsIGfxInfo>& gfxInfo)
{
int32_t angleSupport;
nsCString discardFailureId;
gfxUtils::ThreadSafeGetFeatureStatus(gfxInfo,
nsIGfxInfo::FEATURE_WEBGL_ANGLE,
discardFailureId,
&angleSupport);
return (angleSupport == nsIGfxInfo::FEATURE_STATUS_OK);
}
Expand Down
3 changes: 2 additions & 1 deletion gfx/src/DriverCrashGuard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ DriverCrashGuard::FeatureEnabled(int aFeature, bool aDefault)
return aDefault;
}
int32_t status;
if (!NS_SUCCEEDED(mGfxInfo->GetFeatureStatus(aFeature, &status))) {
nsCString discardFailureId;
if (!NS_SUCCEEDED(mGfxInfo->GetFeatureStatus(aFeature, discardFailureId, &status))) {
return false;
}
return status == nsIGfxInfo::FEATURE_STATUS_OK;
Expand Down
14 changes: 9 additions & 5 deletions gfx/thebes/gfxPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,8 +1243,10 @@ bool gfxPlatform::UseAcceleratedCanvas()
if (mPreferredCanvasBackend == BackendType::SKIA && gfxPrefs::CanvasAzureAccelerated()) {
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
int32_t status;
nsCString discardFailureId;
return !gfxInfo ||
(NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION,
discardFailureId,
&status)) &&
status == nsIGfxInfo::FEATURE_STATUS_OK);
}
Expand Down Expand Up @@ -2074,19 +2076,20 @@ InitLayersAccelerationPrefs()
sPrefBrowserTabsRemoteAutostart = BrowserTabsRemoteAutostart();

nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString discardFailureId;
int32_t status;
#ifdef XP_WIN
if (gfxPrefs::LayersAccelerationForceEnabled()) {
sLayersSupportsD3D9 = true;
sLayersSupportsD3D11 = true;
} else if (!gfxPrefs::LayersAccelerationDisabled() && gfxInfo) {
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, &status))) {
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, discardFailureId, &status))) {
if (status == nsIGfxInfo::FEATURE_STATUS_OK) {
MOZ_ASSERT(!sPrefBrowserTabsRemoteAutostart || IsVistaOrLater());
sLayersSupportsD3D9 = true;
}
}
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &status))) {
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, discardFailureId, &status))) {
if (status == nsIGfxInfo::FEATURE_STATUS_OK) {
sLayersSupportsD3D11 = true;
}
Expand All @@ -2095,7 +2098,7 @@ InitLayersAccelerationPrefs()
// Always support D3D11 when WARP is allowed.
sLayersSupportsD3D11 = true;
}
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE, &status))) {
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE, discardFailureId, &status))) {
if (status == nsIGfxInfo::FEATURE_STATUS_OK) {
gANGLESupportsD3D11 = true;
}
Expand All @@ -2108,7 +2111,7 @@ InitLayersAccelerationPrefs()
Preferences::GetBool("media.windows-media-foundation.use-dxva", true) &&
#endif
NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
&status))) {
discardFailureId, &status))) {
if (status == nsIGfxInfo::FEATURE_STATUS_OK || gfxPrefs::HardwareVideoDecodingForceEnabled()) {
sLayersSupportsHardwareVideoDecoding = true;
}
Expand Down Expand Up @@ -2351,7 +2354,8 @@ AllowOpenGL(bool* aWhitelisted)
gfxInfo->GetData();

int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status))) {
nsCString discardFailureId;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, discardFailureId, &status))) {
if (status == nsIGfxInfo::FEATURE_STATUS_OK) {
*aWhitelisted = true;
return true;
Expand Down
14 changes: 10 additions & 4 deletions gfx/thebes/gfxUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1500,19 +1500,21 @@ class GetFeatureStatusRunnable final : public dom::workers::WorkerMainThreadRunn
GetFeatureStatusRunnable(dom::workers::WorkerPrivate* workerPrivate,
const nsCOMPtr<nsIGfxInfo>& gfxInfo,
int32_t feature,
nsACString& failureId,
int32_t* status)
: WorkerMainThreadRunnable(workerPrivate)
, mGfxInfo(gfxInfo)
, mFeature(feature)
, mStatus(status)
, mFailureId(failureId)
, mNSResult(NS_OK)
{
}

bool MainThreadRun() override
{
if (mGfxInfo) {
mNSResult = mGfxInfo->GetFeatureStatus(mFeature, mStatus);
mNSResult = mGfxInfo->GetFeatureStatus(mFeature, mFailureId, mStatus);
}
return true;
}
Expand All @@ -1529,18 +1531,22 @@ class GetFeatureStatusRunnable final : public dom::workers::WorkerMainThreadRunn
nsCOMPtr<nsIGfxInfo> mGfxInfo;
int32_t mFeature;
int32_t* mStatus;
nsACString& mFailureId;
nsresult mNSResult;
};

/* static */ nsresult
gfxUtils::ThreadSafeGetFeatureStatus(const nsCOMPtr<nsIGfxInfo>& gfxInfo,
int32_t feature, int32_t* status)
int32_t feature, nsACString& failureId,
int32_t* status)
{
if (!NS_IsMainThread()) {
dom::workers::WorkerPrivate* workerPrivate =
dom::workers::GetCurrentThreadWorkerPrivate();

RefPtr<GetFeatureStatusRunnable> runnable =
new GetFeatureStatusRunnable(workerPrivate, gfxInfo, feature, status);
new GetFeatureStatusRunnable(workerPrivate, gfxInfo, feature, failureId,
status);

ErrorResult rv;
runnable->Dispatch(rv);
Expand All @@ -1554,7 +1560,7 @@ gfxUtils::ThreadSafeGetFeatureStatus(const nsCOMPtr<nsIGfxInfo>& gfxInfo,
return runnable->GetNSResult();
}

return gfxInfo->GetFeatureStatus(feature, status);
return gfxInfo->GetFeatureStatus(feature, failureId, status);
}

/* static */ bool
Expand Down
1 change: 1 addition & 0 deletions gfx/thebes/gfxUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class gfxUtils {

static nsresult ThreadSafeGetFeatureStatus(const nsCOMPtr<nsIGfxInfo>& gfxInfo,
int32_t feature,
nsACString& failureId,
int32_t* status);

/**
Expand Down
6 changes: 4 additions & 2 deletions gfx/thebes/gfxWindowsPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,8 @@ gfxWindowsPlatform::CheckD3D11Support(bool* aCanUseHardware)

if (nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo()) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &status))) {
nsCString discardFailureId;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, discardFailureId, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
if (CanUseWARP()) {
*aCanUseHardware = false;
Expand Down Expand Up @@ -2445,7 +2446,8 @@ IsD2DBlacklisted()
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT2D, &status))) {
nsCString discardFailureId;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT2D, discardFailureId, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,8 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE, &status))) {
nsCString discardFailureId;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE, discardFailureId, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
NS_WARNING("VP8 encoder hardware is not whitelisted: disabling.\n");
} else {
Expand All @@ -958,7 +959,8 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE, &status))) {
nsCString discardFailureId;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE, discardFailureId, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
NS_WARNING("VP8 decoder hardware is not whitelisted: disabling.\n");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
<gfxItems>
<gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g35">
<os>WINNT 6.1</os>
<vendor>0xabcd</vendor>
<devices>
Expand All @@ -28,7 +28,7 @@
<driverVersion> 8.52.322.2202 </driverVersion>
<driverVersionComparator> LESS_THAN </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g36">
<os>WINNT 6.1</os>
<vendor>0xabab</vendor>
<devices>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
<gfxItems>

<gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g1">
<os>All</os>
<vendor>0xabcd</vendor>
<versionRange minVersion="15.0" maxVersion="15.0"/>
Expand All @@ -16,7 +16,7 @@
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
</gfxBlacklistEntry>

<gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g2">
<os>All</os>
<vendor>0xabcd</vendor>
<versionRange minVersion="15.0" maxVersion="22.0a1"/>
Expand Down Expand Up @@ -68,7 +68,7 @@
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
</gfxBlacklistEntry>

<gfxBlacklistEntry>
<gfxBlacklistEntry blockID="g11">
<os>All</os>
<vendor>0xabcd</vendor>
<versionRange minVersion="14.0b2" maxVersion="15.0"/>
Expand Down
Loading

0 comments on commit 439aea6

Please sign in to comment.