Bug 600620 - 1/2 - Expose feature status block reason so that it can be used by about:support - r=vladimir, a=blocking2.0-b7

This commit is contained in:
Benoit Jacob 2010-10-06 21:40:08 -07:00
parent 45806139e2
commit 764d885972
8 changed files with 71 additions and 29 deletions

View File

@ -322,15 +322,15 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
if (gfxInfo) {
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL_OPENGL, &status))) {
if (status == nsIGfxInfo::FEATURE_BLOCKED ||
status == nsIGfxInfo::FEATURE_NOT_AVAILABLE)
if (status == nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION ||
status == nsIGfxInfo::FEATURE_BLOCKED_DEVICE)
{
useOpenGL = PR_FALSE;
}
}
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL_ANGLE, &status))) {
if (status == nsIGfxInfo::FEATURE_BLOCKED ||
status == nsIGfxInfo::FEATURE_NOT_AVAILABLE)
if (status == nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION ||
status == nsIGfxInfo::FEATURE_BLOCKED_DEVICE)
{
useANGLE = PR_FALSE;
}

View File

@ -80,8 +80,7 @@ LayerManagerD3D9::Initialize()
if (gfxInfo) {
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_UNKNOWN &&
status != nsIGfxInfo::FEATURE_AVAILABLE)
if (status != nsIGfxInfo::FEATURE_NO_INFO)
{
NS_WARNING("Direct3D 9-accelerated layers are not supported on this system.");
return PR_FALSE;

View File

@ -154,8 +154,7 @@ LayerManagerOGL::Initialize(GLContext *aExistingContext)
if (gfxInfo) {
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_UNKNOWN &&
status != nsIGfxInfo::FEATURE_AVAILABLE) {
if (status != nsIGfxInfo::FEATURE_NO_INFO) {
NS_WARNING("OpenGL-accelerated layers are not supported on this system.");
return PR_FALSE;
}

View File

@ -285,11 +285,11 @@ gfxWindowsPlatform::UpdateRenderMode()
if (gfxInfo) {
PRInt32 status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT2D, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_UNKNOWN &&
status != nsIGfxInfo::FEATURE_AVAILABLE)
{
if (status != nsIGfxInfo::FEATURE_NO_INFO) {
d2dDisabled = PR_TRUE;
if (status == nsIGfxInfo::FEATURE_BLOCKED) {
if (status == nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION ||
status == nsIGfxInfo::FEATURE_BLOCKED_DEVICE)
{
d2dBlocked = PR_TRUE;
}
}

View File

@ -93,20 +93,27 @@ interface nsIGfxInfo : nsISupports
/*
* A set of return values from GetFeatureStatus
*/
/* We don't have any information about this feature on this hardware */
const long FEATURE_STATUS_UNKNOWN = 0;
/* This feature is available and can be used */
const long FEATURE_AVAILABLE = 1;
/* This feature is not available */
const long FEATURE_NOT_AVAILABLE = 2;
/* This feature is available, but is blocked due to a blocklist entry */
const long FEATURE_BLOCKED = 3;
/* We don't explicitly block or discourage the feature. Which means we'll try getting it from the
* hardware, and see what happens. */
const long FEATURE_NO_INFO = 1;
/* This feature is blocked on this driver version. Updating driver will typically unblock it. */
const long FEATURE_BLOCKED_DRIVER_VERSION = 2;
/* This feature is blocked on this device, regardless of driver version.
* Typically means we hit too many driver crashes without a good reason to hope for them to
* get fixed soon. */
const long FEATURE_BLOCKED_DEVICE = 3;
/* This feature is available and can be used, but is not suggested (e.g. shouldn't be used by default */
const long FEATURE_NOT_SUGGESTED = 4;
const long FEATURE_DISCOURAGED = 4;
/**
* Ask about a feature, and return the status of that feature
*/
long getFeatureStatus(in long aFeature);
/*
* Ask about a feature, return the minimum driver version required for it if its status is
* FEATURE_BLOCKED_DRIVER_VERSION, otherwise return an empty string.
*/
DOMString getFeatureSuggestedDriverVersion(in long aFeature);
};

View File

@ -197,3 +197,8 @@ GfxInfo::GetFeatureStatus(PRInt32 aFeature, PRInt32 *aStatus)
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetFeatureSuggestedDriverVersion(PRInt32 aFeature, nsAString& aSuggestedDriverVersion)
{
return NS_OK;
}

View File

@ -40,6 +40,7 @@
#include "gfxWindowsPlatform.h"
#include "GfxInfo.h"
#include "nsUnicharUtils.h"
#include "nsPrintfCString.h"
#include "mozilla/FunctionTimer.h"
#if defined(MOZ_CRASHREPORTER) && defined(MOZ_ENABLE_LIBXUL)
@ -314,6 +315,7 @@ GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
}
nsresult err;
*aAdapterDeviceID = device.ToInteger(&err, 16);
return NS_OK;
}
@ -495,7 +497,7 @@ static const GfxDriverInfo driverInfo[] = {
*/
{ allWindowsVersions,
vendorIntel, deviceFamilyIntelBlockDirect2D,
nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED,
nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
DRIVER_LESS_THAN, allDriverVersions },
/* implement the blocklist from bug 594877
@ -505,7 +507,7 @@ static const GfxDriverInfo driverInfo[] = {
#define IMPLEMENT_INTEL_DRIVER_BLOCKLIST(winVer, devFamily, driverVer) \
{ winVer, \
vendorIntel, devFamily, \
allFeatures, nsIGfxInfo::FEATURE_BLOCKED, \
allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
DRIVER_LESS_THAN, driverVer },
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsXP, deviceFamilyIntelGMA500, V(6,14,11,1018))
@ -529,14 +531,14 @@ static const GfxDriverInfo driverInfo[] = {
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindows7, deviceFamilyIntelGMAX3000, V(8,15,10,1930))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindows7, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202))
/* OpenGL on any Intel hardware is not suggested */
/* OpenGL on any Intel hardware is discouraged */
{ allWindowsVersions,
vendorIntel, allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_NOT_SUGGESTED,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, allDriverVersions },
{ allWindowsVersions,
vendorIntel, allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_NOT_SUGGESTED,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, allDriverVersions },
/*
@ -567,10 +569,13 @@ ParseDriverVersion(nsAString& aVersion, PRUint64 *aNumericVersion)
return true;
}
NS_IMETHODIMP
GfxInfo::GetFeatureStatus(PRInt32 aFeature, PRInt32 *aStatus)
nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion)
{
PRInt32 status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
aSuggestedDriverVersion.SetIsVoid(PR_TRUE);
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
PRUint32 adapterVendor = 0;
PRUint32 adapterDeviceID = 0;
@ -587,6 +592,8 @@ GfxInfo::GetFeatureStatus(PRInt32 aFeature, PRInt32 *aStatus)
return NS_ERROR_FAILURE;
}
PRUint64 suggestedDriverVersion = 0;
const GfxDriverInfo *info = &driverInfo[0];
while (info->windowsVersion) {
@ -622,6 +629,7 @@ GfxInfo::GetFeatureStatus(PRInt32 aFeature, PRInt32 *aStatus)
switch (info->op) {
case DRIVER_LESS_THAN:
match = driverVersion < info->version;
suggestedDriverVersion = info->version;
break;
case DRIVER_LESS_THAN_OR_EQUAL:
match = driverVersion <= info->version;
@ -665,6 +673,28 @@ GfxInfo::GetFeatureStatus(PRInt32 aFeature, PRInt32 *aStatus)
}
*aStatus = status;
if (status == FEATURE_BLOCKED_DRIVER_VERSION && suggestedDriverVersion) {
aSuggestedDriverVersion.AppendPrintf("%lld.%lld.%lld.%lld",
(suggestedDriverVersion & 0xffff000000000000) >> 48,
(suggestedDriverVersion & 0x0000ffff00000000) >> 32,
(suggestedDriverVersion & 0x00000000ffff0000) >> 16,
(suggestedDriverVersion & 0x000000000000ffff));
}
return NS_OK;
}
NS_IMETHODIMP
GfxInfo::GetFeatureStatus(PRInt32 aFeature, PRInt32 *aStatus)
{
nsString s;
return GetFeatureStatusImpl(aFeature, aStatus, s);
}
NS_IMETHODIMP
GfxInfo::GetFeatureSuggestedDriverVersion(PRInt32 aFeature, nsAString& aSuggestedDriverVersion)
{
PRInt32 i;
return GetFeatureStatusImpl(aFeature, &i, aSuggestedDriverVersion);
}

View File

@ -62,6 +62,8 @@ private:
nsString mDriverVersion;
nsString mDriverDate;
nsString mDeviceKey;
nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion);
};
} // namespace widget