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