Loading services/surfaceflinger/DisplayDevice.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,25 @@ void DisplayDevice::flip(const Region& dirty) const mPageFlipCount++; } status_t DisplayDevice::prepareFrame(const HWComposer& hwc) const { DisplaySurface::CompositionType compositionType; bool haveGles = hwc.hasGlesComposition(mHwcDisplayId); bool haveHwc = hwc.hasHwcComposition(mHwcDisplayId); if (haveGles && haveHwc) { compositionType = DisplaySurface::COMPOSITION_MIXED; } else if (haveGles) { compositionType = DisplaySurface::COMPOSITION_GLES; } else if (haveHwc) { compositionType = DisplaySurface::COMPOSITION_HWC; } else { // Nothing to do -- when turning the screen off we get a frame like // this. Call it a HWC frame since we won't be doing any GLES work but // will do a prepare/set cycle. compositionType = DisplaySurface::COMPOSITION_HWC; } return mDisplaySurface->prepareFrame(compositionType); } void DisplayDevice::swapBuffers(HWComposer& hwc) const { // We need to call eglSwapBuffers() unless: // (a) there was no GLES composition this frame, or Loading services/surfaceflinger/DisplayDevice.h +2 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,8 @@ public: int32_t getHwcDisplayId() const { return mHwcDisplayId; } const wp<IBinder>& getDisplayToken() const { return mDisplayToken; } status_t prepareFrame(const HWComposer& hwc) const; void swapBuffers(HWComposer& hwc) const; status_t compositionComplete() const; Loading services/surfaceflinger/DisplayHardware/DisplaySurface.h +12 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,18 @@ class DisplaySurface : public virtual RefBase { public: virtual sp<IGraphicBufferProducer> getIGraphicBufferProducer() const = 0; // prepareFrame is called after the composition configuration is known but // before composition takes place. The DisplaySurface can use the // composition type to decide how to manage the flow of buffers between // GLES and HWC for this frame. enum CompositionType { COMPOSITION_UNKNOWN = 0, COMPOSITION_GLES = 1, COMPOSITION_HWC = 2, COMPOSITION_MIXED = COMPOSITION_GLES | COMPOSITION_HWC }; virtual status_t prepareFrame(CompositionType compositionType) = 0; // Should be called when composition rendering is complete for a frame (but // eglSwapBuffers hasn't necessarily been called). Required by certain // older drivers for synchronization. Loading services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,10 @@ sp<IGraphicBufferProducer> FramebufferSurface::getIGraphicBufferProducer() const return getBufferQueue(); } status_t FramebufferSurface::prepareFrame(CompositionType compositionType) { return NO_ERROR; } status_t FramebufferSurface::advanceFrame() { // Once we remove FB HAL support, we can call nextBuffer() from here // instead of using onFrameAvailable(). No real benefit, except it'll be Loading services/surfaceflinger/DisplayHardware/FramebufferSurface.h +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public: virtual sp<IGraphicBufferProducer> getIGraphicBufferProducer() const; virtual status_t prepareFrame(CompositionType compositionType); virtual status_t compositionComplete(); virtual status_t advanceFrame(); virtual void onFrameCommitted(); Loading Loading
services/surfaceflinger/DisplayDevice.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,25 @@ void DisplayDevice::flip(const Region& dirty) const mPageFlipCount++; } status_t DisplayDevice::prepareFrame(const HWComposer& hwc) const { DisplaySurface::CompositionType compositionType; bool haveGles = hwc.hasGlesComposition(mHwcDisplayId); bool haveHwc = hwc.hasHwcComposition(mHwcDisplayId); if (haveGles && haveHwc) { compositionType = DisplaySurface::COMPOSITION_MIXED; } else if (haveGles) { compositionType = DisplaySurface::COMPOSITION_GLES; } else if (haveHwc) { compositionType = DisplaySurface::COMPOSITION_HWC; } else { // Nothing to do -- when turning the screen off we get a frame like // this. Call it a HWC frame since we won't be doing any GLES work but // will do a prepare/set cycle. compositionType = DisplaySurface::COMPOSITION_HWC; } return mDisplaySurface->prepareFrame(compositionType); } void DisplayDevice::swapBuffers(HWComposer& hwc) const { // We need to call eglSwapBuffers() unless: // (a) there was no GLES composition this frame, or Loading
services/surfaceflinger/DisplayDevice.h +2 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,8 @@ public: int32_t getHwcDisplayId() const { return mHwcDisplayId; } const wp<IBinder>& getDisplayToken() const { return mDisplayToken; } status_t prepareFrame(const HWComposer& hwc) const; void swapBuffers(HWComposer& hwc) const; status_t compositionComplete() const; Loading
services/surfaceflinger/DisplayHardware/DisplaySurface.h +12 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,18 @@ class DisplaySurface : public virtual RefBase { public: virtual sp<IGraphicBufferProducer> getIGraphicBufferProducer() const = 0; // prepareFrame is called after the composition configuration is known but // before composition takes place. The DisplaySurface can use the // composition type to decide how to manage the flow of buffers between // GLES and HWC for this frame. enum CompositionType { COMPOSITION_UNKNOWN = 0, COMPOSITION_GLES = 1, COMPOSITION_HWC = 2, COMPOSITION_MIXED = COMPOSITION_GLES | COMPOSITION_HWC }; virtual status_t prepareFrame(CompositionType compositionType) = 0; // Should be called when composition rendering is complete for a frame (but // eglSwapBuffers hasn't necessarily been called). Required by certain // older drivers for synchronization. Loading
services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,10 @@ sp<IGraphicBufferProducer> FramebufferSurface::getIGraphicBufferProducer() const return getBufferQueue(); } status_t FramebufferSurface::prepareFrame(CompositionType compositionType) { return NO_ERROR; } status_t FramebufferSurface::advanceFrame() { // Once we remove FB HAL support, we can call nextBuffer() from here // instead of using onFrameAvailable(). No real benefit, except it'll be Loading
services/surfaceflinger/DisplayHardware/FramebufferSurface.h +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public: virtual sp<IGraphicBufferProducer> getIGraphicBufferProducer() const; virtual status_t prepareFrame(CompositionType compositionType); virtual status_t compositionComplete(); virtual status_t advanceFrame(); virtual void onFrameCommitted(); Loading