1 /* 2 * Copyright (c) 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 __HWC_DISPLAY_NULL_H__ 26 #define __HWC_DISPLAY_NULL_H__ 27 28 #include <qdMetaData.h> 29 #include <gralloc_priv.h> 30 #include "hwc_display.h" 31 32 namespace sdm { 33 34 class HWCDisplayNull : public HWCDisplay { 35 public: 36 static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs, 37 HWCDisplay **hwc_display); 38 static void Destroy(HWCDisplay *hwc_display); 39 virtual int Init(); 40 virtual int Deinit(); 41 virtual int Prepare(hwc_display_contents_1_t *content_list); 42 virtual int Commit(hwc_display_contents_1_t *content_list); EventControl(int event,int enable)43 virtual int EventControl(int event, int enable) { return 0; } SetPowerMode(int mode)44 virtual int SetPowerMode(int mode) { return 0; } 45 46 // Framebuffer configurations GetDisplayConfigs(uint32_t * configs,size_t * num_configs)47 virtual int GetDisplayConfigs(uint32_t *configs, size_t *num_configs) { 48 return HWCDisplay::GetDisplayConfigs(configs, num_configs); 49 } 50 51 virtual int GetDisplayAttributes(uint32_t config, const uint32_t *display_attributes, 52 int32_t *values); GetActiveConfig()53 virtual int GetActiveConfig() { return 0; } SetActiveConfig(int index)54 virtual int SetActiveConfig(int index) { return -1; } 55 SetIdleTimeoutMs(uint32_t timeout_ms)56 virtual void SetIdleTimeoutMs(uint32_t timeout_ms) { return; } SetFrameDumpConfig(uint32_t count,uint32_t bit_mask_layer_type)57 virtual void SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type) { return; } SetMaxMixerStages(uint32_t max_mixer_stages)58 virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages) { return kErrorNone; } ControlPartialUpdate(bool enable,uint32_t * pending)59 virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending) { return kErrorNone; } GetLastPowerMode()60 virtual uint32_t GetLastPowerMode() { return 0; } SetFrameBufferResolution(uint32_t x_pixels,uint32_t y_pixels)61 virtual int SetFrameBufferResolution(uint32_t x_pixels, uint32_t y_pixels) { return 0; } 62 GetFrameBufferResolution(uint32_t * x_pixels,uint32_t * y_pixels)63 virtual void GetFrameBufferResolution(uint32_t *x_pixels, uint32_t *y_pixels) { 64 *x_pixels = x_res_; 65 *y_pixels = y_res_; 66 } 67 GetPanelResolution(uint32_t * x_pixels,uint32_t * y_pixels)68 virtual void GetPanelResolution(uint32_t *x_pixels, uint32_t *y_pixels) { 69 *x_pixels = x_res_; 70 *y_pixels = y_res_; 71 } 72 SetDisplayStatus(uint32_t display_status)73 virtual int SetDisplayStatus(uint32_t display_status) { return 0; } OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level)74 virtual int OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) { return 0; } Perform(uint32_t operation,...)75 virtual int Perform(uint32_t operation, ...) { return 0; } SetCursorPosition(int x,int y)76 virtual int SetCursorPosition(int x, int y) { return 0; } SetSecureDisplay(bool secure_display_active,bool force_flush)77 virtual void SetSecureDisplay(bool secure_display_active, bool force_flush) { return; } 78 79 // Display Configurations SetActiveDisplayConfig(int config)80 virtual int SetActiveDisplayConfig(int config) { return 0; } GetActiveDisplayConfig(uint32_t * config)81 virtual int GetActiveDisplayConfig(uint32_t *config) { return -1; } GetDisplayConfigCount(uint32_t * count)82 virtual int GetDisplayConfigCount(uint32_t *count) { return -1; } GetDisplayAttributesForConfig(int config,DisplayConfigVariableInfo * display_attributes)83 virtual int GetDisplayAttributesForConfig(int config, 84 DisplayConfigVariableInfo *display_attributes) { 85 return -1; 86 } IsValidContentList(hwc_display_contents_1_t * content_list)87 virtual bool IsValidContentList(hwc_display_contents_1_t *content_list) { 88 return true; 89 } 90 SetResolution(uint32_t x_res,uint32_t y_res)91 void SetResolution(uint32_t x_res, uint32_t y_res) { 92 x_res_ = x_res; 93 y_res_ = y_res; 94 } 95 96 97 private: 98 HWCDisplayNull(CoreInterface *core_intf, hwc_procs_t const **hwc_procs); 99 uint32_t x_res_ = 1920; 100 uint32_t y_res_ = 1080; 101 }; 102 103 } // namespace sdm 104 105 #endif // __HWC_DISPLAY_NULL_H__ 106 107