зеркало из https://github.com/mozilla/gecko-dev.git
Bug 991028 - Remove deprecated IPDL SurfaceDescriptor types. r=nical
This commit is contained in:
Родитель
b9ca218121
Коммит
605fb137f9
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "AudioChannelFormat.h"
|
#include "AudioChannelFormat.h"
|
||||||
#include <mozilla/Monitor.h>
|
#include <mozilla/Monitor.h>
|
||||||
|
#include "mozilla/layers/GrallocTextureClient.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
@ -256,9 +257,9 @@ void
|
||||||
ConvertGrallocImageToNV12(GrallocImage* aSource, uint8_t* aDestination)
|
ConvertGrallocImageToNV12(GrallocImage* aSource, uint8_t* aDestination)
|
||||||
{
|
{
|
||||||
// Get graphic buffer.
|
// Get graphic buffer.
|
||||||
SurfaceDescriptor handle = aSource->GetSurfaceDescriptor();
|
GrallocTextureClientOGL* client =
|
||||||
SurfaceDescriptorGralloc gralloc = handle.get_SurfaceDescriptorGralloc();
|
static_cast<GrallocTextureClientOGL*>(aSource->GetTextureClient(nullptr));
|
||||||
sp<GraphicBuffer> graphicBuffer = GrallocBufferActor::GetFrom(gralloc);
|
sp<GraphicBuffer> graphicBuffer = client->GetGraphicBuffer();
|
||||||
|
|
||||||
int pixelFormat = graphicBuffer->getPixelFormat();
|
int pixelFormat = graphicBuffer->getPixelFormat();
|
||||||
// Only support NV21 (from camera) or YV12 (from HW decoder output) for now.
|
// Only support NV21 (from camera) or YV12 (from HW decoder output) for now.
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
#include "ImageTypes.h"
|
#include "ImageTypes.h"
|
||||||
#include "ImageContainer.h"
|
#include "ImageContainer.h"
|
||||||
|
#include "mozilla/layers/GrallocTextureClient.h"
|
||||||
#include "nsMemory.h"
|
#include "nsMemory.h"
|
||||||
#include "mtransport/runnable_utils.h"
|
#include "mtransport/runnable_utils.h"
|
||||||
|
|
||||||
|
@ -653,9 +654,9 @@ MediaEngineWebRTCVideoSource::OnTakePictureComplete(uint8_t* aData, uint32_t aLe
|
||||||
void
|
void
|
||||||
MediaEngineWebRTCVideoSource::RotateImage(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight) {
|
MediaEngineWebRTCVideoSource::RotateImage(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight) {
|
||||||
layers::GrallocImage *nativeImage = static_cast<layers::GrallocImage*>(aImage);
|
layers::GrallocImage *nativeImage = static_cast<layers::GrallocImage*>(aImage);
|
||||||
layers::SurfaceDescriptor handle = nativeImage->GetSurfaceDescriptor();
|
layers::GrallocTextureClientOGL* client =
|
||||||
layers::SurfaceDescriptorGralloc grallocHandle = handle.get_SurfaceDescriptorGralloc();
|
static_cast<layers::GrallocTextureClientOGL*>(nativeImage->GetTextureClient(nullptr));
|
||||||
android::sp<android::GraphicBuffer> graphicBuffer = layers::GrallocBufferActor::GetFrom(grallocHandle);
|
android::sp<android::GraphicBuffer> graphicBuffer = client->GetGraphicBuffer();
|
||||||
void *pMem = nullptr;
|
void *pMem = nullptr;
|
||||||
uint32_t size = aWidth * aHeight * 3 / 2;
|
uint32_t size = aWidth * aHeight * 3 / 2;
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,6 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
|
||||||
case SurfaceDescriptor::TSurfaceDescriptorMemory:
|
case SurfaceDescriptor::TSurfaceDescriptorMemory:
|
||||||
return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);
|
return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);
|
||||||
case SurfaceDescriptor::TSharedTextureDescriptor:
|
case SurfaceDescriptor::TSharedTextureDescriptor:
|
||||||
case SurfaceDescriptor::TSurfaceDescriptorGralloc:
|
|
||||||
case SurfaceDescriptor::TNewSurfaceDescriptorGralloc:
|
case SurfaceDescriptor::TNewSurfaceDescriptorGralloc:
|
||||||
case SurfaceDescriptor::TSurfaceStreamDescriptor:
|
case SurfaceDescriptor::TSurfaceStreamDescriptor:
|
||||||
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
|
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
|
||||||
|
|
|
@ -105,16 +105,6 @@ public:
|
||||||
virtual void UpdatePictureRect(CompositableClient* aCompositable,
|
virtual void UpdatePictureRect(CompositableClient* aCompositable,
|
||||||
const nsIntRect& aRect) = 0;
|
const nsIntRect& aRect) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* The specified layer is destroying its buffers.
|
|
||||||
* |aBackBufferToDestroy| is deallocated when this transaction is
|
|
||||||
* posted to the parent. During the parent-side transaction, the
|
|
||||||
* shadow is told to destroy its front buffer. This can happen when
|
|
||||||
* a new front/back buffer pair have been created because of a layer
|
|
||||||
* resize, e.g.
|
|
||||||
*/
|
|
||||||
virtual void DestroyedThebesBuffer(const SurfaceDescriptor& aBackBufferToDestroy) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the CompositableHost on the compositor side to remove the texture.
|
* Tell the CompositableHost on the compositor side to remove the texture.
|
||||||
* This function does not delete the TextureHost corresponding to the
|
* This function does not delete the TextureHost corresponding to the
|
||||||
|
|
|
@ -63,14 +63,14 @@ static inline uint8_t*
|
||||||
GetAddressFromDescriptor(const SurfaceDescriptor& aDescriptor, size_t& aSize)
|
GetAddressFromDescriptor(const SurfaceDescriptor& aDescriptor, size_t& aSize)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsSurfaceDescriptorValid(aDescriptor));
|
MOZ_ASSERT(IsSurfaceDescriptorValid(aDescriptor));
|
||||||
MOZ_ASSERT(aDescriptor.type() == SurfaceDescriptor::TShmem ||
|
MOZ_ASSERT(aDescriptor.type() == SurfaceDescriptor::TSurfaceDescriptorShmem ||
|
||||||
aDescriptor.type() == SurfaceDescriptor::TMemoryImage);
|
aDescriptor.type() == SurfaceDescriptor::TSurfaceDescriptorMemory);
|
||||||
if (aDescriptor.type() == SurfaceDescriptor::TShmem) {
|
if (aDescriptor.type() == SurfaceDescriptor::TSurfaceDescriptorShmem) {
|
||||||
Shmem shmem(aDescriptor.get_Shmem());
|
Shmem shmem(aDescriptor.get_SurfaceDescriptorShmem().data());
|
||||||
aSize = shmem.Size<uint8_t>();
|
aSize = shmem.Size<uint8_t>();
|
||||||
return shmem.get<uint8_t>();
|
return shmem.get<uint8_t>();
|
||||||
} else {
|
} else {
|
||||||
const MemoryImage& image = aDescriptor.get_MemoryImage();
|
const SurfaceDescriptorMemory& image = aDescriptor.get_SurfaceDescriptorMemory();
|
||||||
aSize = std::numeric_limits<size_t>::max();
|
aSize = std::numeric_limits<size_t>::max();
|
||||||
return reinterpret_cast<uint8_t*>(image.data());
|
return reinterpret_cast<uint8_t*>(image.data());
|
||||||
}
|
}
|
||||||
|
@ -94,27 +94,6 @@ GetSurfaceForDescriptor(const SurfaceDescriptor& aDescriptor)
|
||||||
return image.GetAsSurface();
|
return image.GetAsSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
ISurfaceAllocator::AllocSharedImageSurface(const gfx::IntSize& aSize,
|
|
||||||
gfxContentType aContent,
|
|
||||||
gfxSharedImageSurface** aBuffer)
|
|
||||||
{
|
|
||||||
mozilla::ipc::SharedMemory::SharedMemoryType shmemType = OptimalShmemType();
|
|
||||||
gfxImageFormat format = gfxPlatform::GetPlatform()->OptimalFormatForContent(aContent);
|
|
||||||
|
|
||||||
nsRefPtr<gfxSharedImageSurface> back =
|
|
||||||
gfxSharedImageSurface::CreateUnsafe(this,
|
|
||||||
gfx::ThebesIntSize(aSize),
|
|
||||||
format,
|
|
||||||
shmemType);
|
|
||||||
if (!back)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
*aBuffer = nullptr;
|
|
||||||
back.swap(*aBuffer);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ISurfaceAllocator::AllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
ISurfaceAllocator::AllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
||||||
gfxContentType aContent,
|
gfxContentType aContent,
|
||||||
|
@ -129,11 +108,11 @@ ISurfaceAllocator::AllocSurfaceDescriptorWithCaps(const gfx::IntSize& aSize,
|
||||||
uint32_t aCaps,
|
uint32_t aCaps,
|
||||||
SurfaceDescriptor* aBuffer)
|
SurfaceDescriptor* aBuffer)
|
||||||
{
|
{
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
gfx::SurfaceFormat format =
|
||||||
gfxImageFormat format =
|
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aContent);
|
||||||
gfxPlatform::GetPlatform()->OptimalFormatForContent(aContent);
|
size_t size = ImageDataSerializer::ComputeMinBufferSize(aSize, format);
|
||||||
int32_t stride = gfxASurface::FormatStrideForWidth(format, aSize.width);
|
if (gfxPlatform::GetPlatform()->PreferMemoryOverShmem()) {
|
||||||
uint8_t *data = new (std::nothrow) uint8_t[stride * aSize.height];
|
uint8_t *data = new (std::nothrow) uint8_t[size];
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -141,30 +120,32 @@ ISurfaceAllocator::AllocSurfaceDescriptorWithCaps(const gfx::IntSize& aSize,
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
// Workaround a bug in Quartz where drawing an a8 surface to another a8
|
// Workaround a bug in Quartz where drawing an a8 surface to another a8
|
||||||
// surface with OPERATOR_SOURCE still requires the destination to be clear.
|
// surface with OPERATOR_SOURCE still requires the destination to be clear.
|
||||||
if (format == gfxImageFormat::A8) {
|
if (format == SurfaceFormat::A8) {
|
||||||
memset(data, 0, stride * aSize.height);
|
memset(data, 0, size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*aBuffer = MemoryImage((uintptr_t)data, aSize, stride, format);
|
*aBuffer = SurfaceDescriptorMemory((uintptr_t)data, format);
|
||||||
return true;
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
nsRefPtr<gfxSharedImageSurface> buffer;
|
mozilla::ipc::SharedMemory::SharedMemoryType shmemType = OptimalShmemType();
|
||||||
if (!AllocSharedImageSurface(aSize, aContent,
|
mozilla::ipc::Shmem shmem;
|
||||||
getter_AddRefs(buffer))) {
|
if (!AllocUnsafeShmem(size, shmemType, &shmem)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aBuffer = buffer->GetShmem();
|
*aBuffer = SurfaceDescriptorShmem(shmem, format);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* data = GetAddressFromDescriptor(*aBuffer, size);
|
||||||
|
ImageDataSerializer serializer(data, size);
|
||||||
|
serializer.InitializeBufferInfo(aSize, format);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
ISurfaceAllocator::IsShmem(SurfaceDescriptor* aSurface)
|
ISurfaceAllocator::IsShmem(SurfaceDescriptor* aSurface)
|
||||||
{
|
{
|
||||||
return aSurface && (aSurface->type() == SurfaceDescriptor::TShmem ||
|
return aSurface && (aSurface->type() == SurfaceDescriptor::TSurfaceDescriptorShmem);
|
||||||
aSurface->type() == SurfaceDescriptor::TYCbCrImage ||
|
|
||||||
aSurface->type() == SurfaceDescriptor::TRGBImage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -178,22 +159,12 @@ ISurfaceAllocator::DestroySharedSurface(SurfaceDescriptor* aSurface)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (aSurface->type()) {
|
switch (aSurface->type()) {
|
||||||
case SurfaceDescriptor::TShmem:
|
case SurfaceDescriptor::TSurfaceDescriptorShmem:
|
||||||
DeallocShmem(aSurface->get_Shmem());
|
DeallocShmem(aSurface->get_SurfaceDescriptorShmem().data());
|
||||||
break;
|
break;
|
||||||
case SurfaceDescriptor::TYCbCrImage:
|
case SurfaceDescriptor::TSurfaceDescriptorMemory:
|
||||||
DeallocShmem(aSurface->get_YCbCrImage().data());
|
GfxMemoryImageReporter::WillFree((uint8_t*)aSurface->get_SurfaceDescriptorMemory().data());
|
||||||
break;
|
delete [] (uint8_t*)aSurface->get_SurfaceDescriptorMemory().data();
|
||||||
case SurfaceDescriptor::TRGBImage:
|
|
||||||
DeallocShmem(aSurface->get_RGBImage().data());
|
|
||||||
break;
|
|
||||||
case SurfaceDescriptor::TSurfaceDescriptorD3D9:
|
|
||||||
case SurfaceDescriptor::TSurfaceDescriptorDIB:
|
|
||||||
case SurfaceDescriptor::TSurfaceDescriptorD3D10:
|
|
||||||
break;
|
|
||||||
case SurfaceDescriptor::TMemoryImage:
|
|
||||||
GfxMemoryImageReporter::WillFree((uint8_t*)aSurface->get_MemoryImage().data());
|
|
||||||
delete [] (uint8_t*)aSurface->get_MemoryImage().data();
|
|
||||||
break;
|
break;
|
||||||
case SurfaceDescriptor::Tnull_t:
|
case SurfaceDescriptor::Tnull_t:
|
||||||
case SurfaceDescriptor::T__None:
|
case SurfaceDescriptor::T__None:
|
||||||
|
|
|
@ -137,9 +137,6 @@ public:
|
||||||
virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) = 0;
|
virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) = 0;
|
||||||
|
|
||||||
// was AllocBuffer
|
// was AllocBuffer
|
||||||
virtual bool AllocSharedImageSurface(const gfx::IntSize& aSize,
|
|
||||||
gfxContentType aContent,
|
|
||||||
gfxSharedImageSurface** aBuffer);
|
|
||||||
virtual bool AllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
virtual bool AllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
||||||
gfxContentType aContent,
|
gfxContentType aContent,
|
||||||
SurfaceDescriptor* aBuffer);
|
SurfaceDescriptor* aBuffer);
|
||||||
|
|
|
@ -276,11 +276,6 @@ public:
|
||||||
const nsIntRegion& aUpdatedRegion) MOZ_OVERRIDE {
|
const nsIntRegion& aUpdatedRegion) MOZ_OVERRIDE {
|
||||||
NS_RUNTIMEABORT("should not be called");
|
NS_RUNTIMEABORT("should not be called");
|
||||||
}
|
}
|
||||||
virtual void DestroyedThebesBuffer(const SurfaceDescriptor& aBackBufferToDestroy) MOZ_OVERRIDE
|
|
||||||
{
|
|
||||||
NS_RUNTIMEABORT("should not be called");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ISurfaceAllocator
|
// ISurfaceAllocator
|
||||||
|
|
||||||
|
|
|
@ -66,63 +66,11 @@ struct NewSurfaceDescriptorGralloc {
|
||||||
IntSize size;
|
IntSize size;
|
||||||
};
|
};
|
||||||
|
|
||||||
// XXX - soon to be removed
|
|
||||||
struct SurfaceDescriptorGralloc {
|
|
||||||
PGrallocBuffer buffer;
|
|
||||||
/**
|
|
||||||
* android::GraphicBuffer has a size information. But there are cases
|
|
||||||
* that GraphicBuffer's size and actual video's size are different.
|
|
||||||
* Extra size member is necessary. See Bug 850566.
|
|
||||||
*/
|
|
||||||
IntSize size;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We can have one source producing gralloc buffers and sharing them
|
|
||||||
* with another source that may also produce its own gralloc buffers.
|
|
||||||
* This happens for camera preview buffers sent to video code. When
|
|
||||||
* that happens, the producer can mark the buffer as "external" to
|
|
||||||
* prevent its consumer from mistakenly freeing the buffer.
|
|
||||||
*/
|
|
||||||
bool external;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This gralloc buffer will be treated as if the RB bytes are swapped.
|
|
||||||
* This is useful for rendering using Cairo/Thebes, because there is no
|
|
||||||
* BGRX Android pixel format, and so we have to do byte swapping.
|
|
||||||
*
|
|
||||||
* For example, if the GraphicBuffer has an Android pixel format of
|
|
||||||
* PIXEL_FORMAT_RGBA_8888 and isRBSwapped is true, when it is sampled
|
|
||||||
* (for example, with GL), a BGRA shader should be used.
|
|
||||||
*/
|
|
||||||
bool isRBSwapped;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SurfaceStreamDescriptor {
|
struct SurfaceStreamDescriptor {
|
||||||
SurfaceStreamHandle handle;
|
SurfaceStreamHandle handle;
|
||||||
bool yflip;
|
bool yflip;
|
||||||
};
|
};
|
||||||
|
|
||||||
// XXX - can be removed as soon as DeprecatedImageClientSingle is removed
|
|
||||||
struct YCbCrImage {
|
|
||||||
Shmem data;
|
|
||||||
uint64_t owner;
|
|
||||||
};
|
|
||||||
|
|
||||||
// XXX remove RGBImage (see bug 847914)
|
|
||||||
struct RGBImage {
|
|
||||||
Shmem data;
|
|
||||||
nsIntRect picture;
|
|
||||||
gfxImageFormat rgbFormat;
|
|
||||||
uint64_t owner;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MemoryImage {
|
|
||||||
uintptr_t data;
|
|
||||||
IntSize size;
|
|
||||||
uint32_t stride;
|
|
||||||
gfxImageFormat format;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for shmem-backed YCbCr and (flavors of) RGBA textures
|
* Used for shmem-backed YCbCr and (flavors of) RGBA textures
|
||||||
*/
|
*/
|
||||||
|
@ -150,11 +98,6 @@ union SurfaceDescriptor {
|
||||||
SurfaceStreamDescriptor;
|
SurfaceStreamDescriptor;
|
||||||
SurfaceDescriptorMacIOSurface;
|
SurfaceDescriptorMacIOSurface;
|
||||||
NewSurfaceDescriptorGralloc;
|
NewSurfaceDescriptorGralloc;
|
||||||
YCbCrImage; // XXX - deprecated
|
|
||||||
SurfaceDescriptorGralloc; // XXX - deprecated
|
|
||||||
Shmem; // XXX - deprecated
|
|
||||||
RGBImage; // XXX - deprecated
|
|
||||||
MemoryImage; // XXX - deprecated
|
|
||||||
null_t;
|
null_t;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -379,18 +379,6 @@ ShadowLayerForwarder::DeallocGrallocBuffer(PGrallocBufferChild* aChild)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Both processes
|
// Both processes
|
||||||
|
|
||||||
/*static*/ sp<GraphicBuffer>
|
|
||||||
GrallocBufferActor::GetFrom(const SurfaceDescriptorGralloc& aDescriptor)
|
|
||||||
{
|
|
||||||
GrallocBufferActor* gba = nullptr;
|
|
||||||
if (PGrallocBufferChild* child = aDescriptor.bufferChild()) {
|
|
||||||
gba = static_cast<GrallocBufferActor*>(child);
|
|
||||||
} else if (PGrallocBufferParent* parent = aDescriptor.bufferParent()) {
|
|
||||||
gba = static_cast<GrallocBufferActor*>(parent);
|
|
||||||
}
|
|
||||||
return gba->mGraphicBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
android::GraphicBuffer*
|
android::GraphicBuffer*
|
||||||
GrallocBufferActor::GetGraphicBuffer()
|
GrallocBufferActor::GetGraphicBuffer()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@ namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
class MaybeMagicGrallocBufferHandle;
|
class MaybeMagicGrallocBufferHandle;
|
||||||
class SurfaceDescriptorGralloc;
|
|
||||||
class TextureHost;
|
class TextureHost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,9 +76,6 @@ public:
|
||||||
static PGrallocBufferChild*
|
static PGrallocBufferChild*
|
||||||
Create();
|
Create();
|
||||||
|
|
||||||
static android::sp<GraphicBuffer>
|
|
||||||
GetFrom(const SurfaceDescriptorGralloc& aDescriptor);
|
|
||||||
|
|
||||||
// used only for hacky fix in gecko 23 for bug 862324
|
// used only for hacky fix in gecko 23 for bug 862324
|
||||||
// see bug 865908 about fixing this.
|
// see bug 865908 about fixing this.
|
||||||
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||||
|
|
|
@ -119,21 +119,10 @@ public:
|
||||||
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
||||||
mMutants.insert(aLayer);
|
mMutants.insert(aLayer);
|
||||||
}
|
}
|
||||||
void AddBufferToDestroy(gfxSharedImageSurface* aBuffer)
|
|
||||||
{
|
|
||||||
return AddBufferToDestroy(aBuffer->GetShmem());
|
|
||||||
}
|
|
||||||
void AddBufferToDestroy(const SurfaceDescriptor& aBuffer)
|
|
||||||
{
|
|
||||||
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
||||||
mDyingBuffers.AppendElement(aBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void End()
|
void End()
|
||||||
{
|
{
|
||||||
mCset.clear();
|
mCset.clear();
|
||||||
mPaints.clear();
|
mPaints.clear();
|
||||||
mDyingBuffers.Clear();
|
|
||||||
mMutants.clear();
|
mMutants.clear();
|
||||||
mOpen = false;
|
mOpen = false;
|
||||||
mSwapRequired = false;
|
mSwapRequired = false;
|
||||||
|
@ -150,7 +139,6 @@ public:
|
||||||
|
|
||||||
EditVector mCset;
|
EditVector mCset;
|
||||||
EditVector mPaints;
|
EditVector mPaints;
|
||||||
BufferArray mDyingBuffers;
|
|
||||||
ShadowableLayerSet mMutants;
|
ShadowableLayerSet mMutants;
|
||||||
nsIntRect mTargetBounds;
|
nsIntRect mTargetBounds;
|
||||||
ScreenRotation mTargetRotation;
|
ScreenRotation mTargetRotation;
|
||||||
|
@ -247,12 +235,6 @@ ShadowLayerForwarder::CreatedRefLayer(ShadowableLayer* aRef)
|
||||||
CreatedLayer<OpCreateRefLayer>(mTxn, aRef);
|
CreatedLayer<OpCreateRefLayer>(mTxn, aRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ShadowLayerForwarder::DestroyedThebesBuffer(const SurfaceDescriptor& aBackBufferToDestroy)
|
|
||||||
{
|
|
||||||
mTxn->AddBufferToDestroy(aBackBufferToDestroy);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ShadowLayerForwarder::Mutated(ShadowableLayer* aMutant)
|
ShadowLayerForwarder::Mutated(ShadowableLayer* aMutant)
|
||||||
{
|
{
|
||||||
|
@ -315,11 +297,11 @@ ShadowLayerForwarder::CheckSurfaceDescriptor(const SurfaceDescriptor* aDescripto
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aDescriptor->type() == SurfaceDescriptor::TShmem) {
|
if (aDescriptor->type() == SurfaceDescriptor::TSurfaceDescriptorShmem) {
|
||||||
const mozilla::ipc::Shmem& shmem = aDescriptor->get_Shmem();
|
const SurfaceDescriptorShmem& shmem = aDescriptor->get_SurfaceDescriptorShmem();
|
||||||
shmem.AssertInvariants();
|
shmem.data().AssertInvariants();
|
||||||
MOZ_ASSERT(mShadowManager &&
|
MOZ_ASSERT(mShadowManager &&
|
||||||
mShadowManager->IsTrackingSharedMemory(shmem.mSegment));
|
mShadowManager->IsTrackingSharedMemory(shmem.data().mSegment));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -455,10 +437,6 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||||
|
|
||||||
MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers..."));
|
MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers..."));
|
||||||
|
|
||||||
for (uint32_t i = 0; i < mTxn->mDyingBuffers.Length(); ++i) {
|
|
||||||
DestroySharedSurface(&mTxn->mDyingBuffers[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
MOZ_LAYERS_LOG(("[LayersForwarder] building transaction..."));
|
MOZ_LAYERS_LOG(("[LayersForwarder] building transaction..."));
|
||||||
|
|
||||||
// We purposely add attribute-change ops to the final changeset
|
// We purposely add attribute-change ops to the final changeset
|
||||||
|
|
|
@ -198,16 +198,6 @@ public:
|
||||||
void CreatedCanvasLayer(ShadowableLayer* aCanvas);
|
void CreatedCanvasLayer(ShadowableLayer* aCanvas);
|
||||||
void CreatedRefLayer(ShadowableLayer* aRef);
|
void CreatedRefLayer(ShadowableLayer* aRef);
|
||||||
|
|
||||||
/**
|
|
||||||
* The specified layer is destroying its buffers.
|
|
||||||
* |aBackBufferToDestroy| is deallocated when this transaction is
|
|
||||||
* posted to the parent. During the parent-side transaction, the
|
|
||||||
* shadow is told to destroy its front buffer. This can happen when
|
|
||||||
* a new front/back buffer pair have been created because of a layer
|
|
||||||
* resize, e.g.
|
|
||||||
*/
|
|
||||||
virtual void DestroyedThebesBuffer(const SurfaceDescriptor& aBackBufferToDestroy) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* At least one attribute of |aMutant| has changed, and |aMutant|
|
* At least one attribute of |aMutant| has changed, and |aMutant|
|
||||||
* needs to sync to its shadow layer. This initial implementation
|
* needs to sync to its shadow layer. This initial implementation
|
||||||
|
|
|
@ -36,12 +36,7 @@ public:
|
||||||
|
|
||||||
virtual void DeallocateSharedData(ISurfaceAllocator* allocator) MOZ_OVERRIDE
|
virtual void DeallocateSharedData(ISurfaceAllocator* allocator) MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
// We just need to wrap the actor in a SurfaceDescriptor because that's what
|
allocator->DeallocGrallocBuffer(mGrallocActor);
|
||||||
// ISurfaceAllocator uses as input, we don't care about the other parameters.
|
|
||||||
SurfaceDescriptor sd = SurfaceDescriptorGralloc(nullptr, mGrallocActor,
|
|
||||||
IntSize(0, 0),
|
|
||||||
false, false);
|
|
||||||
allocator->DestroySharedSurface(&sd);
|
|
||||||
mGrallocActor = nullptr;
|
mGrallocActor = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,16 +80,8 @@ GrallocTextureClientOGL::~GrallocTextureClientOGL()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(GrallocTextureClientOGL);
|
MOZ_COUNT_DTOR(GrallocTextureClientOGL);
|
||||||
if (ShouldDeallocateInDestructor()) {
|
if (ShouldDeallocateInDestructor()) {
|
||||||
// If the buffer has never been shared we must deallocate it or it would
|
|
||||||
// leak.
|
|
||||||
// We just need to wrap the actor in a SurfaceDescriptor because that's what
|
|
||||||
// ISurfaceAllocator uses as input, we don't care about the other parameters.
|
|
||||||
SurfaceDescriptor sd = SurfaceDescriptorGralloc(nullptr, mGrallocActor,
|
|
||||||
IntSize(0, 0),
|
|
||||||
false, false);
|
|
||||||
|
|
||||||
ISurfaceAllocator* allocator = GetAllocator();
|
ISurfaceAllocator* allocator = GetAllocator();
|
||||||
allocator->DestroySharedSurface(&sd);
|
allocator->DeallocGrallocBuffer(mGrallocActor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "VideoUtils.h"
|
#include "VideoUtils.h"
|
||||||
#ifdef MOZ_WIDGET_GONK
|
#ifdef MOZ_WIDGET_GONK
|
||||||
#include "GrallocImages.h"
|
#include "GrallocImages.h"
|
||||||
|
#include "mozilla/layers/GrallocTextureClient.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1112,10 +1113,10 @@ void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk(
|
||||||
#ifdef MOZ_WIDGET_GONK
|
#ifdef MOZ_WIDGET_GONK
|
||||||
if (format == ImageFormat::GRALLOC_PLANAR_YCBCR) {
|
if (format == ImageFormat::GRALLOC_PLANAR_YCBCR) {
|
||||||
layers::GrallocImage *nativeImage = static_cast<layers::GrallocImage*>(img);
|
layers::GrallocImage *nativeImage = static_cast<layers::GrallocImage*>(img);
|
||||||
layers::SurfaceDescriptor handle = nativeImage->GetSurfaceDescriptor();
|
layers::GrallocTextureClientOGL* client =
|
||||||
layers::SurfaceDescriptorGralloc grallocHandle = handle.get_SurfaceDescriptorGralloc();
|
static_cast<layers::GrallocTextureClientOGL*>(nativeImage->GetTextureClient(nullptr));
|
||||||
|
|
||||||
android::sp<android::GraphicBuffer> graphicBuffer = layers::GrallocBufferActor::GetFrom(grallocHandle);
|
android::sp<android::GraphicBuffer> graphicBuffer = client->GetGraphicBuffer();
|
||||||
void *basePtr;
|
void *basePtr;
|
||||||
graphicBuffer->lock(android::GraphicBuffer::USAGE_SW_READ_MASK, &basePtr);
|
graphicBuffer->lock(android::GraphicBuffer::USAGE_SW_READ_MASK, &basePtr);
|
||||||
conduit->SendVideoFrame(static_cast<unsigned char*>(basePtr),
|
conduit->SendVideoFrame(static_cast<unsigned char*>(basePtr),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче