Bug 752643 - Make CompositorParent eglSurface setup available for non-android environment. r=ajuma
This commit is contained in:
@@ -57,7 +57,9 @@ using base::Thread;
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
CompositorParent::CompositorParent(nsIWidget* aWidget, MessageLoop* aMsgLoop, PlatformThreadId aThreadID)
|
CompositorParent::CompositorParent(nsIWidget* aWidget, MessageLoop* aMsgLoop,
|
||||||
|
PlatformThreadId aThreadID, bool aRenderToEGLSurface,
|
||||||
|
int aSurfaceWidth, int aSurfaceHeight)
|
||||||
: mWidget(aWidget)
|
: mWidget(aWidget)
|
||||||
, mCurrentCompositeTask(NULL)
|
, mCurrentCompositeTask(NULL)
|
||||||
, mPaused(false)
|
, mPaused(false)
|
||||||
@@ -67,6 +69,8 @@ CompositorParent::CompositorParent(nsIWidget* aWidget, MessageLoop* aMsgLoop, Pl
|
|||||||
, mLayersUpdated(false)
|
, mLayersUpdated(false)
|
||||||
, mCompositorLoop(aMsgLoop)
|
, mCompositorLoop(aMsgLoop)
|
||||||
, mThreadID(aThreadID)
|
, mThreadID(aThreadID)
|
||||||
|
, mRenderToEGLSurface(aRenderToEGLSurface)
|
||||||
|
, mEGLSurfaceSize(aSurfaceWidth, aSurfaceHeight)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(CompositorParent);
|
MOZ_COUNT_CTOR(CompositorParent);
|
||||||
}
|
}
|
||||||
@@ -163,10 +167,20 @@ CompositorParent::ResumeComposition()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CompositorParent::SetEGLSurfaceSize(int width, int height)
|
||||||
|
{
|
||||||
|
NS_ASSERTION(mRenderToEGLSurface, "Compositor created without RenderToEGLSurface ar provided");
|
||||||
|
mEGLSurfaceSize.SizeTo(width, height);
|
||||||
|
if (mLayerManager) {
|
||||||
|
static_cast<LayerManagerOGL*>(mLayerManager.get())->SetSurfaceSize(mEGLSurfaceSize.width, mEGLSurfaceSize.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CompositorParent::ResumeCompositionAndResize(int width, int height)
|
CompositorParent::ResumeCompositionAndResize(int width, int height)
|
||||||
{
|
{
|
||||||
static_cast<LayerManagerOGL*>(mLayerManager.get())->SetSurfaceSize(width, height);
|
SetEGLSurfaceSize(width, height);
|
||||||
ResumeComposition();
|
ResumeComposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,14 +448,9 @@ PLayersParent*
|
|||||||
CompositorParent::AllocPLayers(const LayersBackend &backendType)
|
CompositorParent::AllocPLayers(const LayersBackend &backendType)
|
||||||
{
|
{
|
||||||
if (backendType == LayerManager::LAYERS_OPENGL) {
|
if (backendType == LayerManager::LAYERS_OPENGL) {
|
||||||
#ifdef MOZ_JAVA_COMPOSITOR
|
nsRefPtr<LayerManagerOGL> layerManager;
|
||||||
nsIntRect rect;
|
layerManager =
|
||||||
mWidget->GetBounds(rect);
|
new LayerManagerOGL(mWidget, mEGLSurfaceSize.width, mEGLSurfaceSize.height, mRenderToEGLSurface);
|
||||||
nsRefPtr<LayerManagerOGL> layerManager =
|
|
||||||
new LayerManagerOGL(mWidget, rect.width, rect.height, true);
|
|
||||||
#else
|
|
||||||
nsRefPtr<LayerManagerOGL> layerManager = new LayerManagerOGL(mWidget);
|
|
||||||
#endif
|
|
||||||
mWidget = NULL;
|
mWidget = NULL;
|
||||||
mLayerManager = layerManager;
|
mLayerManager = layerManager;
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,9 @@ class CompositorParent : public PCompositorParent,
|
|||||||
{
|
{
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorParent)
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorParent)
|
||||||
public:
|
public:
|
||||||
CompositorParent(nsIWidget* aWidget, MessageLoop* aMsgLoop, PlatformThreadId aThreadID);
|
CompositorParent(nsIWidget* aWidget, MessageLoop* aMsgLoop,
|
||||||
|
PlatformThreadId aThreadID, bool aRenderToEGLSurface = false,
|
||||||
|
int aSurfaceWidth = -1, int aSurfaceHeight = -1);
|
||||||
|
|
||||||
virtual ~CompositorParent();
|
virtual ~CompositorParent();
|
||||||
|
|
||||||
@@ -119,6 +121,7 @@ protected:
|
|||||||
virtual void SetPageSize(float aZoom, float aPageWidth, float aPageHeight, float aCssPageWidth, float aCssPageHeight);
|
virtual void SetPageSize(float aZoom, float aPageWidth, float aPageHeight, float aCssPageWidth, float aCssPageHeight);
|
||||||
virtual void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
virtual void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||||
|
void SetEGLSurfaceSize(int width, int height);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PauseComposition();
|
void PauseComposition();
|
||||||
@@ -164,6 +167,8 @@ private:
|
|||||||
|
|
||||||
MessageLoop* mCompositorLoop;
|
MessageLoop* mCompositorLoop;
|
||||||
PlatformThreadId mThreadID;
|
PlatformThreadId mThreadID;
|
||||||
|
bool mRenderToEGLSurface;
|
||||||
|
nsIntSize mEGLSurfaceSize;
|
||||||
|
|
||||||
DISALLOW_EVIL_CONSTRUCTORS(CompositorParent);
|
DISALLOW_EVIL_CONSTRUCTORS(CompositorParent);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -874,7 +874,15 @@ void nsBaseWidget::CreateCompositor()
|
|||||||
{
|
{
|
||||||
mCompositorThread = new Thread("CompositorThread");
|
mCompositorThread = new Thread("CompositorThread");
|
||||||
if (mCompositorThread->Start()) {
|
if (mCompositorThread->Start()) {
|
||||||
mCompositorParent = new CompositorParent(this, mCompositorThread->message_loop(), mCompositorThread->thread_id());
|
bool renderToEGLSurface = false;
|
||||||
|
#ifdef MOZ_JAVA_COMPOSITOR
|
||||||
|
renderToEGLSurface = true;
|
||||||
|
#endif
|
||||||
|
nsIntRect rect;
|
||||||
|
GetBounds(rect);
|
||||||
|
mCompositorParent =
|
||||||
|
new CompositorParent(this, mCompositorThread->message_loop(), mCompositorThread->thread_id(),
|
||||||
|
renderToEGLSurface, rect.width, rect.height);
|
||||||
LayerManager* lm = CreateBasicLayerManager();
|
LayerManager* lm = CreateBasicLayerManager();
|
||||||
MessageLoop *childMessageLoop = mCompositorThread->message_loop();
|
MessageLoop *childMessageLoop = mCompositorThread->message_loop();
|
||||||
mCompositorChild = new CompositorChild(lm);
|
mCompositorChild = new CompositorChild(lm);
|
||||||
|
|||||||
Reference in New Issue
Block a user