1/* 2* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved. 3* 4* Redistribution and use in source and binary forms, with or without modification, are permitted 5* provided that the following conditions are met: 6* * Redistributions of source code must retain the above copyright notice, this list of 7* conditions and the following disclaimer. 8* * Redistributions in binary form must reproduce the above copyright notice, this list of 9* conditions and the following disclaimer in the documentation and/or other materials provided 10* with the distribution. 11* * Neither the name of The Linux Foundation nor the names of its contributors may be used to 12* endorse or promote products derived from this software without specific prior written 13* permission. 14* 15* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 18* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 21* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23*/ 24 25#ifndef __HW_INTERFACE_H__ 26#define __HW_INTERFACE_H__ 27 28#include <core/display_interface.h> 29#include <private/hw_info_types.h> 30#include <private/color_interface.h> 31#include <utils/constants.h> 32#include <core/buffer_sync_handler.h> 33 34namespace sdm { 35 36enum HWScanSupport { 37 kScanNotSupported, 38 kScanAlwaysOverscanned, 39 kScanAlwaysUnderscanned, 40 kScanBoth, 41}; 42 43struct HWScanInfo { 44 HWScanSupport pt_scan_support; // Scan support for preferred timing 45 HWScanSupport it_scan_support; // Scan support for digital monitor or industry timings 46 HWScanSupport cea_scan_support; // Scan support for CEA resolution timings 47 48 HWScanInfo() : pt_scan_support(kScanNotSupported), it_scan_support(kScanNotSupported), 49 cea_scan_support(kScanNotSupported) { } 50}; 51 52// HWEventHandler - Implemented in DisplayBase and HWInterface implementation 53class HWEventHandler { 54 public: 55 virtual DisplayError VSync(int64_t timestamp) = 0; 56 virtual DisplayError Blank(bool blank) = 0; 57 virtual void IdleTimeout() = 0; 58 virtual void ThermalEvent(int64_t thermal_level) = 0; 59 virtual void CECMessage(char *message) = 0; 60 61 protected: 62 virtual ~HWEventHandler() { } 63}; 64 65class HWInterface { 66 public: 67 virtual DisplayError GetActiveConfig(uint32_t *active_config) = 0; 68 virtual DisplayError GetNumDisplayAttributes(uint32_t *count) = 0; 69 virtual DisplayError GetDisplayAttributes(uint32_t index, 70 HWDisplayAttributes *display_attributes) = 0; 71 virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info) = 0; 72 virtual DisplayError SetDisplayAttributes(uint32_t index) = 0; 73 virtual DisplayError SetDisplayAttributes(const HWDisplayAttributes &display_attributes) = 0; 74 virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index) = 0; 75 virtual DisplayError PowerOn() = 0; 76 virtual DisplayError PowerOff() = 0; 77 virtual DisplayError Doze() = 0; 78 virtual DisplayError DozeSuspend() = 0; 79 virtual DisplayError Standby() = 0; 80 virtual DisplayError Validate(HWLayers *hw_layers) = 0; 81 virtual DisplayError Commit(HWLayers *hw_layers) = 0; 82 virtual DisplayError Flush() = 0; 83 virtual DisplayError GetPPFeaturesVersion(PPFeatureVersion *vers) = 0; 84 virtual DisplayError SetPPFeatures(PPFeaturesConfig *feature_list) = 0; 85 virtual DisplayError SetVSyncState(bool enable) = 0; 86 virtual void SetIdleTimeoutMs(uint32_t timeout_ms) = 0; 87 virtual DisplayError SetDisplayMode(const HWDisplayMode hw_display_mode) = 0; 88 virtual DisplayError SetRefreshRate(uint32_t refresh_rate) = 0; 89 virtual DisplayError SetPanelBrightness(int level) = 0; 90 virtual DisplayError GetHWScanInfo(HWScanInfo *scan_info) = 0; 91 virtual DisplayError GetVideoFormat(uint32_t config_index, uint32_t *video_format) = 0; 92 virtual DisplayError GetMaxCEAFormat(uint32_t *max_cea_format) = 0; 93 virtual DisplayError SetCursorPosition(HWLayers *hw_layers, int x, int y) = 0; 94 virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) = 0; 95 virtual DisplayError GetPanelBrightness(int *level) = 0; 96 virtual DisplayError SetAutoRefresh(bool enable) = 0; 97 virtual DisplayError SetS3DMode(HWS3DMode s3d_mode) = 0; 98 virtual DisplayError SetScaleLutConfig(HWScaleLutInfo *lut_info) = 0; 99 virtual DisplayError SetMixerAttributes(const HWMixerAttributes &mixer_attributes) = 0; 100 virtual DisplayError GetMixerAttributes(HWMixerAttributes *mixer_attributes) = 0; 101 102 protected: 103 virtual ~HWInterface() { } 104}; 105 106} // namespace sdm 107 108#endif // __HW_INTERFACE_H__ 109 110