bool ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize, gfxContentType aContent, uint32_t aCaps, SurfaceDescriptor* aBuffer) { 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 false; } if (MAP_AS_IMAGE_SURFACE & aCaps) { // We can't efficiently map pixmaps as gfxImageSurface, in // general. Fall back on Shmem. return false; } gfxPlatform* platform = gfxPlatform::GetPlatform(); nsRefPtr<gfxASurface> buffer = platform->CreateOffscreenSurface(gfx::ThebesIntSize(aSize), aContent); if (!buffer || buffer->GetType() != gfxSurfaceType::Xlib) { NS_ERROR("creating Xlib front/back surfaces failed!"); return false; } gfxXlibSurface* bufferX = static_cast<gfxXlibSurface*>(buffer.get()); // Release Pixmap ownership to the layers model bufferX->ReleasePixmap(); *aBuffer = SurfaceDescriptorX11(bufferX); return true; }
bool ShadowLayerForwarder::PlatformAllocBuffer(const gfxIntSize& aSize, gfxASurface::gfxContentType aContent, SurfaceDescriptor* aBuffer) { 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; } gfxPlatform* platform = gfxPlatform::GetPlatform(); nsRefPtr<gfxASurface> buffer = platform->CreateOffscreenSurface(aSize, aContent); if (!buffer || buffer->GetType() != gfxASurface::SurfaceTypeXlib) { NS_ERROR("creating Xlib front/back surfaces failed!"); return PR_FALSE; } gfxXlibSurface* bufferX = static_cast<gfxXlibSurface*>(buffer.get()); // Release Pixmap ownership to the layers model bufferX->ReleasePixmap(); *aBuffer = SurfaceDescriptorX11(bufferX); return PR_TRUE; }
/*static*/ void ShadowLayerForwarder::PlatformSyncBeforeUpdate() { 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. FinishX(DefaultXDisplay()); } }
/*static*/ void LayerManagerComposite::PlatformSyncBeforeReplyUpdate() { 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. FinishX(DefaultXDisplay()); } }