Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 1 | /* |
Rajavenu Kyatham | 7338b9e | 2019-12-30 19:52:16 +0530 | [diff] [blame] | 2 | * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 3 | * Not a Contribution. |
| 4 | * |
| 5 | * Copyright 2015 The Android Open Source Project |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __HWC_DISPLAY_H__ |
| 21 | #define __HWC_DISPLAY_H__ |
| 22 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 23 | #include <QService.h> |
Gousemoodhin Nadaf | 0e56687 | 2019-05-13 16:14:54 +0530 | [diff] [blame] | 24 | #include <android/hardware/graphics/common/1.2/types.h> |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 25 | #include <core/core_interface.h> |
| 26 | #include <hardware/hwcomposer.h> |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 27 | #include <private/color_params.h> |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 28 | #include <qdMetaData.h> |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 29 | #include <sys/stat.h> |
Lakshmi Narayana Kalavala | 25fe12c | 2019-12-11 20:44:55 -0800 | [diff] [blame] | 30 | #include <algorithm> |
| 31 | #include <bitset> |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 32 | #include <map> |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 33 | #include <queue> |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 34 | #include <set> |
Naseer Ahmed | 2a3c7d9 | 2016-05-17 18:38:54 -0400 | [diff] [blame] | 35 | #include <string> |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 36 | #include <utility> |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 37 | #include <vector> |
Lakshmi Narayana Kalavala | 25fe12c | 2019-12-11 20:44:55 -0800 | [diff] [blame] | 38 | #include "display_null.h" |
| 39 | #include "histogram_collector.h" |
Naseer Ahmed | 4275221 | 2017-01-27 17:32:21 -0500 | [diff] [blame] | 40 | #include "hwc_buffer_allocator.h" |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 41 | #include "hwc_callbacks.h" |
Varun Arora | 7c8ee54 | 2018-05-01 20:58:16 -0700 | [diff] [blame] | 42 | #include "hwc_display_event_handler.h" |
Lakshmi Narayana Kalavala | 25fe12c | 2019-12-11 20:44:55 -0800 | [diff] [blame] | 43 | #include "hwc_layers.h" |
Pullakavi Srinivas | db2b84a | 2019-11-21 14:47:35 +0530 | [diff] [blame] | 44 | #include "hwc_buffer_sync_handler.h" |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 45 | |
Gousemoodhin Nadaf | 0e56687 | 2019-05-13 16:14:54 +0530 | [diff] [blame] | 46 | using android::hardware::graphics::common::V1_2::ColorMode; |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 47 | using android::hardware::graphics::common::V1_1::Dataspace; |
| 48 | using android::hardware::graphics::common::V1_1::RenderIntent; |
Gousemoodhin Nadaf | 4b096d0 | 2019-10-24 15:39:59 +0530 | [diff] [blame] | 49 | using android::hardware::graphics::common::V1_2::Hdr; |
Naseer Ahmed | 8584a0f | 2020-02-19 22:23:30 -0500 | [diff] [blame] | 50 | namespace composer_V2_4 = ::android::hardware::graphics::composer::V2_4; |
| 51 | using HwcAttribute = composer_V2_4::IComposerClient::Attribute; |
Sushil Chauhan | dbd8db4 | 2020-02-28 13:07:48 -0800 | [diff] [blame] | 52 | using VsyncPeriodChangeConstraints = composer_V2_4::IComposerClient::VsyncPeriodChangeConstraints; |
| 53 | using VsyncPeriodChangeTimeline = composer_V2_4::VsyncPeriodChangeTimeline; |
| 54 | using VsyncPeriodNanos = composer_V2_4::VsyncPeriodNanos; |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 55 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 56 | namespace sdm { |
| 57 | |
Arun Kumar K.R | 51be3d1 | 2017-03-31 19:54:38 -0700 | [diff] [blame] | 58 | class HWCToneMapper; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 59 | |
| 60 | // Subclasses set this to their type. This has to be different from DisplayType. |
| 61 | // This is to avoid RTTI and dynamic_cast |
| 62 | enum DisplayClass { |
Dileep Marchya | f3ce11f | 2018-04-30 23:35:46 +0530 | [diff] [blame] | 63 | DISPLAY_CLASS_BUILTIN, |
| 64 | DISPLAY_CLASS_PLUGGABLE, |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 65 | DISPLAY_CLASS_VIRTUAL, |
| 66 | DISPLAY_CLASS_NULL |
| 67 | }; |
| 68 | |
Sushil Chauhan | 0a1b15d | 2019-08-23 12:58:18 -0700 | [diff] [blame] | 69 | enum { |
| 70 | INPUT_LAYER_DUMP, |
| 71 | OUTPUT_LAYER_DUMP, |
| 72 | }; |
| 73 | |
Ramkumar Radhakrishnan | a38b760 | 2018-03-15 14:49:52 -0700 | [diff] [blame] | 74 | enum SecureSessionType { |
| 75 | kSecureDisplay, |
| 76 | kSecureCamera, |
| 77 | kSecureMax, |
| 78 | }; |
| 79 | |
Dileep Marchya | cb2a3a9 | 2019-06-21 17:30:50 +0530 | [diff] [blame] | 80 | // CWB client currently using the block |
| 81 | enum CWBClient { |
| 82 | kCWBClientNone, // No client connected |
| 83 | kCWBClientFrameDump, // Dump to file |
| 84 | kCWBClientColor, // Internal client i.e. Color Manager |
| 85 | kCWBClientExternal, // External client calling through private APIs |
| 86 | kCWBClientComposer, // Client to HWC i.e. SurfaceFlinger |
| 87 | }; |
| 88 | |
Sushil Chauhan | dbd8db4 | 2020-02-28 13:07:48 -0800 | [diff] [blame] | 89 | struct TransientRefreshRateInfo { |
| 90 | uint32_t transient_vsync_period; |
| 91 | int64_t vsync_applied_time; |
| 92 | }; |
| 93 | |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 94 | class HWCColorMode { |
| 95 | public: |
| 96 | explicit HWCColorMode(DisplayInterface *display_intf); |
| 97 | ~HWCColorMode() {} |
| 98 | HWC2::Error Init(); |
| 99 | HWC2::Error DeInit(); |
Naseer Ahmed | 913502b | 2017-04-18 16:05:05 -0400 | [diff] [blame] | 100 | void Dump(std::ostringstream* os); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 101 | uint32_t GetColorModeCount(); |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 102 | uint32_t GetRenderIntentCount(ColorMode mode); |
| 103 | HWC2::Error GetColorModes(uint32_t *out_num_modes, ColorMode *out_modes); |
| 104 | HWC2::Error GetRenderIntents(ColorMode mode, uint32_t *out_num_intents, RenderIntent *out_modes); |
| 105 | HWC2::Error SetColorModeWithRenderIntent(ColorMode mode, RenderIntent intent); |
Naseer Ahmed | 6776dae | 2017-05-09 11:49:41 -0400 | [diff] [blame] | 106 | HWC2::Error SetColorModeById(int32_t color_mode_id); |
Xu Yang | 84e6141 | 2018-12-06 14:52:16 +0800 | [diff] [blame] | 107 | HWC2::Error SetColorModeFromClientApi(std::string mode_string); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 108 | HWC2::Error SetColorTransform(const float *matrix, android_color_transform_t hint); |
Ch Ganesh Kumar | 5d43ff6 | 2017-10-13 19:01:47 +0530 | [diff] [blame] | 109 | HWC2::Error RestoreColorTransform(); |
Gousemoodhin Nadaf | 839f29d | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 110 | ColorMode GetCurrentColorMode() { return current_color_mode_; } |
Xu Yang | 84e6141 | 2018-12-06 14:52:16 +0800 | [diff] [blame] | 111 | HWC2::Error ApplyCurrentColorModeWithRenderIntent(bool hdr_present); |
Sushil Chauhan | 8008d60 | 2018-09-04 14:43:27 -0700 | [diff] [blame] | 112 | HWC2::Error CacheColorModeWithRenderIntent(ColorMode mode, RenderIntent intent); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 113 | |
| 114 | private: |
| 115 | static const uint32_t kColorTransformMatrixCount = 16; |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 116 | void PopulateColorModes(); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 117 | template <class T> |
| 118 | void CopyColorTransformMatrix(const T *input_matrix, double *output_matrix) { |
| 119 | for (uint32_t i = 0; i < kColorTransformMatrixCount; i++) { |
| 120 | output_matrix[i] = static_cast<double>(input_matrix[i]); |
| 121 | } |
| 122 | } |
Sushil Chauhan | 8008d60 | 2018-09-04 14:43:27 -0700 | [diff] [blame] | 123 | HWC2::Error ValidateColorModeWithRenderIntent(ColorMode mode, RenderIntent intent); |
Xu Yang | 84e6141 | 2018-12-06 14:52:16 +0800 | [diff] [blame] | 124 | HWC2::Error SetPreferredColorModeInternal(const std::string &mode_string, bool from_client, |
| 125 | ColorMode *color_mode, DynamicRangeType *dynamic_range); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 126 | |
| 127 | DisplayInterface *display_intf_ = NULL; |
Sushil Chauhan | 7cd110d | 2018-08-24 17:17:55 -0700 | [diff] [blame] | 128 | bool apply_mode_ = false; |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 129 | ColorMode current_color_mode_ = ColorMode::NATIVE; |
| 130 | RenderIntent current_render_intent_ = RenderIntent::COLORIMETRIC; |
Xu Yang | 84e6141 | 2018-12-06 14:52:16 +0800 | [diff] [blame] | 131 | DynamicRangeType curr_dynamic_range_ = kSdrType; |
| 132 | typedef std::map<DynamicRangeType, std::string> DynamicRangeMap; |
| 133 | typedef std::map<RenderIntent, DynamicRangeMap> RenderIntentMap; |
| 134 | // Initialize supported mode/render intent/dynamic range combination |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 135 | std::map<ColorMode, RenderIntentMap> color_mode_map_ = {}; |
Naseer Ahmed | 7dcd137 | 2017-05-19 18:06:51 -0400 | [diff] [blame] | 136 | double color_matrix_[kColorTransformMatrixCount] = { 1.0, 0.0, 0.0, 0.0, \ |
| 137 | 0.0, 1.0, 0.0, 0.0, \ |
| 138 | 0.0, 0.0, 1.0, 0.0, \ |
| 139 | 0.0, 0.0, 0.0, 1.0 }; |
Xu Yang | 84e6141 | 2018-12-06 14:52:16 +0800 | [diff] [blame] | 140 | std::map<ColorMode, DynamicRangeMap> preferred_mode_ = {}; |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 141 | }; |
| 142 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 143 | class HWCDisplay : public DisplayEventHandler { |
| 144 | public: |
Dileep Marchya | 6860b2b | 2017-04-07 15:56:47 +0530 | [diff] [blame] | 145 | enum DisplayStatus { |
| 146 | kDisplayStatusInvalid = -1, |
| 147 | kDisplayStatusOffline, |
| 148 | kDisplayStatusOnline, |
| 149 | kDisplayStatusPause, |
| 150 | kDisplayStatusResume, |
| 151 | }; |
| 152 | |
Sushil Chauhan | e3a9fd0 | 2017-10-12 18:00:05 -0700 | [diff] [blame] | 153 | enum DisplayValidateState { |
| 154 | kNormalValidate, |
| 155 | kInternalValidate, |
| 156 | kSkipValidate, |
| 157 | }; |
| 158 | |
Srinivas Pullakavi | 3c4337f | 2019-07-03 11:24:31 +0530 | [diff] [blame] | 159 | struct HWCLayerStack { |
| 160 | HWCLayer *client_target = nullptr; // Also known as framebuffer target |
| 161 | std::map<hwc2_layer_t, HWCLayer *> layer_map; // Look up by Id - TODO |
| 162 | std::multiset<HWCLayer *, SortLayersByZ> layer_set; // Maintain a set sorted by Z |
| 163 | }; |
| 164 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 165 | virtual ~HWCDisplay() {} |
| 166 | virtual int Init(); |
| 167 | virtual int Deinit(); |
| 168 | |
| 169 | // Framebuffer configurations |
| 170 | virtual void SetIdleTimeoutMs(uint32_t timeout_ms); |
Sushil Chauhan | 267a619 | 2018-06-06 18:41:47 -0700 | [diff] [blame] | 171 | virtual HWC2::Error SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type, |
| 172 | int32_t format, bool post_processed); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 173 | virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages); |
Arun Kumar K.R | 17bbd04 | 2016-06-07 17:38:02 -0700 | [diff] [blame] | 174 | virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending) { |
| 175 | return kErrorNotSupported; |
| 176 | } |
Varun Arora | f027a22 | 2018-11-14 17:38:16 -0800 | [diff] [blame] | 177 | virtual HWC2::PowerMode GetCurrentPowerMode(); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 178 | virtual int SetFrameBufferResolution(uint32_t x_pixels, uint32_t y_pixels); |
| 179 | virtual void GetFrameBufferResolution(uint32_t *x_pixels, uint32_t *y_pixels); |
Dileep Marchya | 6860b2b | 2017-04-07 15:56:47 +0530 | [diff] [blame] | 180 | virtual int SetDisplayStatus(DisplayStatus display_status); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 181 | virtual int OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level); |
| 182 | virtual int Perform(uint32_t operation, ...); |
Ramkumar Radhakrishnan | a38b760 | 2018-03-15 14:49:52 -0700 | [diff] [blame] | 183 | virtual int HandleSecureSession(const std::bitset<kSecureMax> &secure_sessions, |
| 184 | bool *power_on_pending); |
| 185 | virtual int GetActiveSecureSession(std::bitset<kSecureMax> *secure_sessions); |
Arun Kumar K.R | 8da7f50 | 2016-06-07 17:45:50 -0700 | [diff] [blame] | 186 | virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height); |
| 187 | virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height); |
| 188 | virtual void GetPanelResolution(uint32_t *width, uint32_t *height); |
Dileep Marchya | 5892812 | 2020-01-28 12:16:51 +0530 | [diff] [blame] | 189 | virtual void Dump(std::ostringstream *os); |
Gurpreet Singh Dhami | 1207e46 | 2018-12-27 20:02:02 -0500 | [diff] [blame] | 190 | virtual DisplayError TeardownConcurrentWriteback(void) { |
| 191 | return kErrorNotSupported; |
| 192 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 193 | |
| 194 | // Captures frame output in the buffer specified by output_buffer_info. The API is |
| 195 | // non-blocking and the client is expected to check operation status later on. |
| 196 | // Returns -1 if the input is invalid. |
| 197 | virtual int FrameCaptureAsync(const BufferInfo &output_buffer_info, bool post_processed) { |
| 198 | return -1; |
| 199 | } |
Sushil Chauhan | 1d3b90c | 2018-12-11 16:52:35 -0800 | [diff] [blame] | 200 | // Returns the status of frame capture operation requested with FrameCaptureAsync(). |
| 201 | // -EAGAIN : No status obtain yet, call API again after another frame. |
| 202 | // < 0 : Operation happened but failed. |
| 203 | // 0 : Success. |
| 204 | virtual int GetFrameCaptureStatus() { return -EAGAIN; } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 205 | |
Alan Kwong | 2e13633 | 2016-08-16 07:50:16 -0400 | [diff] [blame] | 206 | virtual DisplayError SetDetailEnhancerConfig(const DisplayDetailEnhancerData &de_data) { |
| 207 | return kErrorNotSupported; |
| 208 | } |
Rajavenu Kyatham | 7338b9e | 2019-12-30 19:52:16 +0530 | [diff] [blame] | 209 | virtual HWC2::Error SetReadbackBuffer(const native_handle_t *buffer, |
| 210 | shared_ptr<Fence> acquire_fence, |
Dileep Marchya | cb2a3a9 | 2019-06-21 17:30:50 +0530 | [diff] [blame] | 211 | bool post_processed_output, CWBClient client) { |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 212 | return HWC2::Error::Unsupported; |
| 213 | } |
Rajavenu Kyatham | 7338b9e | 2019-12-30 19:52:16 +0530 | [diff] [blame] | 214 | virtual HWC2::Error GetReadbackBufferFence(shared_ptr<Fence> *release_fence) { |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 215 | return HWC2::Error::Unsupported; |
| 216 | } |
Alan Kwong | 2e13633 | 2016-08-16 07:50:16 -0400 | [diff] [blame] | 217 | |
Yuchao Ma | 577f0f7 | 2018-07-09 11:20:00 +0800 | [diff] [blame] | 218 | virtual HWC2::Error SetDisplayDppsAdROI(uint32_t h_start, uint32_t h_end, |
| 219 | uint32_t v_start, uint32_t v_end, |
| 220 | uint32_t factor_in, uint32_t factor_out) { |
| 221 | return HWC2::Error::Unsupported; |
| 222 | } |
Xu Yang | 9dacc87 | 2018-12-25 11:04:28 +0800 | [diff] [blame] | 223 | virtual HWC2::Error SetFrameTriggerMode(uint32_t mode) { |
| 224 | return HWC2::Error::Unsupported; |
| 225 | } |
Yuchao Ma | 577f0f7 | 2018-07-09 11:20:00 +0800 | [diff] [blame] | 226 | |
Sushil Chauhan | 1566a13 | 2019-10-02 11:59:28 -0700 | [diff] [blame] | 227 | virtual bool IsSmartPanelConfig(uint32_t config_id) { |
| 228 | return false; |
| 229 | } |
| 230 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 231 | // Display Configurations |
Mahesh Aia | f3a1f99 | 2019-01-16 13:07:42 -0800 | [diff] [blame] | 232 | static uint32_t GetThrottlingRefreshRate() { return HWCDisplay::throttling_refresh_rate_; } |
| 233 | static void SetThrottlingRefreshRate(uint32_t newRefreshRate) |
| 234 | { HWCDisplay::throttling_refresh_rate_ = newRefreshRate; } |
Dileep Marchya | 6860b2b | 2017-04-07 15:56:47 +0530 | [diff] [blame] | 235 | virtual int SetActiveDisplayConfig(uint32_t config); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 236 | virtual int GetActiveDisplayConfig(uint32_t *config); |
| 237 | virtual int GetDisplayConfigCount(uint32_t *count); |
Arun Kumar K.R | 8da7f50 | 2016-06-07 17:45:50 -0700 | [diff] [blame] | 238 | virtual int GetDisplayAttributesForConfig(int config, |
| 239 | DisplayConfigVariableInfo *display_attributes); |
Dileep Marchya | d16da3e | 2017-05-20 01:56:21 +0530 | [diff] [blame] | 240 | virtual int SetState(bool connected) { |
| 241 | return kErrorNotSupported; |
| 242 | } |
Rajavenu Kyatham | 0987b0e | 2018-02-14 18:59:26 +0530 | [diff] [blame] | 243 | virtual DisplayError Flush() { |
| 244 | return kErrorNotSupported; |
| 245 | } |
| 246 | |
Mahesh Aia | f3a1f99 | 2019-01-16 13:07:42 -0800 | [diff] [blame] | 247 | uint32_t GetMaxRefreshRate() { return max_refresh_rate_; } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 248 | int ToggleScreenUpdates(bool enable); |
| 249 | int ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload, PPDisplayAPIPayload *out_payload, |
| 250 | PPPendingParams *pending_action); |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 251 | void SolidFillPrepare(); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 252 | DisplayClass GetDisplayClass(); |
| 253 | int GetVisibleDisplayRect(hwc_rect_t *rect); |
| 254 | void BuildLayerStack(void); |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 255 | void BuildSolidFillStack(void); |
Varun Arora | 2c23e58 | 2017-10-10 15:07:13 -0700 | [diff] [blame] | 256 | HWCLayer *GetHWCLayer(hwc2_layer_t layer_id); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 257 | void ResetValidation() { validated_ = false; } |
Sushil Chauhan | 409e844 | 2017-06-12 17:43:25 -0700 | [diff] [blame] | 258 | uint32_t GetGeometryChanges() { return geometry_changes_; } |
Sushil Chauhan | e3a9fd0 | 2017-10-12 18:00:05 -0700 | [diff] [blame] | 259 | bool CanSkipValidate(); |
Sushil Chauhan | e3a9fd0 | 2017-10-12 18:00:05 -0700 | [diff] [blame] | 260 | bool IsSkipValidateState() { return (validate_state_ == kSkipValidate); } |
| 261 | bool IsInternalValidateState() { return (validated_ && (validate_state_ == kInternalValidate)); } |
| 262 | void SetValidationState(DisplayValidateState state) { validate_state_ = state; } |
Sushil Chauhan | fea3e90 | 2018-07-31 15:34:48 -0700 | [diff] [blame] | 263 | ColorMode GetCurrentColorMode() { |
| 264 | return (color_mode_ ? color_mode_->GetCurrentColorMode() : ColorMode::SRGB); |
| 265 | } |
Sushil Chauhan | 181d950 | 2018-12-13 16:40:58 -0800 | [diff] [blame] | 266 | bool HWCClientNeedsValidate() { |
| 267 | return (has_client_composition_ || layer_stack_.flags.single_buffered_layer_present); |
| 268 | } |
Padmanabhan Komanduru | f5b7f99 | 2019-07-08 13:33:44 +0530 | [diff] [blame] | 269 | bool CheckResourceState(); |
Sushil Chauhan | 9c07ad0 | 2019-02-28 12:07:35 -0800 | [diff] [blame] | 270 | virtual void SetFastPathComposition(bool enable) { fast_path_composition_ = enable; } |
Xu Yang | 84e6141 | 2018-12-06 14:52:16 +0800 | [diff] [blame] | 271 | virtual HWC2::Error SetColorModeFromClientApi(int32_t color_mode_id) { |
| 272 | return HWC2::Error::Unsupported; |
| 273 | } |
Mathew Joseph Karimpanal | abe3b3d | 2018-11-27 17:25:40 +0530 | [diff] [blame] | 274 | bool IsFirstCommitDone() { return !first_cycle_; } |
Sushil Chauhan | dbd8db4 | 2020-02-28 13:07:48 -0800 | [diff] [blame] | 275 | virtual void ProcessActiveConfigChange(); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 276 | |
| 277 | // HWC2 APIs |
| 278 | virtual HWC2::Error AcceptDisplayChanges(void); |
| 279 | virtual HWC2::Error GetActiveConfig(hwc2_config_t *out_config); |
| 280 | virtual HWC2::Error SetActiveConfig(hwc2_config_t config); |
Archit Srivastava | a59c4ff | 2019-05-20 10:54:22 +0530 | [diff] [blame] | 281 | virtual HWC2::Error SetPanelLuminanceAttributes(float min_lum, float max_lum) { |
| 282 | return HWC2::Error::Unsupported; |
| 283 | } |
Rajavenu Kyatham | 7338b9e | 2019-12-30 19:52:16 +0530 | [diff] [blame] | 284 | virtual HWC2::Error SetClientTarget(buffer_handle_t target, shared_ptr<Fence> acquire_fence, |
Naseer Ahmed | a20c4c0 | 2016-06-03 17:48:28 -0400 | [diff] [blame] | 285 | int32_t dataspace, hwc_region_t damage); |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 286 | virtual HWC2::Error SetColorMode(ColorMode mode) { return HWC2::Error::Unsupported; } |
| 287 | virtual HWC2::Error SetColorModeWithRenderIntent(ColorMode mode, RenderIntent intent) { |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 288 | return HWC2::Error::Unsupported; |
| 289 | } |
Naseer Ahmed | 6776dae | 2017-05-09 11:49:41 -0400 | [diff] [blame] | 290 | virtual HWC2::Error SetColorModeById(int32_t color_mode_id) { |
| 291 | return HWC2::Error::Unsupported; |
| 292 | } |
Ch Ganesh Kumar | 5d43ff6 | 2017-10-13 19:01:47 +0530 | [diff] [blame] | 293 | virtual HWC2::Error RestoreColorTransform() { |
| 294 | return HWC2::Error::Unsupported; |
| 295 | } |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 296 | virtual HWC2::Error SetColorTransform(const float *matrix, android_color_transform_t hint) { |
| 297 | return HWC2::Error::Unsupported; |
| 298 | } |
Naseer Ahmed | eae2812 | 2016-06-27 15:47:05 -0400 | [diff] [blame] | 299 | virtual HWC2::Error HandleColorModeTransform(android_color_mode_t mode, |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 300 | android_color_transform_t hint, |
| 301 | const double *matrix) { |
| 302 | return HWC2::Error::Unsupported; |
| 303 | } |
Pullakavi Srinivas | 9189e60 | 2018-12-19 16:58:07 +0530 | [diff] [blame] | 304 | virtual DisplayError SetDynamicDSIClock(uint64_t bitclk) { |
| 305 | return kErrorNotSupported; |
| 306 | } |
| 307 | virtual DisplayError GetDynamicDSIClock(uint64_t *bitclk) { |
| 308 | return kErrorNotSupported; |
| 309 | } |
| 310 | virtual DisplayError GetSupportedDSIClock(std::vector<uint64_t> *bitclk) { |
| 311 | return kErrorNotSupported; |
| 312 | } |
Padmanabhan Komanduru | e74cf4f | 2019-04-25 17:38:43 -0700 | [diff] [blame] | 313 | virtual HWC2::Error UpdateDisplayId(hwc2_display_t id) { |
| 314 | return HWC2::Error::Unsupported; |
| 315 | } |
| 316 | virtual HWC2::Error SetPendingRefresh() { |
| 317 | return HWC2::Error::Unsupported; |
| 318 | } |
Varun Arora | 75c05f0 | 2019-05-14 14:53:37 -0700 | [diff] [blame] | 319 | virtual HWC2::Error SetPanelBrightness(float brightness) { |
| 320 | return HWC2::Error::Unsupported; |
| 321 | } |
| 322 | virtual HWC2::Error GetPanelBrightness(float *brightness) { |
| 323 | return HWC2::Error::Unsupported; |
| 324 | } |
Yuchao Ma | ada1c40 | 2019-11-12 14:47:11 +0800 | [diff] [blame] | 325 | virtual HWC2::Error GetPanelMaxBrightness(uint32_t *max_brightness_level) { |
| 326 | return HWC2::Error::Unsupported; |
| 327 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 328 | virtual HWC2::Error GetDisplayConfigs(uint32_t *out_num_configs, hwc2_config_t *out_configs); |
Naseer Ahmed | 8584a0f | 2020-02-19 22:23:30 -0500 | [diff] [blame] | 329 | virtual HWC2::Error GetDisplayAttribute(hwc2_config_t config, HwcAttribute attribute, |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 330 | int32_t *out_value); |
| 331 | virtual HWC2::Error GetClientTargetSupport(uint32_t width, uint32_t height, int32_t format, |
| 332 | int32_t dataspace); |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 333 | virtual HWC2::Error GetColorModes(uint32_t *outNumModes, ColorMode *outModes); |
| 334 | virtual HWC2::Error GetRenderIntents(ColorMode mode, uint32_t *out_num_intents, |
| 335 | RenderIntent *out_intents); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 336 | virtual HWC2::Error GetChangedCompositionTypes(uint32_t *out_num_elements, |
| 337 | hwc2_layer_t *out_layers, int32_t *out_types); |
| 338 | virtual HWC2::Error GetDisplayRequests(int32_t *out_display_requests, uint32_t *out_num_elements, |
| 339 | hwc2_layer_t *out_layers, int32_t *out_layer_requests); |
| 340 | virtual HWC2::Error GetDisplayName(uint32_t *out_size, char *out_name); |
| 341 | virtual HWC2::Error GetDisplayType(int32_t *out_type); |
| 342 | virtual HWC2::Error SetCursorPosition(hwc2_layer_t layer, int x, int y); |
| 343 | virtual HWC2::Error SetVsyncEnabled(HWC2::Vsync enabled); |
Varun Arora | 78580b8 | 2018-09-10 13:59:57 -0700 | [diff] [blame] | 344 | virtual HWC2::Error SetPowerMode(HWC2::PowerMode mode, bool teardown); |
Srinivas Pullakavi | 3c4337f | 2019-07-03 11:24:31 +0530 | [diff] [blame] | 345 | virtual HWC2::Error UpdatePowerMode(HWC2::PowerMode mode) { |
| 346 | return HWC2::Error::None; |
| 347 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 348 | virtual HWC2::Error CreateLayer(hwc2_layer_t *out_layer_id); |
| 349 | virtual HWC2::Error DestroyLayer(hwc2_layer_t layer_id); |
| 350 | virtual HWC2::Error SetLayerZOrder(hwc2_layer_t layer_id, uint32_t z); |
Ray Zhang | 2ee8247 | 2019-09-05 02:53:29 +0800 | [diff] [blame] | 351 | virtual HWC2::Error SetLayerType(hwc2_layer_t layer_id, IQtiComposerClient::LayerType type); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 352 | virtual HWC2::Error Validate(uint32_t *out_num_types, uint32_t *out_num_requests) = 0; |
| 353 | virtual HWC2::Error GetReleaseFences(uint32_t *out_num_elements, hwc2_layer_t *out_layers, |
Rajavenu Kyatham | 7338b9e | 2019-12-30 19:52:16 +0530 | [diff] [blame] | 354 | std::vector<shared_ptr<Fence>> *out_fences); |
Dileep Marchya | ad66843 | 2019-12-02 10:44:52 +0530 | [diff] [blame] | 355 | virtual HWC2::Error Present(shared_ptr<Fence> *out_retire_fence) = 0; |
Arun Kumar K.R | f28957a | 2017-01-10 17:36:52 -0800 | [diff] [blame] | 356 | virtual HWC2::Error GetHdrCapabilities(uint32_t *out_num_types, int32_t* out_types, |
| 357 | float* out_max_luminance, |
| 358 | float* out_max_average_luminance, |
| 359 | float* out_min_luminance); |
Naseer Ahmed | a6782e4 | 2018-06-04 10:56:04 -0400 | [diff] [blame] | 360 | virtual HWC2::Error GetPerFrameMetadataKeys(uint32_t *out_num_keys, |
| 361 | PerFrameMetadataKey *out_keys); |
Naseer Ahmed | a699e79 | 2017-11-09 15:08:31 -0500 | [diff] [blame] | 362 | virtual HWC2::Error SetDisplayAnimating(bool animating) { |
| 363 | animating_ = animating; |
Ramkumar Radhakrishnan | ae338ae | 2017-11-27 21:27:25 -0800 | [diff] [blame] | 364 | validated_ = false; |
Naseer Ahmed | a699e79 | 2017-11-09 15:08:31 -0500 | [diff] [blame] | 365 | return HWC2::Error::None; |
| 366 | } |
Sushil Chauhan | e3a9fd0 | 2017-10-12 18:00:05 -0700 | [diff] [blame] | 367 | virtual HWC2::Error GetValidateDisplayOutput(uint32_t *out_num_types, uint32_t *out_num_requests); |
Ramkumar Radhakrishnan | a38b760 | 2018-03-15 14:49:52 -0700 | [diff] [blame] | 368 | virtual bool IsDisplayCommandMode(); |
Sushil Chauhan | 380a59d | 2018-03-19 15:47:50 -0700 | [diff] [blame] | 369 | virtual HWC2::Error SetQSyncMode(QSyncMode qsync_mode) { |
| 370 | return HWC2::Error::Unsupported; |
| 371 | } |
Ramkumar Radhakrishnan | 4faf8a6 | 2018-11-15 17:15:37 -0800 | [diff] [blame] | 372 | virtual DisplayError ControlIdlePowerCollapse(bool enable, bool synchronous) { |
| 373 | return kErrorNone; |
Ramkumar Radhakrishnan | f985d48 | 2018-07-23 18:10:41 -0700 | [diff] [blame] | 374 | } |
Varun Arora | 6ba9eda | 2019-02-07 17:59:32 -0800 | [diff] [blame] | 375 | virtual HWC2::Error GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size, |
| 376 | uint8_t *out_data); |
Xu Yang | 45d0abf | 2019-07-05 11:34:06 +0800 | [diff] [blame] | 377 | virtual HWC2::Error SetBLScale(uint32_t level) { |
| 378 | return HWC2::Error::Unsupported; |
| 379 | } |
Srinivas Pullakavi | 3c4337f | 2019-07-03 11:24:31 +0530 | [diff] [blame] | 380 | virtual void GetLayerStack(HWCLayerStack *stack); |
| 381 | virtual void SetLayerStack(HWCLayerStack *stack); |
| 382 | virtual void PostPowerMode(); |
Mathew Joseph Karimpanal | b1c1586 | 2019-07-04 11:14:24 +0530 | [diff] [blame] | 383 | virtual HWC2::PowerMode GetPendingPowerMode() { |
| 384 | return pending_power_mode_; |
Rajavenu Kyatham | 2e24edc | 2019-10-10 19:26:30 +0530 | [diff] [blame] | 385 | } |
Mathew Joseph Karimpanal | b1c1586 | 2019-07-04 11:14:24 +0530 | [diff] [blame] | 386 | virtual void ClearPendingPowerMode() { |
| 387 | pending_power_mode_ = current_power_mode_; |
Rajavenu Kyatham | 2e24edc | 2019-10-10 19:26:30 +0530 | [diff] [blame] | 388 | } |
Pullakavi Srinivas | 2d55f3a | 2019-07-16 14:49:06 +0530 | [diff] [blame] | 389 | virtual void NotifyClientStatus(bool connected) { client_connected_ = connected; } |
Padmanabhan Komanduru | 6693fcb | 2019-11-22 21:06:52 +0530 | [diff] [blame] | 390 | virtual bool IsQsyncCallbackNeeded(bool *qsync_enabled, int32_t *refresh_rate, |
| 391 | int32_t *qsync_refresh_rate) { |
| 392 | return false; |
| 393 | } |
Pullakavi Srinivas | db2b84a | 2019-11-21 14:47:35 +0530 | [diff] [blame] | 394 | virtual int PostInit() { return 0; } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 395 | |
Lakshmi Narayana Kalavala | 25fe12c | 2019-12-11 20:44:55 -0800 | [diff] [blame] | 396 | virtual HWC2::Error SetDisplayedContentSamplingEnabledVndService(bool enabled); |
| 397 | virtual HWC2::Error SetDisplayedContentSamplingEnabled(int32_t enabled, uint8_t component_mask, |
| 398 | uint64_t max_frames); |
| 399 | virtual HWC2::Error GetDisplayedContentSamplingAttributes(int32_t *format, int32_t *dataspace, |
| 400 | uint8_t *supported_components); |
| 401 | virtual HWC2::Error GetDisplayedContentSample( |
| 402 | uint64_t max_frames, uint64_t timestamp, uint64_t *numFrames, |
| 403 | int32_t samples_size[NUM_HISTOGRAM_COLOR_COMPONENTS], |
| 404 | uint64_t *samples[NUM_HISTOGRAM_COLOR_COMPONENTS]); |
Sushil Chauhan | dbd8db4 | 2020-02-28 13:07:48 -0800 | [diff] [blame] | 405 | |
| 406 | virtual HWC2::Error GetDisplayVsyncPeriod(VsyncPeriodNanos *vsync_period); |
| 407 | virtual HWC2::Error SetActiveConfigWithConstraints( |
| 408 | hwc2_config_t config, const VsyncPeriodChangeConstraints *vsync_period_change_constraints, |
| 409 | VsyncPeriodChangeTimeline *out_timeline); |
| 410 | |
Padmanabhan Komanduru | 13b5e10 | 2019-12-03 12:35:09 +0530 | [diff] [blame] | 411 | HWC2::Error SetDisplayElapseTime(uint64_t time); |
Venkat Thogaru | 8e9b124 | 2020-03-30 19:25:24 +0530 | [diff] [blame^] | 412 | virtual bool HasReadBackBufferSupport() { return false; } |
Lakshmi Narayana Kalavala | 25fe12c | 2019-12-11 20:44:55 -0800 | [diff] [blame] | 413 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 414 | protected: |
Mahesh Aia | f3a1f99 | 2019-01-16 13:07:42 -0800 | [diff] [blame] | 415 | static uint32_t throttling_refresh_rate_; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 416 | // Maximum number of layers supported by display manager. |
| 417 | static const uint32_t kMaxLayerCount = 32; |
Dileep Marchya | f3ce11f | 2018-04-30 23:35:46 +0530 | [diff] [blame] | 418 | HWCDisplay(CoreInterface *core_intf, BufferAllocator *buffer_allocator, HWCCallbacks *callbacks, |
| 419 | HWCDisplayEventHandler *event_handler, qService::QService *qservice, DisplayType type, |
Gousemoodhin Nadaf | 087c310 | 2019-01-07 19:34:56 +0530 | [diff] [blame] | 420 | hwc2_display_t id, int32_t sdm_id, DisplayClass display_class); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 421 | |
| 422 | // DisplayEventHandler methods |
| 423 | virtual DisplayError VSync(const DisplayEventVSync &vsync); |
| 424 | virtual DisplayError Refresh(); |
| 425 | virtual DisplayError CECMessage(char *message); |
Lakshmi Narayana Kalavala | e0127eb | 2019-12-03 11:07:26 -0800 | [diff] [blame] | 426 | virtual DisplayError HistogramEvent(int source_fd, uint32_t blob_id); |
Sushil Chauhan | 409e844 | 2017-06-12 17:43:25 -0700 | [diff] [blame] | 427 | virtual DisplayError HandleEvent(DisplayEvent event); |
Dileep Marchya | ad66843 | 2019-12-02 10:44:52 +0530 | [diff] [blame] | 428 | virtual void DumpOutputBuffer(const BufferInfo &buffer_info, void *base, |
| 429 | shared_ptr<Fence> &retire_fence); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 430 | virtual HWC2::Error PrepareLayerStack(uint32_t *out_num_types, uint32_t *out_num_requests); |
| 431 | virtual HWC2::Error CommitLayerStack(void); |
Dileep Marchya | ad66843 | 2019-12-02 10:44:52 +0530 | [diff] [blame] | 432 | virtual HWC2::Error PostCommitLayerStack(shared_ptr<Fence> *out_retire_fence); |
Arun Kumar K.R | 17bbd04 | 2016-06-07 17:38:02 -0700 | [diff] [blame] | 433 | virtual DisplayError DisablePartialUpdateOneFrame() { |
| 434 | return kErrorNotSupported; |
| 435 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 436 | const char *GetDisplayString(); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 437 | void MarkLayersForGPUBypass(void); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 438 | void MarkLayersForClientComposition(void); |
Pullakavi Srinivas | 9189e60 | 2018-12-19 16:58:07 +0530 | [diff] [blame] | 439 | void UpdateConfigs(); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 440 | virtual void ApplyScanAdjustment(hwc_rect_t *display_frame); |
Ramakant Singh | 5db0dfb | 2017-08-23 12:34:57 +0530 | [diff] [blame] | 441 | uint32_t GetUpdatingLayersCount(void); |
Sushil Chauhan | 9735cf8 | 2018-07-10 12:06:01 -0700 | [diff] [blame] | 442 | bool IsLayerUpdating(HWCLayer *layer); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 443 | uint32_t SanitizeRefreshRate(uint32_t req_refresh_rate); |
Sushil Chauhan | 409e844 | 2017-06-12 17:43:25 -0700 | [diff] [blame] | 444 | virtual void GetUnderScanConfig() { } |
Arun Kumar K.R | 5b82155 | 2018-12-07 08:00:15 +0530 | [diff] [blame] | 445 | int32_t SetClientTargetDataSpace(int32_t dataspace); |
Padmanabhan Komanduru | a4bf606 | 2019-10-13 09:04:49 +0530 | [diff] [blame] | 446 | int SetFrameBufferConfig(uint32_t x_pixels, uint32_t y_pixels); |
Sushil Chauhan | f854120 | 2020-02-03 23:14:36 -0800 | [diff] [blame] | 447 | int32_t GetDisplayConfigGroup(DisplayConfigGroupInfo variable_config); |
Sushil Chauhan | dbd8db4 | 2020-02-28 13:07:48 -0800 | [diff] [blame] | 448 | HWC2::Error GetVsyncPeriodByActiveConfig(VsyncPeriodNanos *vsync_period); |
| 449 | bool GetTransientVsyncPeriod(VsyncPeriodNanos *vsync_period); |
| 450 | std::tuple<int64_t, int64_t> RequestActiveConfigChange(hwc2_config_t config, |
| 451 | VsyncPeriodNanos current_vsync_period, |
| 452 | int64_t desired_time); |
| 453 | std::tuple<int64_t, int64_t> EstimateVsyncPeriodChangeTimeline( |
| 454 | VsyncPeriodNanos current_vsync_period, int64_t desired_time); |
| 455 | void SubmitActiveConfigChange(VsyncPeriodNanos current_vsync_period); |
| 456 | bool IsActiveConfigReadyToSubmit(int64_t time); |
| 457 | bool IsActiveConfigApplied(int64_t time, int64_t vsync_applied_time); |
| 458 | bool IsSameGroup(hwc2_config_t config_id1, hwc2_config_t config_id2); |
| 459 | bool AllowSeamless(hwc2_config_t request_config); |
| 460 | void SetVsyncsApplyRateChange(uint32_t vsyncs) { vsyncs_to_apply_rate_change_ = vsyncs; } |
Sushil Chauhan | 0c322e6 | 2020-03-20 17:42:52 -0700 | [diff] [blame] | 461 | HWC2::Error SubmitDisplayConfig(hwc2_config_t config); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 462 | |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 463 | bool validated_ = false; |
Saurabh Shah | dccc0f4 | 2018-01-15 15:59:56 -0800 | [diff] [blame] | 464 | bool layer_stack_invalid_ = true; |
Naseer Ahmed | 72dea24 | 2016-05-03 19:13:07 -0400 | [diff] [blame] | 465 | CoreInterface *core_intf_ = nullptr; |
Dileep Marchya | f3ce11f | 2018-04-30 23:35:46 +0530 | [diff] [blame] | 466 | HWCBufferAllocator *buffer_allocator_ = NULL; |
Naseer Ahmed | 72dea24 | 2016-05-03 19:13:07 -0400 | [diff] [blame] | 467 | HWCCallbacks *callbacks_ = nullptr; |
Varun Arora | 7c8ee54 | 2018-05-01 20:58:16 -0700 | [diff] [blame] | 468 | HWCDisplayEventHandler *event_handler_ = nullptr; |
Dileep Marchya | f3ce11f | 2018-04-30 23:35:46 +0530 | [diff] [blame] | 469 | DisplayType type_ = kDisplayTypeMax; |
| 470 | hwc2_display_t id_ = UINT64_MAX; |
| 471 | int32_t sdm_id_ = -1; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 472 | DisplayInterface *display_intf_ = NULL; |
| 473 | LayerStack layer_stack_; |
Naseer Ahmed | 72dea24 | 2016-05-03 19:13:07 -0400 | [diff] [blame] | 474 | HWCLayer *client_target_ = nullptr; // Also known as framebuffer target |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 475 | std::map<hwc2_layer_t, HWCLayer *> layer_map_; // Look up by Id - TODO |
| 476 | std::multiset<HWCLayer *, SortLayersByZ> layer_set_; // Maintain a set sorted by Z |
| 477 | std::map<hwc2_layer_t, HWC2::Composition> layer_changes_; |
| 478 | std::map<hwc2_layer_t, HWC2::LayerRequest> layer_requests_; |
| 479 | bool flush_on_error_ = false; |
| 480 | bool flush_ = false; |
| 481 | uint32_t dump_frame_count_ = 0; |
| 482 | uint32_t dump_frame_index_ = 0; |
| 483 | bool dump_input_layers_ = false; |
Varun Arora | f027a22 | 2018-11-14 17:38:16 -0800 | [diff] [blame] | 484 | HWC2::PowerMode current_power_mode_ = HWC2::PowerMode::Off; |
Mathew Joseph Karimpanal | b1c1586 | 2019-07-04 11:14:24 +0530 | [diff] [blame] | 485 | HWC2::PowerMode pending_power_mode_ = HWC2::PowerMode::Off; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 486 | bool swap_interval_zero_ = false; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 487 | bool display_paused_ = false; |
| 488 | uint32_t min_refresh_rate_ = 0; |
| 489 | uint32_t max_refresh_rate_ = 0; |
| 490 | uint32_t current_refresh_rate_ = 0; |
| 491 | bool use_metadata_refresh_rate_ = false; |
| 492 | uint32_t metadata_refresh_rate_ = 0; |
| 493 | uint32_t force_refresh_rate_ = 0; |
| 494 | bool boot_animation_completed_ = false; |
| 495 | bool shutdown_pending_ = false; |
Ramkumar Radhakrishnan | a38b760 | 2018-03-15 14:49:52 -0700 | [diff] [blame] | 496 | std::bitset<kSecureMax> active_secure_sessions_ = 0; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 497 | bool solid_fill_enable_ = false; |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 498 | Layer *solid_fill_layer_ = NULL; |
| 499 | LayerRect solid_fill_rect_ = {}; |
Gopikrishnaiah Anandan | cc12306 | 2017-07-31 17:21:03 -0700 | [diff] [blame] | 500 | LayerSolidFill solid_fill_color_ = {}; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 501 | LayerRect display_rect_; |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 502 | bool color_tranform_failed_ = false; |
| 503 | HWCColorMode *color_mode_ = NULL; |
Arun Kumar K.R | 51be3d1 | 2017-03-31 19:54:38 -0700 | [diff] [blame] | 504 | HWCToneMapper *tone_mapper_ = nullptr; |
Rajavenu Kyatham | 40fc538 | 2017-07-12 18:36:55 +0530 | [diff] [blame] | 505 | uint32_t num_configs_ = 0; |
Arun Kumar K.R | 2be0bf8 | 2017-05-24 15:14:41 +0530 | [diff] [blame] | 506 | int disable_hdr_handling_ = 0; // disables HDR handling. |
Namit Solanki | 5b428dc | 2018-02-27 11:39:05 +0530 | [diff] [blame] | 507 | bool pending_commit_ = false; |
Tharaga Balachandran | 04192a6 | 2018-08-29 16:23:25 -0400 | [diff] [blame] | 508 | bool is_cmd_mode_ = false; |
| 509 | bool partial_update_enabled_ = false; |
Sushil Chauhan | 7bd2066 | 2018-08-20 17:51:32 -0700 | [diff] [blame] | 510 | bool fast_path_composition_ = false; |
Padmanabhan Komanduru | e74cf4f | 2019-04-25 17:38:43 -0700 | [diff] [blame] | 511 | bool skip_commit_ = false; |
Pullakavi Srinivas | 9189e60 | 2018-12-19 16:58:07 +0530 | [diff] [blame] | 512 | std::map<uint32_t, DisplayConfigVariableInfo> variable_config_map_; |
| 513 | std::vector<uint32_t> hwc_config_map_; |
Pullakavi Srinivas | 2d55f3a | 2019-07-16 14:49:06 +0530 | [diff] [blame] | 514 | bool client_connected_ = true; |
Pullakavi Srinivas | 2457414 | 2019-08-14 12:18:12 +0530 | [diff] [blame] | 515 | bool pending_config_ = false; |
Pullakavi Srinivas | 17495f1 | 2019-09-16 20:25:20 +0530 | [diff] [blame] | 516 | bool has_client_composition_ = false; |
Sushil Chauhan | dbd8db4 | 2020-02-28 13:07:48 -0800 | [diff] [blame] | 517 | uint32_t vsyncs_to_apply_rate_change_ = 1; |
| 518 | hwc2_config_t pending_refresh_rate_config_ = UINT_MAX; |
| 519 | int64_t pending_refresh_rate_refresh_time_ = INT64_MAX; |
| 520 | int64_t pending_refresh_rate_applied_time_ = INT64_MAX; |
| 521 | std::deque<TransientRefreshRateInfo> transient_refresh_rate_info_; |
| 522 | std::mutex transient_refresh_rate_lock_; |
Rajavenu Kyatham | b6292fb | 2018-06-08 14:29:19 +0530 | [diff] [blame] | 523 | LayerRect window_rect_ = {}; |
| 524 | bool windowed_display_ = true; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 525 | |
| 526 | private: |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 527 | void DumpInputBuffers(void); |
Sushil Chauhan | 36c059a | 2018-06-28 11:39:01 -0700 | [diff] [blame] | 528 | bool CanSkipSdmPrepare(uint32_t *num_types, uint32_t *num_requests); |
Pullakavi Srinivas | 3dbb0d9 | 2018-03-07 15:15:14 +0530 | [diff] [blame] | 529 | void UpdateRefreshRate(); |
Rajavenu Kyatham | af26f40 | 2019-02-13 15:04:03 +0530 | [diff] [blame] | 530 | void WaitOnPreviousFence(); |
Pullakavi Srinivas | 81fee96 | 2019-07-26 15:49:32 +0530 | [diff] [blame] | 531 | void UpdateActiveConfig(); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 532 | qService::QService *qservice_ = NULL; |
| 533 | DisplayClass display_class_; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 534 | uint32_t geometry_changes_ = GeometryChanges::kNone; |
Rajavenu Kyatham | ef47418 | 2019-07-03 15:26:08 +0530 | [diff] [blame] | 535 | uint32_t geometry_changes_on_doze_suspend_ = GeometryChanges::kNone; |
Naseer Ahmed | a699e79 | 2017-11-09 15:08:31 -0500 | [diff] [blame] | 536 | bool animating_ = false; |
Varun Arora | 465c1f7 | 2018-02-08 16:18:50 -0800 | [diff] [blame] | 537 | int null_display_mode_ = 0; |
Sushil Chauhan | e3a9fd0 | 2017-10-12 18:00:05 -0700 | [diff] [blame] | 538 | DisplayValidateState validate_state_ = kNormalValidate; |
Sushil Chauhan | 7bd2066 | 2018-08-20 17:51:32 -0700 | [diff] [blame] | 539 | bool fast_path_enabled_ = true; |
Mathew Joseph Karimpanal | abe3b3d | 2018-11-27 17:25:40 +0530 | [diff] [blame] | 540 | bool first_cycle_ = true; // false if a display commit has succeeded on the device. |
Rajavenu Kyatham | 7338b9e | 2019-12-30 19:52:16 +0530 | [diff] [blame] | 541 | shared_ptr<Fence> fbt_release_fence_ = nullptr; |
| 542 | shared_ptr<Fence> release_fence_ = nullptr; |
Pullakavi Srinivas | 81fee96 | 2019-07-26 15:49:32 +0530 | [diff] [blame] | 543 | hwc2_config_t pending_config_index_ = 0; |
Xu Yang | 7469c4f | 2019-11-27 10:25:59 +0800 | [diff] [blame] | 544 | bool game_supported_ = false; |
Padmanabhan Komanduru | 13b5e10 | 2019-12-03 12:35:09 +0530 | [diff] [blame] | 545 | uint64_t elapse_timestamp_ = 0; |
Rajavenu Kyatham | 50966d8 | 2019-08-06 18:02:36 +0530 | [diff] [blame] | 546 | int async_power_mode_ = 0; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 547 | }; |
| 548 | |
| 549 | inline int HWCDisplay::Perform(uint32_t operation, ...) { |
| 550 | return 0; |
| 551 | } |
| 552 | |
| 553 | } // namespace sdm |
| 554 | |
| 555 | #endif // __HWC_DISPLAY_H__ |