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_CONFIG_H__ 31 #define __DISPLAY_CONFIG_H__ 32 33 #include <stdint.h> 34 #include <vector> 35 36 // This header is for clients to use to set/get global display configuration. 37 38 namespace display { 39 40 enum { 41 DISPLAY_PRIMARY = 0, 42 DISPLAY_EXTERNAL, 43 DISPLAY_VIRTUAL, 44 }; 45 46 enum { 47 EXTERNAL_OFFLINE = 0, 48 EXTERNAL_ONLINE, 49 EXTERNAL_PAUSE, 50 EXTERNAL_RESUME, 51 }; 52 53 enum { 54 DISABLE_METADATA_DYN_REFRESH_RATE = 0, 55 ENABLE_METADATA_DYN_REFRESH_RATE, 56 SET_BINDER_DYN_REFRESH_RATE, 57 }; 58 59 enum { 60 DISPLAY_PORT_DEFAULT = 0, 61 DISPLAY_PORT_DSI, 62 DISPLAY_PORT_DTV, 63 DISPLAY_PORT_WRITEBACK, 64 DISPLAY_PORT_LVDS, 65 DISPLAY_PORT_EDP, 66 DISPLAY_PORT_DP, 67 }; 68 69 struct DisplayAttributes { 70 uint32_t vsync_period = 0; //nanoseconds 71 uint32_t xres = 0; 72 uint32_t yres = 0; 73 float xdpi = 0.0f; 74 float ydpi = 0.0f; 75 int panel_type = DISPLAY_PORT_DEFAULT; 76 bool is_yuv = false; 77 }; 78 79 struct DisplayHDRCapabilities { 80 std::vector<int32_t> supported_hdr_types; 81 float max_luminance = 0.0f; 82 float max_avg_luminance = 0.0f; 83 float min_luminance = 0.0f; 84 }; 85 86 struct WriteBackCapabilities { 87 bool isWbUbwcSupported; 88 }; 89 90 //============================================================================= 91 // The functions below run in the client pocess and wherever necessary 92 // do a binder call to HWC to get/set data. 93 94 int isExternalConnected(); 95 int setSecondayDisplayStatus(int dpy, uint32_t status); 96 int configureDynRefeshRate(uint32_t op, uint32_t refreshRate); 97 int getConfigCount(int dpy); 98 int getActiveConfig(int dpy); 99 int setActiveConfig(int dpy, uint32_t config); 100 DisplayAttributes getDisplayAttributes(uint32_t configIndex, int dpy); 101 int setPanelBrightness(uint32_t level); 102 uint32_t getPanelBrightness(); 103 int minHdcpEncryptionLevelChanged(int dpy, uint32_t min_enc_level); 104 int refreshScreen(); 105 int controlPartialUpdate(int dpy, bool enable); 106 int toggleScreenUpdate(uint32_t on); 107 int setIdleTimeout(uint32_t value); 108 int getHDRCapabilities(int dpy, DisplayHDRCapabilities *caps); 109 int setCameraLaunchStatus(uint32_t on); 110 bool displayBWTransactionPending(); 111 int32_t getWriteBackCapabilities( WriteBackCapabilities *caps); 112 113 } // namespace display 114 115 #endif // __DISPLAY_CONFIG_H__ 116