1 /* 2 * Copyright (c) 2014 - 2015, 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 34 namespace sdm { 35 36 enum HWScanSupport { 37 kScanNotSupported, 38 kScanAlwaysOverscanned, 39 kScanAlwaysUnderscanned, 40 kScanBoth, 41 }; 42 43 struct 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 HWScanInfoHWScanInfo48 HWScanInfo() : pt_scan_support(kScanNotSupported), it_scan_support(kScanNotSupported), 49 cea_scan_support(kScanNotSupported) { } 50 }; 51 52 // HWEventHandler - Implemented in DisplayBase and HWInterface implementation 53 class 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 protected: ~HWEventHandler()60 virtual ~HWEventHandler() { } 61 }; 62 63 class HWInterface { 64 public: 65 virtual DisplayError GetActiveConfig(uint32_t *active_config) = 0; 66 virtual DisplayError GetNumDisplayAttributes(uint32_t *count) = 0; 67 virtual DisplayError GetDisplayAttributes(uint32_t index, 68 HWDisplayAttributes *display_attributes) = 0; 69 virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info) = 0; 70 virtual DisplayError SetDisplayAttributes(uint32_t index) = 0; 71 virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index) = 0; 72 virtual DisplayError PowerOn() = 0; 73 virtual DisplayError PowerOff() = 0; 74 virtual DisplayError Doze() = 0; 75 virtual DisplayError DozeSuspend() = 0; 76 virtual DisplayError Standby() = 0; 77 virtual DisplayError Validate(HWLayers *hw_layers) = 0; 78 virtual DisplayError Commit(HWLayers *hw_layers) = 0; 79 virtual DisplayError Flush() = 0; 80 virtual DisplayError GetPPFeaturesVersion(PPFeatureVersion *vers) = 0; 81 virtual DisplayError SetPPFeatures(PPFeaturesConfig *feature_list) = 0; 82 virtual DisplayError SetVSyncState(bool enable) = 0; 83 virtual void SetIdleTimeoutMs(uint32_t timeout_ms) = 0; 84 virtual DisplayError SetDisplayMode(const HWDisplayMode hw_display_mode) = 0; 85 virtual DisplayError SetRefreshRate(uint32_t refresh_rate) = 0; 86 virtual DisplayError SetPanelBrightness(int level) = 0; 87 virtual DisplayError GetHWScanInfo(HWScanInfo *scan_info) = 0; 88 virtual DisplayError GetVideoFormat(uint32_t config_index, uint32_t *video_format) = 0; 89 virtual DisplayError GetMaxCEAFormat(uint32_t *max_cea_format) = 0; 90 virtual DisplayError SetCursorPosition(HWLayers *hw_layers, int x, int y) = 0; 91 virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) = 0; 92 virtual DisplayError GetPanelBrightness(int *level) = 0; 93 virtual DisplayError SetAutoRefresh(bool enable) = 0; 94 virtual DisplayError SetS3DMode(HWS3DMode s3d_mode) = 0; 95 96 protected: ~HWInterface()97 virtual ~HWInterface() { } 98 }; 99 100 } // namespace sdm 101 102 #endif // __HW_INTERFACE_H__ 103 104