Loading services/surfaceflinger/DisplayDevice.cpp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -235,8 +235,7 @@ void DisplayDevice::swapBuffers(HWComposer& hwc) const { void DisplayDevice::onSwapBuffersCompleted(HWComposer& hwc) const { void DisplayDevice::onSwapBuffersCompleted(HWComposer& hwc) const { if (hwc.initCheck() == NO_ERROR) { if (hwc.initCheck() == NO_ERROR) { sp<Fence> fence = hwc.getAndResetReleaseFence(mType); mDisplaySurface->onFrameCommitted(); mDisplaySurface->onFrameCommitted(fence); } } } } Loading services/surfaceflinger/DisplayHardware/DisplaySurface.h +3 −4 Original line number Original line Diff line number Diff line Loading @@ -49,10 +49,9 @@ public: virtual status_t advanceFrame() = 0; virtual status_t advanceFrame() = 0; // onFrameCommitted is called after the frame has been committed to the // onFrameCommitted is called after the frame has been committed to the // hardware composer and a release fence is available for the buffer. // hardware composer. The surface collects the release fence for this // Further operations on the buffer can be queued as long as they wait for // frame's buffer. // the fence to signal. virtual void onFrameCommitted() = 0; virtual void onFrameCommitted(const sp<Fence>& fence) = 0; virtual void dump(String8& result) const = 0; virtual void dump(String8& result) const = 0; Loading services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -140,7 +140,8 @@ void FramebufferSurface::freeBufferLocked(int slotIndex) { } } } } void FramebufferSurface::onFrameCommitted(const sp<Fence>& fence) { void FramebufferSurface::onFrameCommitted() { sp<Fence> fence = mHwc.getAndResetReleaseFence(mDisplayType); if (fence->isValid() && if (fence->isValid() && mCurrentBufferSlot != BufferQueue::INVALID_BUFFER_SLOT) { mCurrentBufferSlot != BufferQueue::INVALID_BUFFER_SLOT) { status_t err = addReleaseFence(mCurrentBufferSlot, fence); status_t err = addReleaseFence(mCurrentBufferSlot, fence); Loading services/surfaceflinger/DisplayHardware/FramebufferSurface.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -43,7 +43,7 @@ public: virtual status_t compositionComplete(); virtual status_t compositionComplete(); virtual status_t advanceFrame(); virtual status_t advanceFrame(); virtual void onFrameCommitted(const sp<Fence>& fence); virtual void onFrameCommitted(); // Implementation of DisplaySurface::dump(). Note that ConsumerBase also // Implementation of DisplaySurface::dump(). Note that ConsumerBase also // has a non-virtual dump() with the same signature. // has a non-virtual dump() with the same signature. Loading services/surfaceflinger/DisplayHardware/HWComposer.cpp +31 −16 Original line number Original line Diff line number Diff line Loading @@ -657,15 +657,12 @@ status_t HWComposer::commit() { mLists[0]->sur = eglGetCurrentSurface(EGL_DRAW); mLists[0]->sur = eglGetCurrentSurface(EGL_DRAW); } } // For virtual displays, the framebufferTarget buffer also serves as // the HWC output buffer, so we need to copy the buffer handle and // dup() the acquire fence. for (size_t i=VIRTUAL_DISPLAY_ID_BASE; i<mNumDisplays; i++) { for (size_t i=VIRTUAL_DISPLAY_ID_BASE; i<mNumDisplays; i++) { DisplayData& disp(mDisplayData[i]); DisplayData& disp(mDisplayData[i]); if (disp.framebufferTarget) { if (disp.outbufHandle) { mLists[i]->outbuf = disp.framebufferTarget->handle; mLists[i]->outbuf = disp.outbufHandle; mLists[i]->outbufAcquireFenceFd = mLists[i]->outbufAcquireFenceFd = dup(disp.framebufferTarget->acquireFenceFd); disp.outbufAcquireFence->dup(); } } } } Loading Loading @@ -706,17 +703,15 @@ status_t HWComposer::acquire(int disp) { void HWComposer::disconnectDisplay(int disp) { void HWComposer::disconnectDisplay(int disp) { LOG_ALWAYS_FATAL_IF(disp < 0 || disp == HWC_DISPLAY_PRIMARY); LOG_ALWAYS_FATAL_IF(disp < 0 || disp == HWC_DISPLAY_PRIMARY); if (disp >= HWC_NUM_DISPLAY_TYPES) { // nothing to do for these yet return; } DisplayData& dd(mDisplayData[disp]); DisplayData& dd(mDisplayData[disp]); if (dd.list != NULL) { free(dd.list); free(dd.list); dd.list = NULL; dd.list = NULL; dd.framebufferTarget = NULL; // points into dd.list dd.framebufferTarget = NULL; // points into dd.list dd.fbTargetHandle = NULL; dd.fbTargetHandle = NULL; } dd.outbufHandle = NULL; dd.lastRetireFence = Fence::NO_FENCE; dd.lastDisplayFence = Fence::NO_FENCE; dd.outbufAcquireFence = Fence::NO_FENCE; } } int HWComposer::getVisualID() const { int HWComposer::getVisualID() const { Loading Loading @@ -765,6 +760,25 @@ void HWComposer::fbDump(String8& result) { } } } } status_t HWComposer::setOutputBuffer(int32_t id, const sp<Fence>& acquireFence, const sp<GraphicBuffer>& buf) { if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) return BAD_INDEX; if (id < VIRTUAL_DISPLAY_ID_BASE) return INVALID_OPERATION; DisplayData& disp(mDisplayData[id]); disp.outbufHandle = buf->handle; disp.outbufAcquireFence = acquireFence; return NO_ERROR; } sp<Fence> HWComposer::getLastRetireFence(int32_t id) { if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) return Fence::NO_FENCE; return mDisplayData[id].lastRetireFence; } /* /* * Helper template to implement a concrete HWCLayer * Helper template to implement a concrete HWCLayer * This holds the pointer to the concrete hwc layer type * This holds the pointer to the concrete hwc layer type Loading Loading @@ -1071,6 +1085,7 @@ HWComposer::DisplayData::DisplayData() capacity(0), list(NULL), capacity(0), list(NULL), framebufferTarget(NULL), fbTargetHandle(0), framebufferTarget(NULL), fbTargetHandle(0), lastRetireFence(Fence::NO_FENCE), lastDisplayFence(Fence::NO_FENCE), lastRetireFence(Fence::NO_FENCE), lastDisplayFence(Fence::NO_FENCE), outbufHandle(NULL), outbufAcquireFence(Fence::NO_FENCE), events(0) events(0) {} {} Loading Loading
services/surfaceflinger/DisplayDevice.cpp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -235,8 +235,7 @@ void DisplayDevice::swapBuffers(HWComposer& hwc) const { void DisplayDevice::onSwapBuffersCompleted(HWComposer& hwc) const { void DisplayDevice::onSwapBuffersCompleted(HWComposer& hwc) const { if (hwc.initCheck() == NO_ERROR) { if (hwc.initCheck() == NO_ERROR) { sp<Fence> fence = hwc.getAndResetReleaseFence(mType); mDisplaySurface->onFrameCommitted(); mDisplaySurface->onFrameCommitted(fence); } } } } Loading
services/surfaceflinger/DisplayHardware/DisplaySurface.h +3 −4 Original line number Original line Diff line number Diff line Loading @@ -49,10 +49,9 @@ public: virtual status_t advanceFrame() = 0; virtual status_t advanceFrame() = 0; // onFrameCommitted is called after the frame has been committed to the // onFrameCommitted is called after the frame has been committed to the // hardware composer and a release fence is available for the buffer. // hardware composer. The surface collects the release fence for this // Further operations on the buffer can be queued as long as they wait for // frame's buffer. // the fence to signal. virtual void onFrameCommitted() = 0; virtual void onFrameCommitted(const sp<Fence>& fence) = 0; virtual void dump(String8& result) const = 0; virtual void dump(String8& result) const = 0; Loading
services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -140,7 +140,8 @@ void FramebufferSurface::freeBufferLocked(int slotIndex) { } } } } void FramebufferSurface::onFrameCommitted(const sp<Fence>& fence) { void FramebufferSurface::onFrameCommitted() { sp<Fence> fence = mHwc.getAndResetReleaseFence(mDisplayType); if (fence->isValid() && if (fence->isValid() && mCurrentBufferSlot != BufferQueue::INVALID_BUFFER_SLOT) { mCurrentBufferSlot != BufferQueue::INVALID_BUFFER_SLOT) { status_t err = addReleaseFence(mCurrentBufferSlot, fence); status_t err = addReleaseFence(mCurrentBufferSlot, fence); Loading
services/surfaceflinger/DisplayHardware/FramebufferSurface.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -43,7 +43,7 @@ public: virtual status_t compositionComplete(); virtual status_t compositionComplete(); virtual status_t advanceFrame(); virtual status_t advanceFrame(); virtual void onFrameCommitted(const sp<Fence>& fence); virtual void onFrameCommitted(); // Implementation of DisplaySurface::dump(). Note that ConsumerBase also // Implementation of DisplaySurface::dump(). Note that ConsumerBase also // has a non-virtual dump() with the same signature. // has a non-virtual dump() with the same signature. Loading
services/surfaceflinger/DisplayHardware/HWComposer.cpp +31 −16 Original line number Original line Diff line number Diff line Loading @@ -657,15 +657,12 @@ status_t HWComposer::commit() { mLists[0]->sur = eglGetCurrentSurface(EGL_DRAW); mLists[0]->sur = eglGetCurrentSurface(EGL_DRAW); } } // For virtual displays, the framebufferTarget buffer also serves as // the HWC output buffer, so we need to copy the buffer handle and // dup() the acquire fence. for (size_t i=VIRTUAL_DISPLAY_ID_BASE; i<mNumDisplays; i++) { for (size_t i=VIRTUAL_DISPLAY_ID_BASE; i<mNumDisplays; i++) { DisplayData& disp(mDisplayData[i]); DisplayData& disp(mDisplayData[i]); if (disp.framebufferTarget) { if (disp.outbufHandle) { mLists[i]->outbuf = disp.framebufferTarget->handle; mLists[i]->outbuf = disp.outbufHandle; mLists[i]->outbufAcquireFenceFd = mLists[i]->outbufAcquireFenceFd = dup(disp.framebufferTarget->acquireFenceFd); disp.outbufAcquireFence->dup(); } } } } Loading Loading @@ -706,17 +703,15 @@ status_t HWComposer::acquire(int disp) { void HWComposer::disconnectDisplay(int disp) { void HWComposer::disconnectDisplay(int disp) { LOG_ALWAYS_FATAL_IF(disp < 0 || disp == HWC_DISPLAY_PRIMARY); LOG_ALWAYS_FATAL_IF(disp < 0 || disp == HWC_DISPLAY_PRIMARY); if (disp >= HWC_NUM_DISPLAY_TYPES) { // nothing to do for these yet return; } DisplayData& dd(mDisplayData[disp]); DisplayData& dd(mDisplayData[disp]); if (dd.list != NULL) { free(dd.list); free(dd.list); dd.list = NULL; dd.list = NULL; dd.framebufferTarget = NULL; // points into dd.list dd.framebufferTarget = NULL; // points into dd.list dd.fbTargetHandle = NULL; dd.fbTargetHandle = NULL; } dd.outbufHandle = NULL; dd.lastRetireFence = Fence::NO_FENCE; dd.lastDisplayFence = Fence::NO_FENCE; dd.outbufAcquireFence = Fence::NO_FENCE; } } int HWComposer::getVisualID() const { int HWComposer::getVisualID() const { Loading Loading @@ -765,6 +760,25 @@ void HWComposer::fbDump(String8& result) { } } } } status_t HWComposer::setOutputBuffer(int32_t id, const sp<Fence>& acquireFence, const sp<GraphicBuffer>& buf) { if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) return BAD_INDEX; if (id < VIRTUAL_DISPLAY_ID_BASE) return INVALID_OPERATION; DisplayData& disp(mDisplayData[id]); disp.outbufHandle = buf->handle; disp.outbufAcquireFence = acquireFence; return NO_ERROR; } sp<Fence> HWComposer::getLastRetireFence(int32_t id) { if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) return Fence::NO_FENCE; return mDisplayData[id].lastRetireFence; } /* /* * Helper template to implement a concrete HWCLayer * Helper template to implement a concrete HWCLayer * This holds the pointer to the concrete hwc layer type * This holds the pointer to the concrete hwc layer type Loading Loading @@ -1071,6 +1085,7 @@ HWComposer::DisplayData::DisplayData() capacity(0), list(NULL), capacity(0), list(NULL), framebufferTarget(NULL), fbTargetHandle(0), framebufferTarget(NULL), fbTargetHandle(0), lastRetireFence(Fence::NO_FENCE), lastDisplayFence(Fence::NO_FENCE), lastRetireFence(Fence::NO_FENCE), lastDisplayFence(Fence::NO_FENCE), outbufHandle(NULL), outbufAcquireFence(Fence::NO_FENCE), events(0) events(0) {} {} Loading