Add debug logs for display lists.
Change-Id: I7bae8fd96e9eccb51f29f73e4069b4d3e6bdbdd7
This commit is contained in:
@@ -47,4 +47,7 @@
|
||||
// Turn on to display debug info about the layer renderer
|
||||
#define DEBUG_LAYER_RENDERER 0
|
||||
|
||||
// Turn on to dump display list state
|
||||
#define DEBUG_DISPLAY_LIST 0
|
||||
|
||||
#endif // ANDROID_HWUI_DEBUG_H
|
||||
|
||||
@@ -81,6 +81,39 @@ void PathHeap::flatten(SkFlattenableWriteBuffer& buffer) const {
|
||||
// Display list
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char* DisplayList::OP_NAMES[] = {
|
||||
"AcquireContext",
|
||||
"ReleaseContext",
|
||||
"Save",
|
||||
"Restore",
|
||||
"RestoreToCount",
|
||||
"SaveLayer",
|
||||
"SaveLayerAlpha",
|
||||
"Translate",
|
||||
"Rotate",
|
||||
"Scale",
|
||||
"SetMatrix",
|
||||
"ConcatMatrix",
|
||||
"ClipRect",
|
||||
"DrawDisplayList",
|
||||
"DrawLayer",
|
||||
"DrawBitmap",
|
||||
"DrawBitmapMatrix",
|
||||
"DrawBitmapRect",
|
||||
"DrawPatch",
|
||||
"DrawColor",
|
||||
"DrawRect",
|
||||
"DrawPath",
|
||||
"DrawLines",
|
||||
"DrawText",
|
||||
"ResetShader",
|
||||
"SetupShader",
|
||||
"ResetColorFilter",
|
||||
"SetupColorFilter",
|
||||
"ResetShadow",
|
||||
"SetupShadow"
|
||||
};
|
||||
|
||||
DisplayList::DisplayList(const DisplayListRenderer& recorder) {
|
||||
initFromDisplayListRenderer(recorder);
|
||||
}
|
||||
@@ -173,14 +206,25 @@ void DisplayList::init() {
|
||||
mPathHeap = NULL;
|
||||
}
|
||||
|
||||
void DisplayList::replay(OpenGLRenderer& renderer) {
|
||||
void DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) {
|
||||
TextContainer text;
|
||||
mReader.rewind();
|
||||
|
||||
int saveCount = renderer.getSaveCount() - 1;
|
||||
#if DEBUG_DISPLAY_LIST
|
||||
uint32_t count = (level + 1) * 2;
|
||||
char indent[count + 1];
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
indent[i] = ' ';
|
||||
}
|
||||
indent[count] = '\0';
|
||||
DISPLAY_LIST_LOGD("%sStart display list (%p)", (char*) indent + 2, this);
|
||||
#endif
|
||||
|
||||
int saveCount = renderer.getSaveCount() - 1;
|
||||
while (!mReader.eof()) {
|
||||
int op = mReader.readInt();
|
||||
DISPLAY_LIST_LOGD("%s%s", (char*) indent, OP_NAMES[op]);
|
||||
|
||||
switch (op) {
|
||||
case AcquireContext: {
|
||||
renderer.acquireContext();
|
||||
@@ -238,7 +282,7 @@ void DisplayList::replay(OpenGLRenderer& renderer) {
|
||||
}
|
||||
break;
|
||||
case DrawDisplayList: {
|
||||
renderer.drawDisplayList(getDisplayList());
|
||||
renderer.drawDisplayList(getDisplayList(), level + 1);
|
||||
}
|
||||
break;
|
||||
case DrawLayer: {
|
||||
@@ -326,6 +370,8 @@ void DisplayList::replay(OpenGLRenderer& renderer) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DISPLAY_LIST_LOGD("%sDone", (char*) indent + 2);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -482,7 +528,7 @@ bool DisplayListRenderer::clipRect(float left, float top, float right, float bot
|
||||
return OpenGLRenderer::clipRect(left, top, right, bottom, op);
|
||||
}
|
||||
|
||||
void DisplayListRenderer::drawDisplayList(DisplayList* displayList) {
|
||||
void DisplayListRenderer::drawDisplayList(DisplayList* displayList, uint32_t level) {
|
||||
addOp(DisplayList::DrawDisplayList);
|
||||
addDisplayList(displayList);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,13 @@ namespace uirenderer {
|
||||
#define MIN_WRITER_SIZE 16384
|
||||
#define HEAP_BLOCK_SIZE 4096
|
||||
|
||||
// Debug
|
||||
#if DEBUG_DISPLAY_LIST
|
||||
#define DISPLAY_LIST_LOGD(...) LOGD(__VA_ARGS__)
|
||||
#else
|
||||
#define DISPLAY_LIST_LOGD(...)
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -78,8 +85,10 @@ public:
|
||||
DisplayList(const DisplayListRenderer& recorder);
|
||||
~DisplayList();
|
||||
|
||||
// IMPORTANT: Update the intialization of OP_NAMES in the .cpp file
|
||||
// when modifying this file
|
||||
enum Op {
|
||||
AcquireContext,
|
||||
AcquireContext = 0,
|
||||
ReleaseContext,
|
||||
Save,
|
||||
Restore,
|
||||
@@ -108,12 +117,14 @@ public:
|
||||
ResetColorFilter,
|
||||
SetupColorFilter,
|
||||
ResetShadow,
|
||||
SetupShadow
|
||||
SetupShadow,
|
||||
};
|
||||
|
||||
static const char* OP_NAMES[];
|
||||
|
||||
void initFromDisplayListRenderer(const DisplayListRenderer& recorder);
|
||||
|
||||
void replay(OpenGLRenderer& renderer);
|
||||
void replay(OpenGLRenderer& renderer, uint32_t level = 0);
|
||||
|
||||
private:
|
||||
void init();
|
||||
@@ -245,7 +256,7 @@ public:
|
||||
|
||||
bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
|
||||
|
||||
void drawDisplayList(DisplayList* displayList);
|
||||
void drawDisplayList(DisplayList* displayList, uint32_t level = 0);
|
||||
void drawLayer(Layer* layer, float x, float y, SkPaint* paint);
|
||||
void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
|
||||
void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
|
||||
|
||||
@@ -48,7 +48,7 @@ int OpenGLDebugRenderer::saveLayer(float left, float top, float right, float bot
|
||||
return OpenGLRenderer::saveLayer(left, top, right, bottom, p, flags);
|
||||
}
|
||||
|
||||
void OpenGLDebugRenderer::drawDisplayList(DisplayList* displayList) {
|
||||
void OpenGLDebugRenderer::drawDisplayList(DisplayList* displayList, uint32_t level) {
|
||||
mPrimitivesCount++;
|
||||
StopWatch w("drawDisplayList");
|
||||
OpenGLRenderer::drawDisplayList(displayList);
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
int saveLayer(float left, float top, float right, float bottom,
|
||||
SkPaint* p, int flags);
|
||||
|
||||
void drawDisplayList(DisplayList* displayList);
|
||||
void drawDisplayList(DisplayList* displayList, uint32_t level = 0);
|
||||
void drawLayer(Layer* layer, float x, float y, SkPaint* paint);
|
||||
void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
|
||||
void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
|
||||
|
||||
@@ -569,6 +569,9 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) {
|
||||
composeLayerRect(layer, rect, true);
|
||||
}
|
||||
|
||||
drawColorRect(rect.left, rect.top, rect.right, rect.bottom, 0x7fff0000,
|
||||
SkXfermode::kSrcOver_Mode, true);
|
||||
|
||||
if (fboLayer) {
|
||||
// Detach the texture from the FBO
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, current->fbo);
|
||||
@@ -1024,11 +1027,11 @@ void OpenGLRenderer::finishDrawTexture() {
|
||||
// Drawing
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void OpenGLRenderer::drawDisplayList(DisplayList* displayList) {
|
||||
void OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t level) {
|
||||
// All the usual checks and setup operations (quickReject, setupDraw, etc.)
|
||||
// will be performed by the display list itself
|
||||
if (displayList) {
|
||||
displayList->replay(*this);
|
||||
displayList->replay(*this, level);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
bool quickReject(float left, float top, float right, float bottom);
|
||||
virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
|
||||
|
||||
virtual void drawDisplayList(DisplayList* displayList);
|
||||
virtual void drawDisplayList(DisplayList* displayList, uint32_t level = 0);
|
||||
virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint);
|
||||
virtual void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
|
||||
virtual void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
|
||||
|
||||
Reference in New Issue
Block a user