blob: eea4ebda5963ccd609c9142e815040dd569b9171 [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) {
29 compositionInfo.layer = this;
David Sodman2b727ac2017-12-21 14:28:08 -080030 compositionInfo.layerName = layerName;
David Sodmanb8af7922017-12-21 15:17:55 -080031}
32
33void LayerBE::onLayerDisplayed(const sp<Fence>& releaseFence) {
34 mLayer->onLayerDisplayed(releaseFence);
35}
36
37void CompositionInfo::dumpHwc(const char* tag) const {
David Sodmanb8aaea12017-12-14 15:54:51 -080038 ALOGV("[%s]\thwcLayer=%p", tag, hwc.hwcLayer.get());
David Sodmanb8af7922017-12-21 15:17:55 -080039 ALOGV("[%s]\tfence=%p", tag, hwc.fence.get());
40 ALOGV("[%s]\ttransform=%d", tag, hwc.transform);
41 ALOGV("[%s]\tz=%d", tag, hwc.z);
42 ALOGV("[%s]\ttype=%d", tag, hwc.type);
43 ALOGV("[%s]\tappId=%d", tag, hwc.appId);
44 ALOGV("[%s]\tdisplayFrame=%4d %4d %4d %4d", tag, hwc.displayFrame.left, hwc.displayFrame.top, hwc.displayFrame.right, hwc.displayFrame.bottom);
45 ALOGV("[%s]\talpha=%.3f", tag, hwc.alpha);
46 ALOGV("[%s]\tsourceCrop=%6.1f %6.1f %6.1f %6.1f", tag, hwc.sourceCrop.left, hwc.sourceCrop.top, hwc.sourceCrop.right, hwc.sourceCrop.bottom);
47
48 std::string label = tag;
49 label+=":visibleRegion";
50 hwc.visibleRegion.dump(label.c_str());
51 label = tag;
52 label+=":surfaceDamage";
53 hwc.surfaceDamage.dump(label.c_str());
54}
55
56void CompositionInfo::dumpRe(const char* tag) const {
57 ALOGV("[%s]\tblackoutLayer=%d", tag, re.blackoutLayer);
58 ALOGV("[%s]\tclearArea=%d", tag, re.clearArea);
59 ALOGV("[%s]\tpreMultipliedAlpha=%d", tag, re.preMultipliedAlpha);
David Sodmanca10ed22018-04-16 14:10:25 -070060 ALOGV("[%s]\topaque=%d", tag, re.opaque);
61 ALOGV("[%s]\tdisableTexture=%d", tag, re.disableTexture);
David Sodmanb8af7922017-12-21 15:17:55 -080062 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());
63 ALOGV("[%s]\tuseIdentityTransform=%d\n", tag, re.useIdentityTransform);
64}
65
66void CompositionInfo::dump(const char* tag) const {
67 ALOGV("[%s] CompositionInfo", tag);
68 ALOGV("[%s]\tLayerName: %s", tag, layerName.c_str());
69 ALOGV("[%s]\tCompositionType: %d", tag, compositionType);
70 ALOGV("[%s]\tmBuffer = %p", tag, mBuffer.get());
71 ALOGV("[%s]\tmBufferSlot=%d", tag, mBufferSlot);
72 switch (compositionType) {
73 case HWC2::Composition::Device:
74 dumpHwc(tag);
75 break;
76 case HWC2::Composition::Client:
77 dumpRe(tag);
78 default:
79 break;
80 }
81}
82
83}; // namespace android