blob: b936b3f6a94d847fd437026e466730b933264def [file] [log] [blame]
David Sodmanb8af7922017-12-21 15:17:55 -08001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_NDEBUG 0
18#undef LOG_TAG
19#define LOG_TAG "LayerBE"
20#define ATRACE_TAG ATRACE_TAG_GRAPHICS
21
22#include "Layer.h"
23
24namespace android {
25
David Sodman2b727ac2017-12-21 14:28:08 -080026LayerBE::LayerBE(Layer* layer, std::string layerName)
David Sodmanb8af7922017-12-21 15:17:55 -080027 : mLayer(layer),
28 mMesh(Mesh::TRIANGLE_FAN, 4, 2, 2) {
David Sodman40a3a5a2018-05-16 11:55:52 -070029 compositionInfo.layer = std::make_shared<LayerBE>(*this);
David Sodman2b727ac2017-12-21 14:28:08 -080030 compositionInfo.layerName = layerName;
David Sodmanb8af7922017-12-21 15:17:55 -080031}
32
David Sodman40a3a5a2018-05-16 11:55:52 -070033LayerBE::LayerBE(const LayerBE& layer)
34 : mLayer(layer.mLayer),
35 mMesh(Mesh::TRIANGLE_FAN, 4, 2, 2) {
36 compositionInfo.layer = layer.compositionInfo.layer;
37 compositionInfo.layerName = layer.mLayer->getName().string();
38}
39
David Sodmanb8af7922017-12-21 15:17:55 -080040void LayerBE::onLayerDisplayed(const sp<Fence>& releaseFence) {
41 mLayer->onLayerDisplayed(releaseFence);
42}
43
44void CompositionInfo::dumpHwc(const char* tag) const {
David Sodmanb8aaea12017-12-14 15:54:51 -080045 ALOGV("[%s]\thwcLayer=%p", tag, hwc.hwcLayer.get());
David Sodmanb8af7922017-12-21 15:17:55 -080046 ALOGV("[%s]\tfence=%p", tag, hwc.fence.get());
47 ALOGV("[%s]\ttransform=%d", tag, hwc.transform);
48 ALOGV("[%s]\tz=%d", tag, hwc.z);
49 ALOGV("[%s]\ttype=%d", tag, hwc.type);
50 ALOGV("[%s]\tappId=%d", tag, hwc.appId);
51 ALOGV("[%s]\tdisplayFrame=%4d %4d %4d %4d", tag, hwc.displayFrame.left, hwc.displayFrame.top, hwc.displayFrame.right, hwc.displayFrame.bottom);
52 ALOGV("[%s]\talpha=%.3f", tag, hwc.alpha);
53 ALOGV("[%s]\tsourceCrop=%6.1f %6.1f %6.1f %6.1f", tag, hwc.sourceCrop.left, hwc.sourceCrop.top, hwc.sourceCrop.right, hwc.sourceCrop.bottom);
54
55 std::string label = tag;
56 label+=":visibleRegion";
57 hwc.visibleRegion.dump(label.c_str());
58 label = tag;
59 label+=":surfaceDamage";
60 hwc.surfaceDamage.dump(label.c_str());
61}
62
63void CompositionInfo::dumpRe(const char* tag) const {
64 ALOGV("[%s]\tblackoutLayer=%d", tag, re.blackoutLayer);
65 ALOGV("[%s]\tclearArea=%d", tag, re.clearArea);
66 ALOGV("[%s]\tpreMultipliedAlpha=%d", tag, re.preMultipliedAlpha);
David Sodmanca10ed22018-04-16 14:10:25 -070067 ALOGV("[%s]\topaque=%d", tag, re.opaque);
68 ALOGV("[%s]\tdisableTexture=%d", tag, re.disableTexture);
David Sodmanb8af7922017-12-21 15:17:55 -080069 ALOGV("[%s]\ttexture:name(%d), target(%d), size(%d/%d)", tag, re.texture.getTextureName(), re.texture.getTextureTarget(), (unsigned int)re.texture.getWidth(), (unsigned int)re.texture.getHeight());
70 ALOGV("[%s]\tuseIdentityTransform=%d\n", tag, re.useIdentityTransform);
71}
72
73void CompositionInfo::dump(const char* tag) const {
74 ALOGV("[%s] CompositionInfo", tag);
75 ALOGV("[%s]\tLayerName: %s", tag, layerName.c_str());
76 ALOGV("[%s]\tCompositionType: %d", tag, compositionType);
77 ALOGV("[%s]\tmBuffer = %p", tag, mBuffer.get());
78 ALOGV("[%s]\tmBufferSlot=%d", tag, mBufferSlot);
79 switch (compositionType) {
80 case HWC2::Composition::Device:
81 dumpHwc(tag);
82 break;
83 case HWC2::Composition::Client:
84 dumpRe(tag);
85 default:
86 break;
87 }
88}
89
90}; // namespace android