Loading include/gui/ISurfaceComposerClient.h +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public: eOpaque = 0x00000400, eProtectedByApp = 0x00000800, eProtectedByDRM = 0x00001000, eCursorWindow = 0x00002000, eFXSurfaceNormal = 0x00000000, eFXSurfaceDim = 0x00020000, Loading include/ui/GraphicBuffer.h +3 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,9 @@ public: USAGE_HW_2D = GRALLOC_USAGE_HW_2D, USAGE_HW_COMPOSER = GRALLOC_USAGE_HW_COMPOSER, USAGE_HW_VIDEO_ENCODER = GRALLOC_USAGE_HW_VIDEO_ENCODER, USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK, USAGE_CURSOR = GRALLOC_USAGE_CURSOR, }; GraphicBuffer(); Loading services/surfaceflinger/DisplayHardware/HWComposer.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -681,6 +681,9 @@ status_t HWComposer::prepare() { if (l.compositionType == HWC_OVERLAY) { disp.hasOvComp = true; } if (l.compositionType == HWC_CURSOR_OVERLAY) { disp.hasOvComp = true; } } if (disp.list->numHwLayers == (disp.framebufferTarget ? 1 : 0)) { disp.hasFbComp = true; Loading Loading @@ -853,6 +856,16 @@ sp<Fence> HWComposer::getLastRetireFence(int32_t id) const { return mDisplayData[id].lastRetireFence; } status_t HWComposer::setCursorPositionAsync(int32_t id, const Rect& pos) { if (mHwc->setCursorPositionAsync) { return (status_t)mHwc->setCursorPositionAsync(mHwc, id, pos.left, pos.top); } else { return NO_ERROR; } } /* * Helper template to implement a concrete HWCLayer * This holds the pointer to the concrete hwc layer type Loading Loading @@ -935,6 +948,16 @@ public: getLayer()->flags &= ~HWC_SKIP_LAYER; } } virtual void setIsCursorLayerHint(bool isCursor) { if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) { if (isCursor) { getLayer()->flags |= HWC_IS_CURSOR_LAYER; } else { getLayer()->flags &= ~HWC_IS_CURSOR_LAYER; } } } virtual void setBlending(uint32_t blending) { getLayer()->blending = blending; } Loading Loading @@ -1122,6 +1145,8 @@ void HWComposer::dump(String8& result) const { "HWC", "BKGND", "FB TARGET", "SIDEBAND", "HWC_CURSOR", "UNKNOWN"}; if (type >= NELEM(compositionTypeName)) type = NELEM(compositionTypeName) - 1; Loading services/surfaceflinger/DisplayHardware/HWComposer.h +3 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,8 @@ public: // displays, writes to the output buffer are complete. sp<Fence> getLastRetireFence(int32_t id) const; status_t setCursorPositionAsync(int32_t id, const Rect &pos); /* * Interface to hardware composer's layers functionality. * This abstracts the HAL interface to layers which can evolve in Loading @@ -157,6 +159,7 @@ public: virtual sp<Fence> getAndResetReleaseFence() = 0; virtual void setDefaultState() = 0; virtual void setSkip(bool skip) = 0; virtual void setIsCursorLayerHint(bool isCursor = true) = 0; virtual void setBlending(uint32_t blending) = 0; virtual void setTransform(uint32_t transform) = 0; virtual void setFrame(const Rect& frame) = 0; Loading services/surfaceflinger/Layer.cpp +27 −2 Original line number Diff line number Diff line Loading @@ -79,7 +79,8 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client, mSecure(false), mProtectedByApp(false), mHasSurface(false), mClientRef(client) mClientRef(client), mPotentialCursor(false) { mCurrentCrop.makeInvalid(); mFlinger->getRenderEngine().genTextures(1, &mTextureName); Loading Loading @@ -200,6 +201,7 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h, mFormat = format; mPotentialCursor = (flags & ISurfaceComposerClient::eCursorWindow) ? true : false; mSecure = (flags & ISurfaceComposerClient::eSecure) ? true : false; mProtectedByApp = (flags & ISurfaceComposerClient::eProtectedByApp) ? true : false; mCurrentOpacity = getOpacityForFormat(format); Loading Loading @@ -441,7 +443,7 @@ void Layer::setAcquireFence(const sp<const DisplayDevice>& /* hw */, // TODO: there is a possible optimization here: we only need to set the // acquire fence the first time a new buffer is acquired on EACH display. if (layer.getCompositionType() == HWC_OVERLAY) { if (layer.getCompositionType() == HWC_OVERLAY || layer.getCompositionType() == HWC_CURSOR_OVERLAY) { sp<Fence> fence = mSurfaceFlingerConsumer->getCurrentFence(); if (fence->isValid()) { fenceFd = fence->dup(); Loading @@ -453,6 +455,26 @@ void Layer::setAcquireFence(const sp<const DisplayDevice>& /* hw */, layer.setAcquireFenceFd(fenceFd); } Rect Layer::getPosition( const sp<const DisplayDevice>& hw) { // this gives us only the "orientation" component of the transform const State& s(getCurrentState()); // apply the layer's transform, followed by the display's global transform // here we're guaranteed that the layer's transform preserves rects Rect win(s.active.w, s.active.h); if (!s.active.crop.isEmpty()) { win.intersect(s.active.crop, &win); } // subtract the transparent region and snap to the bounds Rect bounds = reduce(win, s.activeTransparentRegion); Rect frame(s.transform.transform(bounds)); frame.intersect(hw->getViewport(), &frame); const Transform& tr(hw->getTransform()); return Rect(tr.transform(frame)); } // --------------------------------------------------------------------------- // drawing... // --------------------------------------------------------------------------- Loading Loading @@ -1187,6 +1209,9 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const // need a hardware-protected path to external video sink usage |= GraphicBuffer::USAGE_PROTECTED; } if (mPotentialCursor) { usage |= GraphicBuffer::USAGE_CURSOR; } usage |= GraphicBuffer::USAGE_HW_COMPOSER; return usage; } Loading Loading
include/gui/ISurfaceComposerClient.h +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public: eOpaque = 0x00000400, eProtectedByApp = 0x00000800, eProtectedByDRM = 0x00001000, eCursorWindow = 0x00002000, eFXSurfaceNormal = 0x00000000, eFXSurfaceDim = 0x00020000, Loading
include/ui/GraphicBuffer.h +3 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,9 @@ public: USAGE_HW_2D = GRALLOC_USAGE_HW_2D, USAGE_HW_COMPOSER = GRALLOC_USAGE_HW_COMPOSER, USAGE_HW_VIDEO_ENCODER = GRALLOC_USAGE_HW_VIDEO_ENCODER, USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK, USAGE_CURSOR = GRALLOC_USAGE_CURSOR, }; GraphicBuffer(); Loading
services/surfaceflinger/DisplayHardware/HWComposer.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -681,6 +681,9 @@ status_t HWComposer::prepare() { if (l.compositionType == HWC_OVERLAY) { disp.hasOvComp = true; } if (l.compositionType == HWC_CURSOR_OVERLAY) { disp.hasOvComp = true; } } if (disp.list->numHwLayers == (disp.framebufferTarget ? 1 : 0)) { disp.hasFbComp = true; Loading Loading @@ -853,6 +856,16 @@ sp<Fence> HWComposer::getLastRetireFence(int32_t id) const { return mDisplayData[id].lastRetireFence; } status_t HWComposer::setCursorPositionAsync(int32_t id, const Rect& pos) { if (mHwc->setCursorPositionAsync) { return (status_t)mHwc->setCursorPositionAsync(mHwc, id, pos.left, pos.top); } else { return NO_ERROR; } } /* * Helper template to implement a concrete HWCLayer * This holds the pointer to the concrete hwc layer type Loading Loading @@ -935,6 +948,16 @@ public: getLayer()->flags &= ~HWC_SKIP_LAYER; } } virtual void setIsCursorLayerHint(bool isCursor) { if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) { if (isCursor) { getLayer()->flags |= HWC_IS_CURSOR_LAYER; } else { getLayer()->flags &= ~HWC_IS_CURSOR_LAYER; } } } virtual void setBlending(uint32_t blending) { getLayer()->blending = blending; } Loading Loading @@ -1122,6 +1145,8 @@ void HWComposer::dump(String8& result) const { "HWC", "BKGND", "FB TARGET", "SIDEBAND", "HWC_CURSOR", "UNKNOWN"}; if (type >= NELEM(compositionTypeName)) type = NELEM(compositionTypeName) - 1; Loading
services/surfaceflinger/DisplayHardware/HWComposer.h +3 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,8 @@ public: // displays, writes to the output buffer are complete. sp<Fence> getLastRetireFence(int32_t id) const; status_t setCursorPositionAsync(int32_t id, const Rect &pos); /* * Interface to hardware composer's layers functionality. * This abstracts the HAL interface to layers which can evolve in Loading @@ -157,6 +159,7 @@ public: virtual sp<Fence> getAndResetReleaseFence() = 0; virtual void setDefaultState() = 0; virtual void setSkip(bool skip) = 0; virtual void setIsCursorLayerHint(bool isCursor = true) = 0; virtual void setBlending(uint32_t blending) = 0; virtual void setTransform(uint32_t transform) = 0; virtual void setFrame(const Rect& frame) = 0; Loading
services/surfaceflinger/Layer.cpp +27 −2 Original line number Diff line number Diff line Loading @@ -79,7 +79,8 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client, mSecure(false), mProtectedByApp(false), mHasSurface(false), mClientRef(client) mClientRef(client), mPotentialCursor(false) { mCurrentCrop.makeInvalid(); mFlinger->getRenderEngine().genTextures(1, &mTextureName); Loading Loading @@ -200,6 +201,7 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h, mFormat = format; mPotentialCursor = (flags & ISurfaceComposerClient::eCursorWindow) ? true : false; mSecure = (flags & ISurfaceComposerClient::eSecure) ? true : false; mProtectedByApp = (flags & ISurfaceComposerClient::eProtectedByApp) ? true : false; mCurrentOpacity = getOpacityForFormat(format); Loading Loading @@ -441,7 +443,7 @@ void Layer::setAcquireFence(const sp<const DisplayDevice>& /* hw */, // TODO: there is a possible optimization here: we only need to set the // acquire fence the first time a new buffer is acquired on EACH display. if (layer.getCompositionType() == HWC_OVERLAY) { if (layer.getCompositionType() == HWC_OVERLAY || layer.getCompositionType() == HWC_CURSOR_OVERLAY) { sp<Fence> fence = mSurfaceFlingerConsumer->getCurrentFence(); if (fence->isValid()) { fenceFd = fence->dup(); Loading @@ -453,6 +455,26 @@ void Layer::setAcquireFence(const sp<const DisplayDevice>& /* hw */, layer.setAcquireFenceFd(fenceFd); } Rect Layer::getPosition( const sp<const DisplayDevice>& hw) { // this gives us only the "orientation" component of the transform const State& s(getCurrentState()); // apply the layer's transform, followed by the display's global transform // here we're guaranteed that the layer's transform preserves rects Rect win(s.active.w, s.active.h); if (!s.active.crop.isEmpty()) { win.intersect(s.active.crop, &win); } // subtract the transparent region and snap to the bounds Rect bounds = reduce(win, s.activeTransparentRegion); Rect frame(s.transform.transform(bounds)); frame.intersect(hw->getViewport(), &frame); const Transform& tr(hw->getTransform()); return Rect(tr.transform(frame)); } // --------------------------------------------------------------------------- // drawing... // --------------------------------------------------------------------------- Loading Loading @@ -1187,6 +1209,9 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const // need a hardware-protected path to external video sink usage |= GraphicBuffer::USAGE_PROTECTED; } if (mPotentialCursor) { usage |= GraphicBuffer::USAGE_CURSOR; } usage |= GraphicBuffer::USAGE_HW_COMPOSER; return usage; } Loading