Remove dead code

Remove an old protobuf serialization experiement, skp capture
does this better

Test: builds

Change-Id: Icd875eabee6b517729f901841e48e579d0e8de4d
This commit is contained in:
John Reck
2018-04-09 09:41:29 -07:00
parent 325f7284d9
commit 617673f83f
13 changed files with 0 additions and 282 deletions

View File

@@ -907,10 +907,6 @@ public final class ThreadedRenderer {
animator.getAnimatorNativePtr());
}
public void serializeDisplayListTree() {
nSerializeDisplayListTree(mNativeProxy);
}
public static int copySurfaceInto(Surface surface, Rect srcRect, Bitmap bitmap) {
if (srcRect == null) {
// Empty rect means entire surface
@@ -1202,8 +1198,6 @@ public final class ThreadedRenderer {
private static native void nStopDrawing(long nativeProxy);
private static native void nNotifyFramePending(long nativeProxy);
private static native void nSerializeDisplayListTree(long nativeProxy);
private static native void nDumpProfileInfo(long nativeProxy, FileDescriptor fd,
@DumpFlags int dumpFlags);

View File

@@ -2961,9 +2961,6 @@ public final class ViewRootImpl implements ViewParent,
*/
void outputDisplayList(View view) {
view.mRenderNode.output();
if (mAttachInfo.mThreadedRenderer != null) {
mAttachInfo.mThreadedRenderer.serializeDisplayListTree();
}
}
/**

View File

@@ -813,12 +813,6 @@ static void android_view_ThreadedRenderer_notifyFramePending(JNIEnv* env, jobjec
proxy->notifyFramePending();
}
static void android_view_ThreadedRenderer_serializeDisplayListTree(JNIEnv* env, jobject clazz,
jlong proxyPtr) {
RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
proxy->serializeDisplayListTree();
}
static void android_view_ThreadedRenderer_dumpProfileInfo(JNIEnv* env, jobject clazz,
jlong proxyPtr, jobject javaFileDescriptor, jint dumpFlags) {
RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
@@ -1081,7 +1075,6 @@ static const JNINativeMethod gMethods[] = {
{ "nFence", "(J)V", (void*) android_view_ThreadedRenderer_fence },
{ "nStopDrawing", "(J)V", (void*) android_view_ThreadedRenderer_stopDrawing },
{ "nNotifyFramePending", "(J)V", (void*) android_view_ThreadedRenderer_notifyFramePending },
{ "nSerializeDisplayListTree", "(J)V", (void*) android_view_ThreadedRenderer_serializeDisplayListTree },
{ "nDumpProfileInfo", "(JLjava/io/FileDescriptor;I)V", (void*) android_view_ThreadedRenderer_dumpProfileInfo },
{ "setupShadersDiskCache", "(Ljava/lang/String;Ljava/lang/String;)V",
(void*) android_view_ThreadedRenderer_setupShadersDiskCache },

View File

@@ -269,13 +269,8 @@ cc_defaults {
"TextureCache.cpp",
"VectorDrawable.cpp",
"VkLayer.cpp",
"protos/hwui.proto",
],
proto: {
export_proto_headers: true,
},
export_include_dirs: ["."],
export_shared_lib_headers: ["libRScpp"],
}

View File

@@ -29,9 +29,6 @@
#include "utils/StringUtils.h"
#include "utils/TraceUtils.h"
#include "protos/ProtoHelpers.h"
#include "protos/hwui.pb.h"
#include <SkPathOps.h>
#include <algorithm>
#include <sstream>
@@ -101,77 +98,6 @@ void RenderNode::output(std::ostream& output, uint32_t level) {
output << std::endl;
}
void RenderNode::copyTo(proto::RenderNode* pnode) {
pnode->set_id(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(this)));
pnode->set_name(mName.string(), mName.length());
proto::RenderProperties* pprops = pnode->mutable_properties();
pprops->set_left(properties().getLeft());
pprops->set_top(properties().getTop());
pprops->set_right(properties().getRight());
pprops->set_bottom(properties().getBottom());
pprops->set_clip_flags(properties().getClippingFlags());
pprops->set_alpha(properties().getAlpha());
pprops->set_translation_x(properties().getTranslationX());
pprops->set_translation_y(properties().getTranslationY());
pprops->set_translation_z(properties().getTranslationZ());
pprops->set_elevation(properties().getElevation());
pprops->set_rotation(properties().getRotation());
pprops->set_rotation_x(properties().getRotationX());
pprops->set_rotation_y(properties().getRotationY());
pprops->set_scale_x(properties().getScaleX());
pprops->set_scale_y(properties().getScaleY());
pprops->set_pivot_x(properties().getPivotX());
pprops->set_pivot_y(properties().getPivotY());
pprops->set_has_overlapping_rendering(properties().getHasOverlappingRendering());
pprops->set_pivot_explicitly_set(properties().isPivotExplicitlySet());
pprops->set_project_backwards(properties().getProjectBackwards());
pprops->set_projection_receiver(properties().isProjectionReceiver());
set(pprops->mutable_clip_bounds(), properties().getClipBounds());
const Outline& outline = properties().getOutline();
if (outline.getType() != Outline::Type::None) {
proto::Outline* poutline = pprops->mutable_outline();
poutline->clear_path();
if (outline.getType() == Outline::Type::Empty) {
poutline->set_type(proto::Outline_Type_Empty);
} else if (outline.getType() == Outline::Type::ConvexPath) {
poutline->set_type(proto::Outline_Type_ConvexPath);
if (const SkPath* path = outline.getPath()) {
set(poutline->mutable_path(), *path);
}
} else if (outline.getType() == Outline::Type::RoundRect) {
poutline->set_type(proto::Outline_Type_RoundRect);
} else {
ALOGW("Uknown outline type! %d", static_cast<int>(outline.getType()));
poutline->set_type(proto::Outline_Type_None);
}
poutline->set_should_clip(outline.getShouldClip());
poutline->set_alpha(outline.getAlpha());
poutline->set_radius(outline.getRadius());
set(poutline->mutable_bounds(), outline.getBounds());
} else {
pprops->clear_outline();
}
const RevealClip& revealClip = properties().getRevealClip();
if (revealClip.willClip()) {
proto::RevealClip* prevealClip = pprops->mutable_reveal_clip();
prevealClip->set_x(revealClip.getX());
prevealClip->set_y(revealClip.getY());
prevealClip->set_radius(revealClip.getRadius());
} else {
pprops->clear_reveal_clip();
}
pnode->clear_children();
if (mDisplayList) {
for (auto&& child : mDisplayList->getChildren()) {
child->renderNode->copyTo(pnode->add_children());
}
}
}
int RenderNode::getDebugSize() {
int size = sizeof(RenderNode);
if (mStagingDisplayList) {

View File

@@ -108,7 +108,6 @@ public:
ANDROID_API void output();
ANDROID_API int getDebugSize();
void copyTo(proto::RenderNode* node);
bool isRenderable() const { return mDisplayList && !mDisplayList->isEmpty(); }

View File

@@ -1,41 +0,0 @@
/*
* Copyright (C) 2015 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.
*/
#ifndef PROTOHELPERS_H
#define PROTOHELPERS_H
#include "Rect.h"
#include "protos/hwui.pb.h"
namespace android {
namespace uirenderer {
void set(proto::RectF* dest, const Rect& src) {
dest->set_left(src.left);
dest->set_top(src.top);
dest->set_right(src.right);
dest->set_bottom(src.bottom);
}
void set(std::string* dest, const SkPath& src) {
size_t size = src.writeToMemory(nullptr);
dest->resize(size);
src.writeToMemory(&*dest->begin());
}
} // namespace uirenderer
} // namespace android
#endif // PROTOHELPERS_H

View File

@@ -1,99 +0,0 @@
/*
* Copyright (C) 2015 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.
*/
syntax = "proto2";
package android.uirenderer.proto;
option optimize_for = LITE_RUNTIME;
message RenderNode {
required uint64 id = 1;
required string name = 2;
required RenderProperties properties = 3;
optional DisplayList display_list = 4;
repeated RenderNode children = 5;
};
message RenderProperties {
required int32 left = 1;
required int32 right = 2;
required int32 top = 3;
required int32 bottom = 4;
required int32 clip_flags = 5;
required float alpha = 6;
required float translation_x = 7;
required float translation_y = 8;
required float translation_z = 9;
required float elevation = 10;
required float rotation = 11;
required float rotation_x = 12;
required float rotation_y = 13;
required float scale_x = 14;
required float scale_y = 15;
required float pivot_x = 16;
required float pivot_y = 17;
required bool has_overlapping_rendering = 18;
required bool pivot_explicitly_set = 19;
required bool project_backwards = 20;
required bool projection_receiver = 21;
required RectF clip_bounds = 22;
optional Outline outline = 23;
optional RevealClip reveal_clip = 24;
};
message RectF {
required float left = 1;
required float right = 2;
required float top = 3;
required float bottom = 4;
}
message Outline {
required bool should_clip = 1;
enum Type {
None = 0;
Empty = 1;
ConvexPath = 2;
RoundRect = 3;
}
required Type type = 2;
required RectF bounds = 3;
required float radius = 4;
required float alpha = 5;
optional bytes path = 6;
}
message RevealClip {
required float x = 1;
required float y = 2;
required float radius = 3;
}
message DisplayList {
optional int32 projection_receive_index = 1;
repeated DrawOp draw_ops = 2;
}
message DrawOp {
oneof drawop {
DrawOp_RenderNode render_node = 1;
}
}
message DrawOp_RenderNode {
optional RenderNode node = 1;
}

View File

@@ -29,7 +29,6 @@
#include "pipeline/skia/SkiaOpenGLPipeline.h"
#include "pipeline/skia/SkiaPipeline.h"
#include "pipeline/skia/SkiaVulkanPipeline.h"
#include "protos/hwui.pb.h"
#include "renderstate/RenderState.h"
#include "renderstate/Stencil.h"
#include "utils/GLUtils.h"
@@ -37,7 +36,6 @@
#include "../Properties.h"
#include <cutils/properties.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <private/hwui/DrawGlInfo.h>
#include <strings.h>
@@ -50,8 +48,6 @@
#define TRIM_MEMORY_COMPLETE 80
#define TRIM_MEMORY_UI_HIDDEN 20
#define ENABLE_RENDERNODE_SERIALIZATION false
#define LOG_FRAMETIME_MMA 0
#if LOG_FRAMETIME_MMA
@@ -633,39 +629,6 @@ void CanvasContext::setName(const std::string&& name) {
mJankTracker.setDescription(JankTrackerType::Window, std::move(name));
}
void CanvasContext::serializeDisplayListTree() {
#if ENABLE_RENDERNODE_SERIALIZATION
using namespace google::protobuf::io;
char package[128];
// Check whether tracing is enabled for this process.
FILE* file = fopen("/proc/self/cmdline", "r");
if (file) {
if (!fgets(package, 128, file)) {
ALOGE("Error reading cmdline: %s (%d)", strerror(errno), errno);
fclose(file);
return;
}
fclose(file);
} else {
ALOGE("Error opening /proc/self/cmdline: %s (%d)", strerror(errno), errno);
return;
}
char path[1024];
snprintf(path, 1024, "/data/data/%s/cache/rendertree_dump", package);
int fd = open(path, O_CREAT | O_WRONLY, S_IRWXU | S_IRGRP | S_IROTH);
if (fd == -1) {
ALOGD("Failed to open '%s'", path);
return;
}
proto::RenderNode tree;
// TODO: Streaming writes?
mRootRenderNode->copyTo(&tree);
std::string data = tree.SerializeAsString();
write(fd, data.c_str(), data.length());
close(fd);
#endif
}
void CanvasContext::waitOnFences() {
if (mFrameFences.size()) {
ATRACE_CALL();

View File

@@ -155,8 +155,6 @@ public:
void setName(const std::string&& name);
void serializeDisplayListTree();
void addRenderNode(RenderNode* node, bool placeFront);
void removeRenderNode(RenderNode* node);

View File

@@ -274,10 +274,6 @@ void RenderProxy::setFrameCallback(std::function<void(int64_t)>&& callback) {
mDrawFrameTask.setFrameCallback(std::move(callback));
}
void RenderProxy::serializeDisplayListTree() {
mRenderThread.queue().post([=]() { mContext->serializeDisplayListTree(); });
}
void RenderProxy::addFrameMetricsObserver(FrameMetricsObserver* observerPtr) {
mRenderThread.queue().post([ this, observer = sp{observerPtr} ]() {
mContext->addFrameMetricsObserver(observer.get());

View File

@@ -109,8 +109,6 @@ public:
ANDROID_API static void setProcessStatsBuffer(int fd);
ANDROID_API int getRenderThreadTid();
ANDROID_API void serializeDisplayListTree();
ANDROID_API void addRenderNode(RenderNode* node, bool placeFront);
ANDROID_API void removeRenderNode(RenderNode* node);
ANDROID_API void drawRenderNode(RenderNode* node);

View File

@@ -19,7 +19,6 @@
#include "Properties.h"
#include "hwui/Typeface.h"
#include "protos/hwui.pb.h"
#include <benchmark/benchmark.h>
#include <getopt.h>