• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2015 - 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_HDMI_H__
26 #define __HW_HDMI_H__
27 
28 #include <video/msm_hdmi_modes.h>
29 #include <map>
30 #include <vector>
31 
32 #include "hw_device.h"
33 
34 namespace sdm {
35 
36 using std::vector;
37 
38 class HWHDMI : public HWDevice {
39  public:
40   static DisplayError Create(HWInterface **intf, HWInfoInterface *hw_info_intf,
41                              BufferSyncHandler *buffer_sync_handler);
42   static DisplayError Destroy(HWInterface *intf);
43 
44  protected:
45   enum HWFramerateUpdate {
46     // Switch framerate by switch to other standard modes though panel blank/unblank
47     kModeSuspendResume,
48     // Switch framerate by tuning pixel clock
49     kModeClock,
50     // Switch framerate by tuning vertical front porch
51     kModeVFP,
52     // Switch framerate by tuning horizontal front porch
53     kModeHFP,
54     kModeMAX
55   };
56 
57   HWHDMI(BufferSyncHandler *buffer_sync_handler, HWInfoInterface *hw_info_intf);
58   virtual DisplayError Init();
59   virtual DisplayError Deinit();
60   virtual DisplayError GetNumDisplayAttributes(uint32_t *count);
61   // Requirement to call this only after the first config has been explicitly set by client
62   virtual DisplayError GetActiveConfig(uint32_t *active_config);
63   virtual DisplayError GetDisplayAttributes(uint32_t index,
64                                             HWDisplayAttributes *display_attributes);
65   virtual DisplayError GetHWScanInfo(HWScanInfo *scan_info);
66   virtual DisplayError GetVideoFormat(uint32_t config_index, uint32_t *video_format);
67   virtual DisplayError GetMaxCEAFormat(uint32_t *max_cea_format);
68   virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
69   virtual DisplayError SetDisplayAttributes(uint32_t index);
70   virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index);
71   virtual DisplayError Validate(HWLayers *hw_layers);
72   virtual DisplayError SetS3DMode(HWS3DMode s3d_mode);
73   virtual DisplayError SetRefreshRate(uint32_t refresh_rate);
74 
75  private:
76   DisplayError ReadEDIDInfo();
77   void ReadScanInfo();
78   HWScanSupport MapHWScanSupport(uint32_t value);
79   int OpenResolutionFile(int file_mode);
80   void RequestNewPage(uint32_t page_number);
81   DisplayError ReadTimingInfo();
82   bool ReadResolutionFile(char *config_buffer);
83   bool IsResolutionFilePresent();
84   void SetSourceProductInformation(const char *node, const char *name);
85   DisplayError GetDisplayS3DSupport(uint32_t num_modes,
86                                     HWDisplayAttributes *attrib);
87   bool IsSupportedS3DMode(HWS3DMode s3d_mode);
88   void UpdateMixerAttributes();
89 
90   vector<uint32_t> hdmi_modes_;
91   // Holds the hdmi timing information. Ex: resolution, fps etc.,
92   vector<msm_hdmi_mode_timing_info> supported_video_modes_;
93   HWScanInfo hw_scan_info_;
94   uint32_t active_config_index_;
95   std::map<HWS3DMode, msm_hdmi_s3d_mode> s3d_mode_sdm_to_mdp_;
96   vector<HWS3DMode> supported_s3d_modes_;
97   int active_mdp_s3d_mode_ = HDMI_S3D_NONE;
98   uint32_t frame_rate_ = 0;
99 };
100 
101 }  // namespace sdm
102 
103 #endif  // __HW_HDMI_H__
104 
105