зеркало из https://github.com/mozilla/gecko-dev.git
Bug 597336, part 3: Generalize the not-using-X-compositing check when creating shadow-layer backing surfaces. r=karl
This commit is contained in:
Родитель
48b6010626
Коммит
61c93dad95
|
@ -49,6 +49,15 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
// Return true if we're likely compositing using X and so should use
|
||||
// Xlib surfaces in shadow layers.
|
||||
static PRBool
|
||||
UsingXCompositing()
|
||||
{
|
||||
return (gfxASurface::SurfaceTypeXlib ==
|
||||
gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType());
|
||||
}
|
||||
|
||||
// LookReturn a pointer to |aFormat| that lives in the Xrender library.
|
||||
// All code using render formats assumes it doesn't need to copy.
|
||||
static XRenderPictFormat*
|
||||
|
@ -94,13 +103,14 @@ ShadowLayerForwarder::PlatformAllocDoubleBuffer(const gfxIntSize& aSize,
|
|||
SurfaceDescriptor* aFrontBuffer,
|
||||
SurfaceDescriptor* aBackBuffer)
|
||||
{
|
||||
gfxPlatform* platform = gfxPlatform::GetPlatform();
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
// If optimized platform surface is Image, then it is better to continue with Shmem
|
||||
if (platform->ScreenReferenceSurface()->GetType() != gfxASurface::SurfaceTypeXlib)
|
||||
if (!UsingXCompositing()) {
|
||||
// If we're not using X compositing, we're probably compositing on
|
||||
// the client side, in which case X surfaces would just slow
|
||||
// things down. Use Shmem instead.
|
||||
return PR_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
gfxPlatform* platform = gfxPlatform::GetPlatform();
|
||||
nsRefPtr<gfxASurface> front = platform->CreateOffscreenSurface(aSize, aContent);
|
||||
nsRefPtr<gfxASurface> back = platform->CreateOffscreenSurface(aSize, aContent);
|
||||
if (!front || !back ||
|
||||
|
@ -142,13 +152,26 @@ ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
|
|||
/*static*/ void
|
||||
ShadowLayerForwarder::PlatformSyncBeforeUpdate()
|
||||
{
|
||||
XSync(DefaultXDisplay(), False);
|
||||
if (UsingXCompositing()) {
|
||||
// If we're using X surfaces, then we need to finish all pending
|
||||
// operations on the back buffers before handing them to the
|
||||
// parent, otherwise the surface might be used by the parent's
|
||||
// Display in between two operations queued by our Display.
|
||||
XSync(DefaultXDisplay(), False);
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
|
||||
{
|
||||
XSync(DefaultXDisplay(), False);
|
||||
if (UsingXCompositing()) {
|
||||
// If we're using X surfaces, we need to finish all pending
|
||||
// operations on the *front buffers* before handing them back to
|
||||
// the child, even though they will be read operations.
|
||||
// Otherwise, the child might start scribbling on new back buffers
|
||||
// that are still participating in requests as old front buffers.
|
||||
XSync(DefaultXDisplay(), False);
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
|
Загрузка…
Ссылка в новой задаче