Bug 743830 - Added 'gfx.xrender.enabled' pref (true by default). The pref is fetched in gfPlatformGtk.cpp and can be accessed through gfxPlatformGtk::UseXRender(). UseXRender is used in GLContextProviderGLX to set mUseTextureFromPixmap. r=jmuizelaar

--HG--
extra : rebase_source : 805947a2164aeb2dc71cc33086ac0bd201df3583
This commit is contained in:
Nicolas Silva 2012-04-18 10:27:32 -04:00
Родитель 9f563116e1
Коммит 7c2e58201e
5 изменённых файлов: 39 добавлений и 12 удалений

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

@ -63,6 +63,10 @@
#include "gfxCrashReporterUtils.h"
#ifdef MOZ_WIDGET_GTK2
#include "gfxPlatformGtk.h"
#endif
namespace mozilla {
namespace gl {
@ -251,8 +255,13 @@ GLXLibrary::EnsureInitialized()
GLLibraryLoader::LoadSymbols(mOGLLibrary, symbols_texturefrompixmap,
(GLLibraryLoader::PlatformLookupFunction)&xGetProcAddress))
{
mHasTextureFromPixmap = true;
#ifdef MOZ_WIDGET_GTK2
mUseTextureFromPixmap = gfxPlatformGtk::UseXRender();
#else
mUseTextureFromPixmap = true;
#endif
} else {
mUseTextureFromPixmap = false;
NS_WARNING("Texture from pixmap disabled");
}
@ -278,7 +287,7 @@ GLXLibrary::SupportsTextureFromPixmap(gfxASurface* aSurface)
return false;
}
if (aSurface->GetType() != gfxASurface::SurfaceTypeXlib || !mHasTextureFromPixmap) {
if (aSurface->GetType() != gfxASurface::SurfaceTypeXlib || !mUseTextureFromPixmap) {
return false;
}
@ -328,7 +337,7 @@ GLXLibrary::CreatePixmap(gfxASurface* aSurface)
void
GLXLibrary::DestroyPixmap(GLXPixmap aPixmap)
{
if (!mHasTextureFromPixmap) {
if (!mUseTextureFromPixmap) {
return;
}
@ -339,7 +348,7 @@ GLXLibrary::DestroyPixmap(GLXPixmap aPixmap)
void
GLXLibrary::BindTexImage(GLXPixmap aPixmap)
{
if (!mHasTextureFromPixmap) {
if (!mUseTextureFromPixmap) {
return;
}
@ -352,7 +361,7 @@ GLXLibrary::BindTexImage(GLXPixmap aPixmap)
void
GLXLibrary::ReleaseTexImage(GLXPixmap aPixmap)
{
if (!mHasTextureFromPixmap) {
if (!mUseTextureFromPixmap) {
return;
}
@ -843,7 +852,7 @@ TRY_AGAIN_NO_SHARING:
bool TextureImageSupportsGetBackingSurface()
{
return sGLXLibrary.HasTextureFromPixmap();
return sGLXLibrary.UseTextureFromPixmap();
}
virtual already_AddRefed<TextureImage>

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

@ -49,7 +49,7 @@ class GLXLibrary
{
public:
GLXLibrary() : mInitialized(false), mTriedInitializing(false),
mHasTextureFromPixmap(false), mDebug(false),
mUseTextureFromPixmap(false), mDebug(false),
mHasRobustness(false), mOGLLibrary(nsnull) {}
void xDestroyContext(Display* display, GLXContext context);
@ -121,7 +121,7 @@ public:
void BindTexImage(GLXPixmap aPixmap);
void ReleaseTexImage(GLXPixmap aPixmap);
bool HasTextureFromPixmap() { return mHasTextureFromPixmap; }
bool UseTextureFromPixmap() { return mUseTextureFromPixmap; }
bool HasRobustness() { return mHasRobustness; }
bool SupportsTextureFromPixmap(gfxASurface* aSurface);
@ -230,7 +230,7 @@ private:
bool mInitialized;
bool mTriedInitializing;
bool mHasTextureFromPixmap;
bool mUseTextureFromPixmap;
bool mDebug;
bool mHasRobustness;
PRLibrary *mOGLLibrary;

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

@ -67,6 +67,7 @@
#include <gdk/gdkx.h>
#include "gfxXlibSurface.h"
#include "cairo-xlib.h"
#include "mozilla/Preferences.h"
/* Undefine the Status from Xlib since it will conflict with system headers on OSX */
#if defined(__APPLE__) && defined(Status)
@ -104,14 +105,20 @@ static void do_gdk_drawable_unref (void *data)
g_object_unref (d);
}
#ifdef MOZ_X11
bool gfxPlatformGtk::sUseXRender = true;
#endif
gfxPlatformGtk::gfxPlatformGtk()
{
if (!sFontconfigUtils)
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
#ifdef MOZ_X11
sUseXRender = mozilla::Preferences::GetBool("gfx.xrender.enabled");
#endif
#ifndef MOZ_PANGO
FT_Init_FreeType(&gPlatformFTLibrary);
gPlatformFonts = new FontTable();
gPlatformFonts->Init(100);
gPlatformFontAliases = new FontTable();
@ -178,7 +185,7 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
imageFormat = GetOffscreenFormat();
}
if (UseClientSideRendering()) {
if (!UseXRender()) {
// We're not going to use XRender, so we don't need to
// search for a render format
newSurface = new gfxImageSurface(size, imageFormat);

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

@ -129,7 +129,7 @@ public:
static PRInt32 GetDPI();
static bool UseClientSideRendering() {
static bool UseXRender() {
#if defined(MOZ_X11) && defined(MOZ_PLATFORM_MAEMO)
// XRender is not accelerated on the Maemo at the moment, and
// X server pixman is out of our control; it's likely to be
@ -141,6 +141,8 @@ public:
// rendering, but until we have the ability to featuer test
// this, we'll only disable this for maemo.
return true;
#elif defined(MOZ_X11)
return sUseXRender;
#else
return false;
#endif
@ -153,6 +155,9 @@ protected:
private:
virtual qcms_profile *GetPlatformCMSOutputProfile();
#ifdef MOZ_X11
static bool sUseXRender;
#endif
};
#endif /* GFX_PLATFORM_GTK_H */

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

@ -3469,6 +3469,12 @@ pref("layers.acceleration.draw-fps", false);
pref("layers.offmainthreadcomposition.enabled", false);
#ifdef MOZ_X11
#ifdef MOZ_WIDGET_GTK2
pref("gfx.xrender.enabled",true);
#endif
#endif
#ifdef XP_WIN
// Whether to disable the automatic detection and use of direct2d.
#ifdef MOZ_E10S_COMPAT