1 /* 2 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above 10 * copyright notice, this list of conditions and the following 11 * disclaimer in the documentation and/or other materials provided 12 * with the distribution. 13 * * Neither the name of The Linux Foundation nor the names of its 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #ifndef __DISPLAY_NULL_H__ 31 #define __DISPLAY_NULL_H__ 32 33 #include <core/display_interface.h> 34 #include <string> 35 #include <vector> 36 37 namespace sdm { 38 39 using std::string; 40 using std::vector; 41 42 #define MAKE_NO_OP(virtual_method_signature) \ 43 virtual DisplayError virtual_method_signature { return kErrorNone; } 44 45 class DisplayNull : public DisplayInterface { 46 public: ~DisplayNull()47 virtual ~DisplayNull() { } 48 virtual DisplayError Init(); 49 virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height); 50 51 virtual DisplayError GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info); 52 virtual DisplayError GetConfig(uint32_t index, DisplayConfigVariableInfo *disp_attr); 53 virtual DisplayError GetConfig(DisplayConfigFixedInfo *fixed_info); 54 virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate, uint32_t *max_refresh_rate); 55 virtual DisplayError GetActiveConfig(uint32_t *config); 56 virtual DisplayError GetNumVariableInfoConfigs(uint32_t *count); 57 virtual DisplayError Prepare(LayerStack *layer_stack); IsPrimaryDisplay()58 virtual bool IsPrimaryDisplay() { return true; } IsUnderscanSupported()59 virtual bool IsUnderscanSupported() { return true; } SetIdleTimeoutMs(uint32_t active_ms)60 virtual void SetIdleTimeoutMs(uint32_t active_ms) { } 61 virtual DisplayError GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size, 62 uint8_t *out_data); Dump()63 virtual string Dump() { return ""; } IsSupportSsppTonemap()64 virtual bool IsSupportSsppTonemap() { return false; } IsSupportPanelBrightnessControl()65 virtual bool IsSupportPanelBrightnessControl() { return false; } CanSkipValidate()66 virtual bool CanSkipValidate() { return true; } 67 68 MAKE_NO_OP(TeardownConcurrentWriteback(void)) 69 MAKE_NO_OP(Commit(LayerStack *)) 70 MAKE_NO_OP(GetDisplayState(DisplayState *)) 71 MAKE_NO_OP(SetDisplayState(DisplayState, bool, int*)) 72 MAKE_NO_OP(SetFrameBufferConfig(const DisplayConfigVariableInfo &)) 73 MAKE_NO_OP(Flush(LayerStack *)) 74 MAKE_NO_OP(GetVSyncState(bool *)) 75 MAKE_NO_OP(SetActiveConfig(uint32_t)) 76 MAKE_NO_OP(SetActiveConfig(DisplayConfigVariableInfo *)) 77 MAKE_NO_OP(SetMaxMixerStages(uint32_t)) 78 MAKE_NO_OP(ControlPartialUpdate(bool, uint32_t *)) 79 MAKE_NO_OP(DisablePartialUpdateOneFrame()) 80 MAKE_NO_OP(SetDisplayMode(uint32_t)) 81 MAKE_NO_OP(SetPanelBrightness(int32_t)) 82 MAKE_NO_OP(CachePanelBrightness(int)) 83 MAKE_NO_OP(OnMinHdcpEncryptionLevelChange(uint32_t)) 84 MAKE_NO_OP(ColorSVCRequestRoute(const PPDisplayAPIPayload &, PPDisplayAPIPayload *, 85 PPPendingParams *)) 86 MAKE_NO_OP(GetColorModeCount(uint32_t *)) 87 MAKE_NO_OP(GetColorModes(uint32_t *, vector<string> *)) 88 MAKE_NO_OP(GetColorModeAttr(const string &, AttrVal *)) 89 MAKE_NO_OP(SetColorMode(const string &)) 90 MAKE_NO_OP(SetColorModeById(int32_t)) 91 MAKE_NO_OP(GetColorModeName(int32_t, string *)) 92 MAKE_NO_OP(SetColorTransform(const uint32_t, const double *)) 93 MAKE_NO_OP(GetDefaultColorMode(string *)) 94 MAKE_NO_OP(SetCursorPosition(int, int)) 95 MAKE_NO_OP(SetRefreshRate(uint32_t, bool)) 96 MAKE_NO_OP(GetPanelBrightness(int32_t &) const) 97 MAKE_NO_OP(GetPanelMaxBrightness(int32_t &) const) 98 MAKE_NO_OP(GetRefreshRate(uint32_t *)) 99 MAKE_NO_OP(SetVSyncState(bool)) 100 MAKE_NO_OP(SetMixerResolution(uint32_t, uint32_t)) 101 MAKE_NO_OP(SetDetailEnhancerData(const DisplayDetailEnhancerData &)) 102 MAKE_NO_OP(GetDisplayPort(DisplayPort *)) 103 MAKE_NO_OP(GetDisplayId(int32_t *)) 104 MAKE_NO_OP(GetDisplayType(DisplayType *)) 105 MAKE_NO_OP(SetCompositionState(LayerComposition, bool)) 106 MAKE_NO_OP(GetClientTargetSupport(uint32_t, uint32_t, LayerBufferFormat, 107 const ColorMetaData &)) 108 MAKE_NO_OP(HandleSecureEvent(SecureEvent, LayerStack *)) 109 MAKE_NO_OP(SetQSyncMode(QSyncMode)) 110 MAKE_NO_OP(ControlIdlePowerCollapse(bool, bool)) 111 MAKE_NO_OP(SetDisplayDppsAdROI(void *)) 112 MAKE_NO_OP(SetDynamicDSIClock(uint64_t bit_clk_rate)) 113 MAKE_NO_OP(GetDynamicDSIClock(uint64_t *bit_clk_rate)) 114 MAKE_NO_OP(GetSupportedDSIClock(vector<uint64_t> *bitclk_rates)) 115 MAKE_NO_OP(colorSamplingOn()); 116 MAKE_NO_OP(colorSamplingOff()); 117 MAKE_NO_OP(SetPanelLuminanceAttributes(float min_lum, float max_lum)) 118 119 protected: 120 DisplayConfigVariableInfo default_variable_config_ = {}; 121 DisplayConfigFixedInfo default_fixed_config_ = {}; 122 // 1920x1080 60fps panel of name Null Display with PnPID QCM 123 // Contains many 'don't-care' fields and valid checksum bytes 124 const vector<uint8_t> edid_{ 125 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x44, 0x6D, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 126 0x1B, 0x10, 0x01, 0x03, 0x80, 0x50, 0x2D, 0x78, 0x0A, 0x0D, 0xC9, 0xA0, 0x57, 0x47, 0x98, 0x27, 127 0x12, 0x48, 0x4C, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 128 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, 129 0x45, 0x00, 0x50, 0x1D, 0x74, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x4E, 0x75, 0x6C, 130 0x6C, 0x20, 0x44, 0x69, 0x73, 0x70, 0x6C, 0x61, 0x79, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD1 133 }; 134 }; 135 136 class DisplayNullExternal : public DisplayNull { 137 public: 138 virtual DisplayError Commit(LayerStack *layer_stack); 139 virtual DisplayError GetDisplayState(DisplayState *state); 140 virtual DisplayError SetDisplayState(DisplayState state, bool teardown, 141 int *release_fence); 142 virtual DisplayError SetFrameBufferConfig(const DisplayConfigVariableInfo &variable_info); 143 virtual DisplayError GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info); 144 virtual DisplayError GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size, 145 uint8_t *out_data); SetActive(bool active)146 void SetActive(bool active) { active_ = active; } IsActive()147 bool IsActive() { return active_; } 148 149 private: 150 bool active_ = false; 151 DisplayState state_ = kStateOff; 152 DisplayConfigVariableInfo fb_config_ = {}; 153 }; 154 155 } // namespace sdm 156 157 #endif // __DISPLAY_NULL_H__ 158