| 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) { | 
|  | 29 | compositionInfo.layer = 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 |  | 
|  | 33 | void LayerBE::onLayerDisplayed(const sp<Fence>& releaseFence) { | 
|  | 34 | mLayer->onLayerDisplayed(releaseFence); | 
|  | 35 | } | 
|  | 36 |  | 
|  | 37 | void CompositionInfo::dumpHwc(const char* tag) const { | 
|  | 38 | ALOGV("[%s]\thwcLayer=%p", tag, static_cast<HWC2::Layer*>(*hwc.hwcLayer)); | 
|  | 39 | 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 |  | 
|  | 56 | void 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); | 
| bohu | 2156613 | 2018-03-27 14:36:34 -0700 | [diff] [blame] | 60 | ALOGV("[%s]\topaque=%d\n", tag, re.opaque); | 
| David Sodman | b8af792 | 2017-12-21 15:17:55 -0800 | [diff] [blame] | 61 | 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()); | 
|  | 62 | ALOGV("[%s]\tuseIdentityTransform=%d\n", tag, re.useIdentityTransform); | 
|  | 63 | } | 
|  | 64 |  | 
|  | 65 | void CompositionInfo::dump(const char* tag) const { | 
|  | 66 | ALOGV("[%s] CompositionInfo", tag); | 
|  | 67 | ALOGV("[%s]\tLayerName: %s", tag, layerName.c_str()); | 
|  | 68 | ALOGV("[%s]\tCompositionType: %d", tag, compositionType); | 
|  | 69 | ALOGV("[%s]\tmBuffer = %p", tag, mBuffer.get()); | 
|  | 70 | ALOGV("[%s]\tmBufferSlot=%d", tag, mBufferSlot); | 
|  | 71 | switch (compositionType) { | 
|  | 72 | case HWC2::Composition::Device: | 
|  | 73 | dumpHwc(tag); | 
|  | 74 | break; | 
|  | 75 | case HWC2::Composition::Client: | 
|  | 76 | dumpRe(tag); | 
|  | 77 | default: | 
|  | 78 | break; | 
|  | 79 | } | 
|  | 80 | } | 
|  | 81 |  | 
|  | 82 | }; // namespace android |