1 /* 2 * Copyright (c) 2015-2021, 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 #ifndef __HW_INFO_TYPES_H__ 26 #define __HW_INFO_TYPES_H__ 27 28 #include <stdint.h> 29 #include <core/display_interface.h> 30 #include <core/core_interface.h> 31 #include <utils/locker.h> 32 #include <utils/fence.h> 33 #include <utils/debug.h> 34 #include <bitset> 35 #include <map> 36 #include <memory> 37 #include <set> 38 #include <string> 39 #include <vector> 40 #include <utility> 41 42 namespace sdm { 43 using std::string; 44 using std::pair; 45 using std::vector; 46 47 const int kMaxSDELayers = 16; // Maximum number of layers that can be handled by MDP5 hardware 48 // in a given layer stack. 49 #define MAX_PLANES 4 50 #define MAX_DETAIL_ENHANCE_CURVE 3 51 #define MAJOR 28 52 #define MINOR 16 53 #define SDEVERSION(major, minor, hw_rev) ((major) << MAJOR) | ((minor) << MINOR) | (hw_rev) 54 55 // CSC Max Size 56 #define MAX_CSC_MATRIX_COEFF_SIZE 9 57 #define MAX_CSC_CLAMP_SIZE 6 58 #define MAX_CSC_BIAS_SIZE 3 59 60 #define MAX_SPLIT_COUNT 2 61 62 enum HWDeviceType { 63 kDeviceBuiltIn, 64 kDevicePluggable, 65 kDeviceVirtual, 66 kDeviceRotator, 67 kDeviceMax, 68 }; 69 70 enum HWBlockType { 71 kHWBuiltIn, 72 kHWPluggable, 73 kHWWriteback0, 74 kHWWriteback1, 75 kHWWriteback2, 76 kHWBlockMax 77 }; 78 79 enum HWDisplayMode { 80 kModeDefault, 81 kModeVideo, 82 kModeCommand, 83 }; 84 85 enum PipeType { 86 kPipeTypeUnused, 87 kPipeTypeVIG, 88 kPipeTypeRGB, 89 kPipeTypeDMA, 90 kPipeTypeCursor, 91 }; 92 93 enum HWSubBlockType { 94 kHWVIGPipe, 95 kHWRGBPipe, 96 kHWDMAPipe, 97 kHWCursorPipe, 98 kHWRotatorInput, 99 kHWRotatorOutput, 100 kHWWBIntfOutput, 101 kHWDestinationScalar, 102 kHWSubBlockMax, 103 }; 104 105 enum HWAlphaInterpolation { 106 kInterpolationPixelRepeat, 107 kInterpolationBilinear, 108 kInterpolation2D, 109 kInterpolationMax, 110 }; 111 112 enum HWBlendingFilter { 113 kBlendFilterCircular, 114 kBlendFilterSeparable, 115 kBlendFilterMax, 116 }; 117 118 enum HWPipeFlags { 119 kIGC = 1 << 0, 120 kMultiRect = 1 << 1, 121 kMultiRectParallelMode = 1 << 2, 122 kFlipVertical = 1 << 5, 123 kFlipHorizontal = 1 << 6, 124 kSecure = 1 << 7, 125 kDisplaySecure = 1 << 8, 126 kCameraSecure = 1 << 9, 127 kInterlaced = 1 << 10, 128 kUpdating = 1 < 11, 129 kSolidFill = 1 << 12, 130 kTonemap1d = 1 << 13, 131 kTonemap3d = 1 << 14, 132 }; 133 134 enum HWAVRModes { 135 kQsyncNone, // Disables Qsync. 136 kContinuousMode, // Mode to enable AVR feature for every frame. 137 kOneShotMode, // Mode to enable AVR feature for particular frame. 138 }; 139 140 enum HWTopology { 141 kUnknown, 142 kSingleLM, 143 kSingleLMDSC, 144 kDualLM, 145 kDualLMDSC, 146 kDualLMMerge, 147 kDualLMMergeDSC, 148 kDualLMDSCMerge, 149 kQuadLMMerge, 150 kQuadLMDSCMerge, 151 kQuadLMMergeDSC, 152 kPPSplit, 153 }; 154 155 enum HWMixerSplit { 156 kNoSplit, 157 kDualSplit, 158 kQuadSplit, 159 }; 160 161 enum HwHdrEotf { 162 kHdrEOTFInvalid = 0, 163 kHdrEOTFSDR = 0x1, 164 kHdrEOTFHdrLumRange = 0x2, 165 kHdrEOTFHDR10 = 0x4, 166 kHdrEOTFHLG = 0x8, 167 }; 168 169 enum HwColorspace { 170 kColorspaceXvycc601 = (1 << 0), 171 kColorspaceXvycc709 = (1 << 1), 172 kColorspaceSycc601 = (1 << 2), 173 kColorspaceAdobeycc601 = (1 << 3), 174 kColorspaceAdobergb = (1 << 4), 175 kColorspaceBt2020cycc = (1 << 5), 176 kColorspaceBt2020ycc = (1 << 6), 177 kColorspaceBt2020rgb = (1 << 7), 178 kColorspaceDcip3 = (1 << 15) 179 }; 180 181 enum HWSrcTonemap { 182 kSrcTonemapNone, 183 kSrcTonemap1d, // DMA 184 kSrcTonemap3d, // VIG 185 }; 186 187 enum HWToneMapLut { 188 kLutNone, // No valid lut 189 kDma1dIgc, // DMA IGC Lut 190 kDma1dGc, // DMA GC Lut 191 kVig1dIgc, // VIG IGC Lut 192 kVig3dGamut, // 3D Gamut Lut 193 }; 194 195 enum HWWriteOperation { 196 kNoOp, // No-op, previously set config holds good 197 kSet, // Sets the new config 198 kReset, // Resets/Clears the previously set config 199 }; 200 201 enum class HWRecoveryEvent : uint32_t { 202 kSuccess, // driver succeeded recovery 203 kCapture, // driver PP_TIMEOUT, capture logs 204 kDisplayPowerReset, // driver requesting display power cycle 205 }; 206 207 typedef std::map<HWSubBlockType, std::vector<LayerBufferFormat>> FormatsMap; 208 typedef std::map<LayerBufferFormat, float> CompRatioMap; 209 210 // Base Postprocessing features information. 211 class PPFeatureInfo { 212 public: 213 uint32_t enable_flags_ = 0; // bitmap to indicate subset of parameters enabling or not. 214 uint32_t feature_version_ = 0; 215 uint32_t feature_id_ = 0; 216 uint32_t disp_id_ = 0; 217 uint32_t pipe_id_ = 0; 218 ~PPFeatureInfo()219 virtual ~PPFeatureInfo() {} 220 virtual void *GetConfigData(void) const = 0; 221 }; 222 223 struct HWDynBwLimitInfo { 224 uint32_t cur_mode = kBwVFEOn; 225 uint64_t total_bw_limit[kBwModeMax] = { 0 }; 226 uint64_t pipe_bw_limit[kBwModeMax] = { 0 }; 227 }; 228 229 struct HWPipeCaps { 230 PipeType type = kPipeTypeUnused; 231 uint32_t id = 0; 232 uint32_t master_pipe_id = 0; 233 uint32_t max_rects = 1; 234 bool inverse_pma = 0; 235 uint32_t dgm_csc_version = 0; 236 std::map<HWToneMapLut, uint32_t> tm_lut_version_map = {}; 237 bool block_sec_ui = false; 238 }; 239 240 struct HWRotatorInfo { 241 uint32_t num_rotator = 0; 242 bool has_downscale = false; 243 std::string device_path = ""; 244 float min_downscale = 2.0f; 245 bool downscale_compression = false; 246 uint32_t max_line_width = 0; 247 }; 248 249 enum HWQseedStepVersion { 250 kQseed3v2, 251 kQseed3v3, 252 kQseed3v4, 253 kQseed3litev4, 254 kQseed3litev5, 255 }; 256 257 struct HWDestScalarInfo { 258 uint32_t count = 0; 259 uint32_t max_input_width = 0; 260 uint32_t max_output_width = 0; 261 uint32_t max_scale_up = 1; 262 uint32_t prefill_lines = 4; 263 }; 264 265 enum SmartDMARevision { 266 V1, 267 V2, 268 V2p5 269 }; 270 271 enum InlineRotationVersion { 272 kInlineRotationNone, 273 kInlineRotationV1, 274 kInlineRotationV2, 275 }; 276 277 struct InlineRotationInfo { 278 InlineRotationVersion inrot_version = kInlineRotationNone; 279 std::vector<LayerBufferFormat> inrot_fmts_supported; 280 float max_downscale_rt = 2.2f; // max downscale real time display 281 float max_ds_without_pre_downscaler = 2.2f; 282 }; 283 284 285 const int kPipeVigLimit = (1 << 0); 286 const int kPipeDmaLimit = (1 << 1); 287 const int kPipeScalingLimit = (1 << 2); 288 const int kPipeRotationLimit = (1 << 3); 289 290 struct HWResourceInfo { 291 uint32_t hw_version = 0; 292 uint32_t num_dma_pipe = 0; 293 uint32_t num_vig_pipe = 0; 294 uint32_t num_rgb_pipe = 0; 295 uint32_t num_cursor_pipe = 0; 296 uint32_t num_blending_stages = 0; 297 uint32_t num_solidfill_stages = 0; 298 uint32_t max_scale_up = 1; 299 uint32_t max_scale_down = 1; 300 uint64_t max_bandwidth_low = 0; 301 uint64_t max_bandwidth_high = 0; 302 uint32_t max_mixer_width = 2048; 303 uint32_t max_pipe_width = 2048; 304 uint32_t max_scaler_pipe_width = 2560; 305 uint32_t max_rotation_pipe_width = 1088; 306 uint32_t max_cursor_size = 0; 307 uint64_t max_pipe_bw = 0; 308 uint64_t max_pipe_bw_high = 0; 309 uint32_t max_sde_clk = 0; 310 float clk_fudge_factor = 1.0f; 311 uint32_t macrotile_nv12_factor = 0; 312 uint32_t macrotile_factor = 0; 313 uint32_t linear_factor = 0; 314 uint32_t scale_factor = 0; 315 uint32_t extra_fudge_factor = 0; 316 uint32_t amortizable_threshold = 0; 317 uint32_t system_overhead_lines = 0; 318 bool has_ubwc = false; 319 bool has_decimation = false; 320 bool has_non_scalar_rgb = false; 321 bool is_src_split = false; 322 bool separate_rotator = false; 323 bool has_qseed3 = false; 324 bool has_concurrent_writeback = false; 325 bool has_ppp = false; 326 bool has_excl_rect = false; 327 uint32_t writeback_index = kHWBlockMax; 328 HWDynBwLimitInfo dyn_bw_info; 329 std::vector<HWPipeCaps> hw_pipes; 330 FormatsMap supported_formats_map; 331 HWRotatorInfo hw_rot_info; 332 HWDestScalarInfo hw_dest_scalar_info; 333 bool has_hdr = false; 334 SmartDMARevision smart_dma_rev = SmartDMARevision::V1; 335 float ib_fudge_factor = 1.0f; 336 uint32_t undersized_prefill_lines = 0; 337 CompRatioMap comp_ratio_rt_map; 338 CompRatioMap comp_ratio_nrt_map; 339 uint32_t cache_size = 0; // cache size in bytes 340 HWQseedStepVersion pipe_qseed3_version = kQseed3v2; // only valid when has_qseed3=true 341 uint32_t min_prefill_lines = 0; 342 InlineRotationInfo inline_rot_info = {}; 343 std::bitset<32> src_tone_map = 0; //!< Stores the bit mask of src tone map capability 344 int secure_disp_blend_stage = -1; 345 uint32_t line_width_constraints_count = 0; 346 vector< pair <uint32_t, uint32_t> > line_width_limits; 347 vector< pair <uint32_t, uint32_t> > line_width_constraints; 348 uint32_t num_mnocports = 2; 349 uint32_t mnoc_bus_width = 32; 350 bool use_baselayer_for_stage = false; 351 bool has_micro_idle = false; 352 uint32_t ubwc_version = 1; 353 uint32_t rc_total_mem_size = 0; 354 }; 355 356 struct HWSplitInfo { 357 uint32_t left_split = 0; 358 uint32_t right_split = 0; 359 360 bool operator !=(const HWSplitInfo &split_info) { 361 return ((left_split != split_info.left_split) || (right_split != split_info.right_split)); 362 } 363 364 bool operator ==(const HWSplitInfo &split_info) { 365 return !(operator !=(split_info)); 366 } 367 }; 368 369 struct HWColorPrimaries { 370 uint32_t white_point[2] = {}; // White point 371 uint32_t red[2] = {}; // Red color primary 372 uint32_t green[2] = {}; // Green color primary 373 uint32_t blue[2] = {}; // Blue color primary 374 }; 375 376 struct HWPanelOrientation { 377 bool rotation = false; 378 bool flip_horizontal = false; 379 bool flip_vertical = false; 380 }; 381 382 struct HWPanelInfo { 383 DisplayPort port = kPortDefault; // Display port 384 HWDisplayMode mode = kModeDefault; // Display mode 385 bool partial_update = false; // Partial update feature 386 int left_align = 1; // ROI left alignment restriction 387 int width_align = 1; // ROI width alignment restriction 388 int top_align = 1; // ROI top alignment restriction 389 int height_align = 1; // ROI height alignment restriction 390 int min_roi_width = 1; // Min width needed for ROI 391 int min_roi_height = 1; // Min height needed for ROI 392 bool needs_roi_merge = false; // Merge ROI's of both the DSI's 393 bool dynamic_fps = false; // Panel Supports dynamic fps 394 bool dfps_porch_mode = false; // dynamic fps VFP or HFP mode 395 bool ping_pong_split = false; // Supports Ping pong split 396 uint32_t min_fps = 0; // Min fps supported by panel 397 uint32_t max_fps = 0; // Max fps supported by panel 398 bool is_primary_panel = false; // Panel is primary display 399 bool is_pluggable = false; // Panel is pluggable 400 HWSplitInfo split_info; // Panel split configuration 401 char panel_name[256] = {0}; // Panel name 402 float panel_max_brightness = 255.0f; // Max panel brightness 403 float panel_min_brightness = 1.0f; // Min panel brightness 404 uint32_t left_roi_count = 1; // Number if ROI supported on left panel 405 uint32_t right_roi_count = 1; // Number if ROI supported on right panel 406 bool hdr_enabled = false; // HDR feature supported 407 bool hdr_plus_enabled = false; // HDR10+ feature supported 408 bool hdr_metadata_type_one = false; // Static HDR metadata type one 409 uint32_t hdr_eotf = 0; // Electro optical transfer function 410 float peak_luminance = 0.0f; // Panel's peak luminance level 411 float average_luminance = 0.0f; // Panel's average luminance level 412 float blackness_level = 0.0f; // Panel's blackness level 413 HWColorPrimaries primaries = {}; // WRGB color primaries 414 HWPanelOrientation panel_orientation = {}; // Panel Orientation 415 uint32_t transfer_time_us = 0; // transfer time in micro seconds to panel's active region 416 bool qsync_support = false; // Specifies panel supports qsync feature or not. 417 bool dyn_bitclk_support = false; // Bit clk can be updated to avoid RF interference. 418 std::vector<uint64_t> bitclk_rates; // Supported bit clk levels. 419 uint32_t supported_colorspaces = 0; // supported_colorspaces for DP displays. 420 421 bool operator !=(const HWPanelInfo &panel_info) { 422 return ((port != panel_info.port) || (mode != panel_info.mode) || 423 (partial_update != panel_info.partial_update) || 424 (left_align != panel_info.left_align) || (width_align != panel_info.width_align) || 425 (top_align != panel_info.top_align) || (height_align != panel_info.height_align) || 426 (min_roi_width != panel_info.min_roi_width) || 427 (min_roi_height != panel_info.min_roi_height) || 428 (needs_roi_merge != panel_info.needs_roi_merge) || 429 (dynamic_fps != panel_info.dynamic_fps) || (min_fps != panel_info.min_fps) || 430 (dfps_porch_mode != panel_info.dfps_porch_mode) || 431 (ping_pong_split != panel_info.ping_pong_split) || 432 (max_fps != panel_info.max_fps) || (is_primary_panel != panel_info.is_primary_panel) || 433 (split_info != panel_info.split_info) || 434 (left_roi_count != panel_info.left_roi_count) || 435 (right_roi_count != panel_info.right_roi_count) || 436 (transfer_time_us != panel_info.transfer_time_us) || 437 (qsync_support != panel_info.qsync_support) || 438 (dyn_bitclk_support != panel_info.dyn_bitclk_support) || 439 (bitclk_rates != panel_info.bitclk_rates)); 440 } 441 442 bool operator ==(const HWPanelInfo &panel_info) { 443 return !(operator !=(panel_info)); 444 } 445 }; 446 447 struct HWSessionConfig { 448 LayerRect src_rect {}; 449 LayerRect dst_rect {}; 450 uint32_t buffer_count = 0; 451 bool secure = false; 452 uint32_t frame_rate = 0; 453 LayerTransform transform; 454 bool secure_camera = false; 455 456 bool operator==(const HWSessionConfig& config) const { 457 return (src_rect == config.src_rect && 458 dst_rect == config.dst_rect && 459 buffer_count == config.buffer_count && 460 secure == config.secure && 461 frame_rate == config.frame_rate && 462 transform == config.transform && 463 secure_camera == config.secure_camera); 464 } 465 466 bool operator!=(const HWSessionConfig& config) const { 467 return !operator==(config); 468 } 469 }; 470 471 enum HWRotatorMode { 472 kRotatorNone, 473 kRotatorOffline, 474 kRotatorInline 475 }; 476 477 struct HWRotateInfo { 478 int pipe_id = -1; // Not actual pipe id, but the relative DMA id 479 int writeback_id = -1; // Writeback block id, but this is the same as DMA id 480 LayerRect src_roi {}; // Source crop of each split 481 LayerRect dst_roi {}; // Destination crop of each split 482 bool valid = false; 483 int rotate_id = -1; // Actual rotator session id with driver 484 }; 485 486 struct HWRotatorSession { 487 HWRotateInfo hw_rotate_info[kMaxRotatePerLayer] {}; 488 uint32_t hw_block_count = 0; // number of rotator hw blocks used by rotator session 489 int session_id = -1; // A handle with Session Manager 490 HWSessionConfig hw_session_config {}; 491 LayerBuffer input_buffer {}; // Input to rotator 492 LayerBuffer output_buffer {}; // Output of rotator, crop width and stride are same 493 float input_compression = 1.0f; 494 float output_compression = 1.0f; 495 bool is_buffer_cached = false; 496 HWRotatorMode mode = kRotatorNone; 497 }; 498 499 struct HWScaleLutInfo { 500 uint32_t dir_lut_size = 0; 501 uint32_t cir_lut_size = 0; 502 uint32_t sep_lut_size = 0; 503 uint64_t dir_lut = 0; 504 uint64_t cir_lut = 0; 505 uint64_t sep_lut = 0; 506 }; 507 508 struct HWDetailEnhanceData : DisplayDetailEnhancerData { 509 uint16_t prec_shift = 0; 510 int16_t adjust_a[MAX_DETAIL_ENHANCE_CURVE] = {0}; 511 int16_t adjust_b[MAX_DETAIL_ENHANCE_CURVE] = {0}; 512 int16_t adjust_c[MAX_DETAIL_ENHANCE_CURVE] = {0}; 513 }; 514 515 struct HWPixelExtension { 516 int32_t extension = 0; // Number of pixels extension in left, right, top and bottom directions 517 // for all color components. This pixel value for each color component 518 // should be sum of fetch and repeat pixels. 519 520 int32_t overfetch = 0; // Number of pixels need to be overfetched in left, right, top and bottom 521 // directions from source image for scaling. 522 523 int32_t repeat = 0; // Number of pixels need to be repeated in left, right, top and bottom 524 // directions for scaling. 525 }; 526 527 struct HWPlane { 528 int32_t init_phase_x = 0; 529 int32_t phase_step_x = 0; 530 int32_t init_phase_y = 0; 531 int32_t phase_step_y = 0; 532 HWPixelExtension left {}; 533 HWPixelExtension top {}; 534 HWPixelExtension right {}; 535 HWPixelExtension bottom {}; 536 uint32_t roi_width = 0; 537 int32_t preload_x = 0; 538 int32_t preload_y = 0; 539 uint32_t src_width = 0; 540 uint32_t src_height = 0; 541 }; 542 543 struct HWCsc { 544 int64_t ctm_coeff[MAX_CSC_MATRIX_COEFF_SIZE] = {0}; 545 uint32_t pre_bias[MAX_CSC_BIAS_SIZE] = {0}; 546 uint32_t post_bias[MAX_CSC_BIAS_SIZE] = {0}; 547 uint32_t pre_clamp[MAX_CSC_CLAMP_SIZE] = {0}; 548 uint32_t post_clamp[MAX_CSC_CLAMP_SIZE] = {0}; 549 }; 550 551 struct HWScaleData { 552 struct enable { 553 uint8_t scale = 0; 554 uint8_t direction_detection = 0; 555 uint8_t detail_enhance = 0; 556 uint8_t dyn_exp_disable = 0; // RGB format dynamic pixel expansion disable. 557 } enable; 558 uint32_t dst_width = 0; 559 uint32_t dst_height = 0; 560 uint32_t dir_weight = 0; 561 HWPlane plane[MAX_PLANES] {}; 562 // scale_v2_data fields 563 ScalingFilterConfig y_rgb_filter_cfg = kFilterEdgeDirected; 564 ScalingFilterConfig uv_filter_cfg = kFilterEdgeDirected; 565 HWAlphaInterpolation alpha_filter_cfg = kInterpolationPixelRepeat; 566 HWBlendingFilter blend_cfg = kBlendFilterCircular; 567 568 struct lut_flags { 569 uint8_t lut_swap = 0; 570 uint8_t lut_dir_wr = 0; 571 uint8_t lut_y_cir_wr = 0; 572 uint8_t lut_uv_cir_wr = 0; 573 uint8_t lut_y_sep_wr = 0; 574 uint8_t lut_uv_sep_wr = 0; 575 } lut_flag; 576 577 uint32_t dir_lut_idx = 0; 578 /* for Y(RGB) and UV planes*/ 579 uint32_t y_rgb_cir_lut_idx = 0; 580 uint32_t uv_cir_lut_idx = 0; 581 uint32_t y_rgb_sep_lut_idx = 0; 582 uint32_t uv_sep_lut_idx = 0; 583 HWDetailEnhanceData detail_enhance {}; 584 585 uint32_t src_x_pre_down_scale_0 = 0; 586 uint32_t src_x_pre_down_scale_1 = 0; 587 uint32_t src_y_pre_down_scale_0 = 0; 588 uint32_t src_y_pre_down_scale_1 = 0; 589 }; 590 591 struct HWDestScaleInfo { 592 uint32_t mixer_width = 0; 593 uint32_t mixer_height = 0; 594 bool scale_update = false; 595 HWScaleData scale_data = {}; 596 LayerRect panel_roi = {}; 597 }; 598 599 typedef std::map<uint32_t, HWDestScaleInfo *> DestScaleInfoMap; 600 601 struct HWAVRInfo { 602 bool update = false; // Update avr setting. 603 HWAVRModes mode = kContinuousMode; // Specifies the AVR mode 604 }; 605 606 struct HWPipeCscInfo { 607 HWWriteOperation op = kNoOp; 608 HWCsc csc = {}; 609 }; 610 611 struct HWPipeTonemapLutInfo { 612 HWWriteOperation op = kNoOp; 613 HWToneMapLut type = kLutNone; 614 std::shared_ptr<PPFeatureInfo> pay_load = nullptr; 615 }; 616 617 struct HWPipeTonemapInversePma { 618 HWWriteOperation op = kNoOp; 619 bool inverse_pma = false; 620 }; 621 622 struct HWPipeInfo { 623 HWPipeInfo *pair = NULL; 624 uint8_t rect = 255; 625 uint32_t pipe_id = 0; 626 HWSubBlockType sub_block_type = kHWSubBlockMax; 627 LayerRect src_roi {}; 628 LayerRect dst_roi {}; 629 LayerRect excl_rect {}; // exclusion rectangle per pipe rectangle 630 uint8_t horizontal_decimation = 0; 631 uint8_t vertical_decimation = 0; 632 HWScaleData scale_data {}; 633 uint32_t z_order = 0; 634 uint32_t flags = 0; 635 bool valid = false; 636 bool is_virtual = 0; 637 HWPipeTonemapInversePma inverse_pma_info = {}; 638 HWPipeCscInfo dgm_csc_info = {}; 639 std::vector<HWPipeTonemapLutInfo> lut_info = {}; 640 LayerTransform transform; 641 HWSrcTonemap tonemap = kSrcTonemapNone; 642 LayerBufferFormat format = kFormatARGB8888; // src format of the buffer 643 bool is_solid_fill = false; 644 }; 645 646 struct HWSolidfillStage { 647 uint32_t z_order = kMaxSDELayers; 648 uint32_t color = 0; 649 LayerRect roi = {}; 650 bool is_exclusion_rect = false; 651 LayerSolidFill solid_fill_info = {}; 652 }; 653 654 struct HWLayerConfig { 655 HWPipeInfo left_pipe {}; // pipe for left side of output 656 HWPipeInfo right_pipe {}; // pipe for right side of output 657 HWRotatorSession hw_rotator_session {}; 658 bool use_inline_rot = false; // keep track of which layers inline rotation 659 HWSolidfillStage hw_solidfill_stage {}; 660 float compression = 1.0f; 661 bool use_solidfill_stage = false; 662 }; 663 664 struct HWHDRLayerInfo { 665 enum HDROperation { 666 kNoOp, // No-op. 667 kSet, // Sets the HDR MetaData - Start of HDR 668 kReset, // resets the previously set HDR Metadata, End of HDR 669 }; 670 671 int32_t layer_index = -1; 672 HDROperation operation = kNoOp; 673 bool in_hdr_mode = false; // True if already in HDR mode with static metadata. 674 bool blend_space_layer_changed = false; // True if HDR layer's index changed. 675 std::set<uint32_t> hdr_layers; // Non-tonemapped HDR layer indices. 676 std::vector<uint8_t> dyn_hdr_vsif_payload; // Dynamic HDR VSIF data. 677 }; 678 679 struct RCLayersInfo { 680 int top_width = 0; 681 int top_height = 0; 682 int bottom_width = 0; 683 int bottom_height = 0; 684 }; 685 686 struct LayerExt { 687 std::vector<LayerRect> excl_rects = {}; // list of exclusion rects 688 }; 689 690 struct HWLayersInfo { 691 LayerStack *stack = NULL; // Input layer stack. Set by the caller. 692 uint32_t app_layer_count = 0; // Total number of app layers. Must not be 0. 693 uint32_t gpu_target_index = 0; // GPU target layer index. 0 if not present. 694 uint32_t stitch_target_index = 0; // Blit target layer index. 0 if not present. 695 std::vector<ColorPrimaries> wide_color_primaries = {}; // list of wide color primaries 696 697 std::vector<Layer> hw_layers = {}; // Layers which need to be programmed on the HW 698 std::vector<LayerExt> layer_exts = {}; // Extention layer having list of 699 // exclusion rectangles for each layer 700 std::vector<uint32_t> index {}; // Indexes of the layers from the layer stack which need to 701 // be programmed on hardware. 702 std::vector<uint32_t> roi_index {}; // Stores the ROI index where the layers are visible. 703 shared_ptr<Fence> sync_handle = nullptr; // Release fence id for current draw cycle. 704 int set_idle_time_ms = -1; // Set idle time to the new specified value. 705 // -1 indicates no change in idle time since last set value. 706 std::vector<LayerRect> left_frame_roi = {}; // Left ROI. 707 std::vector<LayerRect> right_frame_roi = {}; // Right ROI. 708 LayerRect partial_fb_roi = {}; // Damaged area in framebuffer. 709 bool roi_split = false; // Indicates separated left and right ROI 710 bool async_cursor_updates = false; // Cursor layer allowed to have async updates 711 bool fast_path_composition = false; // Indicates frame has fast path composition 712 DestScaleInfoMap dest_scale_info_map = {}; 713 HWHDRLayerInfo hdr_layer_info = {}; 714 Handle pvt_data = NULL; // Private data used by sdm extension only. 715 bool game_present = false; // Indicates there is game layer or not 716 bool rc_config = false; 717 RCLayersInfo rc_layers_info = {}; 718 }; 719 720 struct HWQosData { 721 uint64_t core_ab_bps = 0; 722 uint64_t core_ib_bps = 0; 723 uint64_t llcc_ab_bps = 0; 724 uint64_t llcc_ib_bps = 0; 725 uint64_t dram_ab_bps = 0; 726 uint64_t dram_ib_bps = 0; 727 uint64_t rot_prefill_bw_bps = 0; 728 uint32_t clock_hz = 0; 729 uint32_t rot_clock_hz = 0; 730 }; 731 732 enum UpdateType { 733 kUpdateResources, // Indicates Strategy & RM execution, which can update resources. 734 kSwapBuffers, // Indicates Strategy & RM execution, which can update buffer handler and crop. 735 kUpdateMax, 736 }; 737 738 struct HWLayers { 739 HWLayersInfo info {}; 740 HWLayerConfig config[kMaxSDELayers] {}; 741 float output_compression = 1.0f; 742 HWQosData qos_data = {}; 743 HWAVRInfo hw_avr_info = {}; 744 std::bitset<kUpdateMax> updates_mask = 0; 745 uint64_t elapse_timestamp = 0; 746 }; 747 748 struct HWDisplayAttributes : DisplayConfigVariableInfo { 749 bool is_device_split = false; 750 uint32_t v_front_porch = 0; //!< Vertical front porch of panel 751 uint32_t v_back_porch = 0; //!< Vertical back porch of panel 752 uint32_t v_pulse_width = 0; //!< Vertical pulse width of panel 753 uint32_t h_total = 0; //!< Total width of panel (hActive + hFP + hBP + hPulseWidth) 754 uint32_t v_total = 0; //!< Total height of panel (vActive + vFP + vBP + vPulseWidth) 755 uint32_t clock_khz = 0; //!< Stores the pixel clock of panel in khz 756 HWTopology topology = kUnknown; //!< Stores the topology information. 757 758 bool operator !=(const HWDisplayAttributes &display_attributes) { 759 return ((is_device_split != display_attributes.is_device_split) || 760 (x_pixels != display_attributes.x_pixels) || 761 (y_pixels != display_attributes.y_pixels) || 762 (x_dpi != display_attributes.x_dpi) || 763 (y_dpi != display_attributes.y_dpi) || 764 (fps != display_attributes.fps) || 765 (vsync_period_ns != display_attributes.vsync_period_ns) || 766 (v_front_porch != display_attributes.v_front_porch) || 767 (v_back_porch != display_attributes.v_back_porch) || 768 (v_pulse_width != display_attributes.v_pulse_width) || 769 (h_total != display_attributes.h_total) || 770 (is_yuv != display_attributes.is_yuv) || 771 (clock_khz != display_attributes.clock_khz) || 772 (topology != display_attributes.topology)); 773 } 774 775 bool operator ==(const HWDisplayAttributes &display_attributes) { 776 return !(operator !=(display_attributes)); 777 } 778 OnlyFpsChangedHWDisplayAttributes779 bool OnlyFpsChanged(const HWDisplayAttributes &display_attributes) { 780 return ((fps != display_attributes.fps) && 781 (vsync_period_ns != display_attributes.vsync_period_ns) && 782 (x_pixels == display_attributes.x_pixels) && 783 (y_pixels == display_attributes.y_pixels) && 784 (x_dpi == display_attributes.x_dpi) && 785 (y_dpi == display_attributes.y_dpi) && 786 (topology == display_attributes.topology) && 787 (is_device_split == display_attributes.is_device_split) && 788 (v_front_porch == display_attributes.v_front_porch) && 789 (v_back_porch == display_attributes.v_back_porch) && 790 (v_pulse_width == display_attributes.v_pulse_width) && 791 (h_total == display_attributes.h_total) && 792 (is_yuv == display_attributes.is_yuv) && 793 (clock_khz == display_attributes.clock_khz)); 794 } 795 }; 796 797 struct HWMixerAttributes { 798 uint32_t width = 0; // Layer mixer width 799 uint32_t height = 0; // Layer mixer height 800 uint32_t split_left = 0; // Left portion of layer mixer 801 HWMixerSplit split_type = kNoSplit; // Mixer topology 802 LayerBufferFormat output_format = kFormatRGB101010; // Layer mixer output format 803 uint32_t dest_scaler_blocks_used = 0; // Count of dest scaler blocks used 804 805 bool operator !=(const HWMixerAttributes &mixer_attributes) { 806 return ((width != mixer_attributes.width) || 807 (height != mixer_attributes.height) || 808 (split_type != mixer_attributes.split_type) || 809 (output_format != mixer_attributes.output_format) || 810 (split_left != mixer_attributes.split_left) || 811 (dest_scaler_blocks_used != mixer_attributes.dest_scaler_blocks_used)); 812 } 813 814 bool operator ==(const HWMixerAttributes &mixer_attributes) { 815 return !(operator !=(mixer_attributes)); 816 } 817 IsValidHWMixerAttributes818 bool IsValid() { 819 return (width > 0 && height > 0); 820 } 821 }; 822 823 } // namespace sdm 824 825 #endif // __HW_INFO_TYPES_H__ 826 827