Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91eff22b authored by Chris Craik's avatar Chris Craik
Browse files

Support op dumping in new pipeline

bug:26565102

Change-Id: I266e420a2f18ba9ad62942b8a0de295dfa3a2a88
parent eabebc15
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ ifeq (true, $(HWUI_NEW_OPS))
        BakedOpState.cpp \
        FrameBuilder.cpp \
        LayerBuilder.cpp \
        OpDumper.cpp \
        RecordingCanvas.cpp

    hwui_cflags += -DHWUI_NEW_OPS
@@ -253,6 +254,7 @@ ifeq (true, $(HWUI_NEW_OPS))
        tests/unit/BakedOpStateTests.cpp \
        tests/unit/FrameBuilderTests.cpp \
        tests/unit/LeakCheckTests.cpp \
        tests/unit/OpDumperTests.cpp \
        tests/unit/RecordingCanvasTests.cpp
endif

+21 −6
Original line number Diff line number Diff line
@@ -14,14 +14,14 @@
 * limitations under the License.
 */

#ifndef ANDROID_HWUI_MATRIX_H
#define ANDROID_HWUI_MATRIX_H
#pragma once

#include <SkMatrix.h>
#include "Rect.h"

#include <cutils/compiler.h>

#include "Rect.h"
#include <iomanip>
#include <ostream>
#include <SkMatrix.h>

namespace android {
namespace uirenderer {
@@ -218,6 +218,22 @@ public:

    void dump(const char* label = nullptr) const;

    friend std::ostream& operator<<(std::ostream& os, const Matrix4& matrix) {
        if (matrix.isSimple()) {
            os << "offset " << matrix.getTranslateX() << "x" << matrix.getTranslateY();
            if (!matrix.isPureTranslate()) {
                os << ", scale " << matrix[kScaleX] << "x" << matrix[kScaleY];
            }
        } else {
            os << "[" << matrix[0];
            for (int i = 1; i < 16; i++) {
                os << ", " << matrix[i];
            }
            os << "]";
        }
        return os;
    }

    static const Matrix4& identity();

private:
@@ -244,4 +260,3 @@ typedef Matrix4 mat4;
}; // namespace uirenderer
}; // namespace android
#endif // ANDROID_HWUI_MATRIX_H

libs/hwui/OpDumper.cpp

0 → 100644
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "OpDumper.h"

#include "RecordedOp.h"

namespace android {
namespace uirenderer {

#define STRINGIFY(n) #n,
static const char* sOpNameLut[] = BUILD_FULL_OP_LUT(STRINGIFY);

void OpDumper::dump(const RecordedOp& op, std::ostream& output, int level) {
    for (int i = 0; i < level; i++) {
        output << "  ";
    }

    Rect localBounds(op.unmappedBounds);
    op.localMatrix.mapRect(localBounds);
    output << sOpNameLut[op.opId] << " " << localBounds;

    if (op.localClip && !op.localClip->rect.contains(localBounds)) {
        output << std::fixed << std::setprecision(0)
             << " clip=" << op.localClip->rect
             << " mode=" << (int)op.localClip->mode;
    }
}

} // namespace uirenderer
} // namespace android

libs/hwui/OpDumper.h

0 → 100644
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <ostream>

namespace android {
namespace uirenderer {

struct RecordedOp;

class OpDumper {
public:
    static void dump(const RecordedOp& op, std::ostream& output, int level = 0);
};

}; // namespace uirenderer
}; // namespace android
+3 −0
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@ class Tree;
#define BUILD_RENDERABLE_OP_LUT(OP_FN) \
        { MAP_OPS_BASED_ON_TYPE(NULLPTR_OP_FN, OP_FN, OP_FN, OP_FN) }

#define BUILD_FULL_OP_LUT(OP_FN) \
        { MAP_OPS_BASED_ON_TYPE(OP_FN, OP_FN, OP_FN, OP_FN) }

/**
 * Op mapping functions, which skip unsupported ops.
 *
Loading