/* * Copyright (c) Hisilicon Technologies Co., Ltd.. 2016-2019. All rights reserved. * Description: On behalf of a display device, hwcomposer is called for composition and sent for display * Author: Hisilicon * Created: 2019.12.02 */ #ifndef HWC_IAPI_COM_IMPL_H #define HWC_IAPI_COM_IMPL_H #include "HWCIapiAdapter.h" #include namespace android { class HWCIapiComImpl : public HWCIapiAdapter { public: HWCIapiComImpl(); ~HWCIapiComImpl() override {}; bool IsDisplayConnected(const int displayId) override; #ifdef EXT_HDMI_SUPPORT int GetHdmiMaxPara(const int displayId, float &maxWidth, float &maxHeight) override; int RegisterHdmiCallback(const int displayId, HWCHdmiCallback callback) override; int UnregisterHdmiCallback(const int displayId) override; #endif int InitIapiModules() override; int DeInitIapiModules() override; int GetFbDevId(const hwc2_display_t displayId) const override; int GetExternalDisplayStatus(uapi_disp_state *state) override; bool IsDisplaySwitched() override; void UpdateVirtualScreen(const uint64_t displayId, const unsigned int width, const unsigned int height) const override; void DisableVoWindow(const native_handle_t &sideband) const override; void SetVoWindowPosition(const native_handle_t &sideband, const hwc_rect_t &hwcRect, int zorder, int absZorder) const override; int OpenGfx2dAndInitCapability() override; int CloseGfx2d() override; int PrepareGfx2dBasicArg(const int layerNumber) override; int PrepareGfx2dLayerArg(const HWCLayer &layer, const unsigned int i, const int fbWidth, const int fbHeight, const bool isAsync) override; int PrepareGfx2dDestArg(const int framebufferFd, const HWCBuffer &fbBuffer, const bool hwcCompress) override; int Gfx2dCompose(int layerReleaseFence[], const int layerNumber, int &fbRealeaseFence, const bool isAsync) override; void DumpGfx2dComposeInfo() const; void PostGfx2dCompose() override; int FreshDirect(const int framebufferFd, HWCBuffer &layerBuffer) const override; int FreshFb(const int framebufferFd, HWCBuffer &fbBuffer, const int composeType, const bool hwcCompress, const bool discardFrame) const override; int GetHdrInfo(const hwc2_display_t display, HdrCap &hdrCap) const override; int64_t GetVsyncTime(const int framebufferFd, unsigned int &freshRate) const override; int InitDisplayConfigs(const hwc2_display_t display, DisplayConfigs &configs, const framebuffer_device_t &device, unsigned int &active) const override; bool IsSupportGfx2dCompose() override; bool CheckLayerNum(const size_t layerSize) const override; bool CheckLayerSize(const unsigned int cropWidth, const unsigned int cropHeight, const unsigned int dispWidth, const unsigned int dispHeight) const override; bool CheckResizeNum(const int layerNum, const int videoLayerNum) const override; void SetDispPowerState(const int displayId, const HWC2::PowerMode mode) const override; static HWCHdmiCallback m_callback; private: int PrepareGfx2dBasicArgForLayer(uapi_gfx2d_surface &srcSurface, const HWCLayer& layer) const; void PrepareGfx2dHandleRelatedArgForLayer(uapi_gfx2d_surface &srcSurface, const HWCLayer& layer, const bool isAsync) const; bool SupportModesCorrection(DisplayConfigs &configs, uint32_t config) const; uapi_gfx2d_list m_gfx2dList; int m_enabledDisplayCount; // whether need to switch primary display and external display bool m_switchDisplay; uapi_gfx2d_capability m_capabilityInfo; }; } // namespace android #endif // HWC_IAPI_COM_IMPL_H