1 /* 2 * Copyright (c) 2014 - 2020, 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 /*! @file display_interface.h 26 @brief Interface file for display device which represents a physical panel or an output buffer 27 where contents can be rendered. 28 29 @details Display device is used to send layer buffers for composition and get them rendered onto 30 the target device. Each display device represents a unique display target which may be either a 31 physical panel or an output buffer.. 32 */ 33 34 /* 35 * Changes from Qualcomm Innovation Center are provided under the following license: 36 * 37 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 38 * 39 * Redistribution and use in source and binary forms, with or without 40 * modification, are permitted (subject to the limitations in the 41 * disclaimer below) provided that the following conditions are met: 42 * 43 * * Redistributions of source code must retain the above copyright 44 * notice, this list of conditions and the following disclaimer. 45 * 46 * * Redistributions in binary form must reproduce the above 47 * copyright notice, this list of conditions and the following 48 * disclaimer in the documentation and/or other materials provided 49 * with the distribution. 50 * 51 * * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its 52 * contributors may be used to endorse or promote products derived 53 * from this software without specific prior written permission. 54 * 55 * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE 56 * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT 57 * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 58 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 59 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 60 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 61 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 62 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 63 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 64 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 65 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 66 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 67 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 68 */ 69 70 #ifndef __DISPLAY_INTERFACE_H__ 71 #define __DISPLAY_INTERFACE_H__ 72 73 #include <stdint.h> 74 #include <string> 75 #include <vector> 76 #include <utility> 77 78 #include "layer_stack.h" 79 #include "sdm_types.h" 80 81 namespace sdm { 82 83 typedef std::vector<std::pair<std::string, std::string>> AttrVal; 84 85 /*! @brief This enum represents display device types where contents can be rendered. 86 87 @sa CoreInterface::CreateDisplay 88 @sa CoreInterface::IsDisplaySupported 89 */ 90 enum DisplayType { 91 kPrimary, //!< Main physical display which is attached to the handheld device. 92 kBuiltIn = kPrimary, //!< Type name for all non-detachable physical displays. Use kBuiltIn 93 //!< instead of kPrimary. 94 kHDMI, //!< HDMI physical display which is generally detachable. 95 kPluggable = kHDMI, //!< Type name for all pluggable physical displays. Use kPluggable 96 //!< instead of kHDMI. 97 kVirtual, //!< Contents would be rendered into the output buffer provided by the 98 //!< client e.g. wireless display. 99 kDisplayMax, 100 kDisplayTypeMax = kDisplayMax 101 }; 102 103 /*! @brief This enum represents states of a display device. 104 105 @sa DisplayInterface::GetDisplayState 106 @sa DisplayInterface::SetDisplayState 107 */ 108 enum DisplayState { 109 kStateOff, //!< Display is OFF. Contents are not rendered in this state. Client will not 110 //!< receive VSync events in this state. This is default state as well. 111 112 kStateOn, //!< Display is ON. Contents are rendered in this state. 113 114 kStateDoze, //!< Display is ON and it is configured in a low power state. 115 116 kStateDozeSuspend, 117 //!< Display is ON in a low power state and continue showing its current 118 //!< contents indefinitely until the mode changes. 119 120 kStateStandby, //!< Display is OFF. Client will continue to receive VSync events in this state 121 //!< if VSync is enabled. Contents are not rendered in this state. 122 }; 123 124 /*! @brief This enum represents flags to override detail enhancer parameters. 125 126 @sa DisplayInterface::SetDetailEnhancerData 127 */ 128 enum DetailEnhancerOverrideFlags { 129 kOverrideDEEnable = 0x1, // Specifies to enable detail enhancer 130 kOverrideDESharpen1 = 0x2, // Specifies user defined Sharpening/smooth for noise 131 kOverrideDESharpen2 = 0x4, // Specifies user defined Sharpening/smooth for signal 132 kOverrideDEClip = 0x8, // Specifies user defined DE clip shift 133 kOverrideDELimit = 0x10, // Specifies user defined DE limit value 134 kOverrideDEThrQuiet = 0x20, // Specifies user defined DE quiet threshold 135 kOverrideDEThrDieout = 0x40, // Specifies user defined DE dieout threshold 136 kOverrideDEThrLow = 0x80, // Specifies user defined DE low threshold 137 kOverrideDEThrHigh = 0x100, // Specifies user defined DE high threshold 138 kOverrideDEFilterConfig = 0x200, // Specifies user defined scaling filter config 139 kOverrideDEBlend = 0x400, // Specifies user defined DE blend. 140 kOverrideDEMax = 0xFFFFFFFF, 141 }; 142 143 /*! @brief This enum represents Y/RGB scaling filter configuration. 144 145 @sa DisplayInterface::SetDetailEnhancerData 146 */ 147 enum ScalingFilterConfig { 148 kFilterEdgeDirected, 149 kFilterCircular, 150 kFilterSeparable, 151 kFilterBilinear, 152 kFilterMax, 153 }; 154 155 /*! @brief This enum represents the quality level of the content. 156 157 @sa DisplayInterface::SetDetailEnhancerData 158 */ 159 enum ContentQuality { 160 kContentQualityUnknown, // Default: high artifact and noise 161 kContentQualityLow, // Low quality content, high artifact and noise, 162 kContentQualityMedium, // Medium quality, medium artifact and noise, 163 kContentQualityHigh, // High quality content, low artifact and noise 164 kContentQualityMax, 165 }; 166 167 /*! @brief This enum represents the display port. 168 169 @sa DisplayInterface::GetDisplayPort 170 */ 171 enum DisplayPort { 172 kPortDefault, 173 kPortDSI, // Display is connected to DSI port. 174 kPortDTV, // Display is connected to DTV port 175 kPortWriteBack, // Display is connected to writeback port 176 kPortLVDS, // Display is connected to LVDS port 177 kPortEDP, // Display is connected to EDP port 178 kPortDP, // Display is connected to DP port. 179 }; 180 181 /*! @brief This enum represents the events received by Display HAL. */ 182 enum DisplayEvent { 183 kIdleTimeout, // Event triggered by Idle Timer. 184 kThermalEvent, // Event triggered by Thermal. 185 kIdlePowerCollapse, // Event triggered by Idle Power Collapse. 186 kPanelDeadEvent, // Event triggered by ESD. 187 kDisplayPowerResetEvent, // Event triggered by Hardware Recovery. 188 kInvalidateDisplay, // Event triggered by DrawCycle thread to Invalidate display. 189 kSyncInvalidateDisplay, // Event triggered by Non-DrawCycle threads to Invalidate display. 190 kPostIdleTimeout, // Event triggered after entering idle. 191 }; 192 193 /*! @brief This enum represents the secure events received by Display HAL. */ 194 enum SecureEvent { 195 kSecureDisplayStart, // Client sets it to notify secure display session start 196 kSecureDisplayEnd, // Client sets it to notify secure display session end 197 kSecureEventMax, 198 }; 199 200 /*! @brief This enum represents the QSync modes supported by the hardware. */ 201 enum QSyncMode { 202 kQSyncModeNone, // This is set by the client to disable qsync 203 kQSyncModeContinuous, // This is set by the client to enable qsync forever 204 kQsyncModeOneShot, // This is set by client to enable qsync only for current frame. 205 kQsyncModeOneShotContinuous, // This is set by client to enable qsync only for every commit. 206 }; 207 208 /*! @brief This structure defines configuration for display dpps ad4 region of interest. */ 209 struct DisplayDppsAd4RoiCfg { 210 uint32_t h_start; //!< start in hotizontal direction 211 uint32_t h_end; //!< end in hotizontal direction 212 uint32_t v_start; //!< start in vertical direction 213 uint32_t v_end; //!< end in vertical direction 214 uint32_t factor_in; //!< the strength factor of inside ROI region 215 uint32_t factor_out; //!< the strength factor of outside ROI region 216 }; 217 218 /*! @brief This enum defines frame trigger modes. */ 219 enum FrameTriggerMode { 220 kFrameTriggerDefault, //!< Wait for pp_done of previous frame to trigger new frame 221 kFrameTriggerSerialize, //!< Trigger new frame and wait for pp_done of this frame 222 kFrameTriggerPostedStart, //!< Posted start mode, trigger new frame without pp_done 223 kFrameTriggerMax, 224 }; 225 226 /*! @brief This structure defines configuration for fixed properties of a display device. 227 228 @sa DisplayInterface::GetConfig 229 @sa DisplayInterface::SetConfig 230 */ 231 struct DisplayConfigFixedInfo { 232 bool underscan = false; //!< If display support CE underscan. 233 bool secure = false; //!< If this display is capable of handling secure content. 234 bool is_cmdmode = false; //!< If panel is command mode panel. 235 bool hdr_supported = false; //!< If HDR10 is supported. 236 bool hdr_plus_supported = false; //!< If HDR10+ is supported. 237 bool hdr_metadata_type_one = false; //!< Metadata type one obtained from HDR sink 238 uint32_t hdr_eotf = 0; //!< Electro optical transfer function 239 float max_luminance = 0.0f; //!< From Panel's peak luminance 240 float average_luminance = 0.0f; //!< From Panel's average luminance 241 float min_luminance = 0.0f; //!< From Panel's blackness level 242 bool partial_update = false; //!< If display supports Partial Update. 243 bool readback_supported = false; //!< If display supports buffer readback. 244 }; 245 246 /*! @brief This structure defines configuration for variable properties of a display device. 247 248 @sa DisplayInterface::GetConfig 249 @sa DisplayInterface::SetConfig 250 */ 251 struct DisplayConfigGroupInfo { 252 uint32_t x_pixels = 0; //!< Total number of pixels in X-direction on the display panel. 253 uint32_t y_pixels = 0; //!< Total number of pixels in Y-direction on the display panel. 254 float x_dpi = 0.0f; //!< Dots per inch in X-direction. 255 float y_dpi = 0.0f; //!< Dots per inch in Y-direction. 256 bool is_yuv = false; //!< If the display output is in YUV format. 257 bool smart_panel = false; //!< If the display config has smart panel. 258 259 bool operator==(const DisplayConfigGroupInfo& info) const { 260 return ((x_pixels == info.x_pixels) && (y_pixels == info.y_pixels) && (x_dpi == info.x_dpi) && 261 (y_dpi == info.y_dpi) && (is_yuv == info.is_yuv) && (smart_panel == info.smart_panel)); 262 } 263 }; 264 265 struct DisplayConfigVariableInfo : public DisplayConfigGroupInfo { 266 uint32_t fps = 0; //!< Frame rate per second. 267 uint32_t vsync_period_ns = 0; //!< VSync period in nanoseconds. 268 269 bool operator==(const DisplayConfigVariableInfo& info) const { 270 return ((x_pixels == info.x_pixels) && (y_pixels == info.y_pixels) && (x_dpi == info.x_dpi) && 271 (y_dpi == info.y_dpi) && (fps == info.fps) && (vsync_period_ns == info.vsync_period_ns) 272 && (is_yuv == info.is_yuv)); 273 } 274 }; 275 276 /*! @brief Event data associated with VSync event. 277 278 @sa DisplayEventHandler::VSync 279 */ 280 struct DisplayEventVSync { 281 int64_t timestamp = 0; //!< System monotonic clock timestamp in nanoseconds. 282 }; 283 284 /*! @brief The structure defines the user input for detail enhancer module. 285 286 @sa DisplayInterface::SetDetailEnhancerData 287 */ 288 struct DisplayDetailEnhancerData { 289 uint32_t override_flags = 0; // flags to specify which data to be set. 290 uint16_t enable = 0; // Detail enchancer enable 291 int16_t sharpen_level1 = 0; // Sharpening/smooth strenght for noise 292 int16_t sharpen_level2 = 0; // Sharpening/smooth strenght for signal 293 uint16_t clip = 0; // DE clip shift 294 uint16_t limit = 0; // DE limit value 295 uint16_t thr_quiet = 0; // DE quiet threshold 296 uint16_t thr_dieout = 0; // DE dieout threshold 297 uint16_t thr_low = 0; // DE low threshold 298 uint16_t thr_high = 0; // DE high threshold 299 int32_t sharp_factor = 50; // sharp_factor specifies sharpness/smoothness level, 300 // range -100..100 positive for sharpness and negative for 301 // smoothness 302 ContentQuality quality_level = kContentQualityUnknown; 303 // Specifies context quality level 304 ScalingFilterConfig filter_config = kFilterEdgeDirected; 305 // Y/RGB filter configuration 306 uint32_t de_blend = 0; // DE Unsharp Mask blend between High and Low frequencies 307 }; 308 309 /*! @brief Display device event handler implemented by the client. 310 311 @details This class declares prototype for display device event handler methods which must be 312 implemented by the client. Display device will use these methods to notify events to the client. 313 Client must post heavy-weight event handling to a separate thread and unblock display manager 314 thread instantly. 315 316 @sa CoreInterface::CreateDisplay 317 */ 318 class DisplayEventHandler { 319 public: 320 /*! @brief Event handler for VSync event. 321 322 @details This event is dispatched on every vertical synchronization. The event is disabled by 323 default. 324 325 @param[in] vsync \link DisplayEventVSync \endlink 326 327 @return \link DisplayError \endlink 328 329 @sa DisplayInterface::GetDisplayState 330 @sa DisplayInterface::SetDisplayState 331 */ 332 virtual DisplayError VSync(const DisplayEventVSync &vsync) = 0; 333 334 /*! @brief Event handler for Refresh event. 335 336 @details This event is dispatched to trigger a screen refresh. Client must call Prepare() and 337 Commit() in response to it from a separate thread. There is no data associated with this 338 event. 339 340 @return \link DisplayError \endlink 341 342 @sa DisplayInterface::Prepare 343 @sa DisplayInterface::Commit 344 */ 345 virtual DisplayError Refresh() = 0; 346 347 /*! @brief Event handler for CEC messages. 348 349 @details This event is dispatched to send CEC messages to the CEC HAL. 350 351 @param[in] message message to be sent 352 353 @return \link DisplayError \endlink 354 */ 355 virtual DisplayError CECMessage(char *message) = 0; 356 357 /*! @brief Event handler for Histogram messages received by Display HAL. */ 358 virtual DisplayError HistogramEvent(int source_fd, uint32_t blob_id) = 0; 359 360 /*! @brief Event handler for events received by Display HAL. */ 361 virtual DisplayError HandleEvent(DisplayEvent event) = 0; 362 363 protected: ~DisplayEventHandler()364 virtual ~DisplayEventHandler() { } 365 }; 366 367 struct PPDisplayAPIPayload; 368 struct PPPendingParams; 369 370 /*! @brief Display device interface. 371 372 @details This class defines display device interface. It contains methods which client shall use 373 to configure or submit layers for composition on the display device. This interface is created 374 during display device creation and remains valid until destroyed. 375 376 @sa CoreInterface::CreateDisplay 377 @sa CoreInterface::DestroyDisplay 378 */ 379 class DisplayInterface { 380 public: 381 /*! @brief Method to determine hardware capability to compose layers associated with given frame. 382 383 @details Client shall send all layers associated with a frame targeted for current display 384 using this method and check the layers which can be handled completely in display manager. 385 386 Client shall mark composition type for one of the layer as kCompositionGPUTarget; the GPU 387 composed output would be rendered at the specified layer if some of the layers are not handled 388 by SDM. 389 390 Display manager will set each layer as kCompositionGPU or kCompositionSDE upon return. Client 391 shall render all the layers marked as kCompositionGPU using GPU. 392 393 This method can be called multiple times but only last call prevails. This method must be 394 followed by Commit(). 395 396 @param[inout] layer_stack \link LayerStack \endlink 397 398 @return \link DisplayError \endlink 399 400 @sa Commit 401 */ 402 virtual DisplayError Prepare(LayerStack *layer_stack) = 0; 403 404 /*! @brief Method to commit layers of a frame submitted in a former call to Prepare(). 405 406 @details Client shall call this method to submit layers for final composition. The composed 407 output would be displayed on the panel or written in output buffer. 408 409 Client must ensure that layer stack is same as previous call to Prepare. 410 411 This method shall be called only once for each frame. 412 413 In the event of an error as well, this call will cause any fences returned in the previous call 414 to Commit() to eventually become signaled, so the client's wait on fences can be released to 415 prevent deadlocks. 416 417 @param[in] layer_stack \link LayerStack \endlink 418 419 @return \link DisplayError \endlink 420 421 @sa Prepare 422 */ 423 virtual DisplayError Commit(LayerStack *layer_stack) = 0; 424 425 /*! @brief Method to flush any pending buffers/fences submitted previously via Commit() call. 426 427 @details Client shall call this method to request the Display manager to release all buffers and 428 respective fences currently in use. This operation may result in a blank display on the panel 429 until a new frame is submitted for composition. 430 431 For virtual displays this would result in output buffer getting cleared with border color. 432 433 @param[in] layer_stack \link LayerStack \endlink 434 435 @return \link DisplayError \endlink 436 437 @sa Prepare 438 @sa Commit 439 */ 440 virtual DisplayError Flush(LayerStack *layer_stack) = 0; 441 442 /*! @brief Method to get current state of the display device. 443 444 @param[out] state \link DisplayState \endlink 445 446 @return \link DisplayError \endlink 447 448 @sa SetDisplayState 449 */ 450 virtual DisplayError GetDisplayState(DisplayState *state) = 0; 451 452 /*! @brief Method to get number of configurations(variable properties) supported on the display 453 device. 454 455 @param[out] count Number of modes supported; mode index starts with 0. 456 457 @return \link DisplayError \endlink 458 */ 459 virtual DisplayError GetNumVariableInfoConfigs(uint32_t *count) = 0; 460 461 /*! @brief Method to get configuration for fixed properties of the display device. 462 463 @param[out] fixed_info \link DisplayConfigFixedInfo \endlink 464 465 @return \link DisplayError \endlink 466 */ 467 virtual DisplayError GetConfig(DisplayConfigFixedInfo *fixed_info) = 0; 468 469 /*! @brief Method to get configuration for variable properties of the display device. 470 471 @param[in] index index of the mode 472 @param[out] variable_info \link DisplayConfigVariableInfo \endlink 473 474 @return \link DisplayError \endlink 475 */ 476 virtual DisplayError GetConfig(uint32_t index, DisplayConfigVariableInfo *variable_info) = 0; 477 478 /*! @brief Method to get index of active configuration of the display device. 479 480 @param[out] index index of the mode corresponding to variable properties. 481 482 @return \link DisplayError \endlink 483 */ 484 virtual DisplayError GetActiveConfig(uint32_t *index) = 0; 485 486 /*! @brief Method to get VSync event state. Default event state is disabled. 487 488 @param[out] enabled vsync state 489 490 @return \link DisplayError \endlink 491 */ 492 virtual DisplayError GetVSyncState(bool *enabled) = 0; 493 494 /*! @brief Method to set current state of the display device. 495 496 @param[in] state \link DisplayState \endlink 497 @param[in] flag to force full bridge teardown for pluggable displays, no-op for other displays, 498 if requested state is kStateOff 499 @param[in] pointer to release fence 500 501 @return \link DisplayError \endlink 502 503 @sa SetDisplayState 504 */ 505 virtual DisplayError SetDisplayState(DisplayState state, bool teardown, 506 shared_ptr<Fence> *release_fence) = 0; 507 508 /*! @brief Method to set active configuration for variable properties of the display device. 509 510 @param[in] variable_info \link DisplayConfigVariableInfo \endlink 511 512 @return \link DisplayError \endlink 513 */ 514 virtual DisplayError SetActiveConfig(DisplayConfigVariableInfo *variable_info) = 0; 515 516 /*! @brief Method to set active configuration for variable properties of the display device. 517 518 @param[in] index index of the mode corresponding to variable properties. 519 520 @return \link DisplayError \endlink 521 */ 522 virtual DisplayError SetActiveConfig(uint32_t index) = 0; 523 524 /*! @brief Method to set VSync event state. Default event state is disabled. 525 526 @param[out] enabled vsync state 527 528 @return \link DisplayError \endlink 529 */ 530 virtual DisplayError SetVSyncState(bool enable) = 0; 531 532 /*! @brief Method to set idle timeout value. Idle fallback is disabled with timeout value 0. 533 534 @param[in] active_ms value in milliseconds. 535 @param[in] in_active_ms value in milliseconds. 536 537 @return \link void \endlink 538 */ 539 virtual void SetIdleTimeoutMs(uint32_t active_ms, uint32_t inactive_ms) = 0; 540 541 /*! @brief Method to set maximum number of mixer stages for each display. 542 543 @param[in] max_mixer_stages maximum number of mixer stages. 544 545 @return \link DisplayError \endlink 546 */ 547 virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages) = 0; 548 549 /*! @brief Method to control partial update feature for each display. 550 551 @param[in] enable partial update feature control flag 552 @param[out] pending whether the operation is completed or pending for completion 553 554 @return \link DisplayError \endlink 555 */ 556 virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending) = 0; 557 558 /*! @brief Method to disable partial update for at least 1 frame. 559 @return \link DisplayError \endlink 560 */ 561 virtual DisplayError DisablePartialUpdateOneFrame() = 0; 562 563 /*! @brief Method to set the mode of the primary display. 564 565 @param[in] mode the new display mode. 566 567 @return \link DisplayError \endlink 568 */ 569 virtual DisplayError SetDisplayMode(uint32_t mode) = 0; 570 571 /*! @brief Method to get the min and max refresh rate of a display. 572 573 @param[out] min and max refresh rate. 574 575 @return \link DisplayError \endlink 576 */ 577 virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate, 578 uint32_t *max_refresh_rate) = 0; 579 580 /*! @brief Method to set the refresh rate of a display. 581 582 @param[in] refresh_rate new refresh rate of the display. 583 584 @param[in] final_rate indicates whether refresh rate is final rate or can be changed by sdm 585 586 @param[in] idle_screen indicates whether screen is idle. 587 588 @return \link DisplayError \endlink 589 */ 590 virtual DisplayError SetRefreshRate(uint32_t refresh_rate, bool final_rate, 591 bool idle_screen = false) = 0; 592 593 /*! @brief Method to get the refresh rate of a display. 594 595 @param[in] refresh_rate refresh rate of the display. 596 597 @return \link DisplayError \endlink 598 */ 599 virtual DisplayError GetRefreshRate(uint32_t *refresh_rate) = 0; 600 601 /*! @brief Method to query whether scanning is support for the HDMI display. 602 603 @return \link DisplayError \endlink 604 */ 605 virtual bool IsUnderscanSupported() = 0; 606 607 /*! @brief Method to set brightness of the builtin display. 608 609 @param[in] brightness the new backlight level 0.0f(min) to 1.0f(max) where -1.0f represents off. 610 611 @return \link DisplayError \endlink 612 */ 613 virtual DisplayError SetPanelBrightness(float brightness) = 0; 614 615 /*! @brief Method to notify display about change in min HDCP encryption level. 616 617 @param[in] min_enc_level minimum encryption level value. 618 619 @return \link DisplayError \endlink 620 */ 621 virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) = 0; 622 623 /*! @brief Method to route display API requests to color service. 624 625 @param[in] in_payload \link PPDisplayAPIPayload \endlink 626 @param[out] out_payload \link PPDisplayPayload \endlink 627 @param[out] pending_action \link PPPendingParams \endlink 628 629 @return \link DisplayError \endlink 630 */ 631 virtual DisplayError ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload, 632 PPDisplayAPIPayload *out_payload, 633 PPPendingParams *pending_action) = 0; 634 635 /*! @brief Method to request the number of color modes supported. 636 637 @param[out] mode_count Number of modes 638 639 @return \link DisplayError \endlink 640 */ 641 virtual DisplayError GetColorModeCount(uint32_t *mode_count) = 0; 642 643 /*! @brief Method to request the information of supported color modes. 644 645 @param[inout] mode_count Number of updated modes 646 @param[out] vector of mode strings 647 648 @return \link DisplayError \endlink 649 */ 650 virtual DisplayError GetColorModes(uint32_t *mode_count, 651 std::vector<std::string> *color_modes) = 0; 652 653 /*! @brief Method to request the attributes of color mode. 654 655 @param[in] mode name 656 @param[out] vector of mode attributes 657 658 @return \link DisplayError \endlink 659 */ 660 virtual DisplayError GetColorModeAttr(const std::string &color_mode, 661 AttrVal *attr_map) = 0; 662 663 /*! @brief Method to set the color mode 664 665 @param[in] mode_name Mode name which needs to be set 666 667 @return \link DisplayError \endlink 668 */ 669 virtual DisplayError SetColorMode(const std::string &color_mode) = 0; 670 671 /*! @brief Method to set the color mode by ID. This method is used for debugging only. 672 673 @param[in] Mode ID which needs to be set 674 675 @return \link DisplayError \endlink 676 */ 677 virtual DisplayError SetColorModeById(int32_t color_mode_id) = 0; 678 679 /*! @brief Method to get the color mode name. 680 681 @param[in] Mode ID 682 @param[out] Mode name 683 684 @return \link DisplayError \endlink 685 */ 686 virtual DisplayError GetColorModeName(int32_t mode_id, std::string *mode_name) = 0; 687 688 /*! @brief Method to set the color transform 689 690 @param[in] length Mode name which needs to be set 691 @param[in] color_transform 4x4 Matrix for color transform 692 693 @return \link DisplayError \endlink 694 */ 695 virtual DisplayError SetColorTransform(const uint32_t length, const double *color_transform) = 0; 696 697 /*! @brief Method to get the default color mode. 698 699 @param[out] default mode name 700 701 @return \link DisplayError \endlink 702 */ 703 virtual DisplayError GetDefaultColorMode(std::string *color_mode) = 0; 704 705 /*! @brief Method to request applying default display mode. 706 707 @return \link DisplayError \endlink 708 */ 709 virtual DisplayError ApplyDefaultDisplayMode() = 0; 710 711 /*! @brief Method to set the position of the hw cursor. 712 713 @param[in] x \link x position \endlink 714 @param[in] y \link y position \endlink 715 716 @return \link DisplayError \endlink 717 */ 718 virtual DisplayError SetCursorPosition(int x, int y) = 0; 719 720 /*! @brief Method to get the brightness level of the display 721 722 @param[out] brightness brightness percentage 723 724 @return \link DisplayError \endlink 725 */ 726 virtual DisplayError GetPanelBrightness(float *brightness) = 0; 727 728 /*! @brief Method to get the max brightness level of the display 729 730 @param[out] max_brightness level 731 732 @return \link DisplayError \endlink 733 */ 734 virtual DisplayError GetPanelMaxBrightness(uint32_t *max_brightness_level) = 0; 735 736 /*! @brief Method to set layer mixer resolution. 737 738 @param[in] width layer mixer width 739 @param[in] height layer mixer height 740 741 @return \link DisplayError \endlink 742 */ 743 virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height) = 0; 744 745 /*! @brief Method to get layer mixer resolution. 746 747 @param[out] width layer mixer width 748 @param[out] height layer mixer height 749 750 @return \link DisplayError \endlink 751 */ 752 virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height) = 0; 753 754 /*! @brief Method to set frame buffer configuration. 755 756 @param[in] variable_info \link DisplayConfigVariableInfo \endlink 757 758 @return \link DisplayError \endlink 759 */ 760 virtual DisplayError SetFrameBufferConfig(const DisplayConfigVariableInfo &variable_info) = 0; 761 762 /*! @brief Method to get frame buffer configuration. 763 764 @param[out] variable_info \link DisplayConfigVariableInfo \endlink 765 766 @return \link DisplayError \endlink 767 */ 768 virtual DisplayError GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info) = 0; 769 770 /*! @brief Method to set detail enhancement data. 771 772 @param[in] de_data \link DisplayDetailEnhancerData \endlink 773 774 @return \link DisplayError \endlink 775 */ 776 virtual DisplayError SetDetailEnhancerData(const DisplayDetailEnhancerData &de_data) = 0; 777 778 /*! @brief Method to get display port information. 779 780 @param[out] port \link DisplayPort \endlink 781 782 @return \link DisplayError \endlink 783 */ 784 virtual DisplayError GetDisplayPort(DisplayPort *port) = 0; 785 786 /*! @brief Method to get display ID information. 787 788 @param[out] display_id Current display's ID as can be discovered using 789 CoreInterface::GetDisplaysStatus(). 790 791 @return \link DisplayError \endlink 792 */ 793 virtual DisplayError GetDisplayId(int32_t *display_id) = 0; 794 795 /*! @brief Method to get the display's type. 796 797 @param[out] display_type Current display's type. 798 799 @return \link DisplayError \endlink 800 */ 801 virtual DisplayError GetDisplayType(DisplayType *display_type) = 0; 802 803 /*! @brief Method to query whether it is Primrary device. 804 805 @return true if this interface is primary. 806 */ 807 virtual bool IsPrimaryDisplay() = 0; 808 809 /*! @brief Method to toggle composition types handling by SDM. 810 811 @details Client shall call this method to request SDM to enable/disable a specific type of 812 layer composition. If client disables a composition type, SDM will not handle any of the layer 813 composition using the disabled method in a draw cycle. On lack of resources to handle all 814 layers using other enabled composition methods, Prepare() will return an error. 815 816 Request to toggle composition type is applied from subsequent draw cycles. 817 818 Default state of all defined composition types is enabled. 819 820 @param[in] composition_type \link LayerComposition \endlink 821 @param[in] enable \link enable composition type \endlink 822 823 @return \link DisplayError \endlink 824 825 @sa Prepare 826 */ 827 virtual DisplayError SetCompositionState(LayerComposition composition_type, bool enable) = 0; 828 829 /*! @brief Method to check whether a client target with the given properties 830 can be supported/handled by hardware. 831 832 @param[in] width client target width 833 @param[in] height client target height 834 @param[in] format client target format 835 @param[in] colorMetaData client target colorMetaData 836 837 @return \link DisplayError \endlink 838 */ 839 virtual DisplayError GetClientTargetSupport(uint32_t width, uint32_t height, 840 LayerBufferFormat format, 841 const ColorMetaData &color_metadata) = 0; 842 843 /*! @brief Method to handle secure events. 844 845 @param[in] secure_event \link SecureEvent \endlink 846 847 @param[inout] layer_stack \link LayerStack \endlink 848 849 @return \link DisplayError \endlink 850 */ 851 virtual DisplayError HandleSecureEvent(SecureEvent secure_event, LayerStack *layer_stack) = 0; 852 853 /*! @brief Method to set dpps ad roi. 854 855 @param[in] roi config parmas 856 857 @return \link DisplayError \endlink 858 */ 859 860 virtual DisplayError SetDisplayDppsAdROI(void *payload) = 0; 861 862 /*! @brief Method to set the Qsync mode. 863 864 @param[in] qsync_mode: \link QSyncMode \endlink 865 866 @return \link DisplayError \endlink 867 */ 868 virtual DisplayError SetQSyncMode(QSyncMode qsync_mode) = 0; 869 870 /*! @brief Method to control idle power collapse feature for primary display. 871 872 @param[in] enable idle power collapse feature control flag 873 @param[in] synchronous commit flag 874 875 @return \link DisplayError \endlink 876 */ 877 virtual DisplayError ControlIdlePowerCollapse(bool enable, bool synchronous) = 0; 878 879 /*! @brief Method to query whether it is supprt sspp tonemap. 880 881 @return true if support sspp tonemap. 882 */ 883 virtual bool IsSupportSsppTonemap() = 0; 884 885 /*! @brief Method to free concurrent writeback resoures for primary display. 886 @return \link DisplayError \endlink 887 */ 888 virtual DisplayError TeardownConcurrentWriteback(void) = 0; 889 890 /*! @brief Method to set frame trigger mode for primary display. 891 892 @param[in] frame trigger mode 893 894 @return \link DisplayError \endlink 895 */ 896 virtual DisplayError SetFrameTriggerMode(FrameTriggerMode mode) = 0; 897 898 /* 899 * Returns a string consisting of a dump of SDM's display and layer related state 900 * as programmed to driver 901 */ 902 virtual std::string Dump() = 0; 903 904 /*! @brief Method to dynamically set DSI clock rate. 905 906 @param[in] bit_clk_rate DSI bit clock rate in HZ. 907 908 @return \link DisplayError \endlink 909 */ 910 virtual DisplayError SetDynamicDSIClock(uint64_t bit_clk_rate) = 0; 911 912 /*! @brief Method to get the current DSI clock rate 913 914 @param[out] bit_clk_rate DSI bit clock rate in HZ 915 916 @return \link DisplayError \endlink 917 */ 918 virtual DisplayError GetDynamicDSIClock(uint64_t *bit_clk_rate) = 0; 919 920 /*! @brief Method to get the supported DSI clock rates 921 922 @param[out] bitclk DSI bit clock in HZ 923 924 @return \link DisplayError \endlink 925 */ 926 virtual DisplayError GetSupportedDSIClock(std::vector<uint64_t> *bitclk_rates) = 0; 927 928 /*! @brief Method to retrieve the EDID information and HW port ID for display 929 930 @param[out] HW port ID 931 @param[out] size of EDID blob data 932 @param[out] EDID blob 933 934 @return \link DisplayError \endlink 935 */ 936 virtual DisplayError GetDisplayIdentificationData(uint8_t *out_port, uint32_t *out_data_size, 937 uint8_t *out_data) = 0; 938 /*! @brief Method to turn on histogram events. */ 939 virtual DisplayError colorSamplingOn() = 0; 940 941 /*! @brief Method to turn off histogram events. */ 942 virtual DisplayError colorSamplingOff() = 0; 943 944 /*! @brief Method to set min/max luminance for dynamic tonemapping of external device over WFD. 945 946 @param[in] min_lum min luminance supported by external device. 947 @param[in] max_lum max luminance supported by external device. 948 949 @return \link DisplayError \endlink 950 */ 951 virtual DisplayError SetPanelLuminanceAttributes(float min_lum, float max_lum) = 0; 952 953 /*! @brief Method to query if there is a need to validate. 954 955 @return \link boolean \endlink 956 */ 957 virtual bool CanSkipValidate() = 0; 958 959 /*! @brief Method to set display backlight scale ratio. 960 961 @param[in] backlight scale ratio. 962 963 @return \link DisplayError \endlink 964 */ 965 virtual DisplayError SetBLScale(uint32_t level) = 0; 966 967 /*! @brief Method to check if the Default resources are freed for display 968 969 @return \link bool \endlink 970 */ 971 virtual bool CheckResourceState() = 0; 972 973 /*! @brief Method to check if game enhance feature is supported for display 974 975 @return \link bool \endlink 976 */ 977 virtual bool GameEnhanceSupported() = 0; 978 979 /*! @brief Method to get the current qsync mode used. 980 981 @return \link DisplayError \endlink 982 */ 983 virtual DisplayError GetQSyncMode(QSyncMode *qsync_mode) = 0; 984 985 /*! @brief Method to clear scaler LUTs. 986 987 @return \link DisplayError \endlink 988 */ 989 virtual DisplayError ClearLUTs() = 0; 990 991 /*! @brief Method to skip first commit. 992 993 @return \link DisplayError \endlink 994 */ 995 virtual DisplayError DelayFirstCommit() = 0; 996 997 protected: ~DisplayInterface()998 virtual ~DisplayInterface() { } 999 }; 1000 1001 } // namespace sdm 1002 1003 #endif // __DISPLAY_INTERFACE_H__ 1004 1005