зеркало из https://github.com/mozilla/gecko-dev.git
Bug 929513 Part 9: Convert AllocPGrallocBufferActor to use gfx::IntSize r=nical
This commit is contained in:
Родитель
f2e4738722
Коммит
31ff66f73b
|
@ -11,6 +11,7 @@
|
|||
#include "ipc/AutoOpenSurface.h"
|
||||
#include "mozilla/layers/YCbCrImageDataSerializer.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc
|
||||
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
||||
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
|
||||
#include "gfx2DGlue.h"
|
||||
#ifdef DEBUG
|
||||
#include "prenv.h"
|
||||
#endif
|
||||
|
@ -40,7 +41,7 @@ IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface)
|
|||
}
|
||||
|
||||
bool
|
||||
ISurfaceAllocator::AllocSharedImageSurface(const gfxIntSize& aSize,
|
||||
ISurfaceAllocator::AllocSharedImageSurface(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
gfxSharedImageSurface** aBuffer)
|
||||
{
|
||||
|
@ -48,7 +49,7 @@ ISurfaceAllocator::AllocSharedImageSurface(const gfxIntSize& aSize,
|
|||
gfxImageFormat format = gfxPlatform::GetPlatform()->OptimalFormatForContent(aContent);
|
||||
|
||||
nsRefPtr<gfxSharedImageSurface> back =
|
||||
gfxSharedImageSurface::CreateUnsafe(this, aSize, format, shmemType);
|
||||
gfxSharedImageSurface::CreateUnsafe(this, ThebesIntSize(aSize), format, shmemType);
|
||||
if (!back)
|
||||
return false;
|
||||
|
||||
|
@ -58,7 +59,7 @@ ISurfaceAllocator::AllocSharedImageSurface(const gfxIntSize& aSize,
|
|||
}
|
||||
|
||||
bool
|
||||
ISurfaceAllocator::AllocSurfaceDescriptor(const gfxIntSize& aSize,
|
||||
ISurfaceAllocator::AllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
SurfaceDescriptor* aBuffer)
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ ISurfaceAllocator::AllocSurfaceDescriptor(const gfxIntSize& aSize,
|
|||
}
|
||||
|
||||
bool
|
||||
ISurfaceAllocator::AllocSurfaceDescriptorWithCaps(const gfxIntSize& aSize,
|
||||
ISurfaceAllocator::AllocSurfaceDescriptorWithCaps(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
uint32_t aCaps,
|
||||
SurfaceDescriptor* aBuffer)
|
||||
|
@ -95,7 +96,7 @@ ISurfaceAllocator::AllocSurfaceDescriptorWithCaps(const gfxIntSize& aSize,
|
|||
memset(data, 0, stride * aSize.height);
|
||||
}
|
||||
#endif
|
||||
*aBuffer = MemoryImage((uintptr_t)data, aSize, stride, format);
|
||||
*aBuffer = MemoryImage((uintptr_t)data, ThebesIntSize(aSize), stride, format);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -148,7 +149,7 @@ ISurfaceAllocator::DestroySharedSurface(SurfaceDescriptor* aSurface)
|
|||
|
||||
#if !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
||||
bool
|
||||
ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfxIntSize&,
|
||||
ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize&,
|
||||
gfxContentType,
|
||||
uint32_t,
|
||||
SurfaceDescriptor*)
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include "gfxTypes.h"
|
||||
#include "gfxPoint.h" // for gfxIntSize
|
||||
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
|
||||
/*
|
||||
* FIXME [bjacob] *** PURE CRAZYNESS WARNING ***
|
||||
|
@ -96,15 +96,15 @@ ISurfaceAllocator() {}
|
|||
virtual void DeallocShmem(ipc::Shmem& aShmem) = 0;
|
||||
|
||||
// was AllocBuffer
|
||||
virtual bool AllocSharedImageSurface(const gfxIntSize& aSize,
|
||||
virtual bool AllocSharedImageSurface(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
gfxSharedImageSurface** aBuffer);
|
||||
virtual bool AllocSurfaceDescriptor(const gfxIntSize& aSize,
|
||||
virtual bool AllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
SurfaceDescriptor* aBuffer);
|
||||
|
||||
// was AllocBufferWithCaps
|
||||
virtual bool AllocSurfaceDescriptorWithCaps(const gfxIntSize& aSize,
|
||||
virtual bool AllocSurfaceDescriptorWithCaps(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
uint32_t aCaps,
|
||||
SurfaceDescriptor* aBuffer);
|
||||
|
@ -112,7 +112,7 @@ ISurfaceAllocator() {}
|
|||
virtual void DestroySharedSurface(SurfaceDescriptor* aSurface);
|
||||
|
||||
// method that does the actual allocation work
|
||||
virtual PGrallocBufferChild* AllocGrallocBuffer(const gfxIntSize& aSize,
|
||||
virtual PGrallocBufferChild* AllocGrallocBuffer(const gfx::IntSize& aSize,
|
||||
uint32_t aFormat,
|
||||
uint32_t aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aHandle)
|
||||
|
@ -124,7 +124,7 @@ protected:
|
|||
// DeprecatedTextureClient/Host rework.
|
||||
virtual bool IsOnCompositorSide() const = 0;
|
||||
static bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
|
||||
virtual bool PlatformAllocSurfaceDescriptor(const gfxIntSize& aSize,
|
||||
virtual bool PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
uint32_t aCaps,
|
||||
SurfaceDescriptor* aBuffer);
|
||||
|
|
|
@ -693,7 +693,7 @@ ImageBridgeChild::CreateImageClientNow(CompositableType aType)
|
|||
}
|
||||
|
||||
PGrallocBufferChild*
|
||||
ImageBridgeChild::AllocPGrallocBufferChild(const gfxIntSize&, const uint32_t&, const uint32_t&,
|
||||
ImageBridgeChild::AllocPGrallocBufferChild(const gfx::IntSize&, const uint32_t&, const uint32_t&,
|
||||
MaybeMagicGrallocBufferHandle*)
|
||||
{
|
||||
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
||||
|
@ -924,7 +924,7 @@ ImageBridgeChild::DeallocShmem(ipc::Shmem& aShmem)
|
|||
}
|
||||
|
||||
PGrallocBufferChild*
|
||||
ImageBridgeChild::AllocGrallocBuffer(const gfxIntSize& aSize,
|
||||
ImageBridgeChild::AllocGrallocBuffer(const gfx::IntSize& aSize,
|
||||
uint32_t aFormat,
|
||||
uint32_t aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aHandle)
|
||||
|
|
|
@ -189,7 +189,7 @@ public:
|
|||
~ImageBridgeChild();
|
||||
|
||||
virtual PGrallocBufferChild*
|
||||
AllocPGrallocBufferChild(const gfxIntSize&, const uint32_t&, const uint32_t&,
|
||||
AllocPGrallocBufferChild(const gfx::IntSize&, const uint32_t&, const uint32_t&,
|
||||
MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
|
@ -388,7 +388,7 @@ protected:
|
|||
CompositableTransaction* mTxn;
|
||||
|
||||
// ISurfaceAllocator
|
||||
virtual PGrallocBufferChild* AllocGrallocBuffer(const gfxIntSize& aSize,
|
||||
virtual PGrallocBufferChild* AllocGrallocBuffer(const gfx::IntSize& aSize,
|
||||
uint32_t aFormat, uint32_t aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aHandle) MOZ_OVERRIDE;
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsTArray.h" // for nsTArray, nsTArray_Impl
|
||||
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
|
||||
#include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
using namespace base;
|
||||
using namespace mozilla::ipc;
|
||||
|
@ -138,13 +139,13 @@ static uint64_t GenImageContainerID() {
|
|||
}
|
||||
|
||||
PGrallocBufferParent*
|
||||
ImageBridgeParent::AllocPGrallocBufferParent(const gfxIntSize& aSize,
|
||||
ImageBridgeParent::AllocPGrallocBufferParent(const gfx::IntSize& aSize,
|
||||
const uint32_t& aFormat,
|
||||
const uint32_t& aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aOutHandle)
|
||||
{
|
||||
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
||||
return GrallocBufferActor::Create(aSize, aFormat, aUsage, aOutHandle);
|
||||
return GrallocBufferActor::Create(ThebesIntSize(aSize), aFormat, aUsage, aOutHandle);
|
||||
#else
|
||||
NS_RUNTIMEABORT("No gralloc buffers for you");
|
||||
return nullptr;
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
Create(Transport* aTransport, ProcessId aOtherProcess);
|
||||
|
||||
virtual PGrallocBufferParent*
|
||||
AllocPGrallocBufferParent(const gfxIntSize&, const uint32_t&, const uint32_t&,
|
||||
AllocPGrallocBufferParent(const gfx::IntSize&, const uint32_t&, const uint32_t&,
|
||||
MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -29,7 +29,7 @@ LayerTransactionChild::Destroy()
|
|||
}
|
||||
|
||||
PGrallocBufferChild*
|
||||
LayerTransactionChild::AllocPGrallocBufferChild(const gfxIntSize&,
|
||||
LayerTransactionChild::AllocPGrallocBufferChild(const gfx::IntSize&,
|
||||
const uint32_t&,
|
||||
const uint32_t&,
|
||||
MaybeMagicGrallocBufferHandle*)
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
protected:
|
||||
virtual PGrallocBufferChild*
|
||||
AllocPGrallocBufferChild(const gfxIntSize&,
|
||||
AllocPGrallocBufferChild(const gfx::IntSize&,
|
||||
const uint32_t&, const uint32_t&,
|
||||
MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE;
|
||||
virtual bool
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc
|
||||
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
|
||||
#include "GeckoProfiler.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
|
||||
|
||||
|
@ -543,13 +544,13 @@ LayerTransactionParent::RecvClearCachedResources()
|
|||
}
|
||||
|
||||
PGrallocBufferParent*
|
||||
LayerTransactionParent::AllocPGrallocBufferParent(const gfxIntSize& aSize,
|
||||
LayerTransactionParent::AllocPGrallocBufferParent(const gfx::IntSize& aSize,
|
||||
const uint32_t& aFormat,
|
||||
const uint32_t& aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aOutHandle)
|
||||
{
|
||||
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
||||
return GrallocBufferActor::Create(aSize, aFormat, aUsage, aOutHandle);
|
||||
return GrallocBufferActor::Create(ThebesIntSize(aSize), aFormat, aUsage, aOutHandle);
|
||||
#else
|
||||
NS_RUNTIMEABORT("No gralloc buffers for you");
|
||||
return nullptr;
|
||||
|
|
|
@ -94,7 +94,7 @@ protected:
|
|||
gfx3DMatrix* aTransform) MOZ_OVERRIDE;
|
||||
|
||||
virtual PGrallocBufferParent*
|
||||
AllocPGrallocBufferParent(const gfxIntSize& aSize,
|
||||
AllocPGrallocBufferParent(const gfx::IntSize& aSize,
|
||||
const uint32_t& aFormat, const uint32_t& aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aOutHandle) MOZ_OVERRIDE;
|
||||
virtual bool
|
||||
|
|
|
@ -14,6 +14,7 @@ include "mozilla/GfxMessageUtils.h";
|
|||
|
||||
using ImageHandle;
|
||||
using mozilla::layers::TextureInfo;
|
||||
using mozilla::gfx::IntSize;
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -38,7 +39,7 @@ parent:
|
|||
// buffer directly. The format is a enum defined in
|
||||
// system/graphics.h and the usage is the GraphicBuffer usage
|
||||
// flag. See GraphicBuffer.h and gralloc.h.
|
||||
sync PGrallocBuffer(gfxIntSize size, uint32_t format, uint32_t usage)
|
||||
sync PGrallocBuffer(IntSize size, uint32_t format, uint32_t usage)
|
||||
returns (MaybeMagicGrallocBufferHandle handle);
|
||||
|
||||
// First step of the destruction sequence. This puts all the ImageContainerParents
|
||||
|
|
|
@ -20,6 +20,7 @@ include "gfxipc/ShadowLayerUtils.h";
|
|||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using mozilla::layers::TextureInfo;
|
||||
using mozilla::gfx::IntSize;
|
||||
|
||||
/**
|
||||
* The layers protocol is spoken between thread contexts that manage
|
||||
|
@ -66,7 +67,7 @@ parent:
|
|||
* - used for GL rendering to a buffer which the compositor
|
||||
* treats as a texture
|
||||
*/
|
||||
sync PGrallocBuffer(gfxIntSize size, uint32_t format, uint32_t usage)
|
||||
sync PGrallocBuffer(IntSize size, uint32_t format, uint32_t usage)
|
||||
returns (MaybeMagicGrallocBufferHandle handle);
|
||||
async PLayer();
|
||||
async PCompositable(TextureInfo aTextureInfo);
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace layers {
|
|||
// Platform-specific shadow-layers interfaces. See ShadowLayers.h.
|
||||
// D3D10 doesn't need all these yet.
|
||||
bool
|
||||
ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfxIntSize&,
|
||||
ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize&,
|
||||
gfxContentType,
|
||||
uint32_t,
|
||||
SurfaceDescriptor*)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "cutils/properties.h"
|
||||
|
||||
#include "MainThreadUtils.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
using namespace android;
|
||||
using namespace base;
|
||||
|
@ -358,7 +359,7 @@ GrallocBufferActor::InitFromHandle(const MagicGrallocBufferHandle& aHandle)
|
|||
}
|
||||
|
||||
PGrallocBufferChild*
|
||||
ShadowLayerForwarder::AllocGrallocBuffer(const gfxIntSize& aSize,
|
||||
ShadowLayerForwarder::AllocGrallocBuffer(const gfx::IntSize& aSize,
|
||||
uint32_t aFormat,
|
||||
uint32_t aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aHandle)
|
||||
|
@ -367,7 +368,7 @@ ShadowLayerForwarder::AllocGrallocBuffer(const gfxIntSize& aSize,
|
|||
}
|
||||
|
||||
bool
|
||||
ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfxIntSize& aSize,
|
||||
ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
uint32_t aCaps,
|
||||
SurfaceDescriptor* aBuffer)
|
||||
|
@ -447,7 +448,7 @@ ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfxIntSize& aSize,
|
|||
GrallocBufferActor* gba = static_cast<GrallocBufferActor*>(gc);
|
||||
gba->InitFromHandle(handle.get_MagicGrallocBufferHandle());
|
||||
|
||||
*aBuffer = SurfaceDescriptorGralloc(nullptr, gc, aSize,
|
||||
*aBuffer = SurfaceDescriptorGralloc(nullptr, gc, ThebesIntSize(aSize),
|
||||
/* external */ false,
|
||||
defaultRBSwap);
|
||||
return true;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace mozilla {
|
|||
namespace layers {
|
||||
|
||||
bool
|
||||
ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfxIntSize& aSize,
|
||||
ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
||||
gfxContentType aContent,
|
||||
uint32_t aCaps,
|
||||
SurfaceDescriptor* aBuffer)
|
||||
|
|
|
@ -423,7 +423,7 @@ protected:
|
|||
|
||||
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
||||
// from ISurfaceAllocator
|
||||
virtual PGrallocBufferChild* AllocGrallocBuffer(const gfxIntSize& aSize,
|
||||
virtual PGrallocBufferChild* AllocGrallocBuffer(const gfx::IntSize& aSize,
|
||||
uint32_t aFormat,
|
||||
uint32_t aUsage,
|
||||
MaybeMagicGrallocBufferHandle* aHandle) MOZ_OVERRIDE;
|
||||
|
|
|
@ -244,7 +244,7 @@ GrallocTextureClientOGL::AllocateGralloc(gfx::IntSize aSize,
|
|||
|
||||
MaybeMagicGrallocBufferHandle handle;
|
||||
PGrallocBufferChild* actor =
|
||||
allocator->AllocGrallocBuffer(gfx::ThebesIntSize(aSize),
|
||||
allocator->AllocGrallocBuffer(aSize,
|
||||
aAndroidFormat,
|
||||
aUsage,
|
||||
&handle);
|
||||
|
|
Загрузка…
Ссылка в новой задаче