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