blob: 2e7bd097b6a04948c84d7c93d149cca33f5bb5d7 [file] [log] [blame]
Dileep Marchya96db2582014-10-27 20:58:37 -07001/*
Gousemoodhin Nadafc81fd0b2019-01-16 14:40:39 +05302* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
Dileep Marchya96db2582014-10-27 20:58:37 -07003*
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 Karimpanal731bc932017-11-22 10:04:56 +053025#ifndef __DISPLAY_PLUGGABLE_H__
26#define __DISPLAY_PLUGGABLE_H__
Dileep Marchya96db2582014-10-27 20:58:37 -070027
Yang Xu46ef2812015-12-03 17:35:22 +080028#include <map>
Arun Kumar K.R7ec90382018-07-17 09:32:03 +053029#include <string>
Mathew Joseph Karimpanal731bc932017-11-22 10:04:56 +053030#include <vector>
Yang Xu46ef2812015-12-03 17:35:22 +080031
Ramkumar Radhakrishnand33432e2014-11-16 13:23:19 -080032#include "display_base.h"
Saurabh Shah7d476ed2016-06-27 16:40:58 -070033#include "hw_events_interface.h"
Dileep Marchya96db2582014-10-27 20:58:37 -070034
Dileep Marchya73d002e2015-05-08 18:58:33 -070035namespace sdm {
Dileep Marchya96db2582014-10-27 20:58:37 -070036
Mathew Joseph Karimpanal731bc932017-11-22 10:04:56 +053037class DisplayPluggable : public DisplayBase, HWEventHandler {
Dileep Marchya96db2582014-10-27 20:58:37 -070038 public:
Mathew Joseph Karimpanal731bc932017-11-22 10:04:56 +053039 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 Chipeperekwa9a55b8a2015-02-26 15:18:41 -080045 virtual DisplayError Init();
Saurabh Shahc29803d2016-06-20 16:09:37 -070046 virtual DisplayError Prepare(LayerStack *layer_stack);
Arun Kumar K.Rad911322015-07-16 12:31:47 -070047 virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate, uint32_t *max_refresh_rate);
Anjaneya Prasad Musunuri4d65df72017-05-18 19:11:28 +053048 virtual DisplayError SetRefreshRate(uint32_t refresh_rate, bool final_rate);
Tatenda Chipeperekwaed83d822015-04-23 18:12:38 -070049 virtual bool IsUnderscanSupported();
Dileep Marchyaa5b764f2015-10-12 13:06:51 -070050 virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
Arun Kumar K.Rd761c1a2018-04-26 19:47:44 +053051 virtual DisplayError InitializeColorModes();
Gousemoodhin Nadaf56186602018-06-03 15:23:10 +053052 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.R3cbf7392018-07-20 15:24:28 +053056 virtual DisplayError SetColorTransform(const uint32_t length, const double *color_transform) {
57 return kErrorNone;
58 }
Gurpreet Singh Dhami1207e462018-12-27 20:02:02 -050059 virtual DisplayError TeardownConcurrentWriteback(void) { return kErrorNotSupported; }
Tatenda Chipeperekwa9a55b8a2015-02-26 15:18:41 -080060
Tatenda Chipeperekwab37a9b82016-04-01 12:26:15 -070061 // Implement the HWEventHandlers
Tatenda Chipeperekwa38e9e792016-04-15 13:12:28 -070062 virtual DisplayError VSync(int64_t timestamp);
Tatenda Chipeperekwab37a9b82016-04-01 12:26:15 -070063 virtual DisplayError Blank(bool blank) { return kErrorNone; }
Mathew Joseph Karimpanal731bc932017-11-22 10:04:56 +053064 virtual void IdleTimeout() {}
65 virtual void ThermalEvent(int64_t thermal_level) {}
Tatenda Chipeperekwab37a9b82016-04-01 12:26:15 -070066 virtual void CECMessage(char *message);
Mathew Joseph Karimpanal731bc932017-11-22 10:04:56 +053067 virtual void IdlePowerCollapse() {}
68 virtual void PingPongTimeout() {}
69 virtual void PanelDead() {}
Varun Arora7c8ee542018-05-01 20:58:16 -070070 virtual void HwRecovery(const HWRecoveryEvent sdm_event_code);
Tatenda Chipeperekwab37a9b82016-04-01 12:26:15 -070071
Gousemoodhin Nadaf56186602018-06-03 15:23:10 +053072 void UpdateColorModes();
Gousemoodhin Nadaf47b82be2019-05-09 15:30:11 +053073 void InitializeColorModesFromColorspace();
Gousemoodhin Nadaf56186602018-06-03 15:23:10 +053074
Tatenda Chipeperekwa9a55b8a2015-02-26 15:18:41 -080075 private:
Mathew Joseph Karimpanal351bf872018-08-28 16:08:28 +053076 DisplayError GetOverrideConfig(uint32_t *mode_index);
Saurabh Shahc29803d2016-06-20 16:09:37 -070077 void GetScanSupport();
Arun Kumar K.Rd761c1a2018-04-26 19:47:44 +053078
srikanth rajagopalan5d320c62017-06-05 21:08:57 -070079 static const int kPropertyMax = 256;
Tatenda Chipeperekwa8b7a97f2015-03-30 18:24:09 -070080
Saurabh Shahc29803d2016-06-20 16:09:37 -070081 bool underscan_supported_ = false;
Tatenda Chipeperekwaed83d822015-04-23 18:12:38 -070082 HWScanSupport scan_support_;
Mathew Joseph Karimpanal731bc932017-11-22 10:04:56 +053083 std::vector<HWEvent> event_list_ = {HWEvent::VSYNC, HWEvent::IDLE_NOTIFY, HWEvent::EXIT,
84 HWEvent::CEC_READ_MESSAGE, HWEvent::HW_RECOVERY};
Anjaneya Prasad Musunuri4d65df72017-05-18 19:11:28 +053085 uint32_t current_refresh_rate_ = 0;
Dileep Marchya96db2582014-10-27 20:58:37 -070086};
87
Dileep Marchya73d002e2015-05-08 18:58:33 -070088} // namespace sdm
Dileep Marchya96db2582014-10-27 20:58:37 -070089
Mathew Joseph Karimpanal731bc932017-11-22 10:04:56 +053090#endif // __DISPLAY_PLUGGABLE_H__