Use LinearStdAllocator in DisplayList
bug:24300128
This removes most of the remaining calls to malloc when
recording DisplayLists.
Change-Id: If928bd53dac0f145aadc436a62759086b67da0ed
diff --git a/libs/hwui/OpReorderer.cpp b/libs/hwui/OpReorderer.cpp
index 7c34992..7c0e257 100644
--- a/libs/hwui/OpReorderer.cpp
+++ b/libs/hwui/OpReorderer.cpp
@@ -225,18 +225,17 @@
if (node->applyViewProperties(mCanvasState)) {
// not rejected do ops...
const DisplayList& displayList = node->getDisplayList();
- deferImpl(displayList.getChunks(), displayList.getOps());
+ deferImpl(displayList);
}
mCanvasState.restore();
}
}
-void OpReorderer::defer(int viewportWidth, int viewportHeight,
- const std::vector<DisplayList::Chunk>& chunks, const std::vector<RecordedOp*>& ops) {
+void OpReorderer::defer(int viewportWidth, int viewportHeight, const DisplayList& displayList) {
ATRACE_NAME("prepare drawing commands");
mCanvasState.initializeSaveStack(viewportWidth, viewportHeight,
0, 0, viewportWidth, viewportHeight, Vector3());
- deferImpl(chunks, ops);
+ deferImpl(displayList);
}
/**
@@ -247,14 +246,13 @@
*/
#define OP_RECIEVER(Type) \
[](OpReorderer& reorderer, const RecordedOp& op) { reorderer.on##Type(static_cast<const Type&>(op)); },
-void OpReorderer::deferImpl(const std::vector<DisplayList::Chunk>& chunks,
- const std::vector<RecordedOp*>& ops) {
+void OpReorderer::deferImpl(const DisplayList& displayList) {
static std::function<void(OpReorderer& reorderer, const RecordedOp&)> receivers[] = {
MAP_OPS(OP_RECIEVER)
};
- for (const DisplayList::Chunk& chunk : chunks) {
+ for (const DisplayList::Chunk& chunk : displayList.getChunks()) {
for (size_t opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
- const RecordedOp* op = ops[opIndex];
+ const RecordedOp* op = displayList.getOps()[opIndex];
receivers[op->opId](*this, *op);
}
}
@@ -288,8 +286,7 @@
// apply RenderProperties state
if (op.renderNode->applyViewProperties(mCanvasState)) {
// not rejected do ops...
- const DisplayList& displayList = op.renderNode->getDisplayList();
- deferImpl(displayList.getChunks(), displayList.getOps());
+ deferImpl(op.renderNode->getDisplayList());
}
mCanvasState.restore();
}