зеркало из https://github.com/mozilla/pjs.git
Back out 9699edcbcedd (bug 721467) for causing bug 722167.
This commit is contained in:
Родитель
d1a816c4eb
Коммит
e8396257dd
|
@ -382,7 +382,6 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *glVendorString;
|
const char *glVendorString;
|
||||||
const char *glRendererString;
|
|
||||||
|
|
||||||
if (mInitialized) {
|
if (mInitialized) {
|
||||||
glVendorString = (const char *)fGetString(LOCAL_GL_VENDOR);
|
glVendorString = (const char *)fGetString(LOCAL_GL_VENDOR);
|
||||||
|
@ -394,23 +393,11 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||||
};
|
};
|
||||||
mVendor = VendorOther;
|
mVendor = VendorOther;
|
||||||
for (int i = 0; i < VendorOther; ++i) {
|
for (int i = 0; i < VendorOther; ++i) {
|
||||||
if (DoesStringMatch(glVendorString, vendorMatchStrings[i])) {
|
if (DoesVendorStringMatch(glVendorString, vendorMatchStrings[i])) {
|
||||||
mVendor = i;
|
mVendor = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glRendererString = (const char *)fGetString(LOCAL_GL_RENDERER);
|
|
||||||
const char *rendererMatchStrings[RendererOther] = {
|
|
||||||
"Adreno 200"
|
|
||||||
};
|
|
||||||
mRenderer = RendererOther;
|
|
||||||
for (int i = 0; i < RendererOther; ++i) {
|
|
||||||
if (DoesStringMatch(glRendererString, rendererMatchStrings[i])) {
|
|
||||||
mRenderer = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mInitialized) {
|
if (mInitialized) {
|
||||||
|
@ -603,15 +590,6 @@ GLContext::IsExtensionSupported(const char *extension)
|
||||||
return ListHasExtension(fGetString(LOCAL_GL_EXTENSIONS), extension);
|
return ListHasExtension(fGetString(LOCAL_GL_EXTENSIONS), extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
GLContext::CanUploadSubTextures()
|
|
||||||
{
|
|
||||||
// There are certain GPUs that we don't want to use glTexSubImage2D on
|
|
||||||
// because that function can be very slow and/or buggy
|
|
||||||
|
|
||||||
return !(Renderer() == RendererAdreno200);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common code for checking for both GL extensions and GLX extensions.
|
// Common code for checking for both GL extensions and GLX extensions.
|
||||||
bool
|
bool
|
||||||
GLContext::ListHasExtension(const GLubyte *extensions, const char *extension)
|
GLContext::ListHasExtension(const GLubyte *extensions, const char *extension)
|
||||||
|
@ -710,12 +688,7 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
|
||||||
NS_ASSERTION(!mUpdateSurface, "BeginUpdate() without EndUpdate()?");
|
NS_ASSERTION(!mUpdateSurface, "BeginUpdate() without EndUpdate()?");
|
||||||
|
|
||||||
// determine the region the client will need to repaint
|
// determine the region the client will need to repaint
|
||||||
if (!mGLContext->CanUploadSubTextures()) {
|
GetUpdateRegion(aRegion);
|
||||||
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
|
|
||||||
} else {
|
|
||||||
GetUpdateRegion(aRegion);
|
|
||||||
}
|
|
||||||
|
|
||||||
mUpdateRegion = aRegion;
|
mUpdateRegion = aRegion;
|
||||||
|
|
||||||
nsIntRect rgnSize = mUpdateRegion.GetBounds();
|
nsIntRect rgnSize = mUpdateRegion.GetBounds();
|
||||||
|
@ -767,7 +740,6 @@ BasicTextureImage::EndUpdate()
|
||||||
mGLContext->UploadSurfaceToTexture(mUpdateSurface,
|
mGLContext->UploadSurfaceToTexture(mUpdateSurface,
|
||||||
mUpdateRegion,
|
mUpdateRegion,
|
||||||
mTexture,
|
mTexture,
|
||||||
mSize,
|
|
||||||
mTextureState == Created,
|
mTextureState == Created,
|
||||||
mUpdateOffset,
|
mUpdateOffset,
|
||||||
relative);
|
relative);
|
||||||
|
@ -826,7 +798,6 @@ BasicTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion,
|
||||||
mGLContext->UploadSurfaceToTexture(aSurf,
|
mGLContext->UploadSurfaceToTexture(aSurf,
|
||||||
region,
|
region,
|
||||||
mTexture,
|
mTexture,
|
||||||
mSize,
|
|
||||||
mTextureState == Created,
|
mTextureState == Created,
|
||||||
bounds.TopLeft() + aFrom,
|
bounds.TopLeft() + aFrom,
|
||||||
false);
|
false);
|
||||||
|
@ -880,8 +851,7 @@ bool
|
||||||
TiledTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom /* = nsIntPoint(0, 0) */)
|
TiledTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom /* = nsIntPoint(0, 0) */)
|
||||||
{
|
{
|
||||||
nsIntRegion region;
|
nsIntRegion region;
|
||||||
|
if (mTextureState != Valid) {
|
||||||
if (mTextureState != Valid || !mGL->CanUploadSubTextures()) {
|
|
||||||
nsIntRect bounds = nsIntRect(0, 0, mSize.width, mSize.height);
|
nsIntRect bounds = nsIntRect(0, 0, mSize.width, mSize.height);
|
||||||
region = nsIntRegion(bounds);
|
region = nsIntRegion(bounds);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1952,7 +1922,6 @@ ShaderProgramType
|
||||||
GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||||
const nsIntRegion& aDstRegion,
|
const nsIntRegion& aDstRegion,
|
||||||
GLuint& aTexture,
|
GLuint& aTexture,
|
||||||
const nsIntSize& aTextureSize,
|
|
||||||
bool aOverwrite,
|
bool aOverwrite,
|
||||||
const nsIntPoint& aSrcPoint,
|
const nsIntPoint& aSrcPoint,
|
||||||
bool aPixelBuffer)
|
bool aPixelBuffer)
|
||||||
|
@ -2016,7 +1985,6 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||||
if (!aPixelBuffer) {
|
if (!aPixelBuffer) {
|
||||||
data = imageSurface->Data();
|
data = imageSurface->Data();
|
||||||
}
|
}
|
||||||
|
|
||||||
data += DataOffset(imageSurface, aSrcPoint);
|
data += DataOffset(imageSurface, aSrcPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2081,20 +2049,7 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||||
NS_ASSERTION(textureInited || (iterRect->x == 0 && iterRect->y == 0),
|
NS_ASSERTION(textureInited || (iterRect->x == 0 && iterRect->y == 0),
|
||||||
"Must be uploading to the origin when we don't have an existing texture");
|
"Must be uploading to the origin when we don't have an existing texture");
|
||||||
|
|
||||||
bool useTexSubImage2D = true;
|
if (textureInited) {
|
||||||
|
|
||||||
nsIntRect bounds = aDstRegion.GetBounds();
|
|
||||||
|
|
||||||
// Only use glTexSubImage2D when we aren't rendering
|
|
||||||
// the entire texture
|
|
||||||
if (iterRect->x == 0 &&
|
|
||||||
iterRect->y == 0 &&
|
|
||||||
iterRect->width >= aTextureSize.width &&
|
|
||||||
iterRect->height >= aTextureSize.height) {
|
|
||||||
useTexSubImage2D = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (textureInited && useTexSubImage2D) {
|
|
||||||
TexSubImage2D(LOCAL_GL_TEXTURE_2D,
|
TexSubImage2D(LOCAL_GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
iterRect->x,
|
iterRect->x,
|
||||||
|
@ -2145,10 +2100,6 @@ GLContext::TexImage2D(GLenum target, GLint level, GLint internalformat,
|
||||||
GLenum type, const GLvoid *pixels)
|
GLenum type, const GLvoid *pixels)
|
||||||
{
|
{
|
||||||
#ifdef USE_GLES2
|
#ifdef USE_GLES2
|
||||||
|
|
||||||
NS_ASSERTION(format == internalformat,
|
|
||||||
"format and internalformat not the same for glTexImage2D on GLES2");
|
|
||||||
|
|
||||||
// Use GLES-specific workarounds for GL_UNPACK_ROW_LENGTH; these are
|
// Use GLES-specific workarounds for GL_UNPACK_ROW_LENGTH; these are
|
||||||
// implemented in TexSubImage2D.
|
// implemented in TexSubImage2D.
|
||||||
fTexImage2D(target,
|
fTexImage2D(target,
|
||||||
|
|
|
@ -545,7 +545,6 @@ public:
|
||||||
mHasRobustness(false),
|
mHasRobustness(false),
|
||||||
mContextLost(false),
|
mContextLost(false),
|
||||||
mVendor(-1),
|
mVendor(-1),
|
||||||
mRenderer(-1),
|
|
||||||
mDebugMode(0),
|
mDebugMode(0),
|
||||||
mCreationFormat(aFormat),
|
mCreationFormat(aFormat),
|
||||||
mSharedContext(aSharedContext),
|
mSharedContext(aSharedContext),
|
||||||
|
@ -689,21 +688,10 @@ public:
|
||||||
VendorOther
|
VendorOther
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
RendererAdreno200,
|
|
||||||
RendererOther
|
|
||||||
};
|
|
||||||
|
|
||||||
int Vendor() const {
|
int Vendor() const {
|
||||||
return mVendor;
|
return mVendor;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Renderer() const {
|
|
||||||
return mRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CanUploadSubTextures();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this context wraps a double-buffered target, swap the back
|
* If this context wraps a double-buffered target, swap the back
|
||||||
* and front buffers. It should be assumed that after a swap, the
|
* and front buffers. It should be assumed that after a swap, the
|
||||||
|
@ -779,7 +767,6 @@ protected:
|
||||||
bool mFlushGuaranteesResolve;
|
bool mFlushGuaranteesResolve;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void SetFlushGuaranteesResolve(bool aFlushGuaranteesResolve) {
|
void SetFlushGuaranteesResolve(bool aFlushGuaranteesResolve) {
|
||||||
mFlushGuaranteesResolve = aFlushGuaranteesResolve;
|
mFlushGuaranteesResolve = aFlushGuaranteesResolve;
|
||||||
}
|
}
|
||||||
|
@ -1201,7 +1188,6 @@ public:
|
||||||
* \param aSurface Surface to upload.
|
* \param aSurface Surface to upload.
|
||||||
* \param aDstRegion Region of texture to upload to.
|
* \param aDstRegion Region of texture to upload to.
|
||||||
* \param aTexture Texture to use, or 0 to have one created for you.
|
* \param aTexture Texture to use, or 0 to have one created for you.
|
||||||
* \param aTextureSize The size of the texture to use.
|
|
||||||
* \param aOverwrite Over an existing texture with a new one.
|
* \param aOverwrite Over an existing texture with a new one.
|
||||||
* \param aSrcPoint Offset into aSrc where the region's bound's
|
* \param aSrcPoint Offset into aSrc where the region's bound's
|
||||||
* TopLeft() sits.
|
* TopLeft() sits.
|
||||||
|
@ -1213,7 +1199,6 @@ public:
|
||||||
ShaderProgramType UploadSurfaceToTexture(gfxASurface *aSurface,
|
ShaderProgramType UploadSurfaceToTexture(gfxASurface *aSurface,
|
||||||
const nsIntRegion& aDstRegion,
|
const nsIntRegion& aDstRegion,
|
||||||
GLuint& aTexture,
|
GLuint& aTexture,
|
||||||
const nsIntSize& aTextureSize,
|
|
||||||
bool aOverwrite = false,
|
bool aOverwrite = false,
|
||||||
const nsIntPoint& aSrcPoint = nsIntPoint(0, 0),
|
const nsIntPoint& aSrcPoint = nsIntPoint(0, 0),
|
||||||
bool aPixelBuffer = false);
|
bool aPixelBuffer = false);
|
||||||
|
@ -1396,7 +1381,6 @@ protected:
|
||||||
bool mContextLost;
|
bool mContextLost;
|
||||||
|
|
||||||
PRInt32 mVendor;
|
PRInt32 mVendor;
|
||||||
PRInt32 mRenderer;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
DebugEnabled = 1 << 0,
|
DebugEnabled = 1 << 0,
|
||||||
|
@ -2699,23 +2683,23 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
DoesStringMatch(const char* aString, const char *aWantedString)
|
DoesVendorStringMatch(const char* aVendorString, const char *aWantedVendor)
|
||||||
{
|
{
|
||||||
if (!aString || !aWantedString)
|
if (!aVendorString || !aWantedVendor)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const char *occurrence = strstr(aString, aWantedString);
|
const char *occurrence = strstr(aVendorString, aWantedVendor);
|
||||||
|
|
||||||
// aWanted not found
|
// aWantedVendor not found
|
||||||
if (!occurrence)
|
if (!occurrence)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// aWantedString preceded by alpha character
|
// aWantedVendor preceded by alpha character
|
||||||
if (occurrence != aString && isalpha(*(occurrence-1)))
|
if (occurrence != aVendorString && isalpha(*(occurrence-1)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// aWantedVendor followed by alpha character
|
// aWantedVendor followed by alpha character
|
||||||
const char *afterOccurrence = occurrence + strlen(aWantedString);
|
const char *afterOccurrence = occurrence + strlen(aWantedVendor);
|
||||||
if (isalpha(*afterOccurrence))
|
if (isalpha(*afterOccurrence))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -1474,7 +1474,6 @@ public:
|
||||||
mGLContext->UploadSurfaceToTexture(aSurf,
|
mGLContext->UploadSurfaceToTexture(aSurf,
|
||||||
region,
|
region,
|
||||||
mTexture,
|
mTexture,
|
||||||
mSize,
|
|
||||||
mTextureState == Created,
|
mTextureState == Created,
|
||||||
bounds.TopLeft() + aFrom,
|
bounds.TopLeft() + aFrom,
|
||||||
false);
|
false);
|
||||||
|
|
|
@ -261,11 +261,11 @@ GLXLibrary::EnsureInitialized()
|
||||||
mHasRobustness = true;
|
mHasRobustness = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
gIsATI = serverVendor && DoesStringMatch(serverVendor, "ATI");
|
gIsATI = serverVendor && DoesVendorStringMatch(serverVendor, "ATI");
|
||||||
gIsChromium = (serverVendor &&
|
gIsChromium = (serverVendor &&
|
||||||
DoesStringMatch(serverVendor, "Chromium")) ||
|
DoesVendorStringMatch(serverVendor, "Chromium")) ||
|
||||||
(serverVersionStr &&
|
(serverVersionStr &&
|
||||||
DoesStringMatch(serverVersionStr, "Chromium"));
|
DoesVendorStringMatch(serverVersionStr, "Chromium"));
|
||||||
|
|
||||||
mInitialized = true;
|
mInitialized = true;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -212,7 +212,6 @@ CanvasLayerOGL::UpdateSurface()
|
||||||
gl()->UploadSurfaceToTexture(updatedAreaSurface,
|
gl()->UploadSurfaceToTexture(updatedAreaSurface,
|
||||||
mBounds,
|
mBounds,
|
||||||
mTexture,
|
mTexture,
|
||||||
nsIntSize(mBounds.width, mBounds.height),
|
|
||||||
false,
|
false,
|
||||||
nsIntPoint(0, 0));
|
nsIntPoint(0, 0));
|
||||||
}
|
}
|
||||||
|
@ -261,7 +260,6 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
||||||
gl()->UploadSurfaceToTexture(surf,
|
gl()->UploadSurfaceToTexture(surf,
|
||||||
nsIntRect(0, 0, drawRect.width, drawRect.height),
|
nsIntRect(0, 0, drawRect.width, drawRect.height),
|
||||||
mTexture,
|
mTexture,
|
||||||
nsIntSize(mBounds.width, mBounds.height),
|
|
||||||
true,
|
true,
|
||||||
drawRect.TopLeft());
|
drawRect.TopLeft());
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,7 +727,7 @@ UploadYUVToTexture(GLContext* gl, const PlanarYCbCrImage::Data& aData,
|
||||||
aData.mYSize,
|
aData.mYSize,
|
||||||
aData.mYStride,
|
aData.mYStride,
|
||||||
gfxASurface::ImageFormatA8);
|
gfxASurface::ImageFormatA8);
|
||||||
gl->UploadSurfaceToTexture(surf, size, texture, aData.mYSize, true);
|
gl->UploadSurfaceToTexture(surf, size, texture, true);
|
||||||
|
|
||||||
size = nsIntRect(0, 0, aData.mCbCrSize.width, aData.mCbCrSize.height);
|
size = nsIntRect(0, 0, aData.mCbCrSize.width, aData.mCbCrSize.height);
|
||||||
texture = aUTexture->GetTextureID();
|
texture = aUTexture->GetTextureID();
|
||||||
|
@ -735,14 +735,14 @@ UploadYUVToTexture(GLContext* gl, const PlanarYCbCrImage::Data& aData,
|
||||||
aData.mCbCrSize,
|
aData.mCbCrSize,
|
||||||
aData.mCbCrStride,
|
aData.mCbCrStride,
|
||||||
gfxASurface::ImageFormatA8);
|
gfxASurface::ImageFormatA8);
|
||||||
gl->UploadSurfaceToTexture(surf, size, texture, aData.mCbCrSize, true);
|
gl->UploadSurfaceToTexture(surf, size, texture, true);
|
||||||
|
|
||||||
texture = aVTexture->GetTextureID();
|
texture = aVTexture->GetTextureID();
|
||||||
surf = new gfxImageSurface(aData.mCrChannel,
|
surf = new gfxImageSurface(aData.mCrChannel,
|
||||||
aData.mCbCrSize,
|
aData.mCbCrSize,
|
||||||
aData.mCbCrStride,
|
aData.mCbCrStride,
|
||||||
gfxASurface::ImageFormatA8);
|
gfxASurface::ImageFormatA8);
|
||||||
gl->UploadSurfaceToTexture(surf, size, texture, aData.mCbCrSize, true);
|
gl->UploadSurfaceToTexture(surf, size, texture, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -797,7 +797,7 @@ CairoImageOGL::SetData(const CairoImage::Data &aData)
|
||||||
mLayerProgram =
|
mLayerProgram =
|
||||||
gl->UploadSurfaceToTexture(aData.mSurface,
|
gl->UploadSurfaceToTexture(aData.mSurface,
|
||||||
nsIntRect(0,0, mSize.width, mSize.height),
|
nsIntRect(0,0, mSize.width, mSize.height),
|
||||||
tex, mSize, true);
|
tex, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CairoImageOGL::SetTiling(bool aTiling)
|
void CairoImageOGL::SetTiling(bool aTiling)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче