Use renderengine::drawLayers api everywhere.
There's some dead code left after this change, which I'll circle around
to removing in the future.
Bug: 118461793
Bug: 123496360
Change-Id: Ic631b0c452f67b353adaa63896e8cd080e391647
Test: librenderengine_test
Test: SurfaceFlinger_test
Test: libsurfaceflinger_unittest
Test: notch hide
Test: screen rotations
Test: photos
Test: adb screencap
Test: adb screenrecord
Test: simulate virtual displays (incl. secure overlays)
Test: go/wm-smoke with gpu composition forced
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index d30961a..b9dc8d5 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -413,11 +413,9 @@
virtual Rect getCrop(const Layer::State& s) const { return s.crop_legacy; }
protected:
- /*
- * onDraw - draws the surface.
- */
- virtual void onDraw(const RenderArea& renderArea, const Region& clip,
- bool useIdentityTransform) = 0;
+ virtual bool prepareClientLayer(const RenderArea& renderArea, const Region& clip,
+ bool useIdentityTransform, Region& clearRegion,
+ renderengine::LayerSettings& layer) = 0;
public:
virtual void setDefaultBufferSize(uint32_t /*w*/, uint32_t /*h*/) {}
@@ -466,13 +464,15 @@
// If a buffer was replaced this frame, release the former buffer
virtual void releasePendingBuffer(nsecs_t /*dequeueReadyTime*/) { }
-
/*
- * draw - performs some global clipping optimizations
- * and calls onDraw().
+ * prepareClientLayer - populates a renderengine::LayerSettings to passed to
+ * RenderEngine::drawLayers. Returns true if the layer can be used, and
+ * false otherwise.
*/
- void draw(const RenderArea& renderArea, const Region& clip);
- void draw(const RenderArea& renderArea, bool useIdentityTransform);
+ bool prepareClientLayer(const RenderArea& renderArea, const Region& clip, Region& clearRegion,
+ renderengine::LayerSettings& layer);
+ bool prepareClientLayer(const RenderArea& renderArea, bool useIdentityTransform,
+ Region& clearRegion, renderengine::LayerSettings& layer);
/*
* doTransaction - process the transaction. This is a good place to figure
@@ -803,7 +803,13 @@
FenceTimeline mReleaseTimeline;
// main thread
+ // Active buffer fields
sp<GraphicBuffer> mActiveBuffer;
+ sp<Fence> mActiveBufferFence;
+ // False if the buffer and its contents have been previously used for GPU
+ // composition, true otherwise.
+ bool mIsActiveBufferUpdatedForGpu = true;
+
ui::Dataspace mCurrentDataSpace = ui::Dataspace::UNKNOWN;
Rect mCurrentCrop;
uint32_t mCurrentTransform{0};
@@ -857,7 +863,6 @@
const LayerVector::Visitor& visitor);
LayerVector makeChildrenTraversalList(LayerVector::StateSet stateSet,
const std::vector<Layer*>& layersInTree);
-
/**
* Retuns the child bounds in layer space cropped to its bounds as well all its parent bounds.
* The cropped bounds must be transformed back from parent layer space to child layer space by