blob: 22e38aa4357f14ec19fefbfa397981fd2571a6e6 [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
26LayerBE::LayerBE(Layer* layer)
27 : mLayer(layer),
28 mMesh(Mesh::TRIANGLE_FAN, 4, 2, 2) {
29 compositionInfo.layer = this;
30}
31
32void LayerBE::onLayerDisplayed(const sp<Fence>& releaseFence) {
33 mLayer->onLayerDisplayed(releaseFence);
34}
35
36void CompositionInfo::dumpHwc(const char* tag) const {
37 ALOGV("[%s]\thwcLayer=%p", tag, static_cast<HWC2::Layer*>(*hwc.hwcLayer));
38 ALOGV("[%s]\tfence=%p", tag, hwc.fence.get());
39 ALOGV("[%s]\ttransform=%d", tag, hwc.transform);
40 ALOGV("[%s]\tz=%d", tag, hwc.z);
41 ALOGV("[%s]\ttype=%d", tag, hwc.type);
42 ALOGV("[%s]\tappId=%d", tag, hwc.appId);
43 ALOGV("[%s]\tdisplayFrame=%4d %4d %4d %4d", tag, hwc.displayFrame.left, hwc.displayFrame.top, hwc.displayFrame.right, hwc.displayFrame.bottom);
44 ALOGV("[%s]\talpha=%.3f", tag, hwc.alpha);
45 ALOGV("[%s]\tsourceCrop=%6.1f %6.1f %6.1f %6.1f", tag, hwc.sourceCrop.left, hwc.sourceCrop.top, hwc.sourceCrop.right, hwc.sourceCrop.bottom);
46
47 std::string label = tag;
48 label+=":visibleRegion";
49 hwc.visibleRegion.dump(label.c_str());
50 label = tag;
51 label+=":surfaceDamage";
52 hwc.surfaceDamage.dump(label.c_str());
53}
54
55void CompositionInfo::dumpRe(const char* tag) const {
56 ALOGV("[%s]\tblackoutLayer=%d", tag, re.blackoutLayer);
57 ALOGV("[%s]\tclearArea=%d", tag, re.clearArea);
58 ALOGV("[%s]\tpreMultipliedAlpha=%d", tag, re.preMultipliedAlpha);
59 ALOGV("[%s]\topaque=%d\n", tag, re.opaque);
60 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());
61 ALOGV("[%s]\tuseIdentityTransform=%d\n", tag, re.useIdentityTransform);
62}
63
64void CompositionInfo::dump(const char* tag) const {
65 ALOGV("[%s] CompositionInfo", tag);
66 ALOGV("[%s]\tLayerName: %s", tag, layerName.c_str());
67 ALOGV("[%s]\tCompositionType: %d", tag, compositionType);
68 ALOGV("[%s]\tmBuffer = %p", tag, mBuffer.get());
69 ALOGV("[%s]\tmBufferSlot=%d", tag, mBufferSlot);
70 switch (compositionType) {
71 case HWC2::Composition::Device:
72 dumpHwc(tag);
73 break;
74 case HWC2::Composition::Client:
75 dumpRe(tag);
76 default:
77 break;
78 }
79}
80
81}; // namespace android