Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef GFX_LAYERS_ISURFACEDEALLOCATOR
|
|
|
|
#define GFX_LAYERS_ISURFACEDEALLOCATOR
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <stddef.h> // for size_t
|
|
|
|
#include <stdint.h> // for uint32_t
|
2013-09-24 13:45:14 -07:00
|
|
|
#include "gfxTypes.h"
|
2013-12-20 08:46:29 -08:00
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
|
2013-11-27 07:19:34 -08:00
|
|
|
#include "mozilla/RefPtr.h"
|
2013-12-07 22:09:10 -08:00
|
|
|
#include "nsIMemoryReporter.h" // for nsIMemoryReporter
|
2013-11-14 13:54:25 -08:00
|
|
|
#include "mozilla/Atomics.h" // for Atomic
|
2014-03-12 22:17:05 -07:00
|
|
|
#include "mozilla/layers/LayersMessages.h" // for ShmemSection
|
2014-03-07 13:34:04 -08:00
|
|
|
#include "LayersTypes.h"
|
2014-03-12 22:17:05 -07:00
|
|
|
#include <vector>
|
2014-03-18 21:02:42 -07:00
|
|
|
#include "mozilla/layers/AtomicRefCountedWithFinalize.h"
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
2013-05-03 19:57:18 -07:00
|
|
|
/*
|
|
|
|
* FIXME [bjacob] *** PURE CRAZYNESS WARNING ***
|
|
|
|
*
|
|
|
|
* This #define is actually needed here, because subclasses of ISurfaceAllocator,
|
|
|
|
* namely ShadowLayerForwarder, will or will not override AllocGrallocBuffer
|
|
|
|
* depending on whether MOZ_HAVE_SURFACEDESCRIPTORGRALLOC is defined.
|
|
|
|
*/
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
#define MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
|
|
|
#endif
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace ipc {
|
|
|
|
class Shmem;
|
2015-07-13 08:25:42 -07:00
|
|
|
} // namespace ipc
|
2014-04-06 18:32:48 -07:00
|
|
|
namespace gfx {
|
|
|
|
class DataSourceSurface;
|
2015-07-13 08:25:42 -07:00
|
|
|
} // namespace gfx
|
2013-08-11 16:17:23 -07:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
class MaybeMagicGrallocBufferHandle;
|
|
|
|
|
|
|
|
enum BufferCapabilities {
|
|
|
|
DEFAULT_BUFFER_CAPS = 0,
|
|
|
|
/**
|
2014-06-17 10:35:51 -07:00
|
|
|
* The allocated buffer must be efficiently mappable as a DataSourceSurface.
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
*/
|
2013-05-27 07:12:13 -07:00
|
|
|
MAP_AS_IMAGE_SURFACE = 1 << 0,
|
|
|
|
/**
|
|
|
|
* The allocated buffer will be used for GL rendering only
|
|
|
|
*/
|
|
|
|
USING_GL_RENDERING_ONLY = 1 << 1
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class SurfaceDescriptor;
|
|
|
|
|
|
|
|
|
2013-11-17 18:06:21 -08:00
|
|
|
mozilla::ipc::SharedMemory::SharedMemoryType OptimalShmemType();
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
bool IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface);
|
|
|
|
bool IsSurfaceDescriptorOwned(const SurfaceDescriptor& aDescriptor);
|
|
|
|
bool ReleaseOwnedSurfaceDescriptor(const SurfaceDescriptor& aDescriptor);
|
2014-04-06 18:32:48 -07:00
|
|
|
|
2015-06-17 07:00:52 -07:00
|
|
|
already_AddRefed<gfx::DrawTarget> GetDrawTargetForDescriptor(const SurfaceDescriptor& aDescriptor, gfx::BackendType aBackend);
|
|
|
|
already_AddRefed<gfx::DataSourceSurface> GetSurfaceForDescriptor(const SurfaceDescriptor& aDescriptor);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
/**
|
|
|
|
* An interface used to create and destroy surfaces that are shared with the
|
|
|
|
* Compositor process (using shmem, or gralloc, or other platform specific memory)
|
|
|
|
*
|
|
|
|
* Most of the methods here correspond to methods that are implemented by IPDL
|
|
|
|
* actors without a common polymorphic interface.
|
|
|
|
* These methods should be only called in the ipdl implementor's thread, unless
|
|
|
|
* specified otherwise in the implementing class.
|
|
|
|
*/
|
2014-03-18 21:02:42 -07:00
|
|
|
class ISurfaceAllocator : public AtomicRefCountedWithFinalize<ISurfaceAllocator>
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-02-20 18:33:49 -08:00
|
|
|
MOZ_DECLARE_REFCOUNTED_TYPENAME(ISurfaceAllocator)
|
2014-06-27 06:26:51 -07:00
|
|
|
ISurfaceAllocator()
|
|
|
|
: mDefaultMessageLoop(MessageLoop::current())
|
|
|
|
{}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
2014-03-18 21:02:42 -07:00
|
|
|
void Finalize();
|
|
|
|
|
2014-03-07 13:34:04 -08:00
|
|
|
/**
|
|
|
|
* Returns the type of backend that is used off the main thread.
|
|
|
|
* We only don't allow changing the backend type at runtime so this value can
|
|
|
|
* be queried once and will not change until Gecko is restarted.
|
|
|
|
*
|
|
|
|
* XXX - With e10s this may not be true anymore. we can have accelerated widgets
|
|
|
|
* and non-accelerated widgets (small popups, etc.)
|
|
|
|
*/
|
|
|
|
virtual LayersBackend GetCompositorBackendType() const = 0;
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
/**
|
|
|
|
* Allocate shared memory that can be accessed by only one process at a time.
|
|
|
|
* Ownership of this memory is passed when the memory is sent in an IPDL
|
|
|
|
* message.
|
|
|
|
*/
|
|
|
|
virtual bool AllocShmem(size_t aSize,
|
2013-11-17 18:06:21 -08:00
|
|
|
mozilla::ipc::SharedMemory::SharedMemoryType aType,
|
|
|
|
mozilla::ipc::Shmem* aShmem) = 0;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate shared memory that can be accessed by both processes at the
|
|
|
|
* same time. Safety is left for the user of the memory to care about.
|
|
|
|
*/
|
|
|
|
virtual bool AllocUnsafeShmem(size_t aSize,
|
2013-11-17 18:06:21 -08:00
|
|
|
mozilla::ipc::SharedMemory::SharedMemoryType aType,
|
|
|
|
mozilla::ipc::Shmem* aShmem) = 0;
|
2014-03-12 22:17:05 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate memory in shared memory that can always be accessed by both
|
|
|
|
* processes at a time. Safety is left for the user of the memory to care
|
|
|
|
* about.
|
|
|
|
*/
|
|
|
|
bool AllocShmemSection(size_t aSize,
|
|
|
|
mozilla::layers::ShmemSection* aShmemSection);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deallocates a shmem section.
|
|
|
|
*/
|
|
|
|
void FreeShmemSection(mozilla::layers::ShmemSection& aShmemSection);
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
/**
|
|
|
|
* Deallocate memory allocated by either AllocShmem or AllocUnsafeShmem.
|
|
|
|
*/
|
2013-11-17 18:06:21 -08:00
|
|
|
virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) = 0;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
// was AllocBuffer
|
2013-12-20 08:46:29 -08:00
|
|
|
virtual bool AllocSurfaceDescriptor(const gfx::IntSize& aSize,
|
2013-09-24 13:45:13 -07:00
|
|
|
gfxContentType aContent,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
SurfaceDescriptor* aBuffer);
|
|
|
|
|
|
|
|
// was AllocBufferWithCaps
|
2013-12-20 08:46:29 -08:00
|
|
|
virtual bool AllocSurfaceDescriptorWithCaps(const gfx::IntSize& aSize,
|
2013-09-24 13:45:13 -07:00
|
|
|
gfxContentType aContent,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
uint32_t aCaps,
|
|
|
|
SurfaceDescriptor* aBuffer);
|
|
|
|
|
2014-03-12 05:16:37 -07:00
|
|
|
/**
|
|
|
|
* Returns the maximum texture size supported by the compositor.
|
|
|
|
*/
|
|
|
|
virtual int32_t GetMaxTextureSize() const { return INT32_MAX; }
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
virtual void DestroySharedSurface(SurfaceDescriptor* aSurface);
|
|
|
|
|
2013-08-09 08:23:46 -07:00
|
|
|
// method that does the actual allocation work
|
2014-04-30 18:52:00 -07:00
|
|
|
bool AllocGrallocBuffer(const gfx::IntSize& aSize,
|
|
|
|
uint32_t aFormat,
|
|
|
|
uint32_t aUsage,
|
|
|
|
MaybeMagicGrallocBufferHandle* aHandle);
|
|
|
|
|
|
|
|
void DeallocGrallocBuffer(MaybeMagicGrallocBufferHandle* aHandle);
|
2014-03-25 18:28:47 -07:00
|
|
|
|
2014-07-19 05:33:12 -07:00
|
|
|
void DropGrallocBuffer(MaybeMagicGrallocBufferHandle* aHandle);
|
|
|
|
|
2013-11-27 07:18:38 -08:00
|
|
|
virtual bool IPCOpen() const { return true; }
|
2014-02-25 05:12:49 -08:00
|
|
|
virtual bool IsSameProcess() const = 0;
|
2015-05-22 08:54:24 -07:00
|
|
|
virtual base::ProcessId ParentPid() const { return base::ProcessId(); }
|
2013-11-27 07:18:38 -08:00
|
|
|
|
2014-07-15 06:22:35 -07:00
|
|
|
virtual bool IsImageBridgeChild() const { return false; }
|
|
|
|
|
2014-06-27 06:26:51 -07:00
|
|
|
virtual MessageLoop * GetMessageLoop() const
|
|
|
|
{
|
|
|
|
return mDefaultMessageLoop;
|
|
|
|
}
|
|
|
|
|
2013-09-27 02:48:42 -07:00
|
|
|
// Returns true if aSurface wraps a Shmem.
|
|
|
|
static bool IsShmem(SurfaceDescriptor* aSurface);
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
protected:
|
2014-04-02 23:04:04 -07:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
virtual bool IsOnCompositorSide() const = 0;
|
|
|
|
|
2014-03-12 22:17:05 -07:00
|
|
|
virtual ~ISurfaceAllocator();
|
|
|
|
|
|
|
|
void ShrinkShmemSectionHeap();
|
|
|
|
|
|
|
|
// This is used to implement an extremely simple & naive heap allocator.
|
|
|
|
std::vector<mozilla::ipc::Shmem> mUsedShmems;
|
2013-11-27 07:19:34 -08:00
|
|
|
|
2014-06-27 06:26:51 -07:00
|
|
|
MessageLoop* mDefaultMessageLoop;
|
|
|
|
|
2014-03-18 21:02:42 -07:00
|
|
|
friend class AtomicRefCountedWithFinalize<ISurfaceAllocator>;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
};
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class GfxMemoryImageReporter final : public nsIMemoryReporter
|
2013-11-14 13:54:25 -08:00
|
|
|
{
|
2014-06-23 11:49:07 -07:00
|
|
|
~GfxMemoryImageReporter() {}
|
|
|
|
|
2013-11-14 13:54:25 -08:00
|
|
|
public:
|
2013-12-07 22:09:10 -08:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2013-11-14 13:54:25 -08:00
|
|
|
GfxMemoryImageReporter()
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
// There must be only one instance of this class, due to |sAmount|
|
|
|
|
// being static.
|
|
|
|
static bool hasRun = false;
|
|
|
|
MOZ_ASSERT(!hasRun);
|
|
|
|
hasRun = true;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-12-07 22:09:10 -08:00
|
|
|
MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(MallocSizeOfOnAlloc)
|
|
|
|
MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(MallocSizeOfOnFree)
|
|
|
|
|
2013-11-14 13:54:25 -08:00
|
|
|
static void DidAlloc(void* aPointer)
|
|
|
|
{
|
|
|
|
sAmount += MallocSizeOfOnAlloc(aPointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void WillFree(void* aPointer)
|
|
|
|
{
|
|
|
|
sAmount -= MallocSizeOfOnFree(aPointer);
|
|
|
|
}
|
|
|
|
|
2013-12-07 22:09:10 -08:00
|
|
|
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsISupports* aData, bool aAnonymize) override
|
2013-12-07 22:09:10 -08:00
|
|
|
{
|
|
|
|
return MOZ_COLLECT_REPORT(
|
|
|
|
"explicit/gfx/heap-textures", KIND_HEAP, UNITS_BYTES, sAmount,
|
|
|
|
"Heap memory shared between threads by texture clients and hosts.");
|
|
|
|
}
|
2013-11-14 13:54:25 -08:00
|
|
|
|
2013-12-07 22:09:10 -08:00
|
|
|
private:
|
2014-02-10 17:03:24 -08:00
|
|
|
static mozilla::Atomic<size_t> sAmount;
|
2013-11-14 13:54:25 -08:00
|
|
|
};
|
|
|
|
|
2015-07-13 08:25:42 -07:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
#endif
|