X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=services%2Fsurfaceflinger%2FDisplayDevice.h;h=8636e2af790171d5b35cdee0cb926782ac0c343e;hb=0249b61e4d58191847ec2d14dc8a43b07cb5c4d0;hp=8695a44eca38af9735e37d4a6835e7bcf1146b96;hpb=81bab8081e1ddaad809abc91f3d11c2021e6c711;p=android-x86%2Fframeworks-native.git diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h index 8695a44eca..8636e2af79 100644 --- a/services/surfaceflinger/DisplayDevice.h +++ b/services/surfaceflinger/DisplayDevice.h @@ -17,21 +17,31 @@ #ifndef ANDROID_DISPLAY_DEVICE_H #define ANDROID_DISPLAY_DEVICE_H +#include "Transform.h" + #include +#ifndef USE_HWC2 #include +#endif #include #include #include +#ifdef USE_HWC2 +#include +#include +#endif #include #include #include #include -#include "Transform.h" +#ifdef USE_HWC2 +#include +#endif struct ANativeWindow; @@ -39,6 +49,7 @@ namespace android { struct DisplayInfo; class DisplaySurface; +class Fence; class IGraphicBufferProducer; class Layer; class SurfaceFlinger; @@ -72,16 +83,21 @@ public: NO_LAYER_STACK = 0xFFFFFFFF, }; + // clang-format off DisplayDevice( const sp& flinger, DisplayType type, - int32_t hwcId, // negative for non-HWC-composited displays + int32_t hwcId, +#ifndef USE_HWC2 int format, +#endif bool isSecure, const wp& displayToken, const sp& displaySurface, const sp& producer, - EGLConfig config); + EGLConfig config, + bool supportWideColor); + // clang-format on ~DisplayDevice(); @@ -99,14 +115,15 @@ public: int getWidth() const; int getHeight() const; +#ifndef USE_HWC2 PixelFormat getFormat() const; +#endif uint32_t getFlags() const; EGLSurface getEGLSurface() const; void setVisibleLayersSortedByZ(const Vector< sp >& layers); const Vector< sp >& getVisibleLayersSortedByZ() const; - bool getSecureLayerVisible() const; Region getDirtyRegion(bool repaintEverything) const; void setLayerStack(uint32_t stack); @@ -115,6 +132,7 @@ public: int getOrientation() const { return mOrientation; } uint32_t getOrientationTransform() const; + static uint32_t getPrimaryDisplayOrientationTransform(); const Transform& getTransform() const { return mGlobalTransform; } const Rect getViewport() const { return mViewport; } const Rect getFrame() const { return mFrame; } @@ -123,19 +141,31 @@ public: uint32_t getLayerStack() const { return mLayerStack; } int32_t getDisplayType() const { return mType; } + bool isPrimary() const { return mType == DISPLAY_PRIMARY; } int32_t getHwcDisplayId() const { return mHwcDisplayId; } const wp& getDisplayToken() const { return mDisplayToken; } // We pass in mustRecompose so we can keep VirtualDisplaySurface's state // machine happy without actually queueing a buffer if nothing has changed status_t beginFrame(bool mustRecompose) const; +#ifdef USE_HWC2 + status_t prepareFrame(HWComposer& hwc); + bool getWideColorSupport() const { return mDisplayHasWideColor; } +#else status_t prepareFrame(const HWComposer& hwc) const; +#endif void swapBuffers(HWComposer& hwc) const; +#ifndef USE_HWC2 status_t compositionComplete() const; +#endif // called after h/w composer has completed its set() call +#ifdef USE_HWC2 + void onSwapBuffersCompleted() const; +#else void onSwapBuffersCompleted(HWComposer& hwc) const; +#endif Rect getBounds() const { return Rect(mDisplayWidth, mDisplayHeight); @@ -148,6 +178,8 @@ public: EGLBoolean makeCurrent(EGLDisplay dpy, EGLContext ctx) const; void setViewportAndProjection() const; + const sp& getClientTargetAcquireFence() const; + /* ------------------------------------------------------------------------ * Display power mode management. */ @@ -155,6 +187,12 @@ public: void setPowerMode(int mode); bool isDisplayOn() const; +#ifdef USE_HWC2 + android_color_mode_t getActiveColorMode() const; + void setActiveColorMode(android_color_mode_t mode); + void setCompositionDataSpace(android_dataspace dataspace); +#endif + /* ------------------------------------------------------------------------ * Display active config management. */ @@ -188,7 +226,9 @@ private: EGLSurface mSurface; int mDisplayWidth; int mDisplayHeight; +#ifndef USE_HWC2 PixelFormat mFormat; +#endif uint32_t mFlags; mutable uint32_t mPageFlipCount; String8 mDisplayName; @@ -202,18 +242,19 @@ private: // list of visible layers on that display Vector< sp > mVisibleLayersSortedByZ; - // Whether we have a visible secure layer on this display - bool mSecureLayerVisible; - - /* * Transaction state */ static status_t orientationToTransfrom(int orientation, int w, int h, Transform* tr); + // The identifier of the active layer stack for this display. Several displays + // can use the same layer stack: A z-ordered group of layers (sometimes called + // "surfaces"). Any given layer can only be on a single layer stack. uint32_t mLayerStack; + int mOrientation; + static uint32_t sPrimaryDisplayOrientation; // user-provided visible area of the layer stack Rect mViewport; // user-provided rectangle where mViewport gets mapped to @@ -226,6 +267,37 @@ private: int mPowerMode; // Current active config int mActiveConfig; +#ifdef USE_HWC2 + // current active color mode + android_color_mode_t mActiveColorMode; + + // Need to know if display is wide-color capable or not. + // Initialized by SurfaceFlinger when the DisplayDevice is created. + // Fed to RenderEngine during composition. + bool mDisplayHasWideColor; +#endif +}; + +struct DisplayDeviceState { + DisplayDeviceState() = default; + DisplayDeviceState(DisplayDevice::DisplayType type, bool isSecure); + + bool isValid() const { return type >= 0; } + bool isMainDisplay() const { return type == DisplayDevice::DISPLAY_PRIMARY; } + bool isVirtualDisplay() const { return type >= DisplayDevice::DISPLAY_VIRTUAL; } + + static std::atomic nextDisplayId; + int32_t displayId = nextDisplayId++; + DisplayDevice::DisplayType type = DisplayDevice::DISPLAY_ID_INVALID; + sp surface; + uint32_t layerStack = DisplayDevice::NO_LAYER_STACK; + Rect viewport; + Rect frame; + uint8_t orientation = 0; + uint32_t width = 0; + uint32_t height = 0; + String8 displayName; + bool isSecure = false; }; }; // namespace android