зеркало из https://github.com/mozilla/pjs.git
Bug 599562: Allocate cross-process layers surfaces from SyS V shm instead of /dev/shm to avoid being arbitrarily capped on maemo5/N900. r=stuart a=blocking-fennec
This commit is contained in:
Родитель
3eec684f8a
Коммит
bbca7c4811
|
@ -43,12 +43,15 @@
|
|||
|
||||
#include "gfxSharedImageSurface.h"
|
||||
|
||||
#include "mozilla/ipc/SharedMemorySysV.h"
|
||||
#include "mozilla/layers/PLayerChild.h"
|
||||
#include "mozilla/layers/PLayersChild.h"
|
||||
#include "mozilla/layers/PLayersParent.h"
|
||||
#include "ShadowLayers.h"
|
||||
#include "ShadowLayerChild.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
|
@ -382,6 +385,21 @@ OptimalFormatFor(gfxASurface::gfxContentType aContent)
|
|||
}
|
||||
}
|
||||
|
||||
static SharedMemory::SharedMemoryType
|
||||
OptimalShmemType()
|
||||
{
|
||||
#if defined(MOZ_PLATFORM_MAEMO) && defined(MOZ_HAVE_SHAREDMEMORYSYSV)
|
||||
// Use SysV memory because maemo5 on the N900 only allots 64MB to
|
||||
// /dev/shm, even though it has 1GB(!!) of system memory. Sys V shm
|
||||
// is allocated from a different pool. We don't want an arbitrary
|
||||
// cap that's much much lower than available memory on the memory we
|
||||
// use for layers.
|
||||
return SharedMemory::TYPE_SYSV;
|
||||
#else
|
||||
return SharedMemory::TYPE_BASIC;
|
||||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
ShadowLayerForwarder::AllocDoubleBuffer(const gfxIntSize& aSize,
|
||||
gfxASurface::gfxContentType aContent,
|
||||
|
@ -391,10 +409,12 @@ ShadowLayerForwarder::AllocDoubleBuffer(const gfxIntSize& aSize,
|
|||
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
||||
|
||||
gfxASurface::gfxImageFormat format = OptimalFormatFor(aContent);
|
||||
SharedMemory::SharedMemoryType shmemType = OptimalShmemType();
|
||||
|
||||
nsRefPtr<gfxSharedImageSurface> front = new gfxSharedImageSurface();
|
||||
nsRefPtr<gfxSharedImageSurface> back = new gfxSharedImageSurface();
|
||||
if (!front->Init(mShadowManager, aSize, format) ||
|
||||
!back->Init(mShadowManager, aSize, format))
|
||||
if (!front->Init(mShadowManager, aSize, format, shmemType) ||
|
||||
!back->Init(mShadowManager, aSize, format, shmemType))
|
||||
return PR_FALSE;
|
||||
|
||||
*aFrontBuffer = NULL; *aBackBuffer = NULL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче