1 /* 2 * Copyright (c) 2017, 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 #define MAKE_NO_OP(virtual_method_name) \ 40 virtual DisplayError virtual_method_name { return kErrorNone; } 41 42 class DisplayNull : public DisplayInterface { 43 public: ~DisplayNull()44 virtual ~DisplayNull() { } 45 virtual DisplayError Commit(LayerStack *layer_stack); 46 virtual DisplayError GetDisplayState(DisplayState *state); 47 virtual DisplayError SetDisplayState(DisplayState state); 48 virtual DisplayError SetFrameBufferConfig(const DisplayConfigVariableInfo &variable_info); 49 virtual DisplayError GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info); IsUnderscanSupported()50 virtual bool IsUnderscanSupported() { return true; } SetIdleTimeoutMs(uint32_t active_ms)51 virtual void SetIdleTimeoutMs(uint32_t active_ms) { } IsPrimaryDisplay()52 virtual bool IsPrimaryDisplay() { return true; } 53 SetActive(bool active)54 void SetActive(bool active) { 55 active_ = active; 56 } 57 IsActive()58 bool IsActive() { 59 return active_; 60 } 61 62 MAKE_NO_OP(Prepare(LayerStack *)) 63 MAKE_NO_OP(Flush()) 64 MAKE_NO_OP(GetNumVariableInfoConfigs(uint32_t *)) 65 MAKE_NO_OP(GetConfig(uint32_t, DisplayConfigVariableInfo *)) 66 MAKE_NO_OP(GetConfig(DisplayConfigFixedInfo *)) 67 MAKE_NO_OP(GetActiveConfig(uint32_t *)) 68 MAKE_NO_OP(GetVSyncState(bool *)) 69 MAKE_NO_OP(SetActiveConfig(uint32_t)) 70 MAKE_NO_OP(SetActiveConfig(DisplayConfigVariableInfo *)) 71 MAKE_NO_OP(SetMaxMixerStages(uint32_t)) 72 MAKE_NO_OP(ControlPartialUpdate(bool, uint32_t *)) 73 MAKE_NO_OP(DisablePartialUpdateOneFrame()) 74 MAKE_NO_OP(SetDisplayMode(uint32_t)) 75 MAKE_NO_OP(SetPanelBrightness(int)) 76 MAKE_NO_OP(CachePanelBrightness(int)) 77 MAKE_NO_OP(OnMinHdcpEncryptionLevelChange(uint32_t)) 78 MAKE_NO_OP(ColorSVCRequestRoute(const PPDisplayAPIPayload &, PPDisplayAPIPayload *, 79 PPPendingParams *)) 80 MAKE_NO_OP(GetColorModeCount(uint32_t *)) 81 MAKE_NO_OP(GetColorModes(uint32_t *, std::vector<std::string> *)) 82 MAKE_NO_OP(GetColorModeAttr(const std::string &, AttrVal *)) 83 MAKE_NO_OP(SetColorMode(const std::string &)) 84 MAKE_NO_OP(SetColorModeById(int32_t)) 85 MAKE_NO_OP(SetColorTransform(const uint32_t, const double *)) 86 MAKE_NO_OP(GetDefaultColorMode(std::string *)) 87 MAKE_NO_OP(ApplyDefaultDisplayMode()) 88 MAKE_NO_OP(SetCursorPosition(int, int)) 89 MAKE_NO_OP(GetRefreshRateRange(uint32_t *, uint32_t *)) 90 MAKE_NO_OP(SetRefreshRate(uint32_t)) 91 MAKE_NO_OP(GetPanelBrightness(int *)) 92 MAKE_NO_OP(SetVSyncState(bool)) 93 MAKE_NO_OP(SetMixerResolution(uint32_t, uint32_t)) 94 MAKE_NO_OP(GetMixerResolution(uint32_t *, uint32_t *)) 95 MAKE_NO_OP(SetDetailEnhancerData(const DisplayDetailEnhancerData &)) 96 MAKE_NO_OP(GetDisplayPort(DisplayPort *)) 97 MAKE_NO_OP(SetCompositionState(LayerComposition, bool)) 98 99 private: 100 bool active_ = false; 101 DisplayState state_ = kStateOff; 102 DisplayConfigVariableInfo fb_config_ = {}; 103 }; 104 105 } // namespace sdm 106 107 #endif // __DISPLAY_NULL_H__ 108