| David Sodman | b8af792 | 2017-12-21 15:17:55 -0800 | [diff] [blame] | 1 | /* | 
|  | 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 |  | 
|  | 24 | namespace android { | 
|  | 25 |  | 
| David Sodman | 2b727ac | 2017-12-21 14:28:08 -0800 | [diff] [blame] | 26 | LayerBE::LayerBE(Layer* layer, std::string layerName) | 
| David Sodman | b8af792 | 2017-12-21 15:17:55 -0800 | [diff] [blame] | 27 | : mLayer(layer), | 
|  | 28 | mMesh(Mesh::TRIANGLE_FAN, 4, 2, 2) { | 
| David Sodman | 40a3a5a | 2018-05-16 11:55:52 -0700 | [diff] [blame] | 29 | compositionInfo.layer = std::make_shared<LayerBE>(*this); | 
| David Sodman | 2b727ac | 2017-12-21 14:28:08 -0800 | [diff] [blame] | 30 | compositionInfo.layerName = layerName; | 
| David Sodman | b8af792 | 2017-12-21 15:17:55 -0800 | [diff] [blame] | 31 | } | 
|  | 32 |  | 
| David Sodman | 40a3a5a | 2018-05-16 11:55:52 -0700 | [diff] [blame] | 33 | LayerBE::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 Sodman | b8af792 | 2017-12-21 15:17:55 -0800 | [diff] [blame] | 40 | void LayerBE::onLayerDisplayed(const sp<Fence>& releaseFence) { | 
|  | 41 | mLayer->onLayerDisplayed(releaseFence); | 
|  | 42 | } | 
|  | 43 |  | 
|  | 44 | void CompositionInfo::dumpHwc(const char* tag) const { | 
| David Sodman | b8aaea1 | 2017-12-14 15:54:51 -0800 | [diff] [blame] | 45 | ALOGV("[%s]\thwcLayer=%p", tag, hwc.hwcLayer.get()); | 
| David Sodman | b8af792 | 2017-12-21 15:17:55 -0800 | [diff] [blame] | 46 | 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 |  | 
|  | 63 | void 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 Sodman | ca10ed2 | 2018-04-16 14:10:25 -0700 | [diff] [blame] | 67 | ALOGV("[%s]\topaque=%d", tag, re.opaque); | 
|  | 68 | ALOGV("[%s]\tdisableTexture=%d", tag, re.disableTexture); | 
| David Sodman | b8af792 | 2017-12-21 15:17:55 -0800 | [diff] [blame] | 69 | 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 |  | 
|  | 73 | void 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 |