Dileep Marchya | 96db258 | 2014-10-27 20:58:37 -0700 | [diff] [blame] | 1 | /* |
Gousemoodhin Nadaf | c81fd0b | 2019-01-16 14:40:39 +0530 | [diff] [blame] | 2 | * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. |
Dileep Marchya | 96db258 | 2014-10-27 20:58:37 -0700 | [diff] [blame] | 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 | |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 25 | #ifndef __DISPLAY_PLUGGABLE_H__ |
| 26 | #define __DISPLAY_PLUGGABLE_H__ |
Dileep Marchya | 96db258 | 2014-10-27 20:58:37 -0700 | [diff] [blame] | 27 | |
Yang Xu | 46ef281 | 2015-12-03 17:35:22 +0800 | [diff] [blame] | 28 | #include <map> |
Arun Kumar K.R | 7ec9038 | 2018-07-17 09:32:03 +0530 | [diff] [blame] | 29 | #include <string> |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 30 | #include <vector> |
Yang Xu | 46ef281 | 2015-12-03 17:35:22 +0800 | [diff] [blame] | 31 | |
Ramkumar Radhakrishnan | d33432e | 2014-11-16 13:23:19 -0800 | [diff] [blame] | 32 | #include "display_base.h" |
Saurabh Shah | 7d476ed | 2016-06-27 16:40:58 -0700 | [diff] [blame] | 33 | #include "hw_events_interface.h" |
Dileep Marchya | 96db258 | 2014-10-27 20:58:37 -0700 | [diff] [blame] | 34 | |
Dileep Marchya | 73d002e | 2015-05-08 18:58:33 -0700 | [diff] [blame] | 35 | namespace sdm { |
Dileep Marchya | 96db258 | 2014-10-27 20:58:37 -0700 | [diff] [blame] | 36 | |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 37 | class DisplayPluggable : public DisplayBase, HWEventHandler { |
Dileep Marchya | 96db258 | 2014-10-27 20:58:37 -0700 | [diff] [blame] | 38 | public: |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 39 | DisplayPluggable(DisplayEventHandler *event_handler, HWInfoInterface *hw_info_intf, |
| 40 | BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator, |
| 41 | CompManager *comp_manager); |
| 42 | DisplayPluggable(int32_t display_id, DisplayEventHandler *event_handler, |
| 43 | HWInfoInterface *hw_info_intf, BufferSyncHandler *buffer_sync_handler, |
| 44 | BufferAllocator *buffer_allocator, CompManager *comp_manager); |
Tatenda Chipeperekwa | 9a55b8a | 2015-02-26 15:18:41 -0800 | [diff] [blame] | 45 | virtual DisplayError Init(); |
Saurabh Shah | c29803d | 2016-06-20 16:09:37 -0700 | [diff] [blame] | 46 | virtual DisplayError Prepare(LayerStack *layer_stack); |
Arun Kumar K.R | ad91132 | 2015-07-16 12:31:47 -0700 | [diff] [blame] | 47 | virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate, uint32_t *max_refresh_rate); |
Anjaneya Prasad Musunuri | 4d65df7 | 2017-05-18 19:11:28 +0530 | [diff] [blame] | 48 | virtual DisplayError SetRefreshRate(uint32_t refresh_rate, bool final_rate); |
Tatenda Chipeperekwa | ed83d82 | 2015-04-23 18:12:38 -0700 | [diff] [blame] | 49 | virtual bool IsUnderscanSupported(); |
Dileep Marchya | a5b764f | 2015-10-12 13:06:51 -0700 | [diff] [blame] | 50 | virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level); |
Arun Kumar K.R | d761c1a | 2018-04-26 19:47:44 +0530 | [diff] [blame] | 51 | virtual DisplayError InitializeColorModes(); |
Gousemoodhin Nadaf | 5618660 | 2018-06-03 15:23:10 +0530 | [diff] [blame] | 52 | virtual DisplayError SetColorMode(const std::string &color_mode); |
| 53 | virtual DisplayError GetColorModeCount(uint32_t *mode_count); |
| 54 | virtual DisplayError GetColorModes(uint32_t *mode_count, std::vector<std::string> *color_modes); |
| 55 | virtual DisplayError GetColorModeAttr(const std::string &color_mode, AttrVal *attr); |
Arun Kumar K.R | 3cbf739 | 2018-07-20 15:24:28 +0530 | [diff] [blame] | 56 | virtual DisplayError SetColorTransform(const uint32_t length, const double *color_transform) { |
| 57 | return kErrorNone; |
| 58 | } |
Gurpreet Singh Dhami | 1207e46 | 2018-12-27 20:02:02 -0500 | [diff] [blame] | 59 | virtual DisplayError TeardownConcurrentWriteback(void) { return kErrorNotSupported; } |
Tatenda Chipeperekwa | 9a55b8a | 2015-02-26 15:18:41 -0800 | [diff] [blame] | 60 | |
Tatenda Chipeperekwa | b37a9b8 | 2016-04-01 12:26:15 -0700 | [diff] [blame] | 61 | // Implement the HWEventHandlers |
Tatenda Chipeperekwa | 38e9e79 | 2016-04-15 13:12:28 -0700 | [diff] [blame] | 62 | virtual DisplayError VSync(int64_t timestamp); |
Tatenda Chipeperekwa | b37a9b8 | 2016-04-01 12:26:15 -0700 | [diff] [blame] | 63 | virtual DisplayError Blank(bool blank) { return kErrorNone; } |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 64 | virtual void IdleTimeout() {} |
| 65 | virtual void ThermalEvent(int64_t thermal_level) {} |
Tatenda Chipeperekwa | b37a9b8 | 2016-04-01 12:26:15 -0700 | [diff] [blame] | 66 | virtual void CECMessage(char *message); |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 67 | virtual void IdlePowerCollapse() {} |
| 68 | virtual void PingPongTimeout() {} |
| 69 | virtual void PanelDead() {} |
Varun Arora | 7c8ee54 | 2018-05-01 20:58:16 -0700 | [diff] [blame] | 70 | virtual void HwRecovery(const HWRecoveryEvent sdm_event_code); |
Tatenda Chipeperekwa | b37a9b8 | 2016-04-01 12:26:15 -0700 | [diff] [blame] | 71 | |
Gousemoodhin Nadaf | 5618660 | 2018-06-03 15:23:10 +0530 | [diff] [blame] | 72 | void UpdateColorModes(); |
Gousemoodhin Nadaf | 47b82be | 2019-05-09 15:30:11 +0530 | [diff] [blame^] | 73 | void InitializeColorModesFromColorspace(); |
Gousemoodhin Nadaf | 5618660 | 2018-06-03 15:23:10 +0530 | [diff] [blame] | 74 | |
Tatenda Chipeperekwa | 9a55b8a | 2015-02-26 15:18:41 -0800 | [diff] [blame] | 75 | private: |
Mathew Joseph Karimpanal | 351bf87 | 2018-08-28 16:08:28 +0530 | [diff] [blame] | 76 | DisplayError GetOverrideConfig(uint32_t *mode_index); |
Saurabh Shah | c29803d | 2016-06-20 16:09:37 -0700 | [diff] [blame] | 77 | void GetScanSupport(); |
Arun Kumar K.R | d761c1a | 2018-04-26 19:47:44 +0530 | [diff] [blame] | 78 | |
srikanth rajagopalan | 5d320c6 | 2017-06-05 21:08:57 -0700 | [diff] [blame] | 79 | static const int kPropertyMax = 256; |
Tatenda Chipeperekwa | 8b7a97f | 2015-03-30 18:24:09 -0700 | [diff] [blame] | 80 | |
Saurabh Shah | c29803d | 2016-06-20 16:09:37 -0700 | [diff] [blame] | 81 | bool underscan_supported_ = false; |
Tatenda Chipeperekwa | ed83d82 | 2015-04-23 18:12:38 -0700 | [diff] [blame] | 82 | HWScanSupport scan_support_; |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 83 | std::vector<HWEvent> event_list_ = {HWEvent::VSYNC, HWEvent::IDLE_NOTIFY, HWEvent::EXIT, |
| 84 | HWEvent::CEC_READ_MESSAGE, HWEvent::HW_RECOVERY}; |
Anjaneya Prasad Musunuri | 4d65df7 | 2017-05-18 19:11:28 +0530 | [diff] [blame] | 85 | uint32_t current_refresh_rate_ = 0; |
Dileep Marchya | 96db258 | 2014-10-27 20:58:37 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
Dileep Marchya | 73d002e | 2015-05-08 18:58:33 -0700 | [diff] [blame] | 88 | } // namespace sdm |
Dileep Marchya | 96db258 | 2014-10-27 20:58:37 -0700 | [diff] [blame] | 89 | |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 90 | #endif // __DISPLAY_PLUGGABLE_H__ |