1 /* 2 * Copyright (c) 2014 - 2018, 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 kHDMI, //!< HDMI physical display which is generally detachable. 56 kVirtual, //!< Contents would be rendered into the output buffer provided by the client 57 //!< e.g. wireless display. 58 kDisplayMax, 59 }; 60 61 /*! @brief This enum represents states of a display device. 62 63 @sa DisplayInterface::GetDisplayState 64 @sa DisplayInterface::SetDisplayState 65 */ 66 enum DisplayState { 67 kStateOff, //!< Display is OFF. Contents are not rendered in this state. Client will not 68 //!< receive VSync events in this state. This is default state as well. 69 70 kStateOn, //!< Display is ON. Contents are rendered in this state. 71 72 kStateDoze, //!< Display is ON and it is configured in a low power state. 73 74 kStateDozeSuspend, 75 //!< Display is ON in a low power state and continue showing its current 76 //!< contents indefinitely until the mode changes. 77 78 kStateStandby, //!< Display is OFF. Client will continue to receive VSync events in this state 79 //!< if VSync is enabled. Contents are not rendered in this state. 80 }; 81 82 /*! @brief This enum represents flags to override detail enhancer parameters. 83 84 @sa DisplayInterface::SetDetailEnhancerData 85 */ 86 enum DetailEnhancerOverrideFlags { 87 kOverrideDEEnable = 0x1, // Specifies to enable detail enhancer 88 kOverrideDESharpen1 = 0x2, // Specifies user defined Sharpening/smooth for noise 89 kOverrideDESharpen2 = 0x4, // Specifies user defined Sharpening/smooth for signal 90 kOverrideDEClip = 0x8, // Specifies user defined DE clip shift 91 kOverrideDELimit = 0x10, // Specifies user defined DE limit value 92 kOverrideDEThrQuiet = 0x20, // Specifies user defined DE quiet threshold 93 kOverrideDEThrDieout = 0x40, // Specifies user defined DE dieout threshold 94 kOverrideDEThrLow = 0x80, // Specifies user defined DE low threshold 95 kOverrideDEThrHigh = 0x100, // Specifies user defined DE high threshold 96 kOverrideDEFilterConfig = 0x200, // Specifies user defined scaling filter config 97 kOverrideDEMax = 0xFFFFFFFF, 98 }; 99 100 /*! @brief This enum represents Y/RGB scaling filter configuration. 101 102 @sa DisplayInterface::SetDetailEnhancerData 103 */ 104 enum ScalingFilterConfig { 105 kFilterEdgeDirected, 106 kFilterCircular, 107 kFilterSeparable, 108 kFilterBilinear, 109 kFilterMax, 110 }; 111 112 /*! @brief This enum represents the quality level of the content. 113 114 @sa DisplayInterface::SetDetailEnhancerData 115 */ 116 enum ContentQuality { 117 kContentQualityUnknown, // Default: high artifact and noise 118 kContentQualityLow, // Low quality content, high artifact and noise, 119 kContentQualityMedium, // Medium quality, medium artifact and noise, 120 kContentQualityHigh, // High quality content, low artifact and noise 121 kContentQualityMax, 122 }; 123 124 /*! @brief This enum represents the display port. 125 126 @sa DisplayInterface::GetDisplayPort 127 */ 128 enum DisplayPort { 129 kPortDefault, 130 kPortDSI, // Display is connected to DSI port. 131 kPortDTV, // Display is connected to DTV port 132 kPortWriteBack, // Display is connected to writeback port 133 kPortLVDS, // Display is connected to LVDS port 134 kPortEDP, // Display is connected to EDP port 135 kPortDP, // Display is connected to DP port. 136 }; 137 138 /*! @brief This enum represents the events received by Display HAL. */ 139 enum DisplayEvent { 140 kIdleTimeout, // Event triggered by Idle Timer. 141 kThermalEvent, // Event triggered by Thermal. 142 kIdlePowerCollapse, // Event triggered by Idle Power Collapse. 143 kPanelDeadEvent, // Event triggered by ESD. 144 }; 145 146 /*! @brief This structure defines configuration for fixed properties of a display device. 147 148 @sa DisplayInterface::GetConfig 149 @sa DisplayInterface::SetConfig 150 */ 151 struct DisplayConfigFixedInfo { 152 bool underscan = false; //!< If display support CE underscan. 153 bool secure = false; //!< If this display is capable of handling secure content. 154 bool is_cmdmode = false; //!< If panel is command mode panel. 155 bool hdr_supported = false; //!< if HDR is enabled 156 bool hdr_metadata_type_one = false; //!< Metadata type one obtained from HDR sink 157 uint32_t hdr_eotf = 0; //!< Electro optical transfer function 158 uint32_t max_luminance = 0; //!< From Panel's peak luminance 159 uint32_t average_luminance = 0; //!< From Panel's average luminance 160 uint32_t min_luminance = 0; //!< From Panel's blackness level 161 bool partial_update = false; //!< If display supports Partial Update. 162 }; 163 164 /*! @brief This structure defines configuration for variable properties of a display device. 165 166 @sa DisplayInterface::GetConfig 167 @sa DisplayInterface::SetConfig 168 */ 169 struct DisplayConfigVariableInfo { 170 uint32_t x_pixels = 0; //!< Total number of pixels in X-direction on the display panel. 171 uint32_t y_pixels = 0; //!< Total number of pixels in Y-direction on the display panel. 172 float x_dpi = 0.0f; //!< Dots per inch in X-direction. 173 float y_dpi = 0.0f; //!< Dots per inch in Y-direction. 174 uint32_t fps = 0; //!< Frame rate per second. 175 uint32_t vsync_period_ns = 0; //!< VSync period in nanoseconds. 176 bool is_yuv = false; //!< If the display output is in YUV format. 177 }; 178 179 /*! @brief Event data associated with VSync event. 180 181 @sa DisplayEventHandler::VSync 182 */ 183 struct DisplayEventVSync { 184 int64_t timestamp = 0; //!< System monotonic clock timestamp in nanoseconds. 185 }; 186 187 /*! @brief The structure defines the user input for detail enhancer module. 188 189 @sa DisplayInterface::SetDetailEnhancerData 190 */ 191 struct DisplayDetailEnhancerData { 192 uint32_t override_flags = 0; // flags to specify which data to be set. 193 uint16_t enable = 0; // Detail enchancer enable 194 int16_t sharpen_level1 = 0; // Sharpening/smooth strenght for noise 195 int16_t sharpen_level2 = 0; // Sharpening/smooth strenght for signal 196 uint16_t clip = 0; // DE clip shift 197 uint16_t limit = 0; // DE limit value 198 uint16_t thr_quiet = 0; // DE quiet threshold 199 uint16_t thr_dieout = 0; // DE dieout threshold 200 uint16_t thr_low = 0; // DE low threshold 201 uint16_t thr_high = 0; // DE high threshold 202 int32_t sharp_factor = 50; // sharp_factor specifies sharpness/smoothness level, 203 // range -100..100 positive for sharpness and negative for 204 // smoothness 205 ContentQuality quality_level = kContentQualityUnknown; 206 // Specifies context quality level 207 ScalingFilterConfig filter_config = kFilterEdgeDirected; 208 // Y/RGB filter configuration 209 }; 210 211 /*! @brief Display device event handler implemented by the client. 212 213 @details This class declares prototype for display device event handler methods which must be 214 implemented by the client. Display device will use these methods to notify events to the client. 215 Client must post heavy-weight event handling to a separate thread and unblock display manager 216 thread instantly. 217 218 @sa CoreInterface::CreateDisplay 219 */ 220 class DisplayEventHandler { 221 public: 222 /*! @brief Event handler for VSync event. 223 224 @details This event is dispatched on every vertical synchronization. The event is disabled by 225 default. 226 227 @param[in] vsync \link DisplayEventVSync \endlink 228 229 @return \link DisplayError \endlink 230 231 @sa DisplayInterface::GetDisplayState 232 @sa DisplayInterface::SetDisplayState 233 */ 234 virtual DisplayError VSync(const DisplayEventVSync &vsync) = 0; 235 236 /*! @brief Event handler for Refresh event. 237 238 @details This event is dispatched to trigger a screen refresh. Client must call Prepare() and 239 Commit() in response to it from a separate thread. There is no data associated with this 240 event. 241 242 @return \link DisplayError \endlink 243 244 @sa DisplayInterface::Prepare 245 @sa DisplayInterface::Commit 246 */ 247 virtual DisplayError Refresh() = 0; 248 249 /*! @brief Event handler for CEC messages. 250 251 @details This event is dispatched to send CEC messages to the CEC HAL. 252 253 @param[in] message message to be sent 254 255 @return \link DisplayError \endlink 256 */ 257 virtual DisplayError CECMessage(char *message) = 0; 258 259 /*! @brief Event handler for events received by Display HAL. */ 260 virtual DisplayError HandleEvent(DisplayEvent event) = 0; 261 262 protected: ~DisplayEventHandler()263 virtual ~DisplayEventHandler() { } 264 }; 265 266 struct PPDisplayAPIPayload; 267 struct PPPendingParams; 268 269 /*! @brief Display device interface. 270 271 @details This class defines display device interface. It contains methods which client shall use 272 to configure or submit layers for composition on the display device. This interface is created 273 during display device creation and remains valid until destroyed. 274 275 @sa CoreInterface::CreateDisplay 276 @sa CoreInterface::DestroyDisplay 277 */ 278 class DisplayInterface { 279 public: 280 /*! @brief Method to determine hardware capability to compose layers associated with given frame. 281 282 @details Client shall send all layers associated with a frame targeted for current display 283 using this method and check the layers which can be handled completely in display manager. 284 285 Client shall mark composition type for one of the layer as kCompositionGPUTarget; the GPU 286 composed output would be rendered at the specified layer if some of the layers are not handled 287 by SDM. 288 289 Display manager will set each layer as kCompositionGPU or kCompositionSDE upon return. Client 290 shall render all the layers marked as kCompositionGPU using GPU. 291 292 This method can be called multiple times but only last call prevails. This method must be 293 followed by Commit(). 294 295 @param[inout] layer_stack \link LayerStack \endlink 296 297 @return \link DisplayError \endlink 298 299 @sa Commit 300 */ 301 virtual DisplayError Prepare(LayerStack *layer_stack) = 0; 302 303 /*! @brief Method to commit layers of a frame submitted in a former call to Prepare(). 304 305 @details Client shall call this method to submit layers for final composition. The composed 306 output would be displayed on the panel or written in output buffer. 307 308 Client must ensure that layer stack is same as previous call to Prepare. 309 310 This method shall be called only once for each frame. 311 312 In the event of an error as well, this call will cause any fences returned in the previous call 313 to Commit() to eventually become signaled, so the client's wait on fences can be released to 314 prevent deadlocks. 315 316 @param[in] layer_stack \link LayerStack \endlink 317 318 @return \link DisplayError \endlink 319 320 @sa Prepare 321 */ 322 virtual DisplayError Commit(LayerStack *layer_stack) = 0; 323 324 /*! @brief Method to flush any pending buffers/fences submitted previously via Commit() call. 325 326 @details Client shall call this method to request the Display manager to release all buffers and 327 respective fences currently in use. This operation may result in a blank display on the panel 328 until a new frame is submitted for composition. 329 330 @return \link DisplayError \endlink 331 332 @sa Prepare 333 @sa Commit 334 */ 335 virtual DisplayError Flush() = 0; 336 337 /*! @brief Method to get current state of the display device. 338 339 @param[out] state \link DisplayState \endlink 340 341 @return \link DisplayError \endlink 342 343 @sa SetDisplayState 344 */ 345 virtual DisplayError GetDisplayState(DisplayState *state) = 0; 346 347 /*! @brief Method to get number of configurations(variable properties) supported on the display 348 device. 349 350 @param[out] count Number of modes supported; mode index starts with 0. 351 352 @return \link DisplayError \endlink 353 */ 354 virtual DisplayError GetNumVariableInfoConfigs(uint32_t *count) = 0; 355 356 /*! @brief Method to get configuration for fixed properties of the display device. 357 358 @param[out] fixed_info \link DisplayConfigFixedInfo \endlink 359 360 @return \link DisplayError \endlink 361 */ 362 virtual DisplayError GetConfig(DisplayConfigFixedInfo *fixed_info) = 0; 363 364 /*! @brief Method to get configuration for variable properties of the display device. 365 366 @param[in] index index of the mode 367 @param[out] variable_info \link DisplayConfigVariableInfo \endlink 368 369 @return \link DisplayError \endlink 370 */ 371 virtual DisplayError GetConfig(uint32_t index, DisplayConfigVariableInfo *variable_info) = 0; 372 373 /*! @brief Method to get index of active configuration of the display device. 374 375 @param[out] index index of the mode corresponding to variable properties. 376 377 @return \link DisplayError \endlink 378 */ 379 virtual DisplayError GetActiveConfig(uint32_t *index) = 0; 380 381 /*! @brief Method to get VSync event state. Default event state is disabled. 382 383 @param[out] enabled vsync state 384 385 @return \link DisplayError \endlink 386 */ 387 virtual DisplayError GetVSyncState(bool *enabled) = 0; 388 389 /*! @brief Method to set current state of the display device. 390 391 @param[in] state \link DisplayState \endlink 392 @param[in] pointer to release fence 393 394 @return \link DisplayError \endlink 395 396 @sa SetDisplayState 397 */ 398 virtual DisplayError SetDisplayState(DisplayState state, int *release_fence) = 0; 399 400 /*! @brief Method to set active configuration for variable properties of the display device. 401 402 @param[in] variable_info \link DisplayConfigVariableInfo \endlink 403 404 @return \link DisplayError \endlink 405 */ 406 virtual DisplayError SetActiveConfig(DisplayConfigVariableInfo *variable_info) = 0; 407 408 /*! @brief Method to set active configuration for variable properties of the display device. 409 410 @param[in] index index of the mode corresponding to variable properties. 411 412 @return \link DisplayError \endlink 413 */ 414 virtual DisplayError SetActiveConfig(uint32_t index) = 0; 415 416 /*! @brief Method to set VSync event state. Default event state is disabled. 417 418 @param[out] enabled vsync state 419 420 @return \link DisplayError \endlink 421 */ 422 virtual DisplayError SetVSyncState(bool enable) = 0; 423 424 /*! @brief Method to set idle timeout value. Idle fallback is disabled with timeout value 0. 425 426 @param[in] active_ms value in milliseconds. 427 428 @return \link void \endlink 429 */ 430 virtual void SetIdleTimeoutMs(uint32_t active_ms) = 0; 431 432 /*! @brief Method to set maximum number of mixer stages for each display. 433 434 @param[in] max_mixer_stages maximum number of mixer stages. 435 436 @return \link DisplayError \endlink 437 */ 438 virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages) = 0; 439 440 /*! @brief Method to control partial update feature for each display. 441 442 @param[in] enable partial update feature control flag 443 @param[out] pending whether the operation is completed or pending for completion 444 445 @return \link DisplayError \endlink 446 */ 447 virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending) = 0; 448 449 /*! @brief Method to disable partial update for at least 1 frame. 450 @return \link DisplayError \endlink 451 */ 452 virtual DisplayError DisablePartialUpdateOneFrame() = 0; 453 454 /*! @brief Method to set the mode of the primary display. 455 456 @param[in] mode the new display mode. 457 458 @return \link DisplayError \endlink 459 */ 460 virtual DisplayError SetDisplayMode(uint32_t mode) = 0; 461 462 /*! @brief Method to get the min and max refresh rate of a display. 463 464 @param[out] min and max refresh rate. 465 466 @return \link DisplayError \endlink 467 */ 468 virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate, 469 uint32_t *max_refresh_rate) = 0; 470 471 /*! @brief Method to set the refresh rate of a display. 472 473 @param[in] refresh_rate new refresh rate of the display. 474 475 @param[in] final_rate indicates whether refresh rate is final rate or can be changed by sdm 476 477 @return \link DisplayError \endlink 478 */ 479 virtual DisplayError SetRefreshRate(uint32_t refresh_rate, bool final_rate) = 0; 480 481 /*! @brief Method to query whether scanning is support for the HDMI display. 482 483 @return \link DisplayError \endlink 484 */ 485 virtual bool IsUnderscanSupported() = 0; 486 487 /*! @brief Method to set brightness of the primary display. 488 489 @param[in] level the new backlight level. 490 491 @return \link DisplayError \endlink 492 */ 493 virtual DisplayError SetPanelBrightness(int level) = 0; 494 495 /*! @brief Method to notify display about change in min HDCP encryption level. 496 497 @param[in] min_enc_level minimum encryption level value. 498 499 @return \link DisplayError \endlink 500 */ 501 virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) = 0; 502 503 /*! @brief Method to route display API requests to color service. 504 505 @param[in] in_payload \link PPDisplayAPIPayload \endlink 506 @param[out] out_payload \link PPDisplayPayload \endlink 507 @param[out] pending_action \link PPPendingParams \endlink 508 509 @return \link DisplayError \endlink 510 */ 511 virtual DisplayError ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload, 512 PPDisplayAPIPayload *out_payload, 513 PPPendingParams *pending_action) = 0; 514 515 /*! @brief Method to request the number of color modes supported. 516 517 @param[out] mode_count Number of modes 518 519 @return \link DisplayError \endlink 520 */ 521 virtual DisplayError GetColorModeCount(uint32_t *mode_count) = 0; 522 523 /*! @brief Method to request the information of supported color modes. 524 525 @param[inout] mode_count Number of updated modes 526 @param[out] vector of mode strings 527 528 @return \link DisplayError \endlink 529 */ 530 virtual DisplayError GetColorModes(uint32_t *mode_count, 531 std::vector<std::string> *color_modes) = 0; 532 533 /*! @brief Method to request the attributes of color mode. 534 535 @param[in] mode name 536 @param[out] vector of mode attributes 537 538 @return \link DisplayError \endlink 539 */ 540 virtual DisplayError GetColorModeAttr(const std::string &color_mode, 541 AttrVal *attr_map) = 0; 542 543 /*! @brief Method to set the color mode 544 545 @param[in] mode_name Mode name which needs to be set 546 547 @return \link DisplayError \endlink 548 */ 549 virtual DisplayError SetColorMode(const std::string &color_mode) = 0; 550 551 /*! @brief Method to set the color mode by ID. This method is used for debugging only. 552 553 @param[in] mode_name Mode ID which needs to be set 554 555 @return \link DisplayError \endlink 556 */ 557 virtual DisplayError SetColorModeById(int32_t color_mode_id) = 0; 558 /*! @brief Method to set the color transform 559 560 @param[in] length Mode name which needs to be set 561 @param[in] color_transform 4x4 Matrix for color transform 562 563 @return \link DisplayError \endlink 564 */ 565 virtual DisplayError SetColorTransform(const uint32_t length, const double *color_transform) = 0; 566 567 /*! @brief Method to get the default color mode. 568 569 @param[out] default mode name 570 571 @return \link DisplayError \endlink 572 */ 573 virtual DisplayError GetDefaultColorMode(std::string *color_mode) = 0; 574 575 /*! @brief Method to request applying default display mode. 576 577 @return \link DisplayError \endlink 578 */ 579 virtual DisplayError ApplyDefaultDisplayMode() = 0; 580 581 /*! @brief Method to set the position of the hw cursor. 582 583 @param[in] x \link x position \endlink 584 @param[in] y \link y position \endlink 585 586 @return \link DisplayError \endlink 587 */ 588 virtual DisplayError SetCursorPosition(int x, int y) = 0; 589 590 /*! @brief Method to get the brightness level of the display 591 592 @param[out] level brightness level 593 594 @return \link DisplayError \endlink 595 */ 596 virtual DisplayError GetPanelBrightness(int *level) = 0; 597 598 /*! @brief Method to set layer mixer resolution. 599 600 @param[in] width layer mixer width 601 @param[in] height layer mixer height 602 603 @return \link DisplayError \endlink 604 */ 605 virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height) = 0; 606 607 /*! @brief Method to get layer mixer resolution. 608 609 @param[out] width layer mixer width 610 @param[out] height layer mixer height 611 612 @return \link DisplayError \endlink 613 */ 614 virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height) = 0; 615 616 /*! @brief Method to set frame buffer configuration. 617 618 @param[in] variable_info \link DisplayConfigVariableInfo \endlink 619 620 @return \link DisplayError \endlink 621 */ 622 virtual DisplayError SetFrameBufferConfig(const DisplayConfigVariableInfo &variable_info) = 0; 623 624 /*! @brief Method to get frame buffer configuration. 625 626 @param[out] variable_info \link DisplayConfigVariableInfo \endlink 627 628 @return \link DisplayError \endlink 629 */ 630 virtual DisplayError GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info) = 0; 631 632 /*! @brief Method to set detail enhancement data. 633 634 @param[in] de_data \link DisplayDetailEnhancerData \endlink 635 636 @return \link DisplayError \endlink 637 */ 638 virtual DisplayError SetDetailEnhancerData(const DisplayDetailEnhancerData &de_data) = 0; 639 640 /*! @brief Method to get display port information. 641 642 @param[out] port \link DisplayPort \endlink 643 644 @return \link DisplayError \endlink 645 */ 646 virtual DisplayError GetDisplayPort(DisplayPort *port) = 0; 647 648 /*! @brief Method to query whether it is Primrary device. 649 650 @return true if this interface is primary. 651 */ 652 virtual bool IsPrimaryDisplay() = 0; 653 654 /*! @brief Method to toggle composition types handling by SDM. 655 656 @details Client shall call this method to request SDM to enable/disable a specific type of 657 layer composition. If client disables a composition type, SDM will not handle any of the layer 658 composition using the disabled method in a draw cycle. On lack of resources to handle all 659 layers using other enabled composition methods, Prepare() will return an error. 660 661 Request to toggle composition type is applied from subsequent draw cycles. 662 663 Default state of all defined composition types is enabled. 664 665 @param[in] composition_type \link LayerComposition \endlink 666 @param[in] enable \link enable composition type \endlink 667 668 @return \link DisplayError \endlink 669 670 @sa Prepare 671 */ 672 virtual DisplayError SetCompositionState(LayerComposition composition_type, bool enable) = 0; 673 674 /*! @brief Method to check whether a client target with the given properties 675 can be supported/handled by hardware. 676 677 @param[in] width client target width 678 @param[in] height client target height 679 @param[in] format client target format 680 @param[in] colorMetaData client target colorMetaData 681 682 @return \link DisplayError \endlink 683 */ 684 virtual DisplayError GetClientTargetSupport(uint32_t width, uint32_t height, 685 LayerBufferFormat format, 686 const ColorMetaData &color_metadata) = 0; 687 688 /*! @brief Method to control idle power collapse feature for primary display. 689 690 @param[in] enable idle power collapse feature control flag 691 @param[in] synchronous commit flag 692 693 @return \link DisplayError \endlink 694 */ 695 virtual DisplayError ControlIdlePowerCollapse(bool enable, bool synchronous) = 0; 696 697 /*! @brief Method to free concurrent writeback resoures for primary display. 698 @return \link DisplayError \endlink 699 */ 700 virtual DisplayError TeardownConcurrentWriteback(void) = 0; 701 702 /* 703 * Returns a string consisting of a dump of SDM's display and layer related state 704 * as programmed to driver 705 */ 706 virtual std::string Dump() = 0; 707 708 protected: ~DisplayInterface()709 virtual ~DisplayInterface() { } 710 }; 711 712 } // namespace sdm 713 714 #endif // __DISPLAY_INTERFACE_H__ 715 716