1 /* 2 * Copyright (c) 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_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 class HWHDMI : public HWDevice { 37 public: 38 static DisplayError Create(HWInterface **intf, HWInfoInterface *hw_info_intf, 39 BufferSyncHandler *buffer_sync_handler); 40 static DisplayError Destroy(HWInterface *intf); 41 42 protected: 43 HWHDMI(BufferSyncHandler *buffer_sync_handler, HWInfoInterface *hw_info_intf); 44 virtual DisplayError Init(HWEventHandler *eventhandler); 45 virtual DisplayError Deinit(); 46 virtual DisplayError GetNumDisplayAttributes(uint32_t *count); 47 // Requirement to call this only after the first config has been explicitly set by client 48 virtual DisplayError GetActiveConfig(uint32_t *active_config); 49 virtual DisplayError GetDisplayAttributes(uint32_t index, 50 HWDisplayAttributes *display_attributes); 51 virtual DisplayError GetHWScanInfo(HWScanInfo *scan_info); 52 virtual DisplayError GetVideoFormat(uint32_t config_index, uint32_t *video_format); 53 virtual DisplayError GetMaxCEAFormat(uint32_t *max_cea_format); 54 virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level); 55 virtual DisplayError SetDisplayAttributes(uint32_t index); 56 virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index); 57 virtual DisplayError Validate(HWLayers *hw_layers); 58 virtual DisplayError SetS3DMode(HWS3DMode s3d_mode); 59 60 private: 61 DisplayError ReadEDIDInfo(); 62 void ReadScanInfo(); 63 HWScanSupport MapHWScanSupport(uint32_t value); 64 int OpenResolutionFile(int file_mode); 65 void RequestNewPage(uint32_t page_number); 66 DisplayError ReadTimingInfo(); 67 bool ReadResolutionFile(char *config_buffer); 68 bool IsResolutionFilePresent(); 69 void SetSourceProductInformation(const char *node, const char *name); 70 DisplayError GetDisplayS3DSupport(uint32_t num_modes, 71 HWDisplayAttributes *attrib); 72 bool IsSupportedS3DMode(HWS3DMode s3d_mode); 73 74 uint32_t hdmi_mode_count_; 75 uint32_t hdmi_modes_[256]; 76 // Holds the hdmi timing information. Ex: resolution, fps etc., 77 msm_hdmi_mode_timing_info *supported_video_modes_; 78 HWScanInfo hw_scan_info_; 79 uint32_t active_config_index_; 80 std::map<HWS3DMode, msm_hdmi_s3d_mode> s3d_mode_sdm_to_mdp_; 81 std::vector<HWS3DMode> supported_s3d_modes_; 82 int active_mdp_s3d_mode_ = HDMI_S3D_NONE; 83 }; 84 85 } // namespace sdm 86 87 #endif // __HW_HDMI_H__ 88 89