Backed out changeset 6ee70eb03b02 (bug 1183788) for Android crashes.

This commit is contained in:
Ryan VanderMeulen 2015-08-05 10:24:55 -04:00
Родитель 3ace4eac25
Коммит cf74a0c719
4 изменённых файлов: 29 добавлений и 31 удалений

Просмотреть файл

@ -18,7 +18,6 @@
#include "SurfaceTexture.h"
#include "GLContext.h"
#include "mozilla/Preferences.h"
#include "gfxPlatform.h"
using namespace mozilla;
using namespace mozilla::jni;
@ -100,6 +99,8 @@ AndroidSurfaceTexture::Attach(GLContext* aContext, PRIntervalTime aTimeout)
mAttachedContext->MakeCurrent();
aContext->fGenTextures(1, &mTexture);
UpdateCanDetach();
return mSurfaceTexture->AttachToGLContext(mTexture);
}
@ -125,9 +126,25 @@ AndroidSurfaceTexture::Detach()
return NS_OK;
}
void
AndroidSurfaceTexture::UpdateCanDetach()
{
// The API for attach/detach only exists on 16+, and PowerVR has some sort of
// fencing issue. Additionally, attach/detach seems to be busted on at least some
// Mali adapters (400MP2 for sure, bug 1131793)
bool canDetach = Preferences::GetBool("gfx.SurfaceTexture.detach.enabled", true);
mCanDetach = AndroidBridge::Bridge()->GetAPIVersion() >= 16 &&
(!mAttachedContext || mAttachedContext->Vendor() != GLVendor::Imagination) &&
(!mAttachedContext || mAttachedContext->Vendor() != GLVendor::ARM /* Mali */) &&
canDetach;
}
bool
AndroidSurfaceTexture::Init(GLContext* aContext, GLuint aTexture)
{
UpdateCanDetach();
if (!aTexture && !CanDetach()) {
// We have no texture and cannot initialize detached, bail out
return false;
@ -165,6 +182,7 @@ AndroidSurfaceTexture::AndroidSurfaceTexture()
, mSurface()
, mMonitor("AndroidSurfaceTexture::mContextMonitor")
, mAttachedContext(nullptr)
, mCanDetach(false)
{
}

Просмотреть файл

@ -63,7 +63,7 @@ public:
// Ability to detach is based on API version (16+), and we also block PowerVR since it has some type
// of fencing problem. Bug 1100126.
bool CanDetach() { return gfxPlatform::GetPlatform()->CanDetachSurfaceTexture(); }
bool CanDetach() { return mCanDetach; }
GLContext* GetAttachedContext() { return mAttachedContext; }
@ -95,6 +95,7 @@ private:
~AndroidSurfaceTexture();
bool Init(GLContext* aContext, GLuint aTexture);
void UpdateCanDetach();
GLuint mTexture;
widget::sdk::SurfaceTexture::GlobalRef mSurfaceTexture;
@ -102,6 +103,7 @@ private:
Monitor mMonitor;
GLContext* mAttachedContext;
bool mCanDetach;
RefPtr<AndroidNativeWindow> mNativeWindow;
int mID;

Просмотреть файл

@ -83,7 +83,6 @@
#ifdef MOZ_WIDGET_ANDROID
#include "TexturePoolOGL.h"
#include "AndroidBridge.h"
#endif
#ifdef MOZ_WIDGET_GONK
@ -580,18 +579,6 @@ gfxPlatform::Init()
if (XRE_IsParentProcess() && gfxPrefs::HardwareVsyncEnabled()) {
gPlatform->mVsyncSource = gPlatform->CreateHardwareVsyncSource();
}
// The API for attach/detach only exists on 16+, and PowerVR has some sort of
// fencing issue. Additionally, attach/detach seems to be busted on at least some
// Mali adapters (400MP2 for sure, bug 1131793)
#ifdef MOZ_WIDGET_ANDROID
nsString vendorID;
gfxInfo->GetAdapterVendorID(vendorID);
gPlatform->mCanDetachSurfaceTexture = AndroidBridge::Bridge()->GetAPIVersion() >= 16 &&
!vendorID.EqualsLiteral("Imagination") &&
!vendorID.EqualsLiteral("ARM") &&
Preferences::GetBool("gfx.SurfaceTexture.detach.enabled", true);
#endif
}
static bool sLayersIPCIsUp = false;

Просмотреть файл

@ -41,7 +41,6 @@ class SRGBOverrideObserver;
namespace mozilla {
namespace gl {
class SkiaGLGlue;
class GLContext;
} // namespace gl
namespace gfx {
class DrawTarget;
@ -229,7 +228,7 @@ public:
CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
virtual already_AddRefed<DrawTarget>
CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize,
CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize,
int32_t aStride, mozilla::gfx::SurfaceFormat aFormat);
/**
@ -343,8 +342,8 @@ public:
*CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
const gfxFontStyle *aStyle,
gfxUserFontSet *aUserFontSet) = 0;
/**
* Look up a local platform font using the full font face name.
* (Needed to support @font-face src local().)
@ -435,7 +434,7 @@ public:
// in some situations, need to make decisions about ambiguous characters, may need to look at multiple pref langs
void GetLangPrefs(eFontPrefLang aPrefLangs[], uint32_t &aLen, eFontPrefLang aCharLang, eFontPrefLang aPageLang);
/**
* Iterate over pref fonts given a list of lang groups. For a single lang
* group, multiple pref fonts are possible. If error occurs, returns false,
@ -458,13 +457,13 @@ public:
// convert a enum constant to lang group string (i.e. eFontPrefLang_ChineseTW ==> "zh-TW")
static const char* GetPrefLangName(eFontPrefLang aLang);
// map a Unicode range (based on char code) to a font language for Preferences
static eFontPrefLang GetFontPrefLangFor(uint8_t aUnicodeRange);
// returns true if a pref lang is CJK
static bool IsLangCJK(eFontPrefLang aLang);
// helper method to add a pref lang to an array, if not already in array
static void AppendPrefLang(eFontPrefLang aPrefLangs[], uint32_t& aLen, eFontPrefLang aAddLang);
@ -653,12 +652,6 @@ public:
// devices. Currently this is only used on Windows.
virtual void GetDeviceInitData(mozilla::gfx::DeviceInitData* aOut);
/**
* Used to test whether surface texture detach is enabled. Ability to detach
* is based on API Version and device GPU as well as a preference.
*/
bool CanDetachSurfaceTexture() { return mCanDetachSurfaceTexture; }
protected:
gfxPlatform();
virtual ~gfxPlatform();
@ -736,7 +729,7 @@ protected:
int8_t mBidiNumeralOption;
// whether to always search font cmaps globally
// whether to always search font cmaps globally
// when doing system font fallback
int8_t mFallbackUsesCmaps;
@ -794,8 +787,6 @@ private:
// Backend that we are compositing with. NONE, if no compositor has been
// created yet.
mozilla::layers::LayersBackend mCompositorBackend;
bool mCanDetachSurfaceTexture;
};
#endif /* GFX_PLATFORM_H */