зеркало из https://github.com/mozilla/gecko-dev.git
Bug 625508. This moves the GfxInfo checks out of LayerManagerOGL and into the callers. r=vlad
--HG-- extra : rebase_source : 6545f8a3982b04147b41907f1d2f2dd4768538e2
This commit is contained in:
Родитель
9b50356c4e
Коммит
47330451db
|
@ -70,6 +70,7 @@ LayerManagerD3D9::Initialize()
|
|||
{
|
||||
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
|
||||
/* XXX: this preference and blacklist code should move out of the layer manager */
|
||||
PRBool forceAccelerate = PR_FALSE;
|
||||
if (prefs) {
|
||||
// we should use AddBoolPrefVarCache
|
||||
|
|
|
@ -61,8 +61,6 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
|
||||
#include "nsIGfxInfo.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
|
@ -154,25 +152,6 @@ already_AddRefed<mozilla::gl::GLContext>
|
|||
LayerManagerOGL::CreateContext()
|
||||
{
|
||||
nsRefPtr<GLContext> context;
|
||||
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
|
||||
PRBool forceAccelerate = PR_FALSE;
|
||||
if (prefs) {
|
||||
// we should use AddBoolPrefVarCache
|
||||
prefs->GetBoolPref("layers.acceleration.force-enabled",
|
||||
&forceAccelerate);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo) {
|
||||
PRInt32 status;
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status))) {
|
||||
if (status != nsIGfxInfo::FEATURE_NO_INFO && !forceAccelerate) {
|
||||
NS_WARNING("OpenGL-accelerated layers are not supported on this system.");
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (PR_GetEnv("MOZ_LAYERS_PREFER_EGL")) {
|
||||
|
|
|
@ -181,6 +181,7 @@
|
|||
#include "LayerManagerD3D10.h"
|
||||
#endif
|
||||
#include "LayerManagerOGL.h"
|
||||
#include "nsIGfxInfo.h"
|
||||
#endif
|
||||
#include "BasicLayers.h"
|
||||
|
||||
|
@ -3284,6 +3285,7 @@ struct LayerManagerPrefs {
|
|||
{}
|
||||
PRBool mAccelerateByDefault;
|
||||
PRBool mDisableAcceleration;
|
||||
PRBool mForceAcceleration;
|
||||
PRBool mPreferOpenGL;
|
||||
PRBool mPreferD3D9;
|
||||
};
|
||||
|
@ -3295,6 +3297,8 @@ GetLayerManagerPrefs(LayerManagerPrefs* aManagerPrefs)
|
|||
if (prefs) {
|
||||
prefs->GetBoolPref("layers.acceleration.disabled",
|
||||
&aManagerPrefs->mDisableAcceleration);
|
||||
prefs->GetBoolPref("layers.acceleration.force-enabled",
|
||||
&aManagerPrefs->mForceAcceleration);
|
||||
prefs->GetBoolPref("layers.prefer-opengl",
|
||||
&aManagerPrefs->mPreferOpenGL);
|
||||
prefs->GetBoolPref("layers.prefer-d3d9",
|
||||
|
@ -3383,10 +3387,22 @@ nsWindow::GetLayerManager(LayerManagerPersistence aPersistence, bool* aAllowReta
|
|||
}
|
||||
#endif
|
||||
if (!mLayerManager && prefs.mPreferOpenGL) {
|
||||
nsRefPtr<mozilla::layers::LayerManagerOGL> layerManager =
|
||||
new mozilla::layers::LayerManagerOGL(this);
|
||||
if (layerManager->Initialize()) {
|
||||
mLayerManager = layerManager;
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
|
||||
|
||||
if (gfxInfo && !prefs.mForceAcceleration) {
|
||||
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status);
|
||||
}
|
||||
|
||||
if (status == nsIGfxInfo::FEATURE_NO_INFO) {
|
||||
nsRefPtr<mozilla::layers::LayerManagerOGL> layerManager =
|
||||
new mozilla::layers::LayerManagerOGL(this);
|
||||
if (layerManager->Initialize()) {
|
||||
mLayerManager = layerManager;
|
||||
}
|
||||
|
||||
} else {
|
||||
NS_WARNING("OpenGL accelerated layers are not supported on this system.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "BasicLayers.h"
|
||||
#include "LayerManagerOGL.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsIGfxInfo.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsIObserver.h"
|
||||
|
@ -812,7 +813,21 @@ nsBaseWidget::GetShouldAccelerate()
|
|||
if (disableAcceleration || safeMode)
|
||||
return PR_FALSE;
|
||||
|
||||
if (accelerateByDefault || forceAcceleration)
|
||||
if (forceAcceleration)
|
||||
return PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo) {
|
||||
PRInt32 status;
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status))) {
|
||||
if (status != nsIGfxInfo::FEATURE_NO_INFO) {
|
||||
NS_WARNING("OpenGL-accelerated layers are not supported on this system.");
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (accelerateByDefault)
|
||||
return PR_TRUE;
|
||||
|
||||
/* use the window acceleration flag */
|
||||
|
@ -828,7 +843,6 @@ LayerManager* nsBaseWidget::GetLayerManager(LayerManagerPersistence,
|
|||
bool* aAllowRetaining)
|
||||
{
|
||||
if (!mLayerManager) {
|
||||
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
|
||||
mUseAcceleratedRendering = GetShouldAccelerate();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче