Merge m-c to s-c.

This commit is contained in:
Richard Newman 2011-12-15 11:55:38 -08:00
commit 30820be911
80 changed files with 1819 additions and 2955 deletions

View File

@ -225,4 +225,4 @@
</gfxItems>
</blocklist>
</blocklist>

View File

@ -58,6 +58,7 @@
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
#endif
#ifdef XP_WIN32
@BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
#if _MSC_VER == 1400
@BINPATH@/Microsoft.VC80.CRT.manifest
@BINPATH@/msvcm80.dll

View File

@ -1037,3 +1037,14 @@ shareuiinterface.h
vpx/vpx_decoder.h
vpx/vp8dx.h
#endif
#ifdef XP_WIN
vpx/vpx_decoder.h
vpx/vp8dx.h
sydneyaudio/sydney_audio.h
vorbis/codec.h
theora/theoradec.h
tremor/ivorbiscodec.h
ogg/ogg.h
ogg/os_types.h
nestegg/nestegg.h
#endif

View File

@ -0,0 +1,5 @@
<!DOCTYPE html>
<script>
mozCancelRequestAnimationFrame(mozRequestAnimationFrame(function() {}));
mozRequestAnimationFrame(function() {});
</script>

View File

@ -102,3 +102,4 @@ load 700090-1.html
load 700090-2.html
load 700512.html
load xhr_html_nullresponse.html
load 709384.html

View File

@ -75,3 +75,4 @@ DEPRECATED_OPERATION(Position)
DEPRECATED_OPERATION(TotalSize)
DEPRECATED_OPERATION(GlobalStorage)
DEPRECATED_OPERATION(InputEncoding)
DEPRECATED_OPERATION(MozBeforePaint)

View File

@ -8095,11 +8095,12 @@ void
nsIDocument::CancelFrameRequestCallback(PRInt32 aHandle)
{
// mFrameRequestCallbacks is stored sorted by handle
mFrameRequestCallbacks.RemoveElementSorted(aHandle);
// Not going to worry about unscheduling our refresh driver
// callback. It'll just be a no-op when it happens, if we have no
// more frame request callbacks.
if (mFrameRequestCallbacks.RemoveElementSorted(aHandle) &&
mFrameRequestCallbacks.IsEmpty() &&
mPresShell && IsEventHandlingEnabled()) {
mPresShell->GetPresContext()->RefreshDriver()->
RevokeFrameRequestCallbacks(this);
}
}
nsresult

View File

@ -37,7 +37,7 @@ function checker() {
}
}
window.mozRequestAnimationFrame(checker);
window.mozCancelRequestAnimationFrame(handle1);
window.mozCancelAnimationFrame(handle1);
</script>
</pre>

View File

@ -647,7 +647,6 @@ void nsBuiltinDecoder::NotifySuspendedStatusChanged()
nsMediaStream* activeStream;
bool suspended = mStream->IsSuspendedByCache(&activeStream);
printf("*** nsBuiltinDecoder::NotifySuspendedStatusChanged(%p), suspended=%d, active-stream=%p\n", this, suspended, activeStream);
if (suspended && mElement) {
// if this is an autoplay element, we need to kick off its autoplaying
// now so we consume data and hopefully free up cache space

View File

@ -1913,7 +1913,7 @@ nsMediaCacheStream::AreAllStreamsForResourceSuspended(nsMediaStream** aActiveStr
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
nsMediaCache::ResourceStreamIterator iter(mResourceID);
while (nsMediaCacheStream* stream = iter.Next()) {
if (!stream->mCacheSuspended && !stream->mChannelEnded) {
if (!stream->mCacheSuspended && !stream->mChannelEnded && !stream->mClosed) {
if (aActiveStream) {
*aActiveStream = stream->mClient;
}

View File

@ -751,8 +751,6 @@ private:
void
nsMediaChannelStream::CacheClientNotifyDataEnded(nsresult aStatus)
{
printf("*** nsMediaChannelStream::CacheClientNotifyDataEnded() mDecoder=%p\n", mDecoder);
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
// NOTE: this can be called with the media cache lock held, so don't
// block or do anything which might try to acquire a lock!
@ -766,8 +764,6 @@ nsMediaChannelStream::CacheClientSeek(PRInt64 aOffset, bool aResume)
{
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
printf("*** nsMediaChannelStream::CacheClientSeek() mDecoder=%p aOffset=%lld aResume = %d\n", mDecoder, (long long)aOffset, aResume);
CloseChannel();
if (aResume) {
@ -787,8 +783,6 @@ nsMediaChannelStream::CacheClientSeek(PRInt64 aOffset, bool aResume)
nsresult
nsMediaChannelStream::CacheClientSuspend()
{
printf("*** nsMediaChannelStream::CacheClientSuspend() mDecoder=%p\n", mDecoder);
Suspend(false);
mDecoder->NotifySuspendedStatusChanged();
@ -798,8 +792,6 @@ nsMediaChannelStream::CacheClientSuspend()
nsresult
nsMediaChannelStream::CacheClientResume()
{
printf("*** nsMediaChannelStream::CacheClientResume() mDecoder=%p\n", mDecoder);
Resume();
mDecoder->NotifySuspendedStatusChanged();

View File

@ -161,7 +161,7 @@ nsWebMReader::~nsWebMReader()
nsresult nsWebMReader::Init(nsBuiltinDecoderReader* aCloneDonor)
{
if (vpx_codec_dec_init(&mVP8, &vpx_codec_vp8_dx_algo, NULL, 0)) {
if (vpx_codec_dec_init(&mVP8, vpx_codec_vp8_dx(), NULL, 0)) {
return NS_ERROR_FAILURE;
}
@ -669,7 +669,7 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
vpx_codec_stream_info_t si;
memset(&si, 0, sizeof(si));
si.sz = sizeof(si);
vpx_codec_peek_stream_info(&vpx_codec_vp8_dx_algo, data, length, &si);
vpx_codec_peek_stream_info(vpx_codec_vp8_dx(), data, length, &si);
if (aKeyframeSkip && (!si.is_kf || tstamp_usecs < aTimeThreshold)) {
// Skipping to next keyframe...
parsed++; // Assume 1 frame per chunk.

View File

@ -3885,6 +3885,7 @@ nsGlobalWindow::MozRequestAnimationFrame(nsIFrameRequestCallback* aCallback,
}
if (!aCallback) {
mDoc->WarnOnceAbout(nsIDocument::eMozBeforePaint);
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
@ -3894,7 +3895,13 @@ nsGlobalWindow::MozRequestAnimationFrame(nsIFrameRequestCallback* aCallback,
NS_IMETHODIMP
nsGlobalWindow::MozCancelRequestAnimationFrame(PRInt32 aHandle)
{
FORWARD_TO_INNER(MozCancelRequestAnimationFrame, (aHandle),
return MozCancelAnimationFrame(aHandle);
}
NS_IMETHODIMP
nsGlobalWindow::MozCancelAnimationFrame(PRInt32 aHandle)
{
FORWARD_TO_INNER(MozCancelAnimationFrame, (aHandle),
NS_ERROR_NOT_INITIALIZED);
if (!mDoc) {

View File

@ -70,7 +70,7 @@ interface nsIDOMMozURLProperty : nsISupports
* @see <http://www.whatwg.org/html/#window>
*/
[scriptable, uuid(973e7219-40d5-4f94-b78d-53c2a0b8a13c)]
[scriptable, uuid(f6e3b10d-d5f4-4fcd-aa4c-5f98626d428a)]
interface nsIDOMWindow : nsISupports
{
// the current browsing context
@ -417,12 +417,15 @@ interface nsIDOMWindow : nsISupports
*
* @see <http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html>
*/
// Argument is optional only so we can warn when it's null
long
mozRequestAnimationFrame(in nsIFrameRequestCallback aCallback);
mozRequestAnimationFrame([optional] in nsIFrameRequestCallback aCallback);
/**
* Cancel a refresh callback.
*/
void mozCancelAnimationFrame(in long aHandle);
// Backwards-compat shim for now to make Google maps work
void mozCancelRequestAnimationFrame(in long aHandle);
/**

View File

@ -115,6 +115,8 @@ nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.st
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.
InputEncodingWarning=Use of inputEncoding is deprecated.
GlobalStorageWarning=Use of globalStorage is deprecated. Please use localStorage instead.
# LOCALIZATION NOTE: Do not translate "MozBeforePaint" and "mozRequestAnimationFrame"
MozBeforePaintWarning=MozBeforePaint events are no longer supported. mozRequestAnimationFrame must be passed a non-null callback argument.
FullScreenDeniedDisabled=Request for full-screen was denied because full-screen API is disabled by user preference.
FullScreenDeniedPlugins=Request for full-screen was denied because a document on this page contains a windowed plugin.
FullScreenDeniedHidden=Request for full-screen was denied because the document is no longer visible.

View File

@ -45,7 +45,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = angle
LIBRARY_NAME = angle
LIBXUL_LIBRARY = 1
EXPORT_LIBRARY = 1
ifeq (WINNT,$(OS_TARGET))
VISIBILITY_FLAGS =
endif
EXPORTS_NAMESPACES = angle

View File

@ -527,7 +527,7 @@ struct THEBES_API ContextFormat
class GLContext
: public LibrarySymbolLoader
{
THEBES_INLINE_DECL_THREADSAFE_REFCOUNTING(GLContext)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GLContext)
public:
GLContext(const ContextFormat& aFormat,
bool aIsOffscreen = false,

View File

@ -40,6 +40,7 @@
#include "Layers.h"
#include "nsISupportsImpl.h"
#include "gfxPattern.h"
#include "nsThreadUtils.h"
#include "mozilla/ReentrantMonitor.h"
@ -74,7 +75,7 @@ enum StereoMode {
* sampled. For example, cairo images should be sampled in EXTEND_PAD mode.
*/
class THEBES_API Image {
THEBES_INLINE_DECL_THREADSAFE_REFCOUNTING(Image)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Image)
public:
virtual ~Image() {}
@ -132,7 +133,7 @@ protected:
* video playback without involving the main thread, for example.
*/
class THEBES_API ImageContainer {
THEBES_INLINE_DECL_THREADSAFE_REFCOUNTING(ImageContainer)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ImageContainer)
public:
ImageContainer() :

View File

@ -97,7 +97,7 @@ private:
* reference loop between an ImageContainerOGL and its active image.
*/
class RecycleBin {
THEBES_INLINE_DECL_THREADSAFE_REFCOUNTING(RecycleBin)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RecycleBin)
typedef mozilla::gl::GLContext GLContext;

View File

@ -89,27 +89,4 @@ enum gfxBreakPriority {
eNormalBreak
};
#define THEBES_INLINE_DECL_THREADSAFE_REFCOUNTING(_class) \
public: \
nsrefcnt AddRef(void) { \
NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
nsrefcnt count = NS_AtomicIncrementRefcnt(mRefCnt); \
NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \
return count; \
} \
nsrefcnt Release(void) { \
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt); \
NS_LOG_RELEASE(this, count, #_class); \
if (count == 0) { \
mRefCnt = 1; /* stabilize */ \
delete this; \
return 0; \
} \
return count; \
} \
protected: \
nsAutoRefCnt mRefCnt; \
public:
#endif /* GFX_TYPES_H */

View File

@ -63,7 +63,6 @@ endif # }
vpath %.cc \
$(srcdir)/src/base \
$(srcdir)/src/base/third_party/nspr \
$(srcdir)/src/base/third_party/nss \
$(srcdir)/src/chrome/common \
$(NULL)
@ -98,7 +97,6 @@ CPPSRCS += \
ref_counted.cc \
revocable_store.cc \
scoped_temp_dir.cc \
sha2.cc \
simple_thread.cc \
stats_table.cc \
string_escape.cc \
@ -130,7 +128,6 @@ CPPSRCS += \
message_router.cc \
notification_service.cc \
task_queue.cc \
sha512.cc \
$(NULL)
ifdef OS_WIN # {

View File

@ -1,24 +0,0 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/sha2.h"
#include "base/third_party/nss/blapi.h"
#include "base/third_party/nss/sha256.h"
using namespace nss;
namespace base {
void SHA256HashString(const std::string& str, void* output, size_t len) {
SHA256Context ctx;
SHA256_Begin(&ctx);
SHA256_Update(&ctx, reinterpret_cast<const unsigned char*>(str.data()),
static_cast<unsigned int>(str.length()));
SHA256_End(&ctx, static_cast<unsigned char*>(output), NULL,
static_cast<unsigned int>(len));
}
} // namespace base

View File

@ -1,27 +0,0 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_SHA2_H__
#define BASE_SHA2_H__
#include <string>
namespace base {
// These functions perform SHA-256 operations.
//
// Functions for SHA-384 and SHA-512 can be added when the need arises.
enum {
SHA256_LENGTH = 32 // length in bytes of a SHA-256 hash
};
// Computes the SHA-256 hash of the input string 'str' and stores the first
// 'len' bytes of the hash in the output buffer 'output'. If 'len' > 32,
// only 32 bytes (the full hash) are stored in the 'output' buffer.
void SHA256HashString(const std::string& str, void* output, size_t len);
} // namespace base
#endif // BASE_SHA2_H__

View File

@ -1,78 +0,0 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/sha2.h"
#include "base/basictypes.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(Sha256Test, Test1) {
// Example B.1 from FIPS 180-2: one-block message.
std::string input1 = "abc";
int expected1[] = { 0xba, 0x78, 0x16, 0xbf,
0x8f, 0x01, 0xcf, 0xea,
0x41, 0x41, 0x40, 0xde,
0x5d, 0xae, 0x22, 0x23,
0xb0, 0x03, 0x61, 0xa3,
0x96, 0x17, 0x7a, 0x9c,
0xb4, 0x10, 0xff, 0x61,
0xf2, 0x00, 0x15, 0xad };
uint8 output1[base::SHA256_LENGTH];
base::SHA256HashString(input1, output1, sizeof(output1));
for (size_t i = 0; i < base::SHA256_LENGTH; i++)
EXPECT_EQ(expected1[i], static_cast<int>(output1[i]));
uint8 output_truncated1[4]; // 4 bytes == 32 bits
base::SHA256HashString(input1, output_truncated1, sizeof(output_truncated1));
for (size_t i = 0; i < sizeof(output_truncated1); i++)
EXPECT_EQ(expected1[i], static_cast<int>(output_truncated1[i]));
}
TEST(Sha256Test, Test2) {
// Example B.2 from FIPS 180-2: multi-block message.
std::string input2 =
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
int expected2[] = { 0x24, 0x8d, 0x6a, 0x61,
0xd2, 0x06, 0x38, 0xb8,
0xe5, 0xc0, 0x26, 0x93,
0x0c, 0x3e, 0x60, 0x39,
0xa3, 0x3c, 0xe4, 0x59,
0x64, 0xff, 0x21, 0x67,
0xf6, 0xec, 0xed, 0xd4,
0x19, 0xdb, 0x06, 0xc1 };
uint8 output2[base::SHA256_LENGTH];
base::SHA256HashString(input2, output2, sizeof(output2));
for (size_t i = 0; i < base::SHA256_LENGTH; i++)
EXPECT_EQ(expected2[i], static_cast<int>(output2[i]));
uint8 output_truncated2[6];
base::SHA256HashString(input2, output_truncated2, sizeof(output_truncated2));
for (size_t i = 0; i < sizeof(output_truncated2); i++)
EXPECT_EQ(expected2[i], static_cast<int>(output_truncated2[i]));
}
TEST(Sha256Test, Test3) {
// Example B.3 from FIPS 180-2: long message.
std::string input3(1000000, 'a'); // 'a' repeated a million times
int expected3[] = { 0xcd, 0xc7, 0x6e, 0x5c,
0x99, 0x14, 0xfb, 0x92,
0x81, 0xa1, 0xc7, 0xe2,
0x84, 0xd7, 0x3e, 0x67,
0xf1, 0x80, 0x9a, 0x48,
0xa4, 0x97, 0x20, 0x0e,
0x04, 0x6d, 0x39, 0xcc,
0xc7, 0x11, 0x2c, 0xd0 };
uint8 output3[base::SHA256_LENGTH];
base::SHA256HashString(input3, output3, sizeof(output3));
for (size_t i = 0; i < base::SHA256_LENGTH; i++)
EXPECT_EQ(expected3[i], static_cast<int>(output3[i]));
uint8 output_truncated3[12];
base::SHA256HashString(input3, output_truncated3, sizeof(output_truncated3));
for (size_t i = 0; i < sizeof(output_truncated3); i++)
EXPECT_EQ(expected3[i], static_cast<int>(output_truncated3[i]));
}

View File

@ -1,8 +0,0 @@
The original code is the Network Security Services (NSS), licensed under
the MPL/GPL/LGPL tri-license (http://www.mozilla.org/MPL/).
We extracted the SHA-256 source files, eliminated unneeded dependencies,
deleted or commented out unused code, and tweaked them for Chrome's source
tree. sha512.c is renamed sha512.cc so that it can include Chrome's C++
header "base/basictypes.h". We define NOUNROLL256 to reduce the object code
size.

View File

@ -1,105 +0,0 @@
/*
* crypto.h - public data structures and prototypes for the crypto library
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape security libraries.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1994-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* $Id: blapi.h,v 1.27 2007/11/09 18:49:32 wtc%google.com Exp $ */
#ifndef _BLAPI_H_
#define _BLAPI_H_
#include "base/third_party/nss/blapit.h"
namespace nss {
/******************************************/
extern SHA256Context *SHA256_NewContext(void);
extern void SHA256_DestroyContext(SHA256Context *cx, bool freeit);
extern void SHA256_Begin(SHA256Context *cx);
extern void SHA256_Update(SHA256Context *cx, const unsigned char *input,
unsigned int inputLen);
extern void SHA256_End(SHA256Context *cx, unsigned char *digest,
unsigned int *digestLen, unsigned int maxDigestLen);
extern SECStatus SHA256_HashBuf(unsigned char *dest, const unsigned char *src,
uint32 src_length);
extern SECStatus SHA256_Hash(unsigned char *dest, const char *src);
extern void SHA256_TraceState(SHA256Context *cx);
extern unsigned int SHA256_FlattenSize(SHA256Context *cx);
extern SECStatus SHA256_Flatten(SHA256Context *cx,unsigned char *space);
extern SHA256Context * SHA256_Resurrect(unsigned char *space, void *arg);
extern void SHA256_Clone(SHA256Context *dest, SHA256Context *src);
/******************************************/
extern SHA512Context *SHA512_NewContext(void);
extern void SHA512_DestroyContext(SHA512Context *cx, bool freeit);
extern void SHA512_Begin(SHA512Context *cx);
extern void SHA512_Update(SHA512Context *cx, const unsigned char *input,
unsigned int inputLen);
extern void SHA512_End(SHA512Context *cx, unsigned char *digest,
unsigned int *digestLen, unsigned int maxDigestLen);
extern SECStatus SHA512_HashBuf(unsigned char *dest, const unsigned char *src,
uint32 src_length);
extern SECStatus SHA512_Hash(unsigned char *dest, const char *src);
extern void SHA512_TraceState(SHA512Context *cx);
extern unsigned int SHA512_FlattenSize(SHA512Context *cx);
extern SECStatus SHA512_Flatten(SHA512Context *cx,unsigned char *space);
extern SHA512Context * SHA512_Resurrect(unsigned char *space, void *arg);
extern void SHA512_Clone(SHA512Context *dest, SHA512Context *src);
/******************************************/
extern SHA384Context *SHA384_NewContext(void);
extern void SHA384_DestroyContext(SHA384Context *cx, bool freeit);
extern void SHA384_Begin(SHA384Context *cx);
extern void SHA384_Update(SHA384Context *cx, const unsigned char *input,
unsigned int inputLen);
extern void SHA384_End(SHA384Context *cx, unsigned char *digest,
unsigned int *digestLen, unsigned int maxDigestLen);
extern SECStatus SHA384_HashBuf(unsigned char *dest, const unsigned char *src,
uint32 src_length);
extern SECStatus SHA384_Hash(unsigned char *dest, const char *src);
extern void SHA384_TraceState(SHA384Context *cx);
extern unsigned int SHA384_FlattenSize(SHA384Context *cx);
extern SECStatus SHA384_Flatten(SHA384Context *cx,unsigned char *space);
extern SHA384Context * SHA384_Resurrect(unsigned char *space, void *arg);
extern void SHA384_Clone(SHA384Context *dest, SHA384Context *src);
} // namespace nss
#endif /* _BLAPI_H_ */

View File

@ -1,91 +0,0 @@
/*
* blapit.h - public data structures for the crypto library
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape security libraries.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1994-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Dr Vipul Gupta <vipul.gupta@sun.com> and
* Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* $Id: blapit.h,v 1.20 2007/02/28 19:47:37 rrelyea%redhat.com Exp $ */
#ifndef _BLAPIT_H_
#define _BLAPIT_H_
#include "base/third_party/nspr/prtypes.h"
/*
** A status code. Status's are used by procedures that return status
** values. Again the motivation is so that a compiler can generate
** warnings when return values are wrong. Correct testing of status codes:
**
** SECStatus rv;
** rv = some_function (some_argument);
** if (rv != SECSuccess)
** do_an_error_thing();
**
*/
typedef enum _SECStatus {
SECWouldBlock = -2,
SECFailure = -1,
SECSuccess = 0
} SECStatus;
#define SHA256_LENGTH 32 /* bytes */
#define SHA384_LENGTH 48 /* bytes */
#define SHA512_LENGTH 64 /* bytes */
#define HASH_LENGTH_MAX SHA512_LENGTH
/*
* Input block size for each hash algorithm.
*/
#define SHA256_BLOCK_LENGTH 64 /* bytes */
#define SHA384_BLOCK_LENGTH 128 /* bytes */
#define SHA512_BLOCK_LENGTH 128 /* bytes */
#define HASH_BLOCK_LENGTH_MAX SHA512_BLOCK_LENGTH
/***************************************************************************
** Opaque objects
*/
struct SHA256ContextStr ;
struct SHA512ContextStr ;
typedef struct SHA256ContextStr SHA256Context;
typedef struct SHA512ContextStr SHA512Context;
/* SHA384Context is really a SHA512ContextStr. This is not a mistake. */
typedef struct SHA512ContextStr SHA384Context;
#endif /* _BLAPIT_H_ */

View File

@ -1,51 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape security libraries.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _SHA_256_H_
#define _SHA_256_H_
#include "base/third_party/nspr/prtypes.h"
struct SHA256ContextStr {
union {
PRUint32 w[64]; /* message schedule, input buffer, plus 48 words */
PRUint8 b[256];
} u;
PRUint32 h[8]; /* 8 state variables */
PRUint32 sizeHi,sizeLo; /* 64-bit count of hashed bytes. */
};
#endif /* _SHA_256_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1037,3 +1037,14 @@ shareuiinterface.h
vpx/vpx_decoder.h
vpx/vp8dx.h
#endif
#ifdef XP_WIN
vpx/vpx_decoder.h
vpx/vp8dx.h
sydneyaudio/sydney_audio.h
vorbis/codec.h
theora/theoradec.h
tremor/ivorbiscodec.h
ogg/ogg.h
ogg/os_types.h
nestegg/nestegg.h
#endif

View File

@ -67,6 +67,7 @@ PARALLEL_DIRS += inspector/tests inspector/tests/chrome
endif
DIRS += build
DIRS += media
ifdef ENABLE_TESTS
PARALLEL_DIRS += \

View File

@ -150,20 +150,6 @@ ifdef MOZ_B2G_RIL #{
SHARED_LIBRARY_LIBS += $(DEPTH)/dom/system/b2g/$(LIB_PREFIX)domsystemb2g_s.$(LIB_SUFFIX)
endif #}
ifdef MOZ_VORBIS
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libvorbis/lib/$(LIB_PREFIX)vorbis.$(LIB_SUFFIX) \
$(DEPTH)/media/libogg/src/$(LIB_PREFIX)ogg.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_TREMOR
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libtremor/lib/$(LIB_PREFIX)tremor.$(LIB_SUFFIX) \
$(DEPTH)/media/libogg/src/$(LIB_PREFIX)ogg.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_MEDIA
SHARED_LIBRARY_LIBS += \
$(DEPTH)/content/media/$(LIB_PREFIX)gkconmedia_s.$(LIB_SUFFIX) \
@ -172,7 +158,6 @@ endif
ifdef MOZ_OGG
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libtheora/lib/$(LIB_PREFIX)theora.$(LIB_SUFFIX) \
$(DEPTH)/content/media/ogg/$(LIB_PREFIX)gkconogg_s.$(LIB_SUFFIX) \
$(NULL)
endif
@ -186,11 +171,7 @@ endif
ifdef MOZ_WEBM
SHARED_LIBRARY_LIBS += \
$(DEPTH)/content/media/webm/$(LIB_PREFIX)gkconwebm_s.$(LIB_SUFFIX) \
$(DEPTH)/media/libnestegg/src/$(LIB_PREFIX)nestegg.$(LIB_SUFFIX) \
$(NULL)
ifndef MOZ_NATIVE_LIBVPX
SHARED_LIBRARY_LIBS += $(DEPTH)/media/libvpx/$(LIB_PREFIX)vpx.$(LIB_SUFFIX)
endif
endif
ifdef MOZ_WAVE
@ -200,9 +181,6 @@ SHARED_LIBRARY_LIBS += \
endif
ifdef MOZ_SYDNEYAUDIO
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libsydneyaudio/src/$(LIB_PREFIX)sydneyaudio.$(LIB_SUFFIX) \
$(NULL)
LOCAL_INCLUDES += -I$(DEPTH)/content/html/content/src
endif

99
layout/media/Makefile.in Normal file
View File

@ -0,0 +1,99 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = layout
LIBRARY_NAME = gkmedias
EXPORT_LIBRARY = $(DIST)/lib
ifeq (WINNT,$(OS_TARGET))
FORCE_SHARED_LIB = 1
endif
SHARED_LIBRARY_LIBS =
ifdef MOZ_VORBIS
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libvorbis/lib/$(LIB_PREFIX)vorbis.$(LIB_SUFFIX) \
$(DEPTH)/media/libogg/src/$(LIB_PREFIX)ogg.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_TREMOR
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libtremor/lib/$(LIB_PREFIX)tremor.$(LIB_SUFFIX) \
$(DEPTH)/media/libogg/src/$(LIB_PREFIX)ogg.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_OGG
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libtheora/lib/$(LIB_PREFIX)theora.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_WEBM
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libnestegg/src/$(LIB_PREFIX)nestegg.$(LIB_SUFFIX) \
$(NULL)
ifndef MOZ_NATIVE_LIBVPX
SHARED_LIBRARY_LIBS += $(DEPTH)/media/libvpx/$(LIB_PREFIX)vpx.$(LIB_SUFFIX)
endif
endif
ifdef MOZ_SYDNEYAUDIO
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libsydneyaudio/src/$(LIB_PREFIX)sydneyaudio.$(LIB_SUFFIX) \
$(NULL)
endif
SHARED_LIBRARY_LIBS += \
$(DEPTH)/gfx/angle/$(LIB_PREFIX)angle.$(LIB_SUFFIX) \
$(NULL)
EXTRA_DSO_LDOPTS = $(MOZALLOC_LIB) $(NSPR_LIBS)
ifeq (WINNT,$(OS_TARGET))
DEFFILE = $(srcdir)/symbols.def
endif
include $(topsrcdir)/config/rules.mk

87
layout/media/symbols.def Normal file
View File

@ -0,0 +1,87 @@
LIBRARY gkmedias.dll
EXPORTS
nestegg_destroy
nestegg_duration
nestegg_free_packet
nestegg_init
nestegg_packet_count
nestegg_packet_data
nestegg_packet_track
nestegg_packet_tstamp
nestegg_read_packet
nestegg_track_audio_params
nestegg_track_codec_data
nestegg_track_codec_data_count
nestegg_track_codec_id
nestegg_track_count
nestegg_track_seek
nestegg_track_type
nestegg_track_video_params
nestegg_tstamp_scale
ogg_page_bos
ogg_page_granulepos
ogg_page_serialno
ogg_stream_check
ogg_stream_clear
ogg_stream_init
ogg_stream_packetout
ogg_stream_pagein
ogg_stream_reset
ogg_sync_buffer
ogg_sync_clear
ogg_sync_init
ogg_sync_pageseek
ogg_sync_reset
ogg_sync_wrote
sa_stream_create_pcm
sa_stream_destroy
sa_stream_drain
sa_stream_get_min_write
sa_stream_get_position
sa_stream_get_write_size
sa_stream_open
sa_stream_pause
sa_stream_resume
sa_stream_write
th_comment_clear
th_comment_init
th_decode_alloc
th_decode_free
th_decode_headerin
th_decode_packetin
th_decode_ycbcr_out
th_granule_frame
th_info_clear
th_info_init
th_packet_isheader
th_packet_iskeyframe
th_setup_free
vorbis_block_clear
vorbis_block_init
vorbis_comment_clear
vorbis_comment_init
vorbis_dsp_clear
vorbis_info_clear
vorbis_info_init
vorbis_packet_blocksize
vorbis_synthesis
vorbis_synthesis_blockin
vorbis_synthesis_headerin
vorbis_synthesis_init
vorbis_synthesis_pcmout
vorbis_synthesis_read
vorbis_synthesis_restart
vpx_codec_dec_init_ver
vpx_codec_decode
vpx_codec_destroy
vpx_codec_get_frame
vpx_codec_peek_stream_info
vpx_codec_vp8_dx
ShInitialize
ShFinalize
ShGetObjectCode
ShDestruct
ShGetInfoLog
ShCompile
ShGetInfo
ShConstructCompiler

View File

@ -68,6 +68,7 @@ var gRemote = false;
var gIgnoreWindowSize = false;
var gTotalChunks = 0;
var gThisChunk = 0;
var gContainingWindow = null;
// "<!--CLEAR-->"
const BLANK_URL_FOR_CLEARING = "data:text/html,%3C%21%2D%2DCLEAR%2D%2D%3E";
@ -189,12 +190,10 @@ function FlushTestLog()
function AllocateCanvas()
{
var windowElem = document.documentElement;
if (gRecycledCanvases.length > 0)
return gRecycledCanvases.shift();
var canvas = document.createElementNS(XHTML_NS, "canvas");
var canvas = gContainingWindow.document.createElementNS(XHTML_NS, "canvas");
var r = gBrowser.getBoundingClientRect();
canvas.setAttribute("width", Math.ceil(r.width));
canvas.setAttribute("height", Math.ceil(r.height));
@ -236,8 +235,12 @@ function OnRefTestLoad()
} catch (e) {
gBrowserIsRemote = false;
}
if (gContainingWindow == null && window != null) {
gContainingWindow = window;
}
gBrowser = document.createElementNS(XUL_NS, "xul:browser");
gBrowser = gContainingWindow.document.createElementNS(XUL_NS, "xul:browser");
gBrowser.setAttribute("id", "browser");
gBrowser.setAttribute("type", "content-primary");
gBrowser.setAttribute("remote", gBrowserIsRemote ? "true" : "false");
@ -310,15 +313,13 @@ function InitAndStartRefTests()
}
try {
gWindowUtils = window.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIDOMWindowUtils);
gWindowUtils = gContainingWindow.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIDOMWindowUtils);
if (gWindowUtils && !gWindowUtils.compareCanvases)
gWindowUtils = null;
} catch (e) {
gWindowUtils = null;
}
var windowElem = document.documentElement;
gIOService = CC[IO_SERVICE_CONTRACTID].getService(CI.nsIIOService);
gDebug = CC[DEBUG_CONTRACTID].getService(CI.nsIDebug2);
@ -471,6 +472,8 @@ function BuildConditionSandbox(aURL) {
// see if we have the test plugin available,
// and set a sandox prop accordingly
sandbox.haveTestPlugin = false;
var navigator = gContainingWindow.navigator;
for (var i = 0; i < navigator.mimeTypes.length; i++) {
if (navigator.mimeTypes[i].type == "application/x-test" &&
navigator.mimeTypes[i].enabledPlugin != null &&
@ -481,11 +484,11 @@ function BuildConditionSandbox(aURL) {
}
// Set a flag on sandbox if the windows default theme is active
var box = document.createElement("box");
var box = gContainingWindow.document.createElement("box");
box.setAttribute("id", "_box_windowsDefaultTheme");
document.documentElement.appendChild(box);
sandbox.windowsDefaultTheme = (getComputedStyle(box, null).display == "none");
document.documentElement.removeChild(box);
gContainingWindow.document.documentElement.appendChild(box);
sandbox.windowsDefaultTheme = (gContainingWindow.getComputedStyle(box, null).display == "none");
gContainingWindow.document.documentElement.removeChild(box);
var prefs = CC["@mozilla.org/preferences-service;1"].
getService(CI.nsIPrefBranch2);
@ -506,7 +509,10 @@ function BuildConditionSandbox(aURL) {
}
sandbox.testPluginIsOOP = function () {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (ex) {}
var prefservice = Components.classes["@mozilla.org/preferences-service;1"]
.getService(CI.nsIPrefBranch);
@ -883,7 +889,7 @@ function Focus()
}
var fm = CC["@mozilla.org/focus-manager;1"].getService(CI.nsIFocusManager);
fm.activeWindow = window;
fm.activeWindow = gContainingWindow;
try {
var dock = CC["@mozilla.org/widget/macdocksupport;1"].getService(CI.nsIMacDockSupport);
dock.activateApplication(true);
@ -921,7 +927,7 @@ function StartCurrentTest()
}
else {
var currentTest = gTotalTests - gURLs.length;
document.title = "reftest: " + currentTest + " / " + gTotalTests +
gContainingWindow.document.title = "reftest: " + currentTest + " / " + gTotalTests +
" (" + Math.floor(100 * (currentTest / gTotalTests)) + "%)";
StartCurrentURI(1);
}
@ -938,7 +944,7 @@ function StartCurrentURI(aState)
gURLs[0].maxAsserts == 0) {
// Pretend the document loaded --- RecordResult will notice
// there's already a canvas for this URL
setTimeout(RecordResult, 0);
gContainingWindow.setTimeout(RecordResult, 0);
} else {
var currentTest = gTotalTests - gURLs.length;
gDumpLog("REFTEST TEST-START | " + gCurrentURL + " | " + currentTest + " / " + gTotalTests +
@ -1023,8 +1029,8 @@ function DoDrawWindow(ctx, x, y, w, h)
if (gIgnoreWindowSize ||
(0 <= testRect.left &&
0 <= testRect.top &&
window.innerWidth >= testRect.right &&
window.innerHeight >= testRect.bottom)) {
gContainingWindow.innerWidth >= testRect.right &&
gContainingWindow.innerHeight >= testRect.bottom)) {
// We can use the window's retained layer manager
// because the window is big enough to display the entire
// browser element
@ -1046,13 +1052,13 @@ function DoDrawWindow(ctx, x, y, w, h)
gDumpLog("REFTEST INFO | WARNING: USE_WIDGET_LAYERS disabled\n");
}
gDumpLog("REFTEST INFO | drawWindow flags = " + flagsStr +
"; window size = " + window.innerWidth + "," + window.innerHeight +
"; window size = " + gContainingWindow.innerWidth + "," + gContainingWindow.innerHeight +
"; test browser size = " + testRect.width + "," + testRect.height +
"\n");
}
LogInfo("DoDrawWindow " + x + "," + y + "," + w + "," + h);
ctx.drawWindow(window, x, y, w, h, "rgb(255,255,255)",
ctx.drawWindow(gContainingWindow, x, y, w, h, "rgb(255,255,255)",
gDrawWindowFlags);
}

View File

@ -45,6 +45,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = nestegg
LIBRARY_NAME = nestegg
FORCE_STATIC_LIB= 1
ifeq (WINNT,$(OS_TARGET))
VISIBILITY_FLAGS =
endif
CSRCS = \
nestegg.c \

View File

@ -44,6 +44,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = ogg
LIBRARY_NAME = ogg
FORCE_STATIC_LIB= 1
ifeq (WINNT,$(OS_TARGET))
VISIBILITY_FLAGS =
endif
CSRCS = \
ogg_bitwise.c \

View File

@ -44,6 +44,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = sydneyaudio
LIBRARY_NAME = sydneyaudio
FORCE_STATIC_LIB= 1
ifeq (WINNT,$(OS_TARGET))
VISIBILITY_FLAGS =
endif
ifneq (,$(filter DragonFly FreeBSD GNU GNU_% NetBSD OpenBSD,$(OS_ARCH)))
CSRCS = \

View File

@ -43,6 +43,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = theora
LIBRARY_NAME = theora
FORCE_STATIC_LIB = 1
ifeq (WINNT,$(OS_TARGET))
VISIBILITY_FLAGS =
endif
# The encoder is currently not included.
DEFINES += -DTHEORA_DISABLE_ENCODE

View File

@ -44,6 +44,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = vorbis
LIBRARY_NAME = vorbis
FORCE_STATIC_LIB= 1
ifeq (WINNT,$(OS_TARGET))
VISIBILITY_FLAGS =
endif
CSRCS = \
vorbis_mdct.c \

View File

@ -47,6 +47,9 @@ DEFINES += -DHAVE_CONFIG_H=vpx_config.h
MODULE = vpx
LIBRARY_NAME = vpx
FORCE_STATIC_LIB= 1
ifeq (WINNT,$(OS_TARGET))
VISIBILITY_FLAGS =
endif
LOCAL_INCLUDES += \
-I. \

View File

@ -42,6 +42,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -253,9 +254,19 @@ public class AboutHomeContent extends ScrollView {
if (fileStream == null)
return;
StringBuffer jsonString = new StringBuffer();
int read = 0;
while ((read = fileStream.read(buf, 0, 32768)) != -1) {
jsonString.append(new String(buf, 0, read));
try {
int read = 0;
while ((read = fileStream.read(buf, 0, 32768)) != -1) {
jsonString.append(new String(buf, 0, read));
}
} finally {
try {
fileStream.close();
} catch (IOException ioe) {
// catch this here because we can continue even if the
// close failed
Log.i(LOGTAG, "error closing json file", ioe);
}
}
final JSONArray array = new JSONObject(jsonString.toString()).getJSONArray("addons");
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
@ -264,15 +275,15 @@ public class AboutHomeContent extends ScrollView {
for (int i = 0; i < array.length(); i++) {
JSONObject jsonobj = array.getJSONObject(i);
mAddonsAdapter.add(jsonobj.getString("name"));
Log.i("GeckoAddons", "addon #" + i +": " + jsonobj.getString("name"));
Log.i(LOGTAG, "addon #" + i +": " + jsonobj.getString("name"));
}
} catch (Exception e) {
Log.i("GeckoAddons", "error reading json file", e);
Log.i(LOGTAG, "error reading json file", e);
}
}
});
} catch (Exception e) {
Log.i("GeckoAddons", "error reading json file", e);
Log.i(LOGTAG, "error reading json file", e);
}
}
});

View File

@ -331,6 +331,6 @@ public class CrashReporter extends Activity
}
private String unescape(String string) {
return string.replaceAll("\\\\", "\\").replaceAll("\\n", "\n").replaceAll("\\t", "\t");
return string.replaceAll("\\\\\\\\", "\\").replaceAll("\\\\n", "\n").replaceAll("\\\\t", "\t");
}
}

View File

@ -20,6 +20,7 @@
*
* Contributor(s):
* Lucas Rocha <lucasr@mozilla.com>
* Jason Voll <jvoll@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -247,6 +248,7 @@ public class BrowserProvider extends ContentProvider {
}
private static boolean hasImagesInProjection(String[] projection) {
if (projection == null) return true;
for (int i = 0; i < projection.length; ++i) {
if (projection[i].equals(Images.FAVICON) ||
projection[i].equals(Images.THUMBNAIL))

View File

@ -59,6 +59,7 @@
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
#endif
#ifdef XP_WIN32
@BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
#if _MSC_VER == 1400
@BINPATH@/Microsoft.VC80.CRT.manifest
@BINPATH@/msvcm80.dll

View File

@ -264,6 +264,7 @@ function nsPlacesAutoComplete()
}
stmt.bindParameters(params);
stmt.executeAsync();
stmt.finalize();
delete this._openPagesCache;
}

View File

@ -10,7 +10,8 @@ add_test(function database_is_valid() {
do_check_eq(PlacesUtils.history.databaseStatus,
PlacesUtils.history.DATABASE_STATUS_UPGRADED);
// This throws if frecency column does not exist.
DBConn().createStatement("SELECT frecency from moz_places");
stmt = DBConn().createStatement("SELECT frecency from moz_places");
stmt.finalize();
// Check moz_inputhistory is in place.
do_check_true(DBConn().tableExists("moz_inputhistory"));
run_next_test();

View File

@ -249,8 +249,8 @@ function populateGraphicsSection() {
if (gfxInfo) {
let trGraphics = [];
pushInfoRow(trGraphics, "adapterDescription", gfxInfo.adapterDescription);
pushInfoRow(trGraphics, "adapterVendorID", hexValueToString(gfxInfo.adapterVendorID));
pushInfoRow(trGraphics, "adapterDeviceID", hexValueToString(gfxInfo.adapterDeviceID));
pushInfoRow(trGraphics, "adapterVendorID", gfxInfo.adapterVendorID);
pushInfoRow(trGraphics, "adapterDeviceID", gfxInfo.adapterDeviceID);
pushInfoRow(trGraphics, "adapterRAM", gfxInfo.adapterRAM);
pushInfoRow(trGraphics, "adapterDrivers", gfxInfo.adapterDriver);
pushInfoRow(trGraphics, "driverVersion", gfxInfo.adapterDriverVersion);
@ -258,8 +258,8 @@ function populateGraphicsSection() {
#ifdef XP_WIN
pushInfoRow(trGraphics, "adapterDescription2", gfxInfo.adapterDescription2);
pushInfoRow(trGraphics, "adapterVendorID2", hexValueToString(gfxInfo.adapterVendorID2));
pushInfoRow(trGraphics, "adapterDeviceID2", hexValueToString(gfxInfo.adapterDeviceID2));
pushInfoRow(trGraphics, "adapterVendorID2", gfxInfo.adapterVendorID2);
pushInfoRow(trGraphics, "adapterDeviceID2", gfxInfo.adapterDeviceID2);
pushInfoRow(trGraphics, "adapterRAM2", gfxInfo.adapterRAM2);
pushInfoRow(trGraphics, "adapterDrivers2", gfxInfo.adapterDriver2);
pushInfoRow(trGraphics, "driverVersion2", gfxInfo.adapterDriverVersion2);

View File

@ -283,7 +283,7 @@
this.requestHandle = window.mozRequestAnimationFrame(this);
},
stop: function scrollAnim_stop() {
window.mozCancelRequestAnimationFrame(this.requestHandle);
window.mozCancelAnimationFrame(this.requestHandle);
this.requestHandle = 0;
},
sample: function scrollAnim_handleEvent(timeStamp) {
@ -648,7 +648,7 @@
this.requestHandle = window.mozRequestAnimationFrame(this);
},
stop: function arrowSmoothScroll_stop() {
window.mozCancelRequestAnimationFrame(this.requestHandle);
window.mozCancelAnimationFrame(this.requestHandle);
this.requestHandle = 0;
},
sample: function arrowSmoothScroll_handleEvent(timeStamp) {

View File

@ -318,8 +318,6 @@ STATIC_LIBS += thebes gl ycbcr
COMPONENT_LIBS += profiler
STATIC_LIBS += angle
ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
COMPONENT_LIBS += gkwidget
endif
@ -403,6 +401,8 @@ ifdef MOZ_NATIVE_LIBVPX
EXTRA_DSO_LDOPTS += $(MOZ_LIBVPX_LIBS)
endif
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib)
ifdef MOZ_SYDNEYAUDIO
ifeq ($(OS_ARCH),Linux)
EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS)

View File

@ -54,5 +54,65 @@
<driverVersion> 8.52.322.1111 </driverVersion>
<driverVersionComparator> EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Darwin 9</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x2783</device>
<device>0x1234</device>
<device>0x2782</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Linux</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x2783</device>
<device>0x1234</device>
<device>0x2782</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Android</os>
<vendor>abcd</vendor>
<devices>
<device>wxyz</device>
<device>asdf</device>
<device>erty</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
<driverVersion> 5 </driverVersion>
<driverVersionComparator> LESS_THAN_OR_EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Android</os>
<vendor>dcdc</vendor>
<devices>
<device>uiop</device>
<device>vbnm</device>
<device>hjkl</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
<driverVersion> 5 </driverVersion>
<driverVersionComparator> EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Android</os>
<vendor>abab</vendor>
<devices>
<device>ghjk</device>
<device>cvbn</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
<driverVersion> 7 </driverVersion>
<driverVersionComparator> GREATER_THAN_OR_EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
</gfxItems>
</blocklist>

View File

@ -1,72 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Make sure that a blacklist entry with an OS of "All" matches Windows 7, as
// long as the rest of the blacklist matches it.
// Uses test_gfxBlacklist_AllOS.xml
do_load_httpd_js();
var gTestserver = null;
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
blocklist.notify(null);
}
// Performs the initial setup
function run_test() {
try {
var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
} catch (e) {
do_test_finished();
return;
}
// We can't do anything if we can't spoof the stuff we need.
if (!(gfxInfo instanceof Ci.nsIGfxInfoDebug)) {
do_test_finished();
return;
}
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);
do_test_pending();
function checkBlacklist()
{
var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION);
// Make sure unrelated features aren't affected
status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS);
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_NO_INFO);
gTestserver.stop(do_test_finished);
}
Services.obs.addObserver(function(aSubject, aTopic, aData) {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
do_execute_soon(checkBlacklist);
}, "blocklist-data-gfxItems", false);
load_blocklist("test_gfxBlacklist_AllOS.xml");
}

View File

@ -1,72 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Make sure that a blacklist entry with an OS of "All" matches Windows Vista,
// as long as the rest of the blacklist matches it.
// Uses test_gfxBlacklist_AllOS.xml
do_load_httpd_js();
var gTestserver = null;
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
getService(Ci.nsITimerCallback);
blocklist.notify(null);
}
// Performs the initial setup
function run_test() {
try {
var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
} catch (e) {
do_test_finished();
return;
}
// We can't do anything if we can't spoof the stuff we need.
if (!(gfxInfo instanceof Ci.nsIGfxInfoDebug)) {
do_test_finished();
return;
}
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows Vista
gfxInfo.spoofOSVersion(0x60000);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);
do_test_pending();
function checkBlacklist()
{
var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION);
// Make sure unrelated features aren't affected
status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS);
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_NO_INFO);
gTestserver.stop(do_test_finished);
}
Services.obs.addObserver(function(aSubject, aTopic, aData) {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
do_execute_soon(checkBlacklist);
}, "blocklist-data-gfxItems", false);
load_blocklist("test_gfxBlacklist_AllOS.xml");
}

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,29 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x9876);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x9876");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x9876");
break;
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x9876");
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
gfxInfo.spoofVendorID("abcd");
gfxInfo.spoofDeviceID("aabb");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2202");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2202");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("abcd");
gfxInfo.spoofDeviceID("wxyz");
gfxInfo.spoofDriverVersion("6");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xdcdc);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.1112");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xdcdc");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.1112");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("dcdc");
gfxInfo.spoofDeviceID("uiop");
gfxInfo.spoofDriverVersion("6");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xdcdc);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.1110");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xdcdc");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.1110");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("dcdc");
gfxInfo.spoofDeviceID("uiop");
gfxInfo.spoofDriverVersion("4");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xdcdc);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.1111");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xdcdc");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.1111");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("dcdc");
gfxInfo.spoofDeviceID("uiop");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabab);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabab");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("abab");
gfxInfo.spoofDeviceID("ghjk");
gfxInfo.spoofDriverVersion("6");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabab);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2202");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabab");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2202");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("abab");
gfxInfo.spoofDeviceID("ghjk");
gfxInfo.spoofDriverVersion("7");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,29 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
break;
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
gfxInfo.spoofVendorID("abcd");
gfxInfo.spoofDeviceID("asdf");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,30 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows Vista
gfxInfo.spoofOSVersion(0x60000);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows Vista
gfxInfo.spoofOSVersion(0x60000);
break;
case "Linux":
// We don't have any OS versions on Linux, just "Linux".
do_test_finished();
return;
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
// Snow Leopard
gfxInfo.spoofOSVersion(0x1060);
break;
case "Android":
// On Android, the driver version is used as the OS version (because
// there's so many of them).
do_test_finished();
return;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,29 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xdcba);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xdcba");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
gfxInfo.spoofVendorID("0xdcba");
gfxInfo.spoofDeviceID("0x1234");
break;
case "Darwin":
gfxInfo.spoofVendorID("0xdcba");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
gfxInfo.spoofVendorID("dcba");
gfxInfo.spoofDeviceID("asdf");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,29 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
break;
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
gfxInfo.spoofVendorID("abcd");
gfxInfo.spoofDeviceID("asdf");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -150,8 +150,6 @@ skip-if = os == "android"
[test_fuel.js]
[test_general.js]
[test_getresource.js]
[test_gfxBlacklist_AllOS1.js]
[test_gfxBlacklist_AllOS2.js]
[test_gfxBlacklist_Device.js]
[test_gfxBlacklist_DriverNew.js]
[test_gfxBlacklist_Equal_DriverNew.js]

View File

@ -64,11 +64,11 @@ interface nsIGfxInfo : nsISupports
readonly attribute DOMString adapterDriver2;
/* These types are inspired by DXGI_ADAPTER_DESC */
readonly attribute unsigned long adapterVendorID;
readonly attribute unsigned long adapterVendorID2;
readonly attribute DOMString adapterVendorID;
readonly attribute DOMString adapterVendorID2;
readonly attribute unsigned long adapterDeviceID;
readonly attribute unsigned long adapterDeviceID2;
readonly attribute DOMString adapterDeviceID;
readonly attribute DOMString adapterDeviceID2;
/**
* The amount of RAM in MB in the display adapter.
@ -114,19 +114,22 @@ interface nsIGfxInfo : nsISupports
/*
* A set of return values from GetFeatureStatus
*/
/* 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;
/* We don't know the status of the feature yet. The analysis probably hasn't finished yet. */
const long FEATURE_STATUS_UNKNOWN = 2;
/* This feature is blocked on this driver version. Updating driver will typically unblock it. */
const long FEATURE_BLOCKED_DRIVER_VERSION = 2;
const long FEATURE_BLOCKED_DRIVER_VERSION = 3;
/* 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;
const long FEATURE_BLOCKED_DEVICE = 4;
/* This feature is available and can be used, but is not suggested (e.g. shouldn't be used by default */
const long FEATURE_DISCOURAGED = 4;
const long FEATURE_DISCOURAGED = 5;
/* This feature is blocked on this OS version. */
const long FEATURE_BLOCKED_OS_VERSION = 5;
const long FEATURE_BLOCKED_OS_VERSION = 6;
/**
* Ask about a feature, and return the status of that feature

View File

@ -39,11 +39,11 @@
/* NOTE: this interface is only implemented in debug builds */
[scriptable, uuid(0c19c88a-9ef1-4bb4-b0a2-86ab768e8bd6)]
[scriptable, uuid(ca7b0bc7-c67c-4b79-8270-ed7ba002af08)]
interface nsIGfxInfoDebug : nsISupports
{
void spoofVendorID(in unsigned long aVendorID);
void spoofDeviceID(in unsigned long aDeviceID);
void spoofVendorID(in DOMString aVendorID);
void spoofDeviceID(in DOMString aDeviceID);
void spoofDriverVersion(in DOMString aDriverVersion);

View File

@ -51,6 +51,10 @@
using namespace mozilla::widget;
#ifdef DEBUG
NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization
* has occurred because they depend on it for information. (See bug 591561) */
nsresult
@ -88,7 +92,42 @@ GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
nsresult
GfxInfo::Init()
{
mSetCrashReportAnnotations = false;
mAdapterDescription.AssignASCII(mozilla::gl::GetVendor());
if (mozilla::AndroidBridge::Bridge()) {
nsAutoString str;
mAdapterDescription.Append(NS_LITERAL_STRING(", Model: '"));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MODEL", str)) {
mAdapterDeviceID = str;
mAdapterDescription.Append(str);
}
mAdapterDescription.Append(NS_LITERAL_STRING("', Product: '"));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "PRODUCT", str))
mAdapterDescription.Append(str);
mAdapterDescription.Append(NS_LITERAL_STRING("', Manufacturer: '"));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
mAdapterDescription.Append(str);
mAdapterDescription.Append(NS_LITERAL_STRING("', Hardware: '"));
PRInt32 version; // the HARDWARE field isn't available on Android SDK < 8
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &version))
version = 0;
if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
mAdapterVendorID = str;
mAdapterDescription.Append(str);
}
}
mAdapterDescription.Append(NS_LITERAL_STRING("'"));
mAndroidSDKVersion = version;
}
AddOpenGLCrashReportAnnotations();
return GfxInfoBase::Init();
}
@ -96,28 +135,7 @@ GfxInfo::Init()
NS_IMETHODIMP
GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
{
aAdapterDescription.AssignASCII(mozilla::gl::GetVendor());
if (mozilla::AndroidBridge::Bridge()) {
nsAutoString str;
aAdapterDescription.Append(NS_LITERAL_STRING(", Model: '"));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MODEL", str))
aAdapterDescription.Append(str);
aAdapterDescription.Append(NS_LITERAL_STRING("', Product: '"));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "PRODUCT", str))
aAdapterDescription.Append(str);
aAdapterDescription.Append(NS_LITERAL_STRING("', Manufacturer: '"));
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
aAdapterDescription.Append(str);
aAdapterDescription.Append(NS_LITERAL_STRING("', Hardware: '"));
PRInt32 version; // the HARDWARE field isn't available on Android SDK < 8
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &version))
version = 0;
if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
aAdapterDescription.Append(str);
aAdapterDescription.Append(NS_LITERAL_STRING("'"));
}
aAdapterDescription = mAdapterDescription;
return NS_OK;
}
@ -162,7 +180,8 @@ GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
NS_IMETHODIMP
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
{
aAdapterDriverVersion.AssignLiteral("");
aAdapterDriverVersion.Truncate(0);
aAdapterDriverVersion.AppendInt(mAndroidSDKVersion);
return NS_OK;
}
@ -188,47 +207,32 @@ GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterVendorID; */
/* readonly attribute DOMString adapterVendorID; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
{
nsAutoString str;
PRInt32 version; // the HARDWARE field isn't available on Android SDK < 8
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &version))
version = 0;
if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
*aAdapterVendorID = HashString(str);
return NS_OK;
}
*aAdapterVendorID = 0;
aAdapterVendorID = mAdapterVendorID;
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID2; */
/* readonly attribute DOMString adapterVendorID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterDeviceID; */
/* readonly attribute DOMString adapterDeviceID; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
{
nsAutoString str;
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MODEL", str)) {
*aAdapterDeviceID = HashString(str);
return NS_OK;
}
*aAdapterDeviceID = 0;
aAdapterDeviceID = mAdapterDeviceID;
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID2; */
/* readonly attribute DOMString adapterDeviceID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID)
GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
{
return NS_ERROR_FAILURE;
}
@ -244,29 +248,30 @@ void
GfxInfo::AddOpenGLCrashReportAnnotations()
{
#if defined(MOZ_CRASHREPORTER)
nsCAutoString deviceIDString, vendorIDString;
nsAutoString adapterDescriptionString;
PRUint32 deviceID, vendorID;
nsAutoString adapterDescriptionString, deviceID, vendorID;
nsCAutoString narrowDeviceID, narrowVendorID;
GetAdapterDeviceID(&deviceID);
GetAdapterVendorID(&vendorID);
GetAdapterDeviceID(deviceID);
GetAdapterVendorID(vendorID);
GetAdapterDescription(adapterDescriptionString);
deviceIDString.AppendPrintf("%04x", deviceID);
vendorIDString.AppendPrintf("%04x", vendorID);
narrowDeviceID = NS_ConvertUTF16toUTF8(deviceID);
narrowVendorID = NS_ConvertUTF16toUTF8(vendorID);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
vendorIDString);
narrowVendorID);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
deviceIDString);
narrowDeviceID);
/* Add an App Note for now so that we get the data immediately. These
* can go away after we store the above in the socorro db */
nsCAutoString note;
/* AppendPrintf only supports 32 character strings, mrghh. */
note.AppendPrintf("AdapterVendorID: %04x, ", vendorID);
note.AppendPrintf("AdapterDeviceID: %04x.", deviceID);
note.Append("\n");
note.Append("AdapterVendorID: ");
note.Append(narrowVendorID);
note.Append(", AdapterDeviceID: ");
note.Append(narrowDeviceID);
note.Append(".\n");
note.AppendPrintf("AdapterDescription: '%s'.", NS_ConvertUTF16toUTF8(adapterDescriptionString).get());
note.Append("\n");
@ -274,58 +279,90 @@ GfxInfo::AddOpenGLCrashReportAnnotations()
#endif
}
static GfxDriverInfo gDriverInfo[] = {
GfxDriverInfo()
};
const GfxDriverInfo*
const nsTArray<GfxDriverInfo>&
GfxInfo::GetGfxDriverInfo()
{
return &gDriverInfo[0];
if (!mDriverInfo->Length()) {
/* The following entry, when uncommented, will allow us to whitelist a
* specific device. See the long comment in GetFeatureStatusImpl for more
* info. */
// APPEND_TO_DRIVER_BLOCKLIST( DRIVER_OS_ALL,
// my_vendor_id, my_device_id,
// nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_NO_INFO,
// DRIVER_LESS_THAN, GfxDriverInfo::allDevices );
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAll), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
}
return *mDriverInfo;
}
nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS /* = nsnull */)
{
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
NS_ENSURE_ARG_POINTER(aStatus);
aSuggestedDriverVersion.SetIsVoid(true);
// For now, we don't implement the downloaded blacklist.
if (aDriverInfo) {
*aStatus = status;
return NS_OK;
}
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
OperatingSystem os = DRIVER_OS_ANDROID;
if (aFeature == FEATURE_OPENGL_LAYERS) {
if (!mSetCrashReportAnnotations) {
AddOpenGLCrashReportAnnotations();
mSetCrashReportAnnotations = true;
}
/* XXX: Use this code when we're ready to whitelist devices. */
// nsAutoString str;
// /* Whitelist Galaxy S phones */
// if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
// if (str != NS_LITERAL_STRING("smdkc110")) {
// status = FEATURE_BLOCKED_DEVICE;
// }
// }
status = FEATURE_BLOCKED_DEVICE;
}
*aStatus = status;
if (aOS)
*aOS = os;
// XXX disabled for now as this calls GetAdapterVendorID and friends, which currently crash on Android, see bug 700124
// return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
// Don't evaluate special cases when evaluating the downlaoded blocklist.
if (!aDriverInfo.Length()) {
if (aFeature == FEATURE_OPENGL_LAYERS) {
/* The following code is an old way to whitelist devices when we're ready.
* It is staying here for reference. The best way to do this now is to add
* an entry in the list above. There is a dummy entry which will whitelist a
* device when uncommented and device/vendor IDs are inserted. It is
* preferred that we stop whitelisting and instead go to blocklisting, where
* everything is assumed to be okay as long as it's not in the blocklist. */
// nsAutoString str;
// /* Whitelist Galaxy S phones */
// if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
// if (str != NS_LITERAL_STRING("smdkc110")) {
// status = FEATURE_BLOCKED_DEVICE;
// }
// }
}
}
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
}
#ifdef DEBUG
// Implement nsIGfxInfoDebug
/* void spoofVendorID (in DOMString aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
{
mAdapterVendorID = aVendorID;
return NS_OK;
}
/* void spoofDeviceID (in unsigned long aDeviceID); */
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
{
mAdapterDeviceID = aDeviceID;
return NS_OK;
}
/* void spoofDriverVersion (in DOMString aDriverVersion); */
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
{
mDriverVersion = aDriverVersion;
return NS_OK;
}
/* void spoofOSVersion (in unsigned long aVersion); */
NS_IMETHODIMP GfxInfo::SpoofOSVersion(PRUint32 aVersion)
{
return NS_OK;
}
#endif

View File

@ -41,6 +41,7 @@
#define __mozilla_widget_GfxInfo_h__
#include "GfxInfoBase.h"
#include "GfxDriverInfo.h"
#include "nsString.h"
@ -59,15 +60,15 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
@ -78,19 +79,23 @@ public:
virtual nsresult Init();
#ifdef DEBUG
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIGFXINFODEBUG
#endif
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS = nsnull);
virtual const GfxDriverInfo* GetGfxDriverInfo();
virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo();
private:
void AddOpenGLCrashReportAnnotations();
bool mSetCrashReportAnnotations;
nsString mRendererIDsString;
nsString mAdapterRAMString;
@ -99,6 +104,11 @@ private:
nsString mDriverDate;
nsString mDeviceKey;
nsString mAdapterDeviceID;
nsString mAdapterVendorID;
nsString mAdapterDescription;
PRInt32 mAndroidSDKVersion;
PRUint32 mRendererIDs[16];
};

View File

@ -61,33 +61,39 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active);
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
using GfxInfoBase::GetWebGLParameter;
virtual nsresult Init();
#ifdef DEBUG
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIGFXINFODEBUG
#endif
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS = nsnull);
virtual const GfxDriverInfo* GetGfxDriverInfo();
virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo();
private:
@ -101,8 +107,8 @@ private:
nsString mDriverDate;
nsString mDeviceKey;
PRUint32 mAdapterVendorID;
PRUint32 mAdapterDeviceID;
nsString mAdapterVendorID;
nsString mAdapterDeviceID;
PRUint32 mRendererIDs[16];

View File

@ -67,12 +67,28 @@
using namespace mozilla;
using namespace mozilla::widget;
#ifdef DEBUG
NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
GfxInfo::GfxInfo()
: mAdapterVendorID(0),
mAdapterDeviceID(0)
{
}
static OperatingSystem
OSXVersionToOperatingSystem(PRUint32 aOSXVersion)
{
switch (aOSXVersion & MAC_OS_X_VERSION_MAJOR_MASK) {
case MAC_OS_X_VERSION_10_5_HEX:
return DRIVER_OS_OS_X_10_5;
case MAC_OS_X_VERSION_10_6_HEX:
return DRIVER_OS_OS_X_10_6;
case MAC_OS_X_VERSION_10_7_HEX:
return DRIVER_OS_OS_X_10_7;
}
return DRIVER_OS_UNKNOWN;
}
// The following three functions are derived from Chromium code
static CFTypeRef SearchPortForProperty(io_registry_entry_t dspPort,
CFStringRef propertyName)
@ -104,30 +120,16 @@ GfxInfo::GetDeviceInfo()
io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay);
CFTypeRef vendor_id_ref = SearchPortForProperty(dsp_port, CFSTR("vendor-id"));
if (vendor_id_ref) {
mAdapterVendorID = IntValueOfCFData((CFDataRef)vendor_id_ref);
mAdapterVendorID.AppendPrintf("0x%4x", IntValueOfCFData((CFDataRef)vendor_id_ref));
CFRelease(vendor_id_ref);
}
CFTypeRef device_id_ref = SearchPortForProperty(dsp_port, CFSTR("device-id"));
if (device_id_ref) {
mAdapterDeviceID = IntValueOfCFData((CFDataRef)device_id_ref);
mAdapterDeviceID.AppendPrintf("0x%4x", IntValueOfCFData((CFDataRef)device_id_ref));
CFRelease(device_id_ref);
}
}
static bool
IsATIRadeonX1000(PRUint32 aVendorID, PRUint32 aDeviceID)
{
if (aVendorID == 0x1002) {
// this list is from the ATIRadeonX1000.kext Info.plist
PRUint32 devices[] = {0x7187, 0x7210, 0x71DE, 0x7146, 0x7142, 0x7109, 0x71C5, 0x71C0, 0x7240, 0x7249, 0x7291};
for (size_t i = 0; i < ArrayLength(devices); i++) {
if (aDeviceID == devices[i])
return true;
}
}
return false;
}
nsresult
GfxInfo::Init()
{
@ -174,6 +176,8 @@ GfxInfo::Init()
AddCrashReportAnnotations();
mOSXVersion = nsToolkit::OSXVersion();
return rv;
}
@ -292,32 +296,32 @@ GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterVendorID; */
/* readonly attribute DOMString adapterVendorID; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
{
*aAdapterVendorID = mAdapterVendorID;
aAdapterVendorID = mAdapterVendorID;
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID2; */
/* readonly attribute DOMString adapterVendorID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterDeviceID; */
/* readonly attribute DOMString adapterDeviceID; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
{
*aAdapterDeviceID = mAdapterDeviceID;
aAdapterDeviceID = mAdapterDeviceID;
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID2; */
/* readonly attribute DOMString adapterDeviceID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID)
GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
{
return NS_ERROR_FAILURE;
}
@ -333,167 +337,161 @@ void
GfxInfo::AddCrashReportAnnotations()
{
#if defined(MOZ_CRASHREPORTER)
nsCAutoString deviceIDString, vendorIDString;
PRUint32 deviceID, vendorID;
nsString deviceID, vendorID;
nsCAutoString narrowDeviceID, narrowVendorID;
GetAdapterDeviceID(&deviceID);
GetAdapterVendorID(&vendorID);
deviceIDString.AppendPrintf("%04x", deviceID);
vendorIDString.AppendPrintf("%04x", vendorID);
GetAdapterDeviceID(deviceID);
CopyUTF16toUTF8(deviceID, narrowDeviceID);
GetAdapterVendorID(vendorID);
CopyUTF16toUTF8(vendorID, narrowVendorID);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
vendorIDString);
narrowVendorID);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
deviceIDString);
narrowDeviceID);
/* Add an App Note for now so that we get the data immediately. These
* can go away after we store the above in the socorro db */
nsCAutoString note;
/* AppendPrintf only supports 32 character strings, mrghh. */
note.AppendPrintf("AdapterVendorID: %04x, ", vendorID);
note.AppendPrintf("AdapterDeviceID: %04x", deviceID);
note.Append("AdapterVendorID: ");
note.Append(narrowVendorID);
note.Append(", AdapterDeviceID: ");
note.Append(narrowDeviceID);
CrashReporter::AppendAppNotesToCrashReport(note);
#endif
}
static GfxDriverInfo gDriverInfo[] = {
// We don't support checking driver versions on Mac.
#define IMPLEMENT_MAC_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn) \
GfxDriverInfo(os, vendor, device, features, blockOn, \
DRIVER_UNKNOWN_COMPARISON, V(0,0,0,0), ""),
// We don't support checking driver versions on Mac.
#define IMPLEMENT_MAC_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn) \
APPEND_TO_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn, \
DRIVER_UNKNOWN_COMPARISON, V(0,0,0,0), "")
// Example use of macro.
//IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_OS_X_10_7,
// GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
// GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION)
// Block all ATI cards from using MSAA, except for two devices that have
// special exceptions in the GetFeatureStatusImpl() function.
IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_MSAA, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION)
GfxDriverInfo()
};
const GfxDriverInfo*
const nsTArray<GfxDriverInfo>&
GfxInfo::GetGfxDriverInfo()
{
return &gDriverInfo[0];
}
static OperatingSystem
OSXVersionToOperatingSystem(PRUint32 aOSXVersion)
{
switch (aOSXVersion & MAC_OS_X_VERSION_MAJOR_MASK) {
case MAC_OS_X_VERSION_10_5_HEX:
return DRIVER_OS_OS_X_10_5;
case MAC_OS_X_VERSION_10_6_HEX:
return DRIVER_OS_OS_X_10_6;
case MAC_OS_X_VERSION_10_7_HEX:
return DRIVER_OS_OS_X_10_7;
if (!mDriverInfo->Length()) {
IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_MSAA, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION);
IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(RadeonX1000),
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE);
IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(Geforce7300GT),
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_BLOCKED_DEVICE);
}
return DRIVER_OS_UNKNOWN;
return *mDriverInfo;
}
nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32* aStatus,
nsAString& aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS /* = nsnull */)
{
NS_ENSURE_ARG_POINTER(aStatus);
aSuggestedDriverVersion.SetIsVoid(true);
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
OperatingSystem os = OSXVersionToOperatingSystem(nsToolkit::OSXVersion());
// Many WebGL issues on 10.5, especially:
// * bug 631258: WebGL shader paints using textures belonging to other processes on Mac OS 10.5
// * bug 618848: Post process shaders and texture mapping crash OS X 10.5
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL &&
!nsToolkit::OnSnowLeopardOrLater())
{
status = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
}
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS) {
bool foundGoodDevice = false;
if (!IsATIRadeonX1000(mAdapterVendorID, mAdapterDeviceID)) {
foundGoodDevice = true;
}
#if 0
// CGL reports a list of renderers, some renderers are slow (e.g. software)
// and AFAIK we can't decide which one will be used among them, so let's implement this by returning NO_INFO
// if any not-known-to-be-bad renderer is found.
// The assumption that we make here is that the system will spontaneously use the best/fastest renderer in the list.
// Note that the presence of software renderer fallbacks means that slow software rendering may be automatically
// used, which seems to be the case in bug 611292 where the user had a Intel GMA 945 card (non programmable hardware).
// Therefore we need to explicitly blacklist non-OpenGL2 hardware, which could result in a software renderer
// being used.
for (PRUint32 i = 0; i < ArrayLength(mRendererIDs); ++i) {
switch (mRendererIDs[i]) {
case kCGLRendererATIRage128ID: // non-programmable
case kCGLRendererATIRadeonID: // non-programmable
case kCGLRendererATIRageProID: // non-programmable
case kCGLRendererATIRadeon8500ID: // no OpenGL 2 support, http://en.wikipedia.org/wiki/Radeon_R200
case kCGLRendererATIRadeon9700ID: // no OpenGL 2 support, http://en.wikipedia.org/wiki/Radeon_R200
case kCGLRendererATIRadeonX1000ID: // can't render to non-power-of-two texture backed framebuffers
case kCGLRendererIntel900ID: // non-programmable
case kCGLRendererGeForce2MXID: // non-programmable
case kCGLRendererGeForce3ID: // no OpenGL 2 support,
// http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units
case kCGLRendererGeForceFXID: // incomplete OpenGL 2 support with software fallbacks,
// http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units
case kCGLRendererVTBladeXP2ID: // Trident DX8 chip, assuming it's not GL2 capable
case kCGLRendererMesa3DFXID: // non-programmable
case kCGLRendererGenericFloatID: // software renderer
case kCGLRendererGenericID: // software renderer
case kCGLRendererAppleSWID: // software renderer
break;
default:
if (mRendererIDs[i])
foundGoodDevice = true;
}
}
#endif
if (!foundGoodDevice)
status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
}
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL) {
// same comment as above for FEATURE_OPENGL_LAYERS.
bool foundGoodDevice = true;
// Blacklist the Geforce 7300 GT because of bug 678053
if (mAdapterVendorID == 0x10de && mAdapterDeviceID == 0x0393) {
foundGoodDevice = false;
}
if (!foundGoodDevice)
status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
}
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
// Blacklist all ATI cards on OSX, except for
// 0x6760 and 0x9488
if (mAdapterVendorID == GfxDriverInfo::vendorATI &&
(mAdapterDeviceID == 0x6760 || mAdapterDeviceID == 0x9488)) {
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
return NS_OK;
}
}
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
OperatingSystem os = OSXVersionToOperatingSystem(mOSXVersion);
if (aOS)
*aOS = os;
*aStatus = status;
// Don't evaluate special cases when we're evaluating the downloaded blocklist.
if (!aDriverInfo.Length()) {
// Many WebGL issues on 10.5, especially:
// * bug 631258: WebGL shader paints using textures belonging to other processes on Mac OS 10.5
// * bug 618848: Post process shaders and texture mapping crash OS X 10.5
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL &&
!nsToolkit::OnSnowLeopardOrLater()) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
return NS_OK;
}
// The code around the following has been moved into the global blocklist.
#if 0
// CGL reports a list of renderers, some renderers are slow (e.g. software)
// and AFAIK we can't decide which one will be used among them, so let's implement this by returning NO_INFO
// if any not-known-to-be-bad renderer is found.
// The assumption that we make here is that the system will spontaneously use the best/fastest renderer in the list.
// Note that the presence of software renderer fallbacks means that slow software rendering may be automatically
// used, which seems to be the case in bug 611292 where the user had a Intel GMA 945 card (non programmable hardware).
// Therefore we need to explicitly blacklist non-OpenGL2 hardware, which could result in a software renderer
// being used.
for (PRUint32 i = 0; i < ArrayLength(mRendererIDs); ++i) {
switch (mRendererIDs[i]) {
case kCGLRendererATIRage128ID: // non-programmable
case kCGLRendererATIRadeonID: // non-programmable
case kCGLRendererATIRageProID: // non-programmable
case kCGLRendererATIRadeon8500ID: // no OpenGL 2 support, http://en.wikipedia.org/wiki/Radeon_R200
case kCGLRendererATIRadeon9700ID: // no OpenGL 2 support, http://en.wikipedia.org/wiki/Radeon_R200
case kCGLRendererATIRadeonX1000ID: // can't render to non-power-of-two texture backed framebuffers
case kCGLRendererIntel900ID: // non-programmable
case kCGLRendererGeForce2MXID: // non-programmable
case kCGLRendererGeForce3ID: // no OpenGL 2 support,
// http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units
case kCGLRendererGeForceFXID: // incomplete OpenGL 2 support with software fallbacks,
// http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units
case kCGLRendererVTBladeXP2ID: // Trident DX8 chip, assuming it's not GL2 capable
case kCGLRendererMesa3DFXID: // non-programmable
case kCGLRendererGenericFloatID: // software renderer
case kCGLRendererGenericID: // software renderer
case kCGLRendererAppleSWID: // software renderer
break;
default:
if (mRendererIDs[i])
foundGoodDevice = true;
}
}
#endif
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
// Blacklist all ATI cards on OSX, except for
// 0x6760 and 0x9488
if (mAdapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorATI) &&
(mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") ||
mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) {
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
return NS_OK;
}
}
}
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
}
#ifdef DEBUG
// Implement nsIGfxInfoDebug
/* void spoofVendorID (in DOMString aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
{
mAdapterVendorID = aVendorID;
return NS_OK;
}
/* void spoofDeviceID (in unsigned long aDeviceID); */
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
{
mAdapterDeviceID = aDeviceID;
return NS_OK;
}
/* void spoofDriverVersion (in DOMString aDriverVersion); */
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
{
mDriverVersion = aDriverVersion;
return NS_OK;
}
/* void spoofOSVersion (in unsigned long aVersion); */
NS_IMETHODIMP GfxInfo::SpoofOSVersion(PRUint32 aVersion)
{
mOSXVersion = aVersion;
return NS_OK;
}
#endif

View File

@ -49,6 +49,7 @@
#include "prprf.h"
#include "GfxDriverInfo.h"
#include "mozilla/Preferences.h"
#include "nsPrintfCString.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
@ -69,11 +70,7 @@ static const PRUint32 allWindowsVersions = 0xffffffff;
GfxInfo::GfxInfo()
: mAdapterVendorID(0),
mAdapterDeviceID(0),
mAdapterVendorID2(0),
mAdapterDeviceID2(0),
mWindowsVersion(0),
: mWindowsVersion(0),
mHasDualGPU(false),
mIsGPU2Active(false)
{
@ -428,8 +425,8 @@ GfxInfo::Init()
setupDestroyDeviceInfoList(devinfo);
}
mAdapterVendorID = ParseIDFromDeviceID(mDeviceID, "VEN_", 4);
mAdapterDeviceID = ParseIDFromDeviceID(mDeviceID, "&DEV_", 4);
mAdapterVendorID.AppendPrintf("0x%04x", ParseIDFromDeviceID(mDeviceID, "VEN_", 4));
mAdapterDeviceID.AppendPrintf("0x%04x", ParseIDFromDeviceID(mDeviceID, "&DEV_", 4));
mAdapterSubsysID = ParseIDFromDeviceID(mDeviceID, "&SUBSYS_", 8);
// We now check for second display adapter.
@ -479,10 +476,14 @@ GfxInfo::Init()
continue;
}
deviceID2 = value;
nsAutoString adapterVendorID2String;
nsAutoString adapterDeviceID2String;
adapterVendorID2 = ParseIDFromDeviceID(deviceID2, "VEN_", 4);
adapterVendorID2String.AppendPrintf("0x%04x", adapterVendorID2);
adapterDeviceID2 = ParseIDFromDeviceID(deviceID2, "&DEV_", 4);
if ((adapterVendorID2 == mAdapterVendorID) &&
(adapterDeviceID2 == mAdapterDeviceID)) {
adapterDeviceID2String.AppendPrintf("0x%04x", adapterDeviceID2);
if (mAdapterVendorID == adapterVendorID2String &&
mAdapterDeviceID == adapterDeviceID2String) {
RegCloseKey(key);
continue;
}
@ -518,8 +519,8 @@ GfxInfo::Init()
mDeviceKey2 = driverKey2;
mDriverVersion2 = driverVersion2;
mDriverDate2 = driverDate2;
mAdapterVendorID2 = adapterVendorID2;
mAdapterDeviceID2 = adapterDeviceID2;
mAdapterVendorID2.AppendPrintf("0x%04x", adapterVendorID2);
mAdapterDeviceID2.AppendPrintf("0x%04x", adapterDeviceID2);
mAdapterSubsysID2 = ParseIDFromDeviceID(mDeviceID2, "&SUBSYS_", 8);
break;
}
@ -544,11 +545,11 @@ GfxInfo::Init()
const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_VENDOR_ID");
if (spoofedVendor) {
PR_sscanf(spoofedVendor, "%x", &mAdapterVendorID);
mAdapterVendorID.AssignASCII(spoofedVendor);
}
mHasDriverVersionMismatch = false;
if (mAdapterVendorID == GfxDriverInfo::vendorIntel) {
if (mAdapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorIntel)) {
// we've had big crashers (bugs 590373 and 595364) apparently correlated
// with bad Intel driver installations where the DriverVersion reported
// by the registry was not the version of the DLL.
@ -572,7 +573,7 @@ GfxInfo::Init()
const char *spoofedDevice = PR_GetEnv("MOZ_GFX_SPOOF_DEVICE_ID");
if (spoofedDevice) {
PR_sscanf(spoofedDevice, "%x", &mAdapterDeviceID);
mAdapterDeviceID.AssignASCII(spoofedDevice);
}
const char *spoofedWindowsVersion = PR_GetEnv("MOZ_GFX_SPOOF_WINDOWS_VERSION");
@ -677,35 +678,35 @@ GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID; */
/* readonly attribute DOMString adapterVendorID; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
{
*aAdapterVendorID = mAdapterVendorID;
aAdapterVendorID = mAdapterVendorID;
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID2; */
/* readonly attribute DOMString adapterVendorID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
{
*aAdapterVendorID = mAdapterVendorID2;
aAdapterVendorID = mAdapterVendorID2;
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID; */
/* readonly attribute DOMString adapterDeviceID; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
{
*aAdapterDeviceID = mAdapterDeviceID;
aAdapterDeviceID = mAdapterDeviceID;
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID2; */
/* readonly attribute DOMString adapterDeviceID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID)
GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
{
*aAdapterDeviceID = mAdapterDeviceID2;
aAdapterDeviceID = mAdapterDeviceID2;
return NS_OK;
}
@ -740,52 +741,59 @@ GfxInfo::AddCrashReportAnnotations()
#if defined(MOZ_CRASHREPORTER)
CheckForCiscoVPN();
nsCAutoString deviceIDString, vendorIDString;
PRUint32 deviceID, vendorID;
nsString deviceID, vendorID;
nsCString narrowDeviceID, narrowVendorID;
nsAutoString adapterDriverVersionString;
GetAdapterDeviceID(&deviceID);
GetAdapterVendorID(&vendorID);
GetAdapterDeviceID(deviceID);
CopyUTF16toUTF8(deviceID, narrowDeviceID);
GetAdapterVendorID(vendorID);
CopyUTF16toUTF8(vendorID, narrowVendorID);
GetAdapterDriverVersion(adapterDriverVersionString);
deviceIDString.AppendPrintf("%04x", deviceID);
vendorIDString.AppendPrintf("%04x", vendorID);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
vendorIDString);
narrowVendorID);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
deviceIDString);
narrowDeviceID);
/* Add an App Note for now so that we get the data immediately. These
* can go away after we store the above in the socorro db */
nsCAutoString note;
/* AppendPrintf only supports 32 character strings, mrghh. */
note.AppendPrintf("AdapterVendorID: %04x, ", vendorID);
note.AppendPrintf("AdapterDeviceID: %04x, ", deviceID);
note.AppendPrintf("AdapterSubsysID: %08x, ", mAdapterSubsysID);
note.AppendPrintf("AdapterDriverVersion: ");
note.Append("AdapterVendorID: ");
note.Append(narrowVendorID);
note.Append(", AdapterDeviceID: ");
note.Append(narrowDeviceID);
note.AppendPrintf(", AdapterSubsysID: %08x, ", mAdapterSubsysID);
note.Append("AdapterDriverVersion: ");
note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString));
if (vendorID == 0) {
/* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */
note.AppendLiteral(", ");
LossyAppendUTF16toASCII(mDeviceID, note);
note.AppendLiteral(", ");
LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
if (vendorID == GfxDriverInfo::GetDeviceVendor(VendorAll)) {
/* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */
note.Append(", ");
note.AppendWithConversion(mDeviceID);
note.Append(", ");
note.AppendWithConversion(mDeviceKeyDebug);
LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
}
note.Append("\n");
if (mHasDualGPU) {
PRUint32 deviceID2, vendorID2;
nsString deviceID2, vendorID2;
nsAutoString adapterDriverVersionString2;
nsCString narrowDeviceID2, narrowVendorID2;
note.AppendLiteral("Has dual GPUs. GPU #2: ");
GetAdapterDeviceID2(&deviceID2);
GetAdapterVendorID2(&vendorID2);
GetAdapterDeviceID2(deviceID2);
CopyUTF16toUTF8(deviceID2, narrowDeviceID2);
GetAdapterVendorID2(vendorID2);
CopyUTF16toUTF8(vendorID2, narrowVendorID2);
GetAdapterDriverVersion2(adapterDriverVersionString2);
note.AppendPrintf("AdapterVendorID2: %04x, ", vendorID2);
note.AppendPrintf("AdapterDeviceID2: %04x, ", deviceID2);
note.AppendPrintf("AdapterSubsysID2: %08x, ", mAdapterSubsysID2);
note.Append("AdapterVendorID2: ");
note.Append(narrowVendorID2);
note.Append(", AdapterDeviceID2: ");
note.Append(narrowDeviceID2);
note.AppendPrintf(", AdapterSubsysID2: %08x, ", mAdapterSubsysID2);
note.AppendPrintf("AdapterDriverVersion2: ");
note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString2));
}
@ -794,118 +802,6 @@ GfxInfo::AddCrashReportAnnotations()
#endif
}
static const GfxDriverInfo gDriverInfo[] = {
/*
* Notice that the first match defines the result. So always implement special cases firsts and general case last.
*/
/*
* NVIDIA entries
*/
GfxDriverInfo( DRIVER_OS_WINDOWS_XP,
GfxDriverInfo::vendorNVIDIA, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(6,14,12,5721), "257.21" ),
GfxDriverInfo( DRIVER_OS_WINDOWS_VISTA,
GfxDriverInfo::vendorNVIDIA, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" ),
GfxDriverInfo( DRIVER_OS_WINDOWS_7,
GfxDriverInfo::vendorNVIDIA, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" ),
/* Disable D3D9 layers on NVIDIA 6100/6150/6200 series due to glitches
* whilst scrolling. See bugs: 612007, 644787 & 645872.
*/
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorNVIDIA, (GfxDeviceFamily) deviceFamilyNvidiaBlockD3D9Layers,
nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
/*
* AMD/ATI entries
*/
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,741,0,0), "10.6" ),
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorAMD, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,741,0,0), "10.6" ),
/* OpenGL on any ATI/AMD hardware is discouraged
* See:
* bug 619773 - WebGL: Crash with blue screen : "NMI: Parity Check / Memory Parity Error"
* bugs 584403, 584404, 620924 - crashes in atioglxx
* + many complaints about incorrect rendering
*/
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorAMD, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorAMD, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
/*
* Intel entries
*/
/* implement the blocklist from bug 594877
* Block all features on any drivers before this, as there's a crash when a MS Hotfix is installed.
* The crash itself is Direct2D-related, but for safety we block all features.
*/
#define IMPLEMENT_INTEL_DRIVER_BLOCKLIST(winVer, devFamily, driverVer) \
GfxDriverInfo( winVer, \
GfxDriverInfo::vendorIntel, (GfxDeviceFamily) devFamily, \
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
DRIVER_LESS_THAN, driverVer ),
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA500, V(6,14,11,1018))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA900, V(6,14,10,4764))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA950, V(6,14,10,4926))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA3150, V(6,14,10,5260))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMAX3000, V(6,14,10,5218))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMAX4500HD, V(6,14,10,5284))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA500, V(7,14,10,1006))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA900, GfxDriverInfo::allDriverVersions)
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA950, V(7,14,10,1504))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA3150, V(7,14,10,2124))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMAX3000, V(7,15,10,1666))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA500, V(5,0,0,2026))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA900, GfxDriverInfo::allDriverVersions)
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA950, V(8,15,10,1930))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA3150, V(8,14,10,2117))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMAX3000, V(8,15,10,1930))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202))
/* OpenGL on any Intel hardware is discouraged */
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorIntel, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo( DRIVER_OS_ALL,
GfxDriverInfo::vendorIntel, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo()
};
static OperatingSystem
WindowsVersionToOperatingSystem(PRInt32 aWindowsVersion)
{
@ -926,98 +822,208 @@ WindowsVersionToOperatingSystem(PRInt32 aWindowsVersion)
};
}
const GfxDriverInfo*
const nsTArray<GfxDriverInfo>&
GfxInfo::GetGfxDriverInfo()
{
return &gDriverInfo[0];
if (!mDriverInfo->Length()) {
/*
* NVIDIA entries
*/
APPEND_TO_DRIVER_BLOCKLIST( DRIVER_OS_WINDOWS_XP,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(6,14,12,5721), "257.21" );
APPEND_TO_DRIVER_BLOCKLIST( DRIVER_OS_WINDOWS_VISTA,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" );
APPEND_TO_DRIVER_BLOCKLIST( DRIVER_OS_WINDOWS_7,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" );
/*
* AMD/ATI entries
*/
APPEND_TO_DRIVER_BLOCKLIST( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,741,0,0), "10.6" );
APPEND_TO_DRIVER_BLOCKLIST( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAMD), GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,741,0,0), "10.6" );
/* OpenGL on any ATI/AMD hardware is discouraged
* See:
* bug 619773 - WebGL: Crash with blue screen : "NMI: Parity Check / Memory Parity Error"
* bugs 584403, 584404, 620924 - crashes in atioglxx
* + many complaints about incorrect rendering
*/
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAMD), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAMD), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
/*
* Intel entries
*/
/* implement the blocklist from bug 594877
* Block all features on any drivers before this, as there's a crash when a MS Hotfix is installed.
* The crash itself is Direct2D-related, but for safety we block all features.
*/
#define IMPLEMENT_INTEL_DRIVER_BLOCKLIST(winVer, devFamily, driverVer) \
APPEND_TO_DRIVER_BLOCKLIST2( winVer, \
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorIntel), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(devFamily), \
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
DRIVER_LESS_THAN, driverVer )
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, IntelGMA500, V(6,14,11,1018));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, IntelGMA900, V(6,14,10,4764));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, IntelGMA950, V(6,14,10,4926));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, IntelGMA3150, V(6,14,10,5260));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, IntelGMAX3000, V(6,14,10,5218));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, IntelGMAX4500HD, V(6,14,10,5284));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, IntelGMA500, V(7,14,10,1006));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, IntelGMA900, GfxDriverInfo::allDriverVersions);
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, IntelGMA950, V(7,14,10,1504));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, IntelGMA3150, V(7,14,10,2124));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, IntelGMAX3000, V(7,15,10,1666));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, IntelGMAX4500HD, V(8,15,10,2202));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, IntelGMA500, V(5,0,0,2026));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, IntelGMA900, GfxDriverInfo::allDriverVersions);
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, IntelGMA950, V(8,15,10,1930));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, IntelGMA3150, V(8,14,10,2117));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, IntelGMAX3000, V(8,15,10,1930));
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, IntelGMAX4500HD, V(8,15,10,2202));
/* OpenGL on any Intel hardware is discouraged */
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorIntel), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorIntel), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
/* Disable D3D9 layers on NVIDIA 6100/6150/6200 series due to glitches
* whilst scrolling. See bugs: 612007, 644787 & 645872.
*/
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(NvidiaBlockD3D9Layers),
nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
}
return *mDriverInfo;
}
nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS /* = nsnull */)
{
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
NS_ENSURE_ARG_POINTER(aStatus);
aSuggestedDriverVersion.SetIsVoid(true);
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
PRUint32 adapterVendor = 0;
PRUint32 adapterDeviceID = 0;
nsAutoString adapterDriverVersionString;
if (NS_FAILED(GetAdapterVendorID(&adapterVendor)) ||
NS_FAILED(GetAdapterDeviceID(&adapterDeviceID)) ||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
{
return NS_ERROR_FAILURE;
}
if (adapterVendor != GfxDriverInfo::vendorIntel &&
adapterVendor != GfxDriverInfo::vendorNVIDIA &&
adapterVendor != GfxDriverInfo::vendorAMD &&
adapterVendor != GfxDriverInfo::vendorATI &&
// FIXME - these special hex values are currently used in xpcshell tests introduced by
// bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting
// intel/ati/nvidia.
adapterVendor != 0xabcd &&
adapterVendor != 0xdcba &&
adapterVendor != 0xabab &&
adapterVendor != 0xdcdc)
{
*aStatus = FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
PRUint64 driverVersion;
if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
return NS_ERROR_FAILURE;
}
if (aFeature == FEATURE_DIRECT3D_9_LAYERS &&
mWindowsVersion < gfxWindowsPlatform::kWindowsXP)
{
*aStatus = FEATURE_BLOCKED_OS_VERSION;
return NS_OK;
}
// ANGLE currently uses D3D10 <-> D3D9 interop, which crashes on Optimus
// machines.
if (aFeature == FEATURE_WEBGL_ANGLE &&
gfxWindowsPlatform::IsOptimus())
{
*aStatus = FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
OperatingSystem os = WindowsVersionToOperatingSystem(mWindowsVersion);
// Windows Server 2003 should be just like Windows XP for present purpose, but still has a different version number.
// OTOH Windows Server 2008 R1 and R2 already have the same version numbers as Vista and Seven respectively
if (os == DRIVER_OS_WINDOWS_SERVER_2003)
os = DRIVER_OS_WINDOWS_XP;
const GfxDriverInfo *info;
if (aDriverInfo)
info = aDriverInfo;
else
info = &gDriverInfo[0];
if (mHasDriverVersionMismatch) {
if (aFeature == nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS ||
aFeature == nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS ||
aFeature == nsIGfxInfo::FEATURE_DIRECT2D)
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
return NS_OK;
}
}
*aStatus = status;
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
if (aOS)
*aOS = os;
// Don't evaluate special cases if we're checking the downloaded blocklist.
if (!aDriverInfo.Length()) {
nsAutoString adapterVendorID;
nsAutoString adapterDeviceID;
nsAutoString adapterDriverVersionString;
if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
{
return NS_ERROR_FAILURE;
}
if (adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorIntel) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorAMD) &&
adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorATI) &&
// FIXME - these special hex values are currently used in xpcshell tests introduced by
// bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting
// intel/ati/nvidia.
!adapterVendorID.LowerCaseEqualsLiteral("0xabcd") &&
!adapterVendorID.LowerCaseEqualsLiteral("0xdcba") &&
!adapterVendorID.LowerCaseEqualsLiteral("0xabab") &&
!adapterVendorID.LowerCaseEqualsLiteral("0xdcdc"))
{
*aStatus = FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
PRUint64 driverVersion;
if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
return NS_ERROR_FAILURE;
}
// special-case the WinXP test slaves: they have out-of-date drivers, but we still want to
// whitelist them, actually we do know that this combination of device and driver version
// works well.
if (mWindowsVersion == gfxWindowsPlatform::kWindowsXP &&
adapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) &&
adapterDeviceID.LowerCaseEqualsLiteral("0x0861") && // GeForce 9400
driverVersion == V(6,14,11,7756))
{
*aStatus = FEATURE_NO_INFO;
return NS_OK;
}
if (aFeature == FEATURE_DIRECT3D_9_LAYERS &&
mWindowsVersion < gfxWindowsPlatform::kWindowsXP)
{
*aStatus = FEATURE_BLOCKED_OS_VERSION;
return NS_OK;
}
// ANGLE currently uses D3D10 <-> D3D9 interop, which crashes on Optimus
// machines.
if (aFeature == FEATURE_WEBGL_ANGLE &&
gfxWindowsPlatform::IsOptimus())
{
*aStatus = FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
// Windows Server 2003 should be just like Windows XP for present purpose, but still has a different version number.
// OTOH Windows Server 2008 R1 and R2 already have the same version numbers as Vista and Seven respectively
if (os == DRIVER_OS_WINDOWS_SERVER_2003)
os = DRIVER_OS_WINDOWS_XP;
if (mHasDriverVersionMismatch) {
if (aFeature == nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS ||
aFeature == nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS ||
aFeature == nsIGfxInfo::FEATURE_DIRECT2D)
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
return NS_OK;
}
}
}
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
}
@ -1025,15 +1031,15 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
// Implement nsIGfxInfoDebug
/* void spoofVendorID (in unsigned long aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(PRUint32 aVendorID)
/* void spoofVendorID (in DOMString aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
{
mAdapterVendorID = aVendorID;
return NS_OK;
}
/* void spoofDeviceID (in unsigned long aDeviceID); */
NS_IMETHODIMP GfxInfo::SpoofDeviceID(PRUint32 aDeviceID)
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
{
mAdapterDeviceID = aDeviceID;
return NS_OK;

View File

@ -41,15 +41,11 @@
#define __mozilla_widget_GfxInfo_h__
#include "GfxInfoBase.h"
#include "nsIGfxInfoDebug.h"
namespace mozilla {
namespace widget {
class GfxInfo : public GfxInfoBase
#ifdef DEBUG
, public nsIGfxInfoDebug
#endif
{
public:
GfxInfo();
@ -63,15 +59,15 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
@ -80,21 +76,21 @@ public:
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
using GfxInfoBase::GetWebGLParameter;
virtual nsresult Init();
#ifdef DEBUG
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIGFXINFODEBUG
#endif
virtual nsresult Init();
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS = nsnull);
virtual const GfxDriverInfo* GetGfxDriverInfo();
virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo();
private:
@ -105,16 +101,16 @@ private:
nsString mDriverDate;
nsString mDeviceKey;
nsString mDeviceKeyDebug;
PRUint32 mAdapterVendorID;
PRUint32 mAdapterDeviceID;
nsString mAdapterVendorID;
nsString mAdapterDeviceID;
PRUint32 mAdapterSubsysID;
nsString mDeviceString2;
nsString mDriverVersion2;
nsString mDeviceID2;
nsString mDriverDate2;
nsString mDeviceKey2;
PRUint32 mAdapterVendorID2;
PRUint32 mAdapterDeviceID2;
nsString mAdapterVendorID2;
nsString mAdapterDeviceID2;
PRUint32 mAdapterSubsysID2;
PRUint32 mWindowsVersion;
bool mHasDualGPU;

View File

@ -40,20 +40,16 @@
using namespace mozilla::widget;
PRUint32 GfxDriverInfo::allAdapterVendors = 0;
PRInt32 GfxDriverInfo::allFeatures = 0;
PRUint64 GfxDriverInfo::allDriverVersions = ~(PRUint64(0));
GfxDeviceFamily* const GfxDriverInfo::allDevices = nsnull;
PRUint32 GfxDriverInfo::vendorIntel = 0x8086;
PRUint32 GfxDriverInfo::vendorNVIDIA = 0x10de;
PRUint32 GfxDriverInfo::vendorAMD = 0x1022;
PRUint32 GfxDriverInfo::vendorATI = 0x1002;
GfxDeviceFamily GfxDriverInfo::allDevices = nsnull;
GfxDeviceFamily* GfxDriverInfo::mDeviceFamilies[DeviceFamilyMax];
nsAString* GfxDriverInfo::mDeviceVendors[DeviceVendorMax];
GfxDriverInfo::GfxDriverInfo()
: mOperatingSystem(DRIVER_OS_UNKNOWN),
mAdapterVendor(allAdapterVendors),
mAdapterVendor(GfxDriverInfo::GetDeviceVendor(VendorAll)),
mDevices(allDevices),
mDeleteDevices(false),
mFeature(allFeatures),
@ -64,8 +60,8 @@ GfxDriverInfo::GfxDriverInfo()
mSuggestedVersion(nsnull)
{}
GfxDriverInfo::GfxDriverInfo(OperatingSystem os, PRUint32 vendor,
GfxDeviceFamily devices,
GfxDriverInfo::GfxDriverInfo(OperatingSystem os, nsAString& vendor,
GfxDeviceFamily* devices,
PRInt32 feature, PRInt32 featureStatus,
VersionComparisonOp op,
PRUint64 driverVersion,
@ -93,18 +89,11 @@ GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo& aOrig)
mDriverVersionMax(aOrig.mDriverVersionMax),
mSuggestedVersion(aOrig.mSuggestedVersion)
{
// If we're managing the lifetime of the devices array, we have to make a
// copy of the original's array.
if (aOrig.mDeleteDevices) {
PRUint32 count = 0;
const PRUint32 *device = aOrig.mDevices;
while (*device) {
count++;
device++;
}
mDevices = new PRUint32[count + 1];
memcpy(mDevices, aOrig.mDevices, sizeof(PRUint32) * (count + 1));
// If we're managing the lifetime of the device family, we have to make a
// copy of the original's device family.
if (aOrig.mDeleteDevices && aOrig.mDevices) {
mDevices = new GfxDeviceFamily;
*mDevices = *aOrig.mDevices;
} else {
mDevices = aOrig.mDevices;
}
@ -115,5 +104,167 @@ GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo& aOrig)
GfxDriverInfo::~GfxDriverInfo()
{
if (mDeleteDevices)
delete[] mDevices;
delete mDevices;
}
// Macros for appending a device to the DeviceFamily.
#define APPEND_DEVICE(device) APPEND_DEVICE2(#device)
#define APPEND_DEVICE2(device) deviceFamily->AppendElement(NS_LITERAL_STRING(device))
const GfxDeviceFamily* GfxDriverInfo::GetDeviceFamily(DeviceFamily id)
{
// The code here is too sensitive to fall through to the default case if the
// code is invalid.
NS_ASSERTION(id >= 0 && id < DeviceFamilyMax, "DeviceFamily id is out of range");
// If it already exists, we must have processed it once, so return it now.
if (mDeviceFamilies[id])
return mDeviceFamilies[id];
mDeviceFamilies[id] = new GfxDeviceFamily;
GfxDeviceFamily* deviceFamily = mDeviceFamilies[id];
switch (id) {
case IntelGMA500:
APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
break;
case IntelGMA900:
APPEND_DEVICE(0x2582); /* IntelGMA900_1 */
APPEND_DEVICE(0x2782); /* IntelGMA900_2 */
APPEND_DEVICE(0x2592); /* IntelGMA900_3 */
APPEND_DEVICE(0x2792); /* IntelGMA900_4 */
break;
case IntelGMA950:
APPEND_DEVICE(0x2772); /* Intel945G_1 */
APPEND_DEVICE(0x2776); /* Intel945G_2 */
APPEND_DEVICE(0x27a2); /* Intel945_1 */
APPEND_DEVICE(0x27a6); /* Intel945_2 */
APPEND_DEVICE(0x27ae); /* Intel945_3 */
break;
case IntelGMA3150:
APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */
APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */
APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */
APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */
break;
case IntelGMAX3000:
APPEND_DEVICE(0x2972); /* Intel946GZ_1 */
APPEND_DEVICE(0x2973); /* Intel946GZ_2 */
APPEND_DEVICE(0x2982); /* IntelG35_1 */
APPEND_DEVICE(0x2983); /* IntelG35_2 */
APPEND_DEVICE(0x2992); /* IntelQ965_1 */
APPEND_DEVICE(0x2993); /* IntelQ965_2 */
APPEND_DEVICE(0x29a2); /* IntelG965_1 */
APPEND_DEVICE(0x29a3); /* IntelG965_2 */
APPEND_DEVICE(0x29b2); /* IntelQ35_1 */
APPEND_DEVICE(0x29b3); /* IntelQ35_2 */
APPEND_DEVICE(0x29c2); /* IntelG33_1 */
APPEND_DEVICE(0x29c3); /* IntelG33_2 */
APPEND_DEVICE(0x29d2); /* IntelQ33_1 */
APPEND_DEVICE(0x29d3); /* IntelQ33_2 */
APPEND_DEVICE(0x2a02); /* IntelGL960_1 */
APPEND_DEVICE(0x2a03); /* IntelGL960_2 */
APPEND_DEVICE(0x2a12); /* IntelGM965_1 */
APPEND_DEVICE(0x2a13); /* IntelGM965_2 */
break;
case IntelGMAX4500HD:
APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
APPEND_DEVICE(0x2e42); /* IntelB43_1 */
APPEND_DEVICE(0x2e43); /* IntelB43_2 */
APPEND_DEVICE(0x2e92); /* IntelB43_3 */
APPEND_DEVICE(0x2e93); /* IntelB43_4 */
APPEND_DEVICE(0x2e32); /* IntelG41_1 */
APPEND_DEVICE(0x2e33); /* IntelG41_2 */
APPEND_DEVICE(0x2e22); /* IntelG45_1 */
APPEND_DEVICE(0x2e23); /* IntelG45_2 */
APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
APPEND_DEVICE(0x0042); /* IntelHDGraphics */
APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */
APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */
APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */
APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */
APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */
APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */
APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */
APPEND_DEVICE(0x0080); /* IntelIvyBridge */
break;
case NvidiaBlockD3D9Layers:
// Glitches whilst scrolling (see bugs 612007, 644787, 645872)
APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */
APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */
APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */
APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */
APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */
APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */
APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */
APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */
APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */
APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */
APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */
APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */
APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
break;
case RadeonX1000:
// This list is from the ATIRadeonX1000.kext Info.plist
APPEND_DEVICE(0x7187);
APPEND_DEVICE(0x7210);
APPEND_DEVICE(0x71de);
APPEND_DEVICE(0x7146);
APPEND_DEVICE(0x7142);
APPEND_DEVICE(0x7109);
APPEND_DEVICE(0x71c5);
APPEND_DEVICE(0x71c0);
APPEND_DEVICE(0x7240);
APPEND_DEVICE(0x7249);
APPEND_DEVICE(0x7291);
break;
case Geforce7300GT:
APPEND_DEVICE(0x0393);
break;
// This should never happen, but we get a warning if we don't handle this.
case DeviceFamilyMax:
NS_WARNING("Invalid DeviceFamily id");
break;
}
return deviceFamily;
}
// Macro for assigning a device vendor id to a string.
#define DECLARE_VENDOR_ID(name, deviceId) \
case name: \
mDeviceVendors[id]->AssignLiteral(deviceId); \
break;
const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceVendor id)
{
NS_ASSERTION(id >= 0 && id < DeviceVendorMax, "DeviceVendor id is out of range");
if (mDeviceVendors[id])
return *mDeviceVendors[id];
mDeviceVendors[id] = new nsString();
switch (id) {
DECLARE_VENDOR_ID(VendorAll, "");
DECLARE_VENDOR_ID(VendorIntel, "0x8086");
DECLARE_VENDOR_ID(VendorNVIDIA, "0x10de");
DECLARE_VENDOR_ID(VendorAMD, "0x1022");
DECLARE_VENDOR_ID(VendorATI, "0x1002");
// Suppress a warning.
DECLARE_VENDOR_ID(DeviceVendorMax, "");
}
return *mDeviceVendors[id];
}

View File

@ -43,6 +43,12 @@
#define V(a,b,c,d) GFX_DRIVER_VERSION(a,b,c,d)
// Macros for adding a blocklist item to the static list.
#define APPEND_TO_DRIVER_BLOCKLIST(os, vendor, devices, feature, featureStatus, driverComparator, driverVersion, suggestedVersion) \
mDriverInfo->AppendElement(GfxDriverInfo(os, vendor, devices, feature, featureStatus, driverComparator, driverVersion, suggestedVersion))
#define APPEND_TO_DRIVER_BLOCKLIST2(os, vendor, devices, feature, featureStatus, driverComparator, driverVersion) \
mDriverInfo->AppendElement(GfxDriverInfo(os, vendor, devices, feature, featureStatus, driverComparator, driverVersion))
namespace mozilla {
namespace widget {
@ -74,118 +80,36 @@ enum VersionComparisonOp {
DRIVER_UNKNOWN_COMPARISON
};
static const PRUint32 deviceFamilyIntelGMA500[] = {
0x8108, /* IntelGMA500_1 */
0x8109, /* IntelGMA500_2 */
0
enum DeviceFamily {
IntelGMA500,
IntelGMA900,
IntelGMA950,
IntelGMA3150,
IntelGMAX3000,
IntelGMAX4500HD,
NvidiaBlockD3D9Layers,
RadeonX1000,
Geforce7300GT,
DeviceFamilyMax
};
static const PRUint32 deviceFamilyIntelGMA900[] = {
0x2582, /* IntelGMA900_1 */
0x2782, /* IntelGMA900_2 */
0x2592, /* IntelGMA900_3 */
0x2792, /* IntelGMA900_4 */
0
enum DeviceVendor {
VendorAll,
VendorIntel,
VendorNVIDIA,
VendorAMD,
VendorATI,
DeviceVendorMax
};
static const PRUint32 deviceFamilyIntelGMA950[] = {
0x2772, /* Intel945G_1 */
0x2776, /* Intel945G_2 */
0x27A2, /* Intel945_1 */
0x27A6, /* Intel945_2 */
0x27AE, /* Intel945_3 */
0
};
static const PRUint32 deviceFamilyIntelGMA3150[] = {
0xA001, /* IntelGMA3150_Nettop_1 */
0xA002, /* IntelGMA3150_Nettop_2 */
0xA011, /* IntelGMA3150_Netbook_1 */
0xA012, /* IntelGMA3150_Netbook_2 */
0
};
static const PRUint32 deviceFamilyIntelGMAX3000[] = {
0x2972, /* Intel946GZ_1 */
0x2973, /* Intel946GZ_2 */
0x2982, /* IntelG35_1 */
0x2983, /* IntelG35_2 */
0x2992, /* IntelQ965_1 */
0x2993, /* IntelQ965_2 */
0x29A2, /* IntelG965_1 */
0x29A3, /* IntelG965_2 */
0x29B2, /* IntelQ35_1 */
0x29B3, /* IntelQ35_2 */
0x29C2, /* IntelG33_1 */
0x29C3, /* IntelG33_2 */
0x29D2, /* IntelQ33_1 */
0x29D3, /* IntelQ33_2 */
0x2A02, /* IntelGL960_1 */
0x2A03, /* IntelGL960_2 */
0x2A12, /* IntelGM965_1 */
0x2A13, /* IntelGM965_2 */
0
};
static const PRUint32 deviceFamilyIntelGMAX4500HD[] = {
0x2A42, /* IntelGMA4500MHD_1 */
0x2A43, /* IntelGMA4500MHD_2 */
0x2E42, /* IntelB43_1 */
0x2E43, /* IntelB43_2 */
0x2E92, /* IntelB43_3 */
0x2E93, /* IntelB43_4 */
0x2E32, /* IntelG41_1 */
0x2E33, /* IntelG41_2 */
0x2E22, /* IntelG45_1 */
0x2E23, /* IntelG45_2 */
0x2E12, /* IntelQ45_1 */
0x2E13, /* IntelQ45_2 */
0x0042, /* IntelHDGraphics */
0x0046, /* IntelMobileHDGraphics */
0x0102, /* IntelSandyBridge_1 */
0x0106, /* IntelSandyBridge_2 */
0x0112, /* IntelSandyBridge_3 */
0x0116, /* IntelSandyBridge_4 */
0x0122, /* IntelSandyBridge_5 */
0x0126, /* IntelSandyBridge_6 */
0x010A, /* IntelSandyBridge_7 */
0x0080, /* IntelIvyBridge */
0
};
// Glitches whilst scrolling (see bugs 612007, 644787, 645872)
static const PRUint32 deviceFamilyNvidiaBlockD3D9Layers[] = {
0x00f3, /* NV43 [GeForce 6200 (TM)] */
0x0146, /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
0x014f, /* NV43 [GeForce 6200 (TM)] */
0x0161, /* NV44 [GeForce 6200 TurboCache (TM)] */
0x0162, /* NV44 [GeForce 6200SE TurboCache (TM)] */
0x0163, /* NV44 [GeForce 6200 LE (TM)] */
0x0164, /* NV44 [GeForce Go 6200 (TM)] */
0x0167, /* NV43 [GeForce Go 6200/6400 (TM)] */
0x0168, /* NV43 [GeForce Go 6200/6400 (TM)] */
0x0169, /* NV44 [GeForce 6250 (TM)] */
0x0222, /* NV44 [GeForce 6200 A-LE (TM)] */
0x0240, /* C51PV [GeForce 6150 (TM)] */
0x0241, /* C51 [GeForce 6150 LE (TM)] */
0x0244, /* C51 [Geforce Go 6150 (TM)] */
0x0245, /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
0x0247, /* C51 [GeForce Go 6100 (TM)] */
0x03d0, /* C61 [GeForce 6150SE nForce 430 (TM)] */
0x03d1, /* C61 [GeForce 6100 nForce 405 (TM)] */
0x03d2, /* C61 [GeForce 6100 nForce 400 (TM)] */
0x03d5, /* C61 [GeForce 6100 nForce 420 (TM)] */
0
};
/* A zero-terminated array of devices to match, or all devices */
typedef PRUint32 *GfxDeviceFamily;
/* Array of devices to match, or an empty array for all devices */
typedef nsTArray<nsString> GfxDeviceFamily;
struct GfxDriverInfo
{
// If |ownDevices| is true, you are transferring ownership of the devices
// array, and it will be deleted when this GfxDriverInfo is destroyed.
GfxDriverInfo(OperatingSystem os, PRUint32 vendor, GfxDeviceFamily devices,
GfxDriverInfo(OperatingSystem os, nsAString& vendor, GfxDeviceFamily* devices,
PRInt32 feature, PRInt32 featureStatus, VersionComparisonOp op,
PRUint64 driverVersion, const char *suggestedVersion = nsnull,
bool ownDevices = false);
@ -196,11 +120,10 @@ struct GfxDriverInfo
OperatingSystem mOperatingSystem;
PRUint32 mAdapterVendor;
static PRUint32 allAdapterVendors;
nsString mAdapterVendor;
GfxDeviceFamily mDevices;
static GfxDeviceFamily allDevices;
static GfxDeviceFamily* const allDevices;
GfxDeviceFamily* mDevices;
// Whether the mDevices array should be deleted when this structure is
// deallocated. False by default.
@ -220,12 +143,13 @@ struct GfxDriverInfo
PRUint64 mDriverVersionMax;
static PRUint64 allDriverVersions;
static PRUint32 vendorIntel;
static PRUint32 vendorNVIDIA;
static PRUint32 vendorAMD;
static PRUint32 vendorATI;
const char *mSuggestedVersion;
static const GfxDeviceFamily* GetDeviceFamily(DeviceFamily id);
static GfxDeviceFamily* mDeviceFamilies[DeviceFamilyMax];
static const nsAString& GetDeviceVendor(DeviceVendor id);
static nsAString* mDeviceVendors[DeviceVendorMax];
};
#define GFX_DRIVER_VERSION(a,b,c,d) \
@ -234,6 +158,7 @@ struct GfxDriverInfo
inline bool
ParseDriverVersion(nsAString& aVersion, PRUint64 *aNumericVersion)
{
#if defined(XP_WIN)
int a, b, c, d;
/* honestly, why do I even bother */
if (sscanf(NS_LossyConvertUTF16toASCII(aVersion).get(),
@ -245,6 +170,11 @@ ParseDriverVersion(nsAString& aVersion, PRUint64 *aNumericVersion)
if (d < 0 || d > 0xffff) return false;
*aNumericVersion = GFX_DRIVER_VERSION(a, b, c, d);
#elif defined(ANDROID)
// Can't use aVersion.ToInteger() because that's not compiled into our code
// unless we have XPCOM_GLUE_AVOID_NSPR disabled.
*aNumericVersion = atoi(NS_LossyConvertUTF16toASCII(aVersion).get());
#endif
return true;
}

View File

@ -48,6 +48,7 @@
#include "nsAutoPtr.h"
#include "nsString.h"
#include "mozilla/Services.h"
#include "mozilla/Observer.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIDOMElement.h"
@ -60,8 +61,58 @@
#include "nsExceptionHandler.h"
#endif
using namespace mozilla::widget;
using namespace mozilla;
nsTArray<GfxDriverInfo>* GfxInfoBase::mDriverInfo;
bool GfxInfoBase::mDriverInfoObserverInitialized;
// Observes for shutdown so that the child GfxDriverInfo list is freed.
class ShutdownObserver : public nsIObserver
{
public:
ShutdownObserver() {}
virtual ~ShutdownObserver() {}
NS_DECL_ISUPPORTS
NS_IMETHOD Observe(nsISupports *subject, const char *aTopic,
const PRUnichar *aData)
{
MOZ_ASSERT(strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0);
delete GfxInfoBase::mDriverInfo;
GfxInfoBase::mDriverInfo = nsnull;
for (PRUint32 i = 0; i < DeviceFamilyMax; i++)
delete GfxDriverInfo::mDeviceFamilies[i];
for (PRUint32 i = 0; i < DeviceVendorMax; i++)
delete GfxDriverInfo::mDeviceVendors[i];
return NS_OK;
}
};
NS_IMPL_ISUPPORTS1(ShutdownObserver, nsIObserver);
void InitGfxDriverInfoShutdownObserver()
{
if (GfxInfoBase::mDriverInfoObserverInitialized)
return;
GfxInfoBase::mDriverInfoObserverInitialized = true;
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
if (!observerService) {
NS_WARNING("Could not get observer service!");
return;
}
ShutdownObserver *obs = new ShutdownObserver();
observerService->AddObserver(obs, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
}
extern "C" {
void StoreSpline(int ax, int ay, int bx, int by, int cx, int cy, int dx, int dy);
void CrashSpline(double tolerance, int ax, int ay, int bx, int by, int cx, int cy, int dx, int dy);
@ -262,29 +313,16 @@ BlacklistOSToOperatingSystem(const nsAString& os)
return DRIVER_OS_UNKNOWN;
}
static PRUint32
BlacklistHexToInt(const nsAString& aHex)
{
PRInt32 err;
// nsAString doesn't have .ToInteger() :(
nsAutoString hex(aHex);
PRInt32 value = hex.ToInteger(&err, 16);
if (NS_FAILED(err))
return 0;
return (PRUint32) value;
}
static PRUint32*
static GfxDeviceFamily*
BlacklistDevicesToDeviceFamily(nsIDOMNodeList* aDevices)
{
PRUint32 length;
if (NS_FAILED(aDevices->GetLength(&length)))
return nsnull;
// For each <device>, get its device ID, and return a freshly-allocated array
// with the contents of that array.
nsAutoArrayPtr<PRUint32> deviceIds(new PRUint32[length + 1]);
memset(deviceIds, 0, sizeof(PRUint32) * (length + 1));
// For each <device>, get its device ID, and return a freshly-allocated
// GfxDeviceFamily with the contents of that array.
GfxDeviceFamily* deviceIds = new GfxDeviceFamily;
for (PRUint32 i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMNode> node;
@ -295,10 +333,10 @@ BlacklistDevicesToDeviceFamily(nsIDOMNodeList* aDevices)
if (!BlacklistNodeToTextValue(node, deviceValue))
continue;
deviceIds[i] = BlacklistHexToInt(deviceValue);
deviceIds->AppendElement(deviceValue);
}
return deviceIds.forget();
return deviceIds;
}
static PRInt32
@ -338,6 +376,8 @@ BlacklistFeatureStatusToGfxFeatureStatus(const nsAString& aStatus)
else if (aStatus == NS_LITERAL_STRING("BLOCKED_OS_VERSION"))
return nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
// Do not allow it to set STATUS_UNKNOWN.
return nsIGfxInfo::FEATURE_NO_INFO;
}
@ -431,7 +471,7 @@ BlacklistEntryToDriverInfo(nsIDOMNode* aBlacklistEntry,
if (BlacklistNodeGetChildByName(element, NS_LITERAL_STRING("vendor"),
getter_AddRefs(dataNode))) {
BlacklistNodeToTextValue(dataNode, dataValue);
aDriverInfo.mAdapterVendor = BlacklistHexToInt(dataValue);
aDriverInfo.mAdapterVendor = dataValue;
}
// <devices>
@ -448,7 +488,7 @@ BlacklistEntryToDriverInfo(nsIDOMNode* aBlacklistEntry,
nsCOMPtr<nsIDOMNodeList> devices;
if (NS_SUCCEEDED(devicesElement->GetElementsByTagName(NS_LITERAL_STRING("device"),
getter_AddRefs(devices)))) {
PRUint32* deviceIds = BlacklistDevicesToDeviceFamily(devices);
GfxDeviceFamily* deviceIds = BlacklistDevicesToDeviceFamily(devices);
if (deviceIds) {
// Get GfxDriverInfo to adopt the devices array we created.
aDriverInfo.mDeleteDevices = true;
@ -501,6 +541,8 @@ BlacklistEntriesToDriverInfo(nsIDOMNodeList* aBlacklistEntries,
if (NS_FAILED(aBlacklistEntries->GetLength(&length)))
return;
aDriverInfo.Clear();
aDriverInfo.SetLength(length);
for (PRUint32 i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMNode> blacklistEntry;
if (NS_SUCCEEDED(aBlacklistEntries->Item(i,
@ -508,8 +550,10 @@ BlacklistEntriesToDriverInfo(nsIDOMNodeList* aBlacklistEntries,
blacklistEntry) {
GfxDriverInfo di;
if (BlacklistEntryToDriverInfo(blacklistEntry, di)) {
aDriverInfo.AppendElement(di);
aDriverInfo[i] = di;
}
// Prevent di falling out of scope from destroying the devices.
di.mDeleteDevices = false;
}
}
}
@ -529,7 +573,6 @@ GfxInfoBase::Observe(nsISupports* aSubject, const char* aTopic,
{
nsTArray<GfxDriverInfo> driverInfo;
BlacklistEntriesToDriverInfo(blacklistEntries, driverInfo);
EvaluateDownloadedBlacklist(driverInfo);
}
}
@ -550,6 +593,8 @@ GfxInfoBase::~GfxInfoBase()
nsresult
GfxInfoBase::Init()
{
InitGfxDriverInfoShutdownObserver();
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os) {
os->AddObserver(this, "blocklist-data-gfxItems", true);
@ -558,12 +603,6 @@ GfxInfoBase::Init()
return NS_OK;
}
static const GfxDriverInfo gDriverInfo[] = {
// No combinations that cause a crash on every OS.
GfxDriverInfo()
};
NS_IMETHODIMP
GfxInfoBase::GetFeatureStatus(PRInt32 aFeature, PRInt32* aStatus NS_OUTPARAM)
{
@ -571,31 +610,23 @@ GfxInfoBase::GetFeatureStatus(PRInt32 aFeature, PRInt32* aStatus NS_OUTPARAM)
return NS_OK;
nsString version;
return GetFeatureStatusImpl(aFeature, aStatus, version);
nsTArray<GfxDriverInfo> driverInfo;
return GetFeatureStatusImpl(aFeature, aStatus, version, driverInfo);
}
nsresult
GfxInfoBase::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32* aStatus,
nsAString& aVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
OperatingSystem* aOS /* = nsnull */)
PRInt32
GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& info,
nsAString& aSuggestedVersion,
PRInt32 aFeature,
OperatingSystem os)
{
if (*aStatus != nsIGfxInfo::FEATURE_NO_INFO) {
// Terminate now with the status determined by the derived type (OS-specific
// code).
return NS_OK;
}
PRInt32 status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
OperatingSystem os = DRIVER_OS_UNKNOWN;
if (aOS)
os = *aOS;
PRUint32 adapterVendorID = 0;
PRUint32 adapterDeviceID = 0;
nsAutoString adapterVendorID;
nsAutoString adapterDeviceID;
nsAutoString adapterDriverVersionString;
if (NS_FAILED(GetAdapterVendorID(&adapterVendorID)) ||
NS_FAILED(GetAdapterDeviceID(&adapterDeviceID)) ||
if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
{
return NS_OK;
@ -604,95 +635,63 @@ GfxInfoBase::GetFeatureStatusImpl(PRInt32 aFeature,
PRUint64 driverVersion;
ParseDriverVersion(adapterDriverVersionString, &driverVersion);
// special-case the WinXP test slaves: they have out-of-date drivers, but we still want to
// whitelist them, actually we do know that this combination of device and driver version
// works well.
if (os == DRIVER_OS_WINDOWS_XP &&
adapterVendorID == GfxDriverInfo::vendorNVIDIA &&
adapterDeviceID == 0x0861 && // GeForce 9400
driverVersion == V(6,14,11,7756))
{
return NS_OK;
}
PRInt32 status = *aStatus;
const GfxDriverInfo* info = aDriverInfo ? aDriverInfo : &gDriverInfo[0];
// This code will operate in two modes:
// It first loops over the driver tuples stored locally in gDriverInfo,
// then loops over it a second time for the OS's specific list to check for
// all combinations that can lead to disabling a feature.
bool loopingOverOS = false;
while (true) {
if (!info->mOperatingSystem) {
if (loopingOverOS)
break;
else
{
// Mark us as looping over the OS driver tuples.
loopingOverOS = true;
// Get the GfxDriverInfo table from the OS subclass.
info = GetGfxDriverInfo();
}
}
if (info->mOperatingSystem != DRIVER_OS_ALL &&
info->mOperatingSystem != os)
PRUint32 i = 0;
for (; i < info.Length(); i++) {
if (info[i].mOperatingSystem != DRIVER_OS_ALL &&
info[i].mOperatingSystem != os)
{
info++;
continue;
}
if (info->mAdapterVendor != GfxDriverInfo::allAdapterVendors &&
info->mAdapterVendor != adapterVendorID) {
info++;
if (info[i].mAdapterVendor != GfxDriverInfo::GetDeviceVendor(VendorAll) &&
info[i].mAdapterVendor != adapterVendorID) {
continue;
}
if (info->mDevices != GfxDriverInfo::allDevices) {
if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) {
bool deviceMatches = false;
for (const PRUint32 *devices = info->mDevices; *devices; ++devices) {
if (*devices == adapterDeviceID) {
for (PRUint32 j = 0; j < info[i].mDevices->Length(); j++) {
if ((*info[i].mDevices)[j] == adapterDeviceID) {
deviceMatches = true;
break;
}
}
if (!deviceMatches) {
info++;
continue;
}
}
bool match = false;
#if !defined(XP_MACOSX)
switch (info->mComparisonOp) {
#if defined(XP_WIN) || defined(ANDROID)
switch (info[i].mComparisonOp) {
case DRIVER_LESS_THAN:
match = driverVersion < info->mDriverVersion;
match = driverVersion < info[i].mDriverVersion;
break;
case DRIVER_LESS_THAN_OR_EQUAL:
match = driverVersion <= info->mDriverVersion;
match = driverVersion <= info[i].mDriverVersion;
break;
case DRIVER_GREATER_THAN:
match = driverVersion > info->mDriverVersion;
match = driverVersion > info[i].mDriverVersion;
break;
case DRIVER_GREATER_THAN_OR_EQUAL:
match = driverVersion >= info->mDriverVersion;
match = driverVersion >= info[i].mDriverVersion;
break;
case DRIVER_EQUAL:
match = driverVersion == info->mDriverVersion;
match = driverVersion == info[i].mDriverVersion;
break;
case DRIVER_NOT_EQUAL:
match = driverVersion != info->mDriverVersion;
match = driverVersion != info[i].mDriverVersion;
break;
case DRIVER_BETWEEN_EXCLUSIVE:
match = driverVersion > info->mDriverVersion && driverVersion < info->mDriverVersionMax;
match = driverVersion > info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE:
match = driverVersion >= info->mDriverVersion && driverVersion <= info->mDriverVersionMax;
match = driverVersion >= info[i].mDriverVersion && driverVersion <= info[i].mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE_START:
match = driverVersion >= info->mDriverVersion && driverVersion < info->mDriverVersionMax;
match = driverVersion >= info[i].mDriverVersion && driverVersion < info[i].mDriverVersionMax;
break;
default:
NS_WARNING("Bogus op in GfxDriverInfo");
@ -704,38 +703,90 @@ GfxInfoBase::GetFeatureStatusImpl(PRInt32 aFeature,
match = true;
#endif
if (match) {
if (info->mFeature == GfxDriverInfo::allFeatures ||
info->mFeature == aFeature)
if (match || info[i].mDriverVersion == GfxDriverInfo::allDriverVersions) {
if (info[i].mFeature == GfxDriverInfo::allFeatures ||
info[i].mFeature == aFeature)
{
status = info->mFeatureStatus;
status = info[i].mFeatureStatus;
break;
}
}
info++;
}
*aStatus = status;
// Depends on Windows driver versioning. We don't pass a GfxDriverInfo object
// back to the Windows handler, so we must handle this here.
#if defined(XP_WIN)
if (status == FEATURE_BLOCKED_DRIVER_VERSION) {
if (info->mSuggestedVersion) {
aVersion.AppendPrintf("%s", info->mSuggestedVersion);
} else if (info->mComparisonOp == DRIVER_LESS_THAN &&
info->mDriverVersion != GfxDriverInfo::allDriverVersions)
if (info[i].mSuggestedVersion) {
aSuggestedVersion.AppendPrintf("%s", info[i].mSuggestedVersion);
} else if (info[i].mComparisonOp == DRIVER_LESS_THAN &&
info[i].mDriverVersion != GfxDriverInfo::allDriverVersions)
{
aVersion.AppendPrintf("%lld.%lld.%lld.%lld",
(info->mDriverVersion & 0xffff000000000000) >> 48,
(info->mDriverVersion & 0x0000ffff00000000) >> 32,
(info->mDriverVersion & 0x00000000ffff0000) >> 16,
(info->mDriverVersion & 0x000000000000ffff));
aSuggestedVersion.AppendPrintf("%lld.%lld.%lld.%lld",
(info[i].mDriverVersion & 0xffff000000000000) >> 48,
(info[i].mDriverVersion & 0x0000ffff00000000) >> 32,
(info[i].mDriverVersion & 0x00000000ffff0000) >> 16,
(info[i].mDriverVersion & 0x000000000000ffff));
}
}
#endif
return status;
}
nsresult
GfxInfoBase::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32* aStatus,
nsAString& aSuggestedVersion,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS /* = nsnull */)
{
if (*aStatus != nsIGfxInfo::FEATURE_STATUS_UNKNOWN) {
// Terminate now with the status determined by the derived type (OS-specific
// code).
return NS_OK;
}
// If an operating system was provided by the derived GetFeatureStatusImpl,
// grab it here. Otherwise, the OS is unknown.
OperatingSystem os = DRIVER_OS_UNKNOWN;
if (aOS)
os = *aOS;
nsAutoString adapterVendorID;
nsAutoString adapterDeviceID;
nsAutoString adapterDriverVersionString;
if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
{
return NS_OK;
}
PRUint64 driverVersion;
ParseDriverVersion(adapterDriverVersionString, &driverVersion);
// Check if the device is blocked from the downloaded blocklist. If not, check
// the static list after that. This order is used so that we can later escape
// out of static blocks (i.e. if we were wrong or something was patched, we
// can back out our static block without doing a release).
PRInt32 status;
if (aDriverInfo.Length()) {
status = FindBlocklistedDeviceInList(aDriverInfo, aSuggestedVersion, aFeature, os);
} else {
if (!mDriverInfo) {
mDriverInfo = new nsTArray<GfxDriverInfo>();
}
status = FindBlocklistedDeviceInList(GetGfxDriverInfo(), aSuggestedVersion, aFeature, os);
}
// It's now done being processed. It's safe to set the status to NO_INFO.
if (status == nsIGfxInfo::FEATURE_STATUS_UNKNOWN) {
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
} else {
*aStatus = status;
}
return NS_OK;
}
@ -750,7 +801,8 @@ GfxInfoBase::GetFeatureSuggestedDriverVersion(PRInt32 aFeature,
}
PRInt32 status;
return GetFeatureStatusImpl(aFeature, &status, aVersion);
nsTArray<GfxDriverInfo> driverInfo;
return GetFeatureStatusImpl(aFeature, &status, aVersion, driverInfo);
}
@ -776,10 +828,6 @@ GfxInfoBase::EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo)
0
};
// GetFeatureStatusImpl wants a zero-GfxDriverInfo terminated array. So, we
// append that to our list.
aDriverInfo.AppendElement(GfxDriverInfo());
// For every feature we know about, we evaluate whether this blacklist has a
// non-NO_INFO status. If it does, we set the pref we evaluate in
// GetFeatureStatus above, so we don't need to hold on to this blacklist
@ -790,7 +838,7 @@ GfxInfoBase::EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo)
nsAutoString suggestedVersion;
if (NS_SUCCEEDED(GetFeatureStatusImpl(features[i], &status,
suggestedVersion,
aDriverInfo.Elements()))) {
aDriverInfo))) {
switch (status) {
default:
case nsIGfxInfo::FEATURE_NO_INFO:

View File

@ -48,6 +48,7 @@
#include "nsTArray.h"
#include "nsString.h"
#include "GfxInfoCollector.h"
#include "nsIGfxInfoDebug.h"
namespace mozilla {
namespace widget {
@ -55,6 +56,9 @@ namespace widget {
class GfxInfoBase : public nsIGfxInfo,
public nsIObserver,
public nsSupportsWeakReference
#ifdef DEBUG
, public nsIGfxInfoDebug
#endif
{
public:
GfxInfoBase();
@ -87,25 +91,31 @@ public:
// NS_GENERIC_FACTORY_CONSTRUCTOR_INIT require it be nsresult return.
virtual nsresult Init();
// Gets the driver info table. Used by GfxInfoBase to check for general cases
// (while subclasses check for more specific ones).
virtual const GfxDriverInfo* GetGfxDriverInfo() = 0;
// only useful on X11
NS_IMETHOD_(void) GetData() { }
static void AddCollector(GfxInfoCollectorBase* collector);
static void RemoveCollector(GfxInfoCollectorBase* collector);
static nsTArray<GfxDriverInfo>* mDriverInfo;
static bool mDriverInfoObserverInitialized;
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32* aStatus,
nsAString& aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS = nsnull);
// Gets the driver info table. Used by GfxInfoBase to check for general cases
// (while subclasses check for more specific ones).
virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo() = 0;
private:
virtual PRInt32 FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& aDriverInfo,
nsAString& aSuggestedVersion,
PRInt32 aFeature,
OperatingSystem os);
void EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo);

View File

@ -54,6 +54,10 @@
namespace mozilla {
namespace widget {
#ifdef DEBUG
NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
// these global variables will be set when firing the glxtest process
int glxtest_pipe = 0;
pid_t glxtest_pid = 0;
@ -246,78 +250,88 @@ static inline PRUint64 version(PRUint32 major, PRUint32 minor, PRUint32 revision
return (PRUint64(major) << 32) + (PRUint64(minor) << 16) + PRUint64(revision);
}
static GfxDriverInfo gDriverInfo[] = {
GfxDriverInfo()
};
const GfxDriverInfo*
const nsTArray<GfxDriverInfo>&
GfxInfo::GetGfxDriverInfo()
{
return &gDriverInfo[0];
// Nothing here yet.
//if (!mDriverInfo->Length()) {
//
//}
return *mDriverInfo;
}
nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS /* = nsnull */)
{
GetData();
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
aSuggestedDriverVersion.SetIsVoid(true);
NS_ENSURE_ARG_POINTER(aStatus);
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
aSuggestedDriverVersion.SetIsVoid(true);
OperatingSystem os = DRIVER_OS_LINUX;
if (aOS)
*aOS = os;
#ifdef MOZ_PLATFORM_MAEMO
// on Maemo, the glxtest probe doesn't build, and we don't really need GfxInfo anyway
return NS_OK;
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
// on Maemo, the glxtest probe doesn't build, and we don't really need GfxInfo anyway
return NS_OK;
#endif
OperatingSystem os = DRIVER_OS_LINUX;
// Don't evaluate any special cases if we're checking the downloaded blocklist.
if (!aDriverInfo.Length()) {
// Only check features relevant to Linux.
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS ||
aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL ||
aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
GetData();
// Disable OpenGL layers when we don't have texture_from_pixmap because it regresses performance.
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mHasTextureFromPixmap) {
// Disable OpenGL layers when we don't have texture_from_pixmap because it regresses performance.
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mHasTextureFromPixmap) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aSuggestedDriverVersion.AssignLiteral("<Anything with EXT_texture_from_pixmap support>");
return NS_OK;
}
}
// whitelist the linux test slaves' current configuration.
// this is necessary as they're still using the slightly outdated 190.42 driver.
// this isn't a huge risk, as at least this is the exact setting in which we do continuous testing,
// and this only affects GeForce 9400 cards on linux on this precise driver version, which is very few users.
// We do the same thing on Windows XP, see in widget/src/windows/GfxInfo.cpp
if (mIsNVIDIA &&
!strcmp(mRenderer.get(), "GeForce 9400/PCI/SSE2") &&
!strcmp(mVersion.get(), "3.2.0 NVIDIA 190.42"))
{
// whitelist the linux test slaves' current configuration.
// this is necessary as they're still using the slightly outdated 190.42 driver.
// this isn't a huge risk, as at least this is the exact setting in which we do continuous testing,
// and this only affects GeForce 9400 cards on linux on this precise driver version, which is very few users.
// We do the same thing on Windows XP, see in widget/src/windows/GfxInfo.cpp
if (mIsNVIDIA &&
!strcmp(mRenderer.get(), "GeForce 9400/PCI/SSE2") &&
!strcmp(mVersion.get(), "3.2.0 NVIDIA 190.42"))
{
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
return NS_OK;
}
}
if (mIsMesa) {
if (mIsMesa) {
if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(7,10,3)) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aSuggestedDriverVersion.AssignLiteral("Mesa 7.10.3");
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aSuggestedDriverVersion.AssignLiteral("Mesa 7.10.3");
}
} else if (mIsNVIDIA) {
} else if (mIsNVIDIA) {
if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(257,21)) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aSuggestedDriverVersion.AssignLiteral("NVIDIA 257.21");
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aSuggestedDriverVersion.AssignLiteral("NVIDIA 257.21");
}
} else if (mIsFGLRX) {
} else if (mIsFGLRX) {
// FGLRX does not report a driver version number, so we have the OpenGL version instead.
// by requiring OpenGL 3, we effectively require recent drivers.
if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(3, 0)) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
}
} else {
} else {
// like on windows, let's block unknown vendors. Think of virtual machines.
// Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed.
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
}
}
if (aOS)
*aOS = os;
}
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
}
@ -432,32 +446,34 @@ GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterVendorID; */
/* readonly attribute DOMString adapterVendorID; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
{
*aAdapterVendorID = 0;
GetData();
CopyUTF8toUTF16(mVendor, aAdapterVendorID);
return NS_OK;
}
/* readonly attribute unsigned long adapterVendorID2; */
/* readonly attribute DOMString adapterVendorID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
{
return NS_ERROR_FAILURE;
}
/* readonly attribute unsigned long adapterDeviceID; */
/* readonly attribute DOMString adapterDeviceID; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
{
*aAdapterDeviceID = 0;
GetData();
CopyUTF8toUTF16(mRenderer, aAdapterDeviceID);
return NS_OK;
}
/* readonly attribute unsigned long adapterDeviceID2; */
/* readonly attribute DOMString adapterDeviceID2; */
NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID)
GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
{
return NS_ERROR_FAILURE;
}
@ -469,6 +485,40 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
return NS_ERROR_FAILURE;
}
#ifdef DEBUG
// Implement nsIGfxInfoDebug
// We don't support spoofing anything on Linux
/* void spoofVendorID (in DOMString aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
{
CopyUTF16toUTF8(aVendorID, mVendor);
return NS_OK;
}
/* void spoofDeviceID (in unsigned long aDeviceID); */
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
{
CopyUTF16toUTF8(aDeviceID, mRenderer);
return NS_OK;
}
/* void spoofDriverVersion (in DOMString aDriverVersion); */
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
{
CopyUTF16toUTF8(aDriverVersion, mVersion);
return NS_OK;
}
/* void spoofOSVersion (in unsigned long aVersion); */
NS_IMETHODIMP GfxInfo::SpoofOSVersion(PRUint32 aVersion)
{
// We don't support OS versioning on Linux. There's just "Linux".
return NS_OK;
}
#endif
} // end namespace widget
} // end namespace mozilla

View File

@ -58,15 +58,15 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(PRUint32 *aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(PRUint32 *aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID);
NS_SCRIPTABLE NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
@ -79,14 +79,19 @@ public:
NS_IMETHOD_(void) GetData();
#ifdef DEBUG
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIGFXINFODEBUG
#endif
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS = nsnull);
virtual const GfxDriverInfo* GetGfxDriverInfo();
virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo();
private:
nsCString mVendor;

View File

@ -103,6 +103,12 @@ ifdef MOZ_JPROF
DEPENDENT_LIBS_LIST += $(DLL_PREFIX)jprof$(DLL_SUFFIX)
endif
ifeq (WINNT,$(OS_TARGET))
ifneq (,$(MOZ_SYDNEYAUDIO)$(MOZ_WEBM)$(MOZ_OGG)$(MOZ_TREMOR)$(MOZ_VORBIS))
DEPENDENT_LIBS_LIST += $(DLL_PREFIX)gkmedias$(DLL_SUFFIX)
endif
endif
ifeq (bundle,$(MOZ_FS_LAYOUT))
EXTRA_DSO_LDOPTS += $(DIST)/bin/XUL
DEPENDENT_LIBS_LIST += XUL