b=1015218 add pref to remove Xlib offscreen surfaces on GTK3 platform r=karlt

This patch adds a new pref called "layers.use-image-offscreen-surfaces"
that makes GTK3 platform create gfxImageSurfaces for content layers
instead of gfxXlibSurfaces.

--HG--
extra : rebase_source : b803a453bafc70226f3d4c65684618f154147fdb
This commit is contained in:
Frederic Plourde 2014-07-23 11:04:47 +12:00
Родитель 969f61e5af
Коммит ab4ba2bd41
4 изменённых файлов: 23 добавлений и 5 удалений

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

@ -93,7 +93,9 @@ gfxPlatformGtk::CreateOffscreenSurface(const IntSize& size,
// we should try to match
GdkScreen *gdkScreen = gdk_screen_get_default();
if (gdkScreen) {
if (UseXRender()) {
// When forcing Thebes Layers to use image surfaces for content,
// force creation of gfxImageSurface surfaces.
if (UseXRender() && !UseImageOffscreenSurfaces()) {
Screen *screen = gdk_x11_screen_get_xscreen(gdkScreen);
XRenderPictFormat* xrenderFormat =
gfxXlibSurface::FindRenderFormat(DisplayOfScreen(screen),

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

@ -7,6 +7,7 @@
#define GFX_PLATFORM_GTK_H
#include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "nsAutoRef.h"
#include "nsTArray.h"
@ -88,6 +89,16 @@ public:
#endif
}
bool UseImageOffscreenSurfaces() {
// We want to turn on image offscreen surfaces ONLY for GTK3 builds
// since GTK2 theme rendering still requires xlib surfaces per se.
#if (MOZ_WIDGET_GTK == 3)
return gfxPrefs::UseImageOffscreenSurfaces();
#else
return false;
#endif
}
virtual gfxImageFormat GetOffscreenFormat();
virtual int GetScreenDepth() const;

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

@ -240,6 +240,7 @@ private:
DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-enabled", LayersOffMainThreadCompositionForceEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.testing.enabled", LayersOffMainThreadCompositionTestingEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.use-image-offscreen-surfaces", UseImageOffscreenSurfaces, bool, false);
DECL_GFX_PREF(Live, "layers.orientation.sync.timeout", OrientationSyncMillis, uint32_t, (uint32_t)0);
DECL_GFX_PREF(Once, "layers.prefer-d3d9", LayersPreferD3D9, bool, false);
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);

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

@ -12,7 +12,9 @@
#endif
#include "nsShmImage.h"
#include "gfxPlatform.h"
#ifdef MOZ_WIDGET_GTK
#include "gfxPlatformGtk.h"
#endif
#include "gfxImageSurface.h"
#ifdef MOZ_HAVE_SHMIMAGE
@ -24,9 +26,11 @@ using namespace mozilla::ipc;
static bool gShmAvailable = true;
bool nsShmImage::UseShm()
{
return gfxPlatform::GetPlatform()->
ScreenReferenceSurface()->GetType() == gfxSurfaceType::Image
&& gShmAvailable;
#ifdef MOZ_WIDGET_GTK
return (gShmAvailable && !gfxPlatformGtk::GetPlatform()->UseXRender());
#else
return gShmAvailable;
#endif
}
already_AddRefed<nsShmImage>