hwc_utils.h revision 60712080d834941754dca8d34adac6bd355318ea
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 * Copyright (C)2012-2014, The Linux Foundation. All rights reserved.
4 *
5 * Not a Contribution, Apache license notifications and license are retained
6 * for attribution purposes only.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21#ifndef HWC_UTILS_H
22#define HWC_UTILS_H
23
24#define HWC_REMOVE_DEPRECATED_VERSIONS 1
25#include <fcntl.h>
26#include <math.h>
27#include <hardware/hwcomposer.h>
28#include <gr.h>
29#include <gralloc_priv.h>
30#include <utils/String8.h>
31#include "qdMetaData.h"
32#include <overlayUtils.h>
33#include <EGL/egl.h>
34
35
36#define ALIGN_TO(x, align)     (((x) + ((align)-1)) & ~((align)-1))
37#define LIKELY( exp )       (__builtin_expect( (exp) != 0, true  ))
38#define UNLIKELY( exp )     (__builtin_expect( (exp) != 0, false ))
39#define MAX_NUM_APP_LAYERS 32
40#define MIN_DISPLAY_XRES 200
41#define MIN_DISPLAY_YRES 200
42#define HWC_WFDDISPSYNC_LOG 0
43#define STR(f) #f;
44// Max number of PTOR layers handled
45#define MAX_PTOR_LAYERS 2
46
47//Fwrd decls
48struct hwc_context_t;
49
50namespace ovutils = overlay::utils;
51
52namespace overlay {
53class Overlay;
54class Rotator;
55class RotMgr;
56}
57
58namespace qhwc {
59//fwrd decl
60class QueuedBufferStore;
61class ExternalDisplay;
62class VirtualDisplay;
63class IFBUpdate;
64class IVideoOverlay;
65class MDPComp;
66class CopyBit;
67class HwcDebug;
68class AssertiveDisplay;
69class HWCVirtualBase;
70
71
72struct MDPInfo {
73    int version;
74    char panel;
75    bool hasOverlay;
76};
77
78struct DisplayAttributes {
79    uint32_t vsync_period; //nanos
80    uint32_t xres;
81    uint32_t yres;
82    uint32_t stride;
83    float xdpi;
84    float ydpi;
85    int fd;
86    bool connected; //Applies only to pluggable disp.
87    //Connected does not mean it ready to use.
88    //It should be active also. (UNBLANKED)
89    bool isActive;
90    // In pause state, composition is bypassed
91    // used for WFD displays only
92    bool isPause;
93    // To trigger padding round to clean up mdp
94    // pipes
95    bool isConfiguring;
96    // External Display is in MDP Downscale mode indicator
97    bool mDownScaleMode;
98    // Ext dst Rect
99    hwc_rect_t mDstRect;
100    //Action safe attributes
101    // Flag to indicate the presence of action safe dimensions for external
102    bool mActionSafePresent;
103    int mAsWidthRatio;
104    int mAsHeightRatio;
105
106    //If property fbsize set via adb shell debug.hwc.fbsize = XRESxYRES
107    //following fields are used.
108    bool customFBSize;
109    uint32_t xres_new;
110    uint32_t yres_new;
111
112};
113
114struct ListStats {
115    int numAppLayers; //Total - 1, excluding FB layer.
116    int skipCount;
117    int fbLayerIndex; //Always last for now. = numAppLayers
118    //Video specific
119    int yuvCount;
120    int yuvIndices[MAX_NUM_APP_LAYERS];
121    int extOnlyLayerIndex;
122    bool preMultipliedAlpha;
123    int yuv4k2kIndices[MAX_NUM_APP_LAYERS];
124    int yuv4k2kCount;
125    // Notifies hwcomposer about the start and end of animation
126    // This will be set to true during animation, otherwise false.
127    bool isDisplayAnimating;
128    bool secureUI; // Secure display layer
129    bool isSecurePresent;
130    hwc_rect_t lRoi;  //left ROI
131    hwc_rect_t rRoi;  //right ROI. Unused in single DSI panels.
132    //App Buffer Composition index
133    int  renderBufIndexforABC;
134};
135
136//PTOR Comp info
137struct PtorInfo {
138    int count;
139    int layerIndex[MAX_PTOR_LAYERS];
140    int mRenderBuffOffset[MAX_PTOR_LAYERS];
141    hwc_rect_t displayFrame[MAX_PTOR_LAYERS];
142    bool isActive() { return (count>0); }
143    int getPTORArrayIndex(int index) {
144        int idx = -1;
145        for(int i = 0; i < count; i++) {
146            if(index == layerIndex[i])
147                idx = i;
148        }
149        return idx;
150    }
151};
152
153struct LayerProp {
154    uint32_t mFlags; //qcom specific layer flags
155    LayerProp():mFlags(0){};
156};
157
158struct VsyncState {
159    bool enable;
160    bool fakevsync;
161    bool debug;
162};
163
164struct BwcPM {
165    static void setBwc(const hwc_rect_t& crop,
166            const hwc_rect_t& dst, const int& transform,
167            ovutils::eMdpFlags& mdpFlags);
168};
169
170// LayerProp::flag values
171enum {
172    HWC_MDPCOMP = 0x00000001,
173    HWC_COPYBIT = 0x00000002,
174};
175
176// HAL specific features
177enum {
178    HWC_COLOR_FILL = 0x00000008,
179    HWC_FORMAT_RB_SWAP = 0x00000040,
180};
181
182/* External Display states */
183enum {
184    EXTERNAL_OFFLINE = 0,
185    EXTERNAL_ONLINE,
186    EXTERNAL_PAUSE,
187    EXTERNAL_RESUME,
188    EXTERNAL_MAXSTATES
189};
190
191class LayerRotMap {
192public:
193    LayerRotMap() { reset(); }
194    enum { MAX_SESS = 3 };
195    void add(hwc_layer_1_t* layer, overlay::Rotator *rot);
196    //Resets the mapping of layer to rotator
197    void reset();
198    //Clears mappings and existing rotator fences
199    //Intended to be used during errors
200    void clear();
201    uint32_t getCount() const;
202    hwc_layer_1_t* getLayer(uint32_t index) const;
203    overlay::Rotator* getRot(uint32_t index) const;
204    void setReleaseFd(const int& fence);
205private:
206    hwc_layer_1_t* mLayer[MAX_SESS];
207    overlay::Rotator* mRot[MAX_SESS];
208    uint32_t mCount;
209};
210
211inline uint32_t LayerRotMap::getCount() const {
212    return mCount;
213}
214
215inline hwc_layer_1_t* LayerRotMap::getLayer(uint32_t index) const {
216    if(index >= mCount) return NULL;
217    return mLayer[index];
218}
219
220inline overlay::Rotator* LayerRotMap::getRot(uint32_t index) const {
221    if(index >= mCount) return NULL;
222    return mRot[index];
223}
224
225inline hwc_rect_t integerizeSourceCrop(const hwc_frect_t& cropF) {
226    hwc_rect_t cropI = {0,0,0,0};
227    cropI.left = int(ceilf(cropF.left));
228    cropI.top = int(ceilf(cropF.top));
229    cropI.right = int(floorf(cropF.right));
230    cropI.bottom = int(floorf(cropF.bottom));
231    return cropI;
232}
233
234inline bool isNonIntegralSourceCrop(const hwc_frect_t& cropF) {
235    if(cropF.left - roundf(cropF.left)     ||
236       cropF.top - roundf(cropF.top)       ||
237       cropF.right - roundf(cropF.right)   ||
238       cropF.bottom - roundf(cropF.bottom))
239        return true;
240    else
241        return false;
242}
243
244// -----------------------------------------------------------------------------
245// Utility functions - implemented in hwc_utils.cpp
246void dumpLayer(hwc_layer_1_t const* l);
247void setListStats(hwc_context_t *ctx, hwc_display_contents_1_t *list,
248        int dpy);
249void initContext(hwc_context_t *ctx);
250void closeContext(hwc_context_t *ctx);
251//Crops source buffer against destination and FB boundaries
252void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
253                         const hwc_rect_t& scissor, int orient);
254void getNonWormholeRegion(hwc_display_contents_1_t* list,
255                              hwc_rect_t& nwr);
256bool isSecuring(hwc_context_t* ctx, hwc_layer_1_t const* layer);
257bool isSecureModePolicy(int mdpVersion);
258// Returns true, if the input layer format is supported by rotator
259bool isRotatorSupportedFormat(private_handle_t *hnd);
260//Returns true, if the layer is YUV or the layer has been rendered by CPU
261bool isRotationDoable(hwc_context_t *ctx, private_handle_t *hnd);
262bool isExternalActive(hwc_context_t* ctx);
263bool isAlphaScaled(hwc_layer_1_t const* layer);
264bool needsScaling(hwc_layer_1_t const* layer);
265bool isDownscaleRequired(hwc_layer_1_t const* layer);
266bool needsScalingWithSplit(hwc_context_t* ctx, hwc_layer_1_t const* layer,
267                           const int& dpy);
268void sanitizeSourceCrop(hwc_rect_t& cropL, hwc_rect_t& cropR,
269                        private_handle_t *hnd);
270bool isAlphaPresent(hwc_layer_1_t const* layer);
271int hwc_vsync_control(hwc_context_t* ctx, int dpy, int enable);
272int getBlending(int blending);
273bool isGLESOnlyComp(hwc_context_t *ctx, const int& dpy);
274void reset_layer_prop(hwc_context_t* ctx, int dpy, int numAppLayers);
275bool isAbcInUse(hwc_context_t *ctx);
276
277void dumpBuffer(private_handle_t *ohnd, char *bufferName);
278
279//Helper function to dump logs
280void dumpsys_log(android::String8& buf, const char* fmt, ...);
281
282int getExtOrientation(hwc_context_t* ctx);
283bool isValidRect(const hwc_rect_t& rect);
284hwc_rect_t deductRect(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
285bool isSameRect(const hwc_rect& rect1, const hwc_rect& rect2);
286hwc_rect_t moveRect(const hwc_rect_t& rect, const int& x_off, const int& y_off);
287hwc_rect_t getIntersection(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
288hwc_rect_t getUnion(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
289void optimizeLayerRects(const hwc_display_contents_1_t *list);
290bool areLayersIntersecting(const hwc_layer_1_t* layer1,
291        const hwc_layer_1_t* layer2);
292bool operator ==(const hwc_rect_t& lhs, const hwc_rect_t& rhs);
293
294// returns true if Action safe dimensions are set and target supports Actionsafe
295bool isActionSafePresent(hwc_context_t *ctx, int dpy);
296
297/* Calculates the destination position based on the action safe rectangle */
298void getActionSafePosition(hwc_context_t *ctx, int dpy, hwc_rect_t& dst);
299
300void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
301                                hwc_rect_t& inRect, hwc_rect_t& outRect);
302
303bool isPrimaryPortrait(hwc_context_t *ctx);
304
305bool isOrientationPortrait(hwc_context_t *ctx);
306
307void calcExtDisplayPosition(hwc_context_t *ctx,
308                               private_handle_t *hnd,
309                               int dpy,
310                               hwc_rect_t& sourceCrop,
311                               hwc_rect_t& displayFrame,
312                               int& transform,
313                               ovutils::eTransform& orient);
314
315// Returns the orientation that needs to be set on external for
316// BufferMirrirMode(Sidesync)
317int getMirrorModeOrientation(hwc_context_t *ctx);
318
319/* Get External State names */
320const char* getExternalDisplayState(uint32_t external_state);
321
322// Resets display ROI to full panel resoluion
323void resetROI(hwc_context_t *ctx, const int dpy);
324
325// Aligns updating ROI to panel restrictions
326hwc_rect_t getSanitizeROI(struct hwc_rect roi, hwc_rect boundary);
327
328// Handles wfd Pause and resume events
329void handle_pause(hwc_context_t *ctx, int dpy);
330void handle_resume(hwc_context_t *ctx, int dpy);
331
332//Close acquireFenceFds of all layers of incoming list
333void closeAcquireFds(hwc_display_contents_1_t* list);
334
335//Sync point impl.
336int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
337        int fd);
338
339//Sets appropriate mdp flags for a layer.
340void setMdpFlags(hwc_context_t *ctx, hwc_layer_1_t *layer,
341        ovutils::eMdpFlags &mdpFlags,
342        int rotDownscale, int transform);
343
344int configRotator(overlay::Rotator *rot, ovutils::Whf& whf,
345        hwc_rect_t& crop, const ovutils::eMdpFlags& mdpFlags,
346        const ovutils::eTransform& orient, const int& downscale);
347
348int configMdp(overlay::Overlay *ov, const ovutils::PipeArgs& parg,
349        const ovutils::eTransform& orient, const hwc_rect_t& crop,
350        const hwc_rect_t& pos, const MetaData_t *metadata,
351        const ovutils::eDest& dest);
352
353int configColorLayer(hwc_context_t *ctx, hwc_layer_1_t *layer, const int& dpy,
354        ovutils::eMdpFlags& mdpFlags, ovutils::eZorder& z,
355        ovutils::eIsFg& isFg, const ovutils::eDest& dest);
356
357void updateSource(ovutils::eTransform& orient, ovutils::Whf& whf,
358        hwc_rect_t& crop, overlay::Rotator *rot);
359
360//Routine to configure low resolution panels (<= 2048 width)
361int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer, const int& dpy,
362        ovutils::eMdpFlags& mdpFlags, ovutils::eZorder& z,
363        ovutils::eIsFg& isFg, const ovutils::eDest& dest,
364        overlay::Rotator **rot);
365
366//Routine to configure high resolution panels (> 2048 width)
367int configureSplit(hwc_context_t *ctx, hwc_layer_1_t *layer, const int& dpy,
368        ovutils::eMdpFlags& mdpFlags, ovutils::eZorder& z,
369        ovutils::eIsFg& isFg, const ovutils::eDest& lDest,
370        const ovutils::eDest& rDest, overlay::Rotator **rot);
371
372//Routine to split and configure high resolution YUV layer (> 2048 width)
373int configureSourceSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
374        const int& dpy,
375        ovutils::eMdpFlags& mdpFlags, ovutils::eZorder& z,
376        ovutils::eIsFg& isFg, const ovutils::eDest& lDest,
377        const ovutils::eDest& rDest, overlay::Rotator **rot);
378
379//On certain targets DMA pipes are used for rotation and they won't be available
380//for line operations. On a per-target basis we can restrict certain use cases
381//from using rotator, since we know before-hand that such scenarios can lead to
382//extreme unavailability of pipes. This can also be done via hybrid calculations
383//also involving many more variables like number of write-back interfaces etc,
384//but the variety of scenarios is too high to warrant that.
385bool canUseRotator(hwc_context_t *ctx, int dpy);
386
387int getLeftSplit(hwc_context_t *ctx, const int& dpy);
388
389bool isDisplaySplit(hwc_context_t* ctx, int dpy);
390
391// Set the GPU hint flag to high for MIXED/GPU composition only for
392// first frame after MDP to GPU/MIXED mode transition.
393// Set the GPU hint to default if the current composition type is GPU
394// due to idle fallback or MDP composition.
395void setGPUHint(hwc_context_t* ctx, hwc_display_contents_1_t* list);
396
397// Returns true if rect1 is peripheral to rect2, false otherwise.
398bool isPeripheral(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
399
400// Inline utility functions
401static inline bool isSkipLayer(const hwc_layer_1_t* l) {
402    return (UNLIKELY(l && (l->flags & HWC_SKIP_LAYER)));
403}
404
405// Returns true if the buffer is yuv
406static inline bool isYuvBuffer(const private_handle_t* hnd) {
407    return (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO));
408}
409
410// Returns true if the buffer is yuv
411static inline bool is4kx2kYuvBuffer(const private_handle_t* hnd) {
412    return (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO) &&
413            (hnd->width > 2048));
414}
415
416// Returns true if the buffer is secure
417static inline bool isSecureBuffer(const private_handle_t* hnd) {
418    return (hnd && (private_handle_t::PRIV_FLAGS_SECURE_BUFFER & hnd->flags));
419}
420
421static inline bool isTileRendered(const private_handle_t* hnd) {
422    return (hnd && (private_handle_t::PRIV_FLAGS_TILE_RENDERED & hnd->flags));
423}
424
425static inline bool isCPURendered(const private_handle_t* hnd) {
426    return (hnd && (private_handle_t::PRIV_FLAGS_CPU_RENDERED & hnd->flags));
427}
428
429//Return true if buffer is marked locked
430static inline bool isBufferLocked(const private_handle_t* hnd) {
431    return (hnd && (private_handle_t::PRIV_FLAGS_HWC_LOCK & hnd->flags));
432}
433
434//Return true if buffer is for external display only
435static inline bool isExtOnly(const private_handle_t* hnd) {
436    return (hnd && (hnd->flags & private_handle_t::PRIV_FLAGS_EXTERNAL_ONLY));
437}
438
439//Return true if the buffer is intended for Secure Display
440static inline bool isSecureDisplayBuffer(const private_handle_t* hnd) {
441    return (hnd && (hnd->flags & private_handle_t::PRIV_FLAGS_SECURE_DISPLAY));
442}
443
444static inline int getWidth(const private_handle_t* hnd) {
445    if(isYuvBuffer(hnd)) {
446        MetaData_t *metadata = reinterpret_cast<MetaData_t*>(hnd->base_metadata);
447        if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
448            return metadata->bufferDim.sliceWidth;
449        }
450    }
451    return hnd->width;
452}
453
454static inline int getHeight(const private_handle_t* hnd) {
455    if(isYuvBuffer(hnd)) {
456        MetaData_t *metadata = reinterpret_cast<MetaData_t*>(hnd->base_metadata);
457        if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
458            return metadata->bufferDim.sliceHeight;
459        }
460    }
461    return hnd->height;
462}
463
464template<typename T> inline T max(T a, T b) { return (a > b) ? a : b; }
465template<typename T> inline T min(T a, T b) { return (a < b) ? a : b; }
466
467// Initialize uevent thread
468void init_uevent_thread(hwc_context_t* ctx);
469// Initialize vsync thread
470void init_vsync_thread(hwc_context_t* ctx);
471
472inline void getLayerResolution(const hwc_layer_1_t* layer,
473                               int& width, int& height) {
474    hwc_rect_t displayFrame  = layer->displayFrame;
475    width = displayFrame.right - displayFrame.left;
476    height = displayFrame.bottom - displayFrame.top;
477}
478
479static inline int openFb(int dpy) {
480    int fd = -1;
481    const char *devtmpl = "/dev/graphics/fb%u";
482    char name[64] = {0};
483    snprintf(name, 64, devtmpl, dpy);
484    fd = open(name, O_RDWR);
485    return fd;
486}
487
488template <class T>
489inline void swap(T& a, T& b) {
490    T tmp = a;
491    a = b;
492    b = tmp;
493}
494
495}; //qhwc namespace
496
497enum eAnimationState{
498    ANIMATION_STOPPED,
499    ANIMATION_STARTED,
500};
501
502enum eCompositionState {
503    COMPOSITION_STATE_MDP = 0,        // Set if composition type is MDP
504    COMPOSITION_STATE_GPU,            // Set if composition type is GPU or MIXED
505    COMPOSITION_STATE_IDLE_FALLBACK,  // Set if it is idlefallback
506};
507
508// Structure holds the information about the GPU hint.
509struct gpu_hint_info {
510    // system level flag to enable gpu_perf_mode
511    bool mGpuPerfModeEnable;
512    // Stores the current GPU performance mode DEFAULT/HIGH
513    bool mCurrGPUPerfMode;
514    // Stores the compositon state GPU, MDP or IDLE_FALLBACK
515    bool mCompositionState;
516    // Stores the EGLContext of current process
517    EGLContext mEGLContext;
518    // Stores the EGLDisplay of current process
519    EGLDisplay mEGLDisplay;
520};
521
522// -----------------------------------------------------------------------------
523// HWC context
524// This structure contains overall state
525struct hwc_context_t {
526    hwc_composer_device_1_t device;
527    const hwc_procs_t* proc;
528
529    //CopyBit objects
530    qhwc::CopyBit *mCopyBit[HWC_NUM_DISPLAY_TYPES];
531
532    //Overlay object - NULL for non overlay devices
533    overlay::Overlay *mOverlay;
534    //Holds a few rot objects
535    overlay::RotMgr *mRotMgr;
536
537    //Primary and external FB updater
538    qhwc::IFBUpdate *mFBUpdate[HWC_NUM_DISPLAY_TYPES];
539    // External display related information
540    qhwc::ExternalDisplay *mExtDisplay;
541    qhwc::VirtualDisplay *mVirtualDisplay;
542    qhwc::MDPInfo mMDP;
543    qhwc::VsyncState vstate;
544    qhwc::DisplayAttributes dpyAttr[HWC_NUM_DISPLAY_TYPES];
545    qhwc::ListStats listStats[HWC_NUM_DISPLAY_TYPES];
546    qhwc::LayerProp *layerProp[HWC_NUM_DISPLAY_TYPES];
547    qhwc::MDPComp *mMDPComp[HWC_NUM_DISPLAY_TYPES];
548    qhwc::HwcDebug *mHwcDebug[HWC_NUM_DISPLAY_TYPES];
549    hwc_rect_t mViewFrame[HWC_NUM_DISPLAY_TYPES];
550    qhwc::AssertiveDisplay *mAD;
551    eAnimationState mAnimationState[HWC_NUM_DISPLAY_TYPES];
552    qhwc::HWCVirtualBase *mHWCVirtual;
553
554    // stores the #numHwLayers of the previous frame
555    // for each display device
556    int mPrevHwLayerCount[HWC_NUM_DISPLAY_TYPES];
557
558    // stores the primary device orientation
559    int deviceOrientation;
560    //Securing in progress indicator
561    bool mSecuring;
562    //WFD on proprietary stack
563    bool mVirtualonExtActive;
564    //Display in secure mode indicator
565    bool mSecureMode;
566    //Lock to protect drawing data structures
567    mutable Locker mDrawLock;
568    //Drawing round when we use GPU
569    bool isPaddingRound;
570    // External Orientation
571    int mExtOrientation;
572    //Flags the transition of a video session
573    bool mVideoTransFlag;
574    //Used for SideSync feature
575    //which overrides the mExtOrientation
576    bool mBufferMirrorMode;
577    // Used to synchronize between WFD and Display modules
578    mutable Locker mWfdSyncLock;
579
580    qhwc::LayerRotMap *mLayerRotMap[HWC_NUM_DISPLAY_TYPES];
581    // Panel reset flag will be set if BTA check fails
582    bool mPanelResetStatus;
583    // number of active Displays
584    int numActiveDisplays;
585    // Downscale feature switch, set via system property
586    // sys.hwc.mdp_downscale_enabled
587    bool mMDPDownscaleEnabled;
588    // Is WFD enabled through VDS solution ?
589    // This can be set via system property
590    // persist.hwc.enable_vds
591    bool mVDSEnabled;
592    struct gpu_hint_info mGPUHintInfo;
593    //App Buffer Composition
594    bool enableABC;
595    // PTOR Info
596    qhwc::PtorInfo mPtorInfo;
597};
598
599namespace qhwc {
600static inline bool isSkipPresent (hwc_context_t *ctx, int dpy) {
601    return  ctx->listStats[dpy].skipCount;
602}
603
604static inline bool isYuvPresent (hwc_context_t *ctx, int dpy) {
605    return  ctx->listStats[dpy].yuvCount;
606}
607
608static inline bool has90Transform(hwc_layer_1_t const* layer) {
609    return ((layer->transform & HWC_TRANSFORM_ROT_90) &&
610            !(layer->flags & HWC_COLOR_FILL));
611}
612
613inline bool isSecurePresent(hwc_context_t *ctx, int dpy) {
614    return ctx->listStats[dpy].isSecurePresent;
615}
616
617static inline bool isSecondaryConfiguring(hwc_context_t* ctx) {
618    return (ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isConfiguring ||
619            ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isConfiguring);
620}
621
622static inline bool isSecondaryConnected(hwc_context_t* ctx) {
623    return (ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected ||
624            ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].connected);
625}
626
627};
628
629#endif //HWC_UTILS_H
630