Home | History | Annotate | Download | only in gui
      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 #pragma once
     18 
     19 #include <binder/Parcelable.h>
     20 
     21 #include <ui/PixelFormat.h>
     22 #include <ui/Region.h>
     23 
     24 #include <string>
     25 #include <math/vec4.h>
     26 
     27 namespace android {
     28 
     29 /* Class for transporting debug info from SurfaceFlinger to authorized
     30  * recipients.  The class is intended to be a data container. There are
     31  * no getters or setters.
     32  */
     33 class LayerDebugInfo : public Parcelable {
     34 public:
     35     LayerDebugInfo() = default;
     36     LayerDebugInfo(const LayerDebugInfo&) = default;
     37     virtual ~LayerDebugInfo() = default;
     38 
     39     virtual status_t writeToParcel(Parcel* parcel) const;
     40     virtual status_t readFromParcel(const Parcel* parcel);
     41 
     42     std::string mName = std::string("NOT FILLED");
     43     std::string mParentName = std::string("NOT FILLED");
     44     std::string mType = std::string("NOT FILLED");
     45     Region mTransparentRegion = Region::INVALID_REGION;
     46     Region mVisibleRegion = Region::INVALID_REGION;
     47     Region mSurfaceDamageRegion = Region::INVALID_REGION;
     48     uint32_t mLayerStack = 0;
     49     float mX = 0.f;
     50     float mY = 0.f;
     51     uint32_t mZ = 0 ;
     52     int32_t mWidth = -1;
     53     int32_t mHeight = -1;
     54     Rect mCrop = Rect::INVALID_RECT;
     55     Rect mFinalCrop = Rect::INVALID_RECT;
     56     half4 mColor = half4(1.0_hf, 1.0_hf, 1.0_hf, 0.0_hf);
     57     uint32_t mFlags = 0;
     58     PixelFormat mPixelFormat = PIXEL_FORMAT_NONE;
     59     android_dataspace mDataSpace = HAL_DATASPACE_UNKNOWN;
     60     // Row-major transform matrix (SurfaceControl::setMatrix())
     61     float mMatrix[2][2] = {{0.f, 0.f}, {0.f, 0.f}};
     62     int32_t mActiveBufferWidth = -1;
     63     int32_t mActiveBufferHeight = -1;
     64     int32_t mActiveBufferStride = 0;
     65     PixelFormat mActiveBufferFormat = PIXEL_FORMAT_NONE;
     66     int32_t mNumQueuedFrames = -1;
     67     bool mRefreshPending = false;
     68     bool mIsOpaque = false;
     69     bool mContentDirty = false;
     70 };
     71 
     72 std::string to_string(const LayerDebugInfo& info);
     73 
     74 } // namespace android
     75