Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 1 | /* |
Varun Arora | 465c1f7 | 2018-02-08 16:18:50 -0800 | [diff] [blame] | 2 | * Copyright (c) 2014 - 2018, The Linux Foundation. All rights reserved. |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 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 | #include <cutils/properties.h> |
| 31 | #include <sync/sync.h> |
| 32 | #include <utils/constants.h> |
| 33 | #include <utils/debug.h> |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 34 | #include <utils/utils.h> |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 35 | #include <stdarg.h> |
| 36 | #include <sys/mman.h> |
| 37 | |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 38 | #include <map> |
| 39 | #include <string> |
| 40 | #include <vector> |
| 41 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 42 | #include "hwc_display_primary.h" |
| 43 | #include "hwc_debugger.h" |
| 44 | |
| 45 | #define __CLASS__ "HWCDisplayPrimary" |
| 46 | |
| 47 | namespace sdm { |
| 48 | |
| 49 | int HWCDisplayPrimary::Create(CoreInterface *core_intf, BufferAllocator *buffer_allocator, |
Varun Arora | 7c8ee54 | 2018-05-01 20:58:16 -0700 | [diff] [blame] | 50 | HWCCallbacks *callbacks, HWCDisplayEventHandler *event_handler, |
| 51 | qService::QService *qservice, HWCDisplay **hwc_display) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 52 | int status = 0; |
| 53 | uint32_t primary_width = 0; |
| 54 | uint32_t primary_height = 0; |
| 55 | |
| 56 | HWCDisplay *hwc_display_primary = |
Varun Arora | 7c8ee54 | 2018-05-01 20:58:16 -0700 | [diff] [blame] | 57 | new HWCDisplayPrimary(core_intf, buffer_allocator, callbacks, event_handler, qservice); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 58 | status = hwc_display_primary->Init(); |
| 59 | if (status) { |
| 60 | delete hwc_display_primary; |
| 61 | return status; |
| 62 | } |
| 63 | |
Arun Kumar K.R | 8da7f50 | 2016-06-07 17:45:50 -0700 | [diff] [blame] | 64 | hwc_display_primary->GetMixerResolution(&primary_width, &primary_height); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 65 | int width = 0, height = 0; |
Uday Kiran Pichika | 5e656b2 | 2018-05-15 18:48:24 +0530 | [diff] [blame] | 66 | HWCDebugHandler::Get()->GetProperty(FB_WIDTH_PROP, &width); |
| 67 | HWCDebugHandler::Get()->GetProperty(FB_HEIGHT_PROP, &height); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 68 | if (width > 0 && height > 0) { |
| 69 | primary_width = UINT32(width); |
| 70 | primary_height = UINT32(height); |
| 71 | } |
| 72 | |
| 73 | status = hwc_display_primary->SetFrameBufferResolution(primary_width, primary_height); |
| 74 | if (status) { |
| 75 | Destroy(hwc_display_primary); |
| 76 | return status; |
| 77 | } |
| 78 | |
| 79 | *hwc_display = hwc_display_primary; |
| 80 | |
| 81 | return status; |
| 82 | } |
| 83 | |
| 84 | void HWCDisplayPrimary::Destroy(HWCDisplay *hwc_display) { |
| 85 | hwc_display->Deinit(); |
| 86 | delete hwc_display; |
| 87 | } |
| 88 | |
| 89 | HWCDisplayPrimary::HWCDisplayPrimary(CoreInterface *core_intf, BufferAllocator *buffer_allocator, |
Varun Arora | 7c8ee54 | 2018-05-01 20:58:16 -0700 | [diff] [blame] | 90 | HWCCallbacks *callbacks, HWCDisplayEventHandler *event_handler, |
| 91 | qService::QService *qservice) |
| 92 | : HWCDisplay(core_intf, callbacks, event_handler, kPrimary, HWC_DISPLAY_PRIMARY, true, |
| 93 | qservice, DISPLAY_CLASS_PRIMARY, buffer_allocator), |
| 94 | buffer_allocator_(buffer_allocator), cpu_hint_(NULL) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | int HWCDisplayPrimary::Init() { |
| 98 | cpu_hint_ = new CPUHint(); |
| 99 | if (cpu_hint_->Init(static_cast<HWCDebugHandler *>(HWCDebugHandler::Get())) != kErrorNone) { |
| 100 | delete cpu_hint_; |
| 101 | cpu_hint_ = NULL; |
| 102 | } |
| 103 | |
| 104 | use_metadata_refresh_rate_ = true; |
| 105 | int disable_metadata_dynfps = 0; |
Uday Kiran Pichika | 5e656b2 | 2018-05-15 18:48:24 +0530 | [diff] [blame] | 106 | HWCDebugHandler::Get()->GetProperty(DISABLE_METADATA_DYNAMIC_FPS_PROP, &disable_metadata_dynfps); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 107 | if (disable_metadata_dynfps) { |
| 108 | use_metadata_refresh_rate_ = false; |
| 109 | } |
| 110 | |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 111 | int status = HWCDisplay::Init(); |
| 112 | if (status) { |
| 113 | return status; |
| 114 | } |
| 115 | color_mode_ = new HWCColorMode(display_intf_); |
Naseer Ahmed | 61f6095 | 2017-05-24 16:48:35 -0400 | [diff] [blame] | 116 | color_mode_->Init(); |
Uday Kiran Pichika | 5e656b2 | 2018-05-15 18:48:24 +0530 | [diff] [blame] | 117 | HWCDebugHandler::Get()->GetProperty(ENABLE_DEFAULT_COLOR_MODE, |
Ch Ganesh Kumar | 86c4651 | 2017-06-13 13:09:22 +0530 | [diff] [blame] | 118 | &default_mode_status_); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 119 | |
Naseer Ahmed | 61f6095 | 2017-05-24 16:48:35 -0400 | [diff] [blame] | 120 | return status; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | void HWCDisplayPrimary::ProcessBootAnimCompleted() { |
| 124 | uint32_t numBootUpLayers = 0; |
| 125 | // TODO(user): Remove this hack |
| 126 | |
| 127 | numBootUpLayers = static_cast<uint32_t>(Debug::GetBootAnimLayerCount()); |
| 128 | |
| 129 | if (numBootUpLayers == 0) { |
| 130 | numBootUpLayers = 2; |
| 131 | } |
| 132 | /* All other checks namely "init.svc.bootanim" or |
| 133 | * HWC_GEOMETRY_CHANGED fail in correctly identifying the |
| 134 | * exact bootup transition to homescreen |
| 135 | */ |
Naseer Ahmed | ac442ae | 2016-06-23 18:58:03 -0400 | [diff] [blame] | 136 | char property[PROPERTY_VALUE_MAX]; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 137 | bool isEncrypted = false; |
| 138 | bool main_class_services_started = false; |
Naseer Ahmed | ac442ae | 2016-06-23 18:58:03 -0400 | [diff] [blame] | 139 | property_get("ro.crypto.state", property, "unencrypted"); |
| 140 | if (!strcmp(property, "encrypted")) { |
| 141 | property_get("ro.crypto.type", property, "block"); |
| 142 | if (!strcmp(property, "block")) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 143 | isEncrypted = true; |
Naseer Ahmed | ac442ae | 2016-06-23 18:58:03 -0400 | [diff] [blame] | 144 | property_get("vold.decrypt", property, ""); |
| 145 | if (!strcmp(property, "trigger_restart_framework")) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 146 | main_class_services_started = true; |
Naseer Ahmed | ac442ae | 2016-06-23 18:58:03 -0400 | [diff] [blame] | 147 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 148 | } |
| 149 | } |
Naseer Ahmed | ac442ae | 2016-06-23 18:58:03 -0400 | [diff] [blame] | 150 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 151 | if ((!isEncrypted || (isEncrypted && main_class_services_started)) && |
| 152 | (layer_set_.size() > numBootUpLayers)) { |
Naseer Ahmed | ac442ae | 2016-06-23 18:58:03 -0400 | [diff] [blame] | 153 | DLOGI("Applying default mode"); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 154 | boot_animation_completed_ = true; |
| 155 | // Applying default mode after bootanimation is finished And |
| 156 | // If Data is Encrypted, it is ready for access. |
Ch Ganesh Kumar | 5d43ff6 | 2017-10-13 19:01:47 +0530 | [diff] [blame] | 157 | if (display_intf_) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 158 | display_intf_->ApplyDefaultDisplayMode(); |
Ch Ganesh Kumar | 5d43ff6 | 2017-10-13 19:01:47 +0530 | [diff] [blame] | 159 | RestoreColorTransform(); |
| 160 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 161 | } |
| 162 | } |
| 163 | |
| 164 | HWC2::Error HWCDisplayPrimary::Validate(uint32_t *out_num_types, uint32_t *out_num_requests) { |
| 165 | auto status = HWC2::Error::None; |
| 166 | DisplayError error = kErrorNone; |
| 167 | |
Ch Ganesh Kumar | 86c4651 | 2017-06-13 13:09:22 +0530 | [diff] [blame] | 168 | if (default_mode_status_ && !boot_animation_completed_) { |
| 169 | ProcessBootAnimCompleted(); |
| 170 | } |
| 171 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 172 | if (display_paused_) { |
| 173 | MarkLayersForGPUBypass(); |
| 174 | return status; |
| 175 | } |
| 176 | |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 177 | if (color_tranform_failed_) { |
| 178 | // Must fall back to client composition |
| 179 | MarkLayersForClientComposition(); |
| 180 | } |
| 181 | |
Ramkumar Radhakrishnan | 3dcf8a2 | 2017-11-27 14:53:06 -0800 | [diff] [blame] | 182 | if (config_pending_) { |
| 183 | if (display_intf_->SetActiveConfig(display_config_) != kErrorNone) { |
| 184 | DLOGW("Invalid display config %d", display_config_); |
| 185 | // Reset the display config with active config |
| 186 | display_intf_->GetActiveConfig(&display_config_); |
| 187 | } |
| 188 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 189 | // Fill in the remaining blanks in the layers and add them to the SDM layerstack |
| 190 | BuildLayerStack(); |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 191 | // Checks and replaces layer stack for solid fill |
| 192 | SolidFillPrepare(); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 193 | |
| 194 | bool pending_output_dump = dump_frame_count_ && dump_output_to_file_; |
| 195 | |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 196 | if (readback_buffer_queued_ || pending_output_dump) { |
| 197 | CloseFd(&output_buffer_.release_fence_fd); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 198 | // RHS values were set in FrameCaptureAsync() called from a binder thread. They are picked up |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 199 | // here in a subsequent draw round. Readback is not allowed for any secure use case. |
| 200 | readback_configured_ = !layer_stack_.flags.secure_present; |
| 201 | if (readback_configured_) { |
| 202 | layer_stack_.output_buffer = &output_buffer_; |
| 203 | layer_stack_.flags.post_processed_output = post_processed_output_; |
| 204 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 205 | } |
| 206 | |
Ramakant Singh | 5db0dfb | 2017-08-23 12:34:57 +0530 | [diff] [blame] | 207 | uint32_t num_updating_layers = GetUpdatingLayersCount(); |
| 208 | bool one_updating_layer = (num_updating_layers == 1); |
| 209 | if (num_updating_layers != 0) { |
| 210 | ToggleCPUHint(one_updating_layer); |
| 211 | } |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 212 | |
| 213 | uint32_t refresh_rate = GetOptimalRefreshRate(one_updating_layer); |
Anjaneya Prasad Musunuri | 4d65df7 | 2017-05-18 19:11:28 +0530 | [diff] [blame] | 214 | bool final_rate = force_refresh_rate_ ? true : false; |
| 215 | error = display_intf_->SetRefreshRate(refresh_rate, final_rate); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 216 | if (error == kErrorNone) { |
| 217 | // On success, set current refresh rate to new refresh rate |
| 218 | current_refresh_rate_ = refresh_rate; |
| 219 | } |
| 220 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 221 | if (layer_set_.empty()) { |
Uday Kiran Pichika | 8d82773 | 2018-01-09 18:08:38 +0530 | [diff] [blame] | 222 | // Avoid flush for Command mode panel. |
Ramkumar Radhakrishnan | a38b760 | 2018-03-15 14:49:52 -0700 | [diff] [blame] | 223 | flush_ = !IsDisplayCommandMode(); |
| 224 | validated_ = true; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 225 | return status; |
| 226 | } |
| 227 | |
| 228 | status = PrepareLayerStack(out_num_types, out_num_requests); |
| 229 | return status; |
| 230 | } |
| 231 | |
| 232 | HWC2::Error HWCDisplayPrimary::Present(int32_t *out_retire_fence) { |
| 233 | auto status = HWC2::Error::None; |
| 234 | if (display_paused_) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 235 | DisplayError error = display_intf_->Flush(); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 236 | validated_ = false; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 237 | if (error != kErrorNone) { |
| 238 | DLOGE("Flush failed. Error = %d", error); |
| 239 | } |
| 240 | } else { |
| 241 | status = HWCDisplay::CommitLayerStack(); |
| 242 | if (status == HWC2::Error::None) { |
| 243 | HandleFrameOutput(); |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 244 | SolidFillCommit(); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 245 | status = HWCDisplay::PostCommitLayerStack(out_retire_fence); |
| 246 | } |
| 247 | } |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 248 | |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 249 | CloseFd(&output_buffer_.acquire_fence_fd); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 250 | return status; |
| 251 | } |
| 252 | |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame^] | 253 | HWC2::Error HWCDisplayPrimary::GetColorModes(uint32_t *out_num_modes, ColorMode *out_modes) { |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 254 | if (out_modes == nullptr) { |
| 255 | *out_num_modes = color_mode_->GetColorModeCount(); |
| 256 | } else { |
| 257 | color_mode_->GetColorModes(out_num_modes, out_modes); |
| 258 | } |
| 259 | |
| 260 | return HWC2::Error::None; |
| 261 | } |
| 262 | |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame^] | 263 | HWC2::Error HWCDisplayPrimary::GetRenderIntents(ColorMode mode, uint32_t *out_num_intents, |
| 264 | RenderIntent *out_intents) { |
| 265 | if (out_intents == nullptr) { |
| 266 | *out_num_intents = color_mode_->GetRenderIntentCount(mode); |
| 267 | } else { |
| 268 | color_mode_->GetRenderIntents(mode, out_num_intents, out_intents); |
| 269 | } |
| 270 | return HWC2::Error::None; |
| 271 | } |
| 272 | |
| 273 | HWC2::Error HWCDisplayPrimary::SetColorMode(ColorMode mode) { |
| 274 | return SetColorModeWithRenderIntent(mode, RenderIntent::COLORIMETRIC); |
| 275 | } |
| 276 | |
| 277 | HWC2::Error HWCDisplayPrimary::SetColorModeWithRenderIntent(ColorMode mode, RenderIntent intent) { |
| 278 | auto status = color_mode_->SetColorModeWithRenderIntent(mode, intent); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 279 | if (status != HWC2::Error::None) { |
Naseer Ahmed | e7a7798 | 2018-06-04 10:56:04 -0400 | [diff] [blame^] | 280 | DLOGE("failed for mode = %d intent = %d", mode, intent); |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 281 | return status; |
| 282 | } |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 283 | callbacks_->Refresh(HWC_DISPLAY_PRIMARY); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 284 | validated_ = false; |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 285 | return status; |
| 286 | } |
| 287 | |
Naseer Ahmed | 6776dae | 2017-05-09 11:49:41 -0400 | [diff] [blame] | 288 | HWC2::Error HWCDisplayPrimary::SetColorModeById(int32_t color_mode_id) { |
| 289 | auto status = color_mode_->SetColorModeById(color_mode_id); |
| 290 | if (status != HWC2::Error::None) { |
| 291 | DLOGE("failed for mode = %d", color_mode_id); |
| 292 | return status; |
| 293 | } |
| 294 | |
| 295 | callbacks_->Refresh(HWC_DISPLAY_PRIMARY); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 296 | validated_ = false; |
Naseer Ahmed | 6776dae | 2017-05-09 11:49:41 -0400 | [diff] [blame] | 297 | |
| 298 | return status; |
| 299 | } |
| 300 | |
Ch Ganesh Kumar | 5d43ff6 | 2017-10-13 19:01:47 +0530 | [diff] [blame] | 301 | HWC2::Error HWCDisplayPrimary::RestoreColorTransform() { |
| 302 | auto status = color_mode_->RestoreColorTransform(); |
| 303 | if (status != HWC2::Error::None) { |
| 304 | DLOGE("failed to RestoreColorTransform"); |
| 305 | return status; |
| 306 | } |
| 307 | |
| 308 | callbacks_->Refresh(HWC_DISPLAY_PRIMARY); |
| 309 | |
| 310 | return status; |
| 311 | } |
| 312 | |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 313 | HWC2::Error HWCDisplayPrimary::SetColorTransform(const float *matrix, |
| 314 | android_color_transform_t hint) { |
| 315 | if (!matrix) { |
| 316 | return HWC2::Error::BadParameter; |
| 317 | } |
| 318 | |
| 319 | auto status = color_mode_->SetColorTransform(matrix, hint); |
| 320 | if (status != HWC2::Error::None) { |
| 321 | DLOGE("failed for hint = %d", hint); |
| 322 | color_tranform_failed_ = true; |
| 323 | return status; |
| 324 | } |
| 325 | |
| 326 | callbacks_->Refresh(HWC_DISPLAY_PRIMARY); |
| 327 | color_tranform_failed_ = false; |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 328 | validated_ = false; |
Arun Kumar K.R | 29cd658 | 2016-05-10 19:12:45 -0700 | [diff] [blame] | 329 | |
| 330 | return status; |
| 331 | } |
| 332 | |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 333 | HWC2::Error HWCDisplayPrimary::SetReadbackBuffer(const native_handle_t *buffer, |
| 334 | int32_t acquire_fence, |
| 335 | bool post_processed_output) { |
| 336 | const private_handle_t *handle = reinterpret_cast<const private_handle_t *>(buffer); |
| 337 | if (!handle || (handle->fd < 0)) { |
| 338 | return HWC2::Error::BadParameter; |
| 339 | } |
| 340 | |
| 341 | // Configure the output buffer as Readback buffer |
| 342 | output_buffer_.width = UINT32(handle->width); |
| 343 | output_buffer_.height = UINT32(handle->height); |
| 344 | output_buffer_.unaligned_width = UINT32(handle->unaligned_width); |
| 345 | output_buffer_.unaligned_height = UINT32(handle->unaligned_height); |
| 346 | output_buffer_.format = HWCLayer::GetSDMFormat(handle->format, handle->flags); |
| 347 | output_buffer_.planes[0].fd = handle->fd; |
| 348 | output_buffer_.planes[0].stride = UINT32(handle->width); |
| 349 | output_buffer_.acquire_fence_fd = dup(acquire_fence); |
| 350 | output_buffer_.release_fence_fd = -1; |
| 351 | |
| 352 | post_processed_output_ = post_processed_output; |
| 353 | readback_buffer_queued_ = true; |
| 354 | readback_configured_ = false; |
| 355 | validated_ = false; |
| 356 | |
| 357 | DisablePartialUpdateOneFrame(); |
| 358 | return HWC2::Error::None; |
| 359 | } |
| 360 | |
| 361 | HWC2::Error HWCDisplayPrimary::GetReadbackBufferFence(int32_t *release_fence) { |
| 362 | auto status = HWC2::Error::None; |
| 363 | |
| 364 | if (readback_configured_ && (output_buffer_.release_fence_fd >= 0)) { |
| 365 | *release_fence = output_buffer_.release_fence_fd; |
| 366 | } else { |
| 367 | status = HWC2::Error::Unsupported; |
| 368 | *release_fence = -1; |
| 369 | } |
| 370 | |
| 371 | post_processed_output_ = false; |
| 372 | readback_buffer_queued_ = false; |
| 373 | readback_configured_ = false; |
| 374 | output_buffer_ = {}; |
| 375 | |
| 376 | return status; |
| 377 | } |
| 378 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 379 | int HWCDisplayPrimary::Perform(uint32_t operation, ...) { |
| 380 | va_list args; |
| 381 | va_start(args, operation); |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 382 | int val = 0; |
Gopikrishnaiah Anandan | cc12306 | 2017-07-31 17:21:03 -0700 | [diff] [blame] | 383 | LayerSolidFill *solid_fill_color; |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 384 | LayerRect *rect = NULL; |
| 385 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 386 | switch (operation) { |
| 387 | case SET_METADATA_DYN_REFRESH_RATE: |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 388 | val = va_arg(args, int32_t); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 389 | SetMetaDataRefreshRateFlag(val); |
| 390 | break; |
| 391 | case SET_BINDER_DYN_REFRESH_RATE: |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 392 | val = va_arg(args, int32_t); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 393 | ForceRefreshRate(UINT32(val)); |
| 394 | break; |
| 395 | case SET_DISPLAY_MODE: |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 396 | val = va_arg(args, int32_t); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 397 | SetDisplayMode(UINT32(val)); |
| 398 | break; |
| 399 | case SET_QDCM_SOLID_FILL_INFO: |
Gopikrishnaiah Anandan | cc12306 | 2017-07-31 17:21:03 -0700 | [diff] [blame] | 400 | solid_fill_color = va_arg(args, LayerSolidFill*); |
| 401 | SetQDCMSolidFillInfo(true, *solid_fill_color); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 402 | break; |
| 403 | case UNSET_QDCM_SOLID_FILL_INFO: |
Gopikrishnaiah Anandan | cc12306 | 2017-07-31 17:21:03 -0700 | [diff] [blame] | 404 | solid_fill_color = va_arg(args, LayerSolidFill*); |
| 405 | SetQDCMSolidFillInfo(false, *solid_fill_color); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 406 | break; |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 407 | case SET_QDCM_SOLID_FILL_RECT: |
| 408 | rect = va_arg(args, LayerRect*); |
| 409 | solid_fill_rect_ = *rect; |
| 410 | break; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 411 | default: |
| 412 | DLOGW("Invalid operation %d", operation); |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 413 | va_end(args); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 414 | return -EINVAL; |
| 415 | } |
Arun Kumar K.R | 536c7d6 | 2016-06-14 18:47:39 -0700 | [diff] [blame] | 416 | va_end(args); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 417 | validated_ = false; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 418 | |
| 419 | return 0; |
| 420 | } |
| 421 | |
| 422 | DisplayError HWCDisplayPrimary::SetDisplayMode(uint32_t mode) { |
| 423 | DisplayError error = kErrorNone; |
| 424 | |
| 425 | if (display_intf_) { |
| 426 | error = display_intf_->SetDisplayMode(mode); |
| 427 | } |
| 428 | |
| 429 | return error; |
| 430 | } |
| 431 | |
| 432 | void HWCDisplayPrimary::SetMetaDataRefreshRateFlag(bool enable) { |
| 433 | int disable_metadata_dynfps = 0; |
| 434 | |
Uday Kiran Pichika | 5e656b2 | 2018-05-15 18:48:24 +0530 | [diff] [blame] | 435 | HWCDebugHandler::Get()->GetProperty(DISABLE_METADATA_DYNAMIC_FPS_PROP, &disable_metadata_dynfps); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 436 | if (disable_metadata_dynfps) { |
| 437 | return; |
| 438 | } |
| 439 | use_metadata_refresh_rate_ = enable; |
| 440 | } |
| 441 | |
Gopikrishnaiah Anandan | cc12306 | 2017-07-31 17:21:03 -0700 | [diff] [blame] | 442 | void HWCDisplayPrimary::SetQDCMSolidFillInfo(bool enable, const LayerSolidFill &color) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 443 | solid_fill_enable_ = enable; |
| 444 | solid_fill_color_ = color; |
| 445 | } |
| 446 | |
| 447 | void HWCDisplayPrimary::ToggleCPUHint(bool set) { |
| 448 | if (!cpu_hint_) { |
| 449 | return; |
| 450 | } |
| 451 | |
| 452 | if (set) { |
| 453 | cpu_hint_->Set(); |
| 454 | } else { |
| 455 | cpu_hint_->Reset(); |
| 456 | } |
| 457 | } |
| 458 | |
Ramkumar Radhakrishnan | a38b760 | 2018-03-15 14:49:52 -0700 | [diff] [blame] | 459 | int HWCDisplayPrimary::HandleSecureSession(const std::bitset<kSecureMax> &secure_sessions, |
| 460 | bool *power_on_pending) { |
| 461 | if (!power_on_pending) { |
| 462 | return -EINVAL; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 463 | } |
Ramkumar Radhakrishnan | a38b760 | 2018-03-15 14:49:52 -0700 | [diff] [blame] | 464 | |
| 465 | if (active_secure_sessions_[kSecureDisplay] != secure_sessions[kSecureDisplay]) { |
| 466 | SecureEvent secure_event = |
| 467 | secure_sessions.test(kSecureDisplay) ? kSecureDisplayStart : kSecureDisplayEnd; |
| 468 | DisplayError err = display_intf_->HandleSecureEvent(secure_event); |
| 469 | if (err != kErrorNone) { |
| 470 | DLOGE("Set secure event failed"); |
| 471 | return err; |
| 472 | } |
| 473 | |
| 474 | DLOGI("SecureDisplay state changed from %d to %d for display %d", |
| 475 | active_secure_sessions_.test(kSecureDisplay), secure_sessions.test(kSecureDisplay), |
| 476 | type_); |
| 477 | } |
| 478 | active_secure_sessions_ = secure_sessions; |
| 479 | *power_on_pending = false; |
| 480 | return 0; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 481 | } |
| 482 | |
| 483 | void HWCDisplayPrimary::ForceRefreshRate(uint32_t refresh_rate) { |
| 484 | if ((refresh_rate && (refresh_rate < min_refresh_rate_ || refresh_rate > max_refresh_rate_)) || |
| 485 | force_refresh_rate_ == refresh_rate) { |
| 486 | // Cannot honor force refresh rate, as its beyond the range or new request is same |
| 487 | return; |
| 488 | } |
| 489 | |
| 490 | force_refresh_rate_ = refresh_rate; |
| 491 | |
| 492 | callbacks_->Refresh(HWC_DISPLAY_PRIMARY); |
| 493 | |
| 494 | return; |
| 495 | } |
| 496 | |
| 497 | uint32_t HWCDisplayPrimary::GetOptimalRefreshRate(bool one_updating_layer) { |
| 498 | if (force_refresh_rate_) { |
| 499 | return force_refresh_rate_; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 500 | } else if (use_metadata_refresh_rate_ && one_updating_layer && metadata_refresh_rate_) { |
| 501 | return metadata_refresh_rate_; |
| 502 | } |
| 503 | |
| 504 | return max_refresh_rate_; |
| 505 | } |
| 506 | |
| 507 | DisplayError HWCDisplayPrimary::Refresh() { |
| 508 | DisplayError error = kErrorNone; |
| 509 | |
| 510 | callbacks_->Refresh(HWC_DISPLAY_PRIMARY); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 511 | |
| 512 | return error; |
| 513 | } |
| 514 | |
| 515 | void HWCDisplayPrimary::SetIdleTimeoutMs(uint32_t timeout_ms) { |
| 516 | display_intf_->SetIdleTimeoutMs(timeout_ms); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 517 | validated_ = false; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 518 | } |
| 519 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 520 | void HWCDisplayPrimary::HandleFrameOutput() { |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 521 | if (readback_buffer_queued_) { |
| 522 | validated_ = false; |
| 523 | } |
| 524 | |
| 525 | if (dump_output_to_file_) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 526 | HandleFrameDump(); |
| 527 | } |
| 528 | } |
| 529 | |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 530 | void HWCDisplayPrimary::HandleFrameDump() { |
| 531 | if (!readback_configured_) { |
| 532 | dump_frame_count_ = 0; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 533 | } |
| 534 | |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 535 | if (dump_frame_count_ && output_buffer_.release_fence_fd >= 0) { |
| 536 | int ret = sync_wait(output_buffer_.release_fence_fd, 1000); |
| 537 | ::close(output_buffer_.release_fence_fd); |
| 538 | output_buffer_.release_fence_fd = -1; |
| 539 | if (ret < 0) { |
| 540 | DLOGE("sync_wait error errno = %d, desc = %s", errno, strerror(errno)); |
| 541 | } else { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 542 | DumpOutputBuffer(output_buffer_info_, output_buffer_base_, layer_stack_.retire_fence_fd); |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 543 | readback_buffer_queued_ = false; |
Sushil Chauhan | 062a7a4 | 2018-04-25 22:27:52 -0700 | [diff] [blame] | 544 | validated_ = false; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 545 | } |
| 546 | } |
| 547 | |
| 548 | if (0 == dump_frame_count_) { |
| 549 | dump_output_to_file_ = false; |
| 550 | // Unmap and Free buffer |
| 551 | if (munmap(output_buffer_base_, output_buffer_info_.alloc_buffer_info.size) != 0) { |
| 552 | DLOGE("unmap failed with err %d", errno); |
| 553 | } |
| 554 | if (buffer_allocator_->FreeBuffer(&output_buffer_info_) != 0) { |
| 555 | DLOGE("FreeBuffer failed"); |
| 556 | } |
| 557 | |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 558 | readback_buffer_queued_ = false; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 559 | post_processed_output_ = false; |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 560 | readback_configured_ = false; |
| 561 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 562 | output_buffer_ = {}; |
| 563 | output_buffer_info_ = {}; |
| 564 | output_buffer_base_ = nullptr; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 565 | } |
| 566 | } |
| 567 | |
Mathew Joseph Karimpanal | dbd64f8 | 2017-10-06 10:13:38 +0530 | [diff] [blame] | 568 | HWC2::Error HWCDisplayPrimary::SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 569 | HWCDisplay::SetFrameDumpConfig(count, bit_mask_layer_type); |
| 570 | dump_output_to_file_ = bit_mask_layer_type & (1 << OUTPUT_LAYER_DUMP); |
| 571 | DLOGI("output_layer_dump_enable %d", dump_output_to_file_); |
| 572 | |
| 573 | if (!count || !dump_output_to_file_) { |
Mathew Joseph Karimpanal | dbd64f8 | 2017-10-06 10:13:38 +0530 | [diff] [blame] | 574 | return HWC2::Error::None; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 575 | } |
| 576 | |
| 577 | // Allocate and map output buffer |
| 578 | output_buffer_info_ = {}; |
| 579 | // Since we dump DSPP output use Panel resolution. |
| 580 | GetPanelResolution(&output_buffer_info_.buffer_config.width, |
| 581 | &output_buffer_info_.buffer_config.height); |
| 582 | output_buffer_info_.buffer_config.format = kFormatRGB888; |
| 583 | output_buffer_info_.buffer_config.buffer_count = 1; |
| 584 | if (buffer_allocator_->AllocateBuffer(&output_buffer_info_) != 0) { |
| 585 | DLOGE("Buffer allocation failed"); |
| 586 | output_buffer_info_ = {}; |
Mathew Joseph Karimpanal | dbd64f8 | 2017-10-06 10:13:38 +0530 | [diff] [blame] | 587 | return HWC2::Error::NoResources; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 588 | } |
| 589 | |
| 590 | void *buffer = mmap(NULL, output_buffer_info_.alloc_buffer_info.size, PROT_READ | PROT_WRITE, |
| 591 | MAP_SHARED, output_buffer_info_.alloc_buffer_info.fd, 0); |
| 592 | |
| 593 | if (buffer == MAP_FAILED) { |
| 594 | DLOGE("mmap failed with err %d", errno); |
| 595 | buffer_allocator_->FreeBuffer(&output_buffer_info_); |
| 596 | output_buffer_info_ = {}; |
Mathew Joseph Karimpanal | dbd64f8 | 2017-10-06 10:13:38 +0530 | [diff] [blame] | 597 | return HWC2::Error::NoResources; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 598 | } |
| 599 | |
| 600 | output_buffer_base_ = buffer; |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 601 | const native_handle_t *handle = static_cast<native_handle_t *>(output_buffer_info_.private_data); |
| 602 | SetReadbackBuffer(handle, -1, true); |
| 603 | |
Mathew Joseph Karimpanal | dbd64f8 | 2017-10-06 10:13:38 +0530 | [diff] [blame] | 604 | return HWC2::Error::None; |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | int HWCDisplayPrimary::FrameCaptureAsync(const BufferInfo &output_buffer_info, |
| 608 | bool post_processed_output) { |
| 609 | // Note: This function is called in context of a binder thread and a lock is already held |
| 610 | if (output_buffer_info.alloc_buffer_info.fd < 0) { |
| 611 | DLOGE("Invalid fd %d", output_buffer_info.alloc_buffer_info.fd); |
| 612 | return -1; |
| 613 | } |
| 614 | |
| 615 | auto panel_width = 0u; |
| 616 | auto panel_height = 0u; |
| 617 | auto fb_width = 0u; |
| 618 | auto fb_height = 0u; |
| 619 | |
| 620 | GetPanelResolution(&panel_width, &panel_height); |
| 621 | GetFrameBufferResolution(&fb_width, &fb_height); |
| 622 | |
Ch Ganesh Kumar | 5c4988b | 2017-06-07 15:21:02 +0530 | [diff] [blame] | 623 | if (post_processed_output && (output_buffer_info.buffer_config.width < panel_width || |
| 624 | output_buffer_info.buffer_config.height < panel_height)) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 625 | DLOGE("Buffer dimensions should not be less than panel resolution"); |
| 626 | return -1; |
Ch Ganesh Kumar | 5c4988b | 2017-06-07 15:21:02 +0530 | [diff] [blame] | 627 | } else if (!post_processed_output && (output_buffer_info.buffer_config.width < fb_width || |
| 628 | output_buffer_info.buffer_config.height < fb_height)) { |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 629 | DLOGE("Buffer dimensions should not be less than FB resolution"); |
| 630 | return -1; |
| 631 | } |
| 632 | |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 633 | const native_handle_t *buffer = static_cast<native_handle_t *>(output_buffer_info.private_data); |
| 634 | SetReadbackBuffer(buffer, -1, post_processed_output); |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 635 | |
| 636 | return 0; |
| 637 | } |
| 638 | |
Sushil Chauhan | 0652158 | 2018-03-19 14:00:23 -0700 | [diff] [blame] | 639 | bool HWCDisplayPrimary::GetFrameCaptureFence(int32_t *release_fence) { |
| 640 | return (GetReadbackBufferFence(release_fence) == HWC2::Error::None); |
| 641 | } |
| 642 | |
Alan Kwong | 2e13633 | 2016-08-16 07:50:16 -0400 | [diff] [blame] | 643 | DisplayError HWCDisplayPrimary::SetDetailEnhancerConfig |
| 644 | (const DisplayDetailEnhancerData &de_data) { |
| 645 | DisplayError error = kErrorNotSupported; |
| 646 | |
| 647 | if (display_intf_) { |
| 648 | error = display_intf_->SetDetailEnhancerData(de_data); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 649 | validated_ = false; |
Alan Kwong | 2e13633 | 2016-08-16 07:50:16 -0400 | [diff] [blame] | 650 | } |
| 651 | return error; |
| 652 | } |
| 653 | |
Arun Kumar K.R | 17bbd04 | 2016-06-07 17:38:02 -0700 | [diff] [blame] | 654 | DisplayError HWCDisplayPrimary::ControlPartialUpdate(bool enable, uint32_t *pending) { |
| 655 | DisplayError error = kErrorNone; |
| 656 | |
| 657 | if (display_intf_) { |
| 658 | error = display_intf_->ControlPartialUpdate(enable, pending); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 659 | validated_ = false; |
Arun Kumar K.R | 17bbd04 | 2016-06-07 17:38:02 -0700 | [diff] [blame] | 660 | } |
| 661 | |
| 662 | return error; |
| 663 | } |
| 664 | |
| 665 | DisplayError HWCDisplayPrimary::DisablePartialUpdateOneFrame() { |
| 666 | DisplayError error = kErrorNone; |
| 667 | |
| 668 | if (display_intf_) { |
| 669 | error = display_intf_->DisablePartialUpdateOneFrame(); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 670 | validated_ = false; |
Arun Kumar K.R | 17bbd04 | 2016-06-07 17:38:02 -0700 | [diff] [blame] | 671 | } |
| 672 | |
| 673 | return error; |
| 674 | } |
| 675 | |
| 676 | |
Arun Kumar K.R | 8da7f50 | 2016-06-07 17:45:50 -0700 | [diff] [blame] | 677 | DisplayError HWCDisplayPrimary::SetMixerResolution(uint32_t width, uint32_t height) { |
Sushil Chauhan | 409e844 | 2017-06-12 17:43:25 -0700 | [diff] [blame] | 678 | DisplayError error = display_intf_->SetMixerResolution(width, height); |
Saurabh Shah | a307e8c | 2017-09-28 18:05:40 -0700 | [diff] [blame] | 679 | validated_ = false; |
Sushil Chauhan | 409e844 | 2017-06-12 17:43:25 -0700 | [diff] [blame] | 680 | return error; |
Arun Kumar K.R | 8da7f50 | 2016-06-07 17:45:50 -0700 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | DisplayError HWCDisplayPrimary::GetMixerResolution(uint32_t *width, uint32_t *height) { |
| 684 | return display_intf_->GetMixerResolution(width, height); |
| 685 | } |
| 686 | |
Sushil Chauhan | 380a59d | 2018-03-19 15:47:50 -0700 | [diff] [blame] | 687 | HWC2::Error HWCDisplayPrimary::SetQSyncMode(QSyncMode qsync_mode) { |
| 688 | auto err = display_intf_->SetQSyncMode(qsync_mode); |
| 689 | if (err != kErrorNone) { |
| 690 | return HWC2::Error::Unsupported; |
| 691 | } |
| 692 | |
| 693 | return HWC2::Error::None; |
| 694 | } |
| 695 | |
Naseer Ahmed | b92e73f | 2016-03-12 02:03:48 -0500 | [diff] [blame] | 696 | } // namespace sdm |