mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 974152 - Use FrameBuffer's Acquire Fence as Layer buffer's ReleaseFence on gonk r=sushil,nical
This commit is contained in:
parent
ed4031c28e
commit
1f8749fe25
@ -121,6 +121,7 @@ struct Effect;
|
||||
struct EffectChain;
|
||||
class Image;
|
||||
class ISurfaceAllocator;
|
||||
class Layer;
|
||||
class NewTextureSource;
|
||||
class DataTextureSource;
|
||||
class CompositingRenderTarget;
|
||||
@ -359,6 +360,8 @@ public:
|
||||
*/
|
||||
virtual void EndFrame() = 0;
|
||||
|
||||
virtual void SetFBAcquireFence(Layer* aLayer) {}
|
||||
|
||||
/**
|
||||
* Post-rendering stuff if the rendering is done outside of this Compositor
|
||||
* e.g., by Composer2D.
|
||||
|
@ -509,6 +509,7 @@ LayerManagerComposite::Render()
|
||||
{
|
||||
PROFILER_LABEL("LayerManagerComposite", "EndFrame");
|
||||
mCompositor->EndFrame();
|
||||
mCompositor->SetFBAcquireFence(mRoot);
|
||||
}
|
||||
|
||||
mCompositor->GetWidget()->PostRender(this);
|
||||
|
@ -202,6 +202,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
'opengl/GrallocTextureClient.cpp',
|
||||
'opengl/GrallocTextureHost.cpp',
|
||||
]
|
||||
LOCAL_INCLUDES += ['/widget/gonk']
|
||||
SOURCES += [
|
||||
'ipc/ShadowLayerUtilsGralloc.cpp',
|
||||
]
|
||||
|
@ -50,6 +50,11 @@
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
||||
#include "libdisplay/GonkDisplay.h" // for GonkDisplay
|
||||
#include <ui/Fence.h>
|
||||
#endif
|
||||
|
||||
#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
|
||||
|
||||
namespace mozilla {
|
||||
@ -1283,6 +1288,46 @@ CompositorOGL::EndFrame()
|
||||
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
||||
void
|
||||
CompositorOGL::SetFBAcquireFence(Layer* aLayer)
|
||||
{
|
||||
if (!aLayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion();
|
||||
if (visibleRegion.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set FBAcquireFence to child
|
||||
ContainerLayer* container = aLayer->AsContainerLayer();
|
||||
if (container) {
|
||||
for (Layer* child = container->GetFirstChild(); child; child = child->GetNextSibling()) {
|
||||
SetFBAcquireFence(child);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Set FBAcquireFence to TexutreHost
|
||||
LayerRenderState state = aLayer->GetRenderState();
|
||||
if (!state.mTexture) {
|
||||
return;
|
||||
}
|
||||
TextureHostOGL* texture = state.mTexture->AsHostOGL();
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
texture->SetReleaseFence(new android::Fence(GetGonkDisplay()->GetPrevFBAcquireFd()));
|
||||
}
|
||||
#else
|
||||
void
|
||||
CompositorOGL::SetFBAcquireFence(Layer* aLayer)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
CompositorOGL::EndFrameForExternalComposition(const gfx::Matrix& aTransform)
|
||||
{
|
||||
|
@ -113,6 +113,7 @@ public:
|
||||
|
||||
|
||||
virtual void EndFrame() MOZ_OVERRIDE;
|
||||
virtual void SetFBAcquireFence(Layer* aLayer) MOZ_OVERRIDE;
|
||||
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) MOZ_OVERRIDE;
|
||||
virtual void AbortFrame() MOZ_OVERRIDE;
|
||||
|
||||
|
@ -571,7 +571,7 @@ HwcComposer2D::TryHwComposition()
|
||||
return false;
|
||||
}
|
||||
mList->hwLayers[idx].handle = fbsurface->lastHandle;
|
||||
mList->hwLayers[idx].acquireFenceFd = fbsurface->lastFenceFD;
|
||||
mList->hwLayers[idx].acquireFenceFd = fbsurface->GetPrevFBAcquireFd();
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,7 +601,7 @@ HwcComposer2D::Render(EGLDisplay dpy, EGLSurface sur)
|
||||
if (mPrepared) {
|
||||
// No mHwc prepare, if already prepared in current draw cycle
|
||||
mList->hwLayers[mList->numHwLayers - 1].handle = fbsurface->lastHandle;
|
||||
mList->hwLayers[mList->numHwLayers - 1].acquireFenceFd = fbsurface->lastFenceFD;
|
||||
mList->hwLayers[mList->numHwLayers - 1].acquireFenceFd = fbsurface->GetPrevFBAcquireFd();
|
||||
} else {
|
||||
mList->numHwLayers = 2;
|
||||
mList->hwLayers[0].hints = 0;
|
||||
@ -611,7 +611,7 @@ HwcComposer2D::Render(EGLDisplay dpy, EGLSurface sur)
|
||||
mList->hwLayers[0].acquireFenceFd = -1;
|
||||
mList->hwLayers[0].releaseFenceFd = -1;
|
||||
mList->hwLayers[0].displayFrame = {0, 0, mScreenRect.width, mScreenRect.height};
|
||||
Prepare(fbsurface->lastHandle, fbsurface->lastFenceFD);
|
||||
Prepare(fbsurface->lastHandle, fbsurface->GetPrevFBAcquireFd());
|
||||
}
|
||||
|
||||
// GPU or partial HWC Composition
|
||||
|
@ -136,9 +136,9 @@ void FramebufferSurface::onFrameAvailable() {
|
||||
return;
|
||||
}
|
||||
if (acquireFence.get())
|
||||
lastFenceFD = acquireFence->dup();
|
||||
mPrevFBAcquireFence = new Fence(acquireFence->dup());
|
||||
else
|
||||
lastFenceFD = -1;
|
||||
mPrevFBAcquireFence = Fence::NO_FENCE;
|
||||
|
||||
lastHandle = buf->handle;
|
||||
}
|
||||
@ -167,6 +167,10 @@ status_t FramebufferSurface::setReleaseFenceFd(int fenceFd) {
|
||||
return err;
|
||||
}
|
||||
|
||||
int FramebufferSurface::GetPrevFBAcquireFd() {
|
||||
return mPrevFBAcquireFence->dup();
|
||||
}
|
||||
|
||||
status_t FramebufferSurface::setUpdateRectangle(const Rect& r)
|
||||
{
|
||||
return INVALID_OPERATION;
|
||||
|
@ -51,8 +51,9 @@ public:
|
||||
// when finished with it.
|
||||
status_t setReleaseFenceFd(int fenceFd);
|
||||
|
||||
virtual int GetPrevFBAcquireFd();
|
||||
|
||||
buffer_handle_t lastHandle;
|
||||
int lastFenceFD;
|
||||
private:
|
||||
virtual ~FramebufferSurface() { }; // this class cannot be overloaded
|
||||
|
||||
@ -75,6 +76,8 @@ private:
|
||||
// mCurrentBuffer is the current buffer or NULL to indicate that there is
|
||||
// no current buffer.
|
||||
sp<GraphicBuffer> mCurrentBuffer;
|
||||
|
||||
android::sp<android::Fence> mPrevFBAcquireFence;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,10 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace layers {
|
||||
class Layer;
|
||||
}
|
||||
|
||||
typedef void * EGLDisplay;
|
||||
typedef void * EGLSurface;
|
||||
|
||||
@ -47,6 +51,8 @@ public:
|
||||
|
||||
virtual void SetFBReleaseFd(int fd) = 0;
|
||||
|
||||
virtual int GetPrevFBAcquireFd() = 0;
|
||||
|
||||
float xdpi;
|
||||
uint32_t surfaceformat;
|
||||
};
|
||||
|
@ -50,6 +50,11 @@ public:
|
||||
|
||||
virtual void SetFBReleaseFd(int fd);
|
||||
|
||||
virtual int GetPrevFBAcquireFd()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
private:
|
||||
hw_module_t const* mModule;
|
||||
hwc_composer_device_t* mHwc;
|
||||
|
@ -216,7 +216,7 @@ GonkDisplayJB::SwapBuffers(EGLDisplay dpy, EGLSurface sur)
|
||||
mList->outbufAcquireFenceFd = -1;
|
||||
#endif
|
||||
eglSwapBuffers(dpy, sur);
|
||||
return Post(mFBSurface->lastHandle, mFBSurface->lastFenceFD);
|
||||
return Post(mFBSurface->lastHandle, mFBSurface->GetPrevFBAcquireFd());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -304,6 +304,12 @@ GonkDisplayJB::SetFBReleaseFd(int fd)
|
||||
mFBSurface->setReleaseFenceFd(fd);
|
||||
}
|
||||
|
||||
int
|
||||
GonkDisplayJB::GetPrevFBAcquireFd()
|
||||
{
|
||||
return mFBSurface->GetPrevFBAcquireFd();
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("default")))
|
||||
GonkDisplay*
|
||||
GetGonkDisplay()
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "FramebufferSurface.h"
|
||||
#include "hardware/hwcomposer.h"
|
||||
#include "hardware/power.h"
|
||||
#include "ui/Fence.h"
|
||||
#include "utils/RefBase.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -49,6 +50,8 @@ public:
|
||||
|
||||
virtual void SetFBReleaseFd(int fd);
|
||||
|
||||
virtual int GetPrevFBAcquireFd();
|
||||
|
||||
bool Post(buffer_handle_t buf, int fence);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user