1 /* 2 * Copyright 2015 Advanced Micro Devices, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 * 22 * Authors: AMD 23 */ 24 25 #ifndef DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ 26 #define DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ 27 28 #include "core_types.h" 29 #include "core_status.h" 30 #include "dal_asic_id.h" 31 #include "dm_pp_smu.h" 32 33 #define MEMORY_TYPE_MULTIPLIER_CZ 4 34 #define MEMORY_TYPE_HBM 2 35 #define MAX_MCACHES 8 36 37 38 #define IS_PIPE_SYNCD_VALID(pipe) ((((pipe)->pipe_idx_syncd) & 0x80)?1:0) 39 #define GET_PIPE_SYNCD_FROM_PIPE(pipe) ((pipe)->pipe_idx_syncd & 0x7F) 40 #define SET_PIPE_SYNCD_TO_PIPE(pipe, pipe_syncd) ((pipe)->pipe_idx_syncd = (0x80 | pipe_syncd)) 41 42 enum dce_version resource_parse_asic_id( 43 struct hw_asic_id asic_id); 44 45 struct resource_caps { 46 int num_timing_generator; 47 int num_opp; 48 int num_dpp; 49 int num_video_plane; 50 int num_audio; 51 int num_stream_encoder; 52 int num_analog_stream_encoder; 53 int num_pll; 54 int num_dwb; 55 int num_ddc; 56 int num_vmid; 57 int num_dsc; 58 unsigned int num_dig_link_enc; // Total number of DIGs (digital encoders) in DIO (Display Input/Output). 59 unsigned int num_usb4_dpia; // Total number of USB4 DPIA (DisplayPort Input Adapters). 60 int num_hpo_dp_stream_encoder; 61 int num_hpo_dp_link_encoder; 62 int num_mpc_3dlut; 63 }; 64 65 struct resource_straps { 66 uint32_t hdmi_disable; 67 uint32_t dc_pinstraps_audio; 68 uint32_t audio_stream_number; 69 }; 70 71 struct dc_mcache_allocations { 72 int global_mcache_ids_plane0[MAX_MCACHES + 1]; 73 int global_mcache_ids_plane1[MAX_MCACHES + 1]; 74 int global_mcache_ids_mall_plane0[MAX_MCACHES + 1]; 75 int global_mcache_ids_mall_plane1[MAX_MCACHES + 1]; 76 }; 77 78 struct resource_create_funcs { 79 void (*read_dce_straps)( 80 struct dc_context *ctx, struct resource_straps *straps); 81 82 struct audio *(*create_audio)( 83 struct dc_context *ctx, unsigned int inst); 84 85 struct stream_encoder *(*create_stream_encoder)( 86 enum engine_id eng_id, struct dc_context *ctx); 87 88 struct hpo_dp_stream_encoder *(*create_hpo_dp_stream_encoder)( 89 enum engine_id eng_id, struct dc_context *ctx); 90 struct hpo_dp_link_encoder *(*create_hpo_dp_link_encoder)( 91 uint8_t inst, 92 struct dc_context *ctx); 93 struct dce_hwseq *(*create_hwseq)( 94 struct dc_context *ctx); 95 }; 96 97 bool resource_construct( 98 unsigned int num_virtual_links, 99 struct dc *dc, 100 struct resource_pool *pool, 101 const struct resource_create_funcs *create_funcs); 102 103 struct resource_pool *dc_create_resource_pool(struct dc *dc, 104 const struct dc_init_data *init_data, 105 enum dce_version dc_version); 106 107 void dc_destroy_resource_pool(struct dc *dc); 108 109 enum dc_status resource_map_pool_resources( 110 const struct dc *dc, 111 struct dc_state *context, 112 struct dc_stream_state *stream); 113 114 void resource_build_test_pattern_params( 115 struct resource_context *res_ctx, 116 struct pipe_ctx *pipe_ctx); 117 118 bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx); 119 120 enum dc_status resource_build_scaling_params_for_context( 121 const struct dc *dc, 122 struct dc_state *context); 123 124 void resource_build_info_frame(struct pipe_ctx *pipe_ctx); 125 126 void resource_unreference_clock_source( 127 struct resource_context *res_ctx, 128 const struct resource_pool *pool, 129 struct clock_source *clock_source); 130 131 void resource_reference_clock_source( 132 struct resource_context *res_ctx, 133 const struct resource_pool *pool, 134 struct clock_source *clock_source); 135 136 int resource_get_clock_source_reference( 137 struct resource_context *res_ctx, 138 const struct resource_pool *pool, 139 struct clock_source *clock_source); 140 141 bool resource_are_streams_timing_synchronizable( 142 struct dc_stream_state *stream1, 143 struct dc_stream_state *stream2); 144 145 bool resource_are_vblanks_synchronizable( 146 struct dc_stream_state *stream1, 147 struct dc_stream_state *stream2); 148 149 struct clock_source *resource_find_used_clk_src_for_sharing( 150 struct resource_context *res_ctx, 151 struct pipe_ctx *pipe_ctx); 152 153 struct clock_source *dc_resource_find_first_free_pll( 154 struct resource_context *res_ctx, 155 const struct resource_pool *pool); 156 157 bool resource_attach_surfaces_to_context( 158 struct dc_plane_state *const *plane_state, 159 int surface_count, 160 struct dc_stream_state *dc_stream, 161 struct dc_state *context, 162 const struct resource_pool *pool); 163 164 bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx); 165 166 #define FREE_PIPE_INDEX_NOT_FOUND -1 167 168 /* 169 * pipe types are identified based on MUXes in DCN front end that are capable 170 * of taking input from one DCN pipeline to another DCN pipeline. The name is 171 * in a form of XXXX_YYYY, where XXXX is the DCN front end hardware block the 172 * pipeline ends with and YYYY is the rendering role that the pipe is in. 173 * 174 * For instance OTG_MASTER is a pipe ending with OTG hardware block in its 175 * pipeline and it is in a role of a master pipe for timing generation. 176 * 177 * For quick reference a diagram of each pipe type's areas of responsibility 178 * for outputting timings on the screen is shown below: 179 * 180 * Timing Active for Stream 0 181 * __________________________________________________ 182 * |OTG master 0 (OPP head 0)|OPP head 2 (DPP pipe 2) | 183 * | (DPP pipe 0)| | 184 * | Top Plane 0 | | 185 * | ______________|____ | 186 * | |DPP pipe 1 |DPP | | 187 * | | |pipe| | 188 * | | Bottom |3 | | 189 * | | Plane 1 | | | 190 * | | | | | 191 * | |______________|____| | 192 * | | | 193 * | | | 194 * | ODM slice 0 | ODM slice 1 | 195 * |_________________________|________________________| 196 * 197 * Timing Active for Stream 1 198 * __________________________________________________ 199 * |OTG master 4 (OPP head 4) | 200 * | | 201 * | | 202 * | | 203 * | | 204 * | | 205 * | Blank Pixel Data | 206 * | (generated by DPG4) | 207 * | | 208 * | | 209 * | | 210 * | | 211 * | | 212 * |__________________________________________________| 213 * 214 * Inter-pipe Relation 215 * __________________________________________________ 216 * |PIPE IDX| DPP PIPES | OPP HEADS | OTG MASTER | 217 * | | plane 0 | slice 0 | | 218 * | 0 | -------------MPC---------ODM----------- | 219 * | | plane 1 | | | | | 220 * | 1 | ------------- | | | | 221 * | | plane 0 | slice 1 | | | 222 * | 2 | -------------MPC--------- | | 223 * | | plane 1 | | | | 224 * | 3 | ------------- | | | 225 * | | | blank | | 226 * | 4 | | ----------------------- | 227 * | | | | | 228 * | 5 | (FREE) | | | 229 * |________|_______________|___________|_____________| 230 * 231 * The following is a quick reference of the class relation: 232 * 233 * DC state ---1--------0..N--- streams 234 * 235 * stream ---1-----------1--- OTG Master pipe 236 * 237 * OTG Master pipe ---1--------1..N--- OPP Head pipes 238 * 239 * OPP Head pipe ---1--------0..N--- DPP pipes 240 * 241 * stream ---1--------0..N--- Planes 242 * 243 * Plane ---1--------1..N--- DPP pipes 244 * 245 */ 246 enum pipe_type { 247 /* free pipe - free pipe is an uninitialized pipe without a stream 248 * associated with it. It is a free DCN pipe resource. It can be 249 * acquired as any type of pipe. 250 */ 251 FREE_PIPE, 252 253 /* OTG master pipe - the master pipe of its OPP head pipes with a 254 * functional OTG. It merges all its OPP head pipes pixel data in ODM 255 * block and output to back end DIG. OTG master pipe is responsible for 256 * generating entire CRTC timing to back end DIG. An OTG master pipe may 257 * or may not have a plane. If it has a plane it blends it as the left 258 * most MPC slice of the top most layer. If it doesn't have a plane it 259 * can output pixel data from its OPP head pipes' test pattern 260 * generators (DPG) such as solid black pixel data to blank the screen. 261 */ 262 OTG_MASTER, 263 264 /* OPP head pipe - the head pipe of an MPC blending tree with a 265 * functional OPP outputting to an OTG. OPP head pipe is responsible for 266 * processing output pixels in its own ODM slice. It may or may not have 267 * a plane. If it has a plane it blends it as the top most layer within 268 * its own ODM slice. If it doesn't have a plane it can output pixel 269 * data from its DPG such as solid black pixel data to blank the pixel 270 * data in its own ODM slice. OTG master pipe is also an OPP head pipe 271 * but with more responsibility. 272 */ 273 OPP_HEAD, 274 275 /* DPP pipe - the pipe with a functional DPP outputting to an OPP head 276 * pipe's MPC. DPP pipe is responsible for processing pixel data from 277 * its own MPC slice of a plane. It must be connected to an OPP head 278 * pipe and it must have a plane associated with it. 279 */ 280 DPP_PIPE, 281 }; 282 283 /* 284 * Determine if the input pipe_ctx is of a pipe type. 285 * return - true if pipe_ctx is of the input type. 286 */ 287 bool resource_is_pipe_type(const struct pipe_ctx *pipe_ctx, enum pipe_type type); 288 289 /* 290 * Acquire a pipe as OTG master pipe and allocate pipe resources required to 291 * enable stream output. 292 */ 293 enum dc_status resource_add_otg_master_for_stream_output(struct dc_state *new_ctx, 294 const struct resource_pool *pool, 295 struct dc_stream_state *stream); 296 297 /* 298 * Release pipe resources and the OTG master pipe associated with the stream 299 * The stream must have all planes removed and ODM/MPC slice counts are reset 300 * to 1 before invoking this interface. 301 */ 302 void resource_remove_otg_master_for_stream_output(struct dc_state *new_ctx, 303 const struct resource_pool *pool, 304 struct dc_stream_state *stream); 305 306 /* 307 * Add plane to the bottom most layer in plane composition and allocate DPP pipe 308 * resources as needed. 309 * return - true if plane is added in plane composition, false otherwise. 310 */ 311 bool resource_append_dpp_pipes_for_plane_composition( 312 struct dc_state *new_ctx, 313 struct dc_state *cur_ctx, 314 struct resource_pool *pool, 315 struct pipe_ctx *otg_master_pipe, 316 struct dc_plane_state *plane_state); 317 318 /* 319 * Add plane to the bottom most layer in plane composition and allocate DPP pipe 320 * resources as needed. 321 * return - true if plane is added in plane composition, false otherwise. 322 */ 323 void resource_remove_dpp_pipes_for_plane_composition( 324 struct dc_state *context, 325 const struct resource_pool *pool, 326 const struct dc_plane_state *plane_state); 327 328 /* 329 * Update ODM slice count by acquiring or releasing pipes. If new slices need 330 * to be added, it is going to add them to the last ODM index. If existing 331 * slices need to be removed, it is going to remove them from the last ODM 332 * index. 333 * 334 * return - true if ODM slices are updated and required pipes are acquired. All 335 * affected pipe parameters are updated. 336 * 337 * false if resource fails to complete this update. The function is not designed 338 * to recover the creation of invalid topologies. Returning false is typically 339 * an indication of insufficient validation in caller's stack. new_ctx will be 340 * invalid. Caller may attempt to restore new_ctx by calling this function 341 * again with original slice count. 342 */ 343 bool resource_update_pipes_for_stream_with_slice_count( 344 struct dc_state *new_ctx, 345 const struct dc_state *cur_ctx, 346 const struct resource_pool *pool, 347 const struct dc_stream_state *stream, 348 int new_slice_count); 349 350 /* 351 * Update MPC slice count by acquiring or releasing DPP pipes. If new slices 352 * need to be added it is going to add to the last MPC index. If existing 353 * slices need to be removed, it is going to remove them from the last MPC 354 * index. 355 * 356 * @dpp_pipe - top most dpp pipe for MPCC combine. 357 * 358 * return - true if MPC slices are updated and required pipes are acquired. All 359 * affected pipe parameters are updated. 360 * 361 * false if resource fails to complete this update. The function is not designed 362 * to recover the creation of invalid topologies. Returning false is typically 363 * an indication of insufficient validation in caller's stack. new_ctx will be 364 * invalid. Caller may attempt to restore new_ctx by calling this function 365 * again with original slice count. 366 */ 367 bool resource_update_pipes_for_plane_with_slice_count( 368 struct dc_state *new_ctx, 369 const struct dc_state *cur_ctx, 370 const struct resource_pool *pool, 371 const struct dc_plane_state *plane, 372 int slice_count); 373 374 /* 375 * Get the OTG master pipe in resource context associated with the stream. 376 * return - NULL if not found. Otherwise the OTG master pipe associated with the 377 * stream. 378 */ 379 struct pipe_ctx *resource_get_otg_master_for_stream( 380 struct resource_context *res_ctx, 381 const struct dc_stream_state *stream); 382 383 /* 384 * Get an array of OPP heads in opp_heads ordered with index low to high for OTG 385 * master pipe in res_ctx. 386 * return - number of OPP heads in the array. If otg_master passed in is not 387 * an OTG master, the function returns 0. 388 */ 389 int resource_get_opp_heads_for_otg_master(const struct pipe_ctx *otg_master, 390 struct resource_context *res_ctx, 391 struct pipe_ctx *opp_heads[MAX_PIPES]); 392 393 /* 394 * Get an array of DPP pipes in dpp_pipes ordered with index low to high for OPP 395 * head pipe in res_ctx. 396 * return - number of DPP pipes in the array. If opp_head passed in is not 397 * an OPP pipe, the function returns 0. 398 */ 399 int resource_get_dpp_pipes_for_opp_head(const struct pipe_ctx *opp_head, 400 struct resource_context *res_ctx, 401 struct pipe_ctx *dpp_pipes[MAX_PIPES]); 402 403 /* 404 * Get an array of DPP pipes in dpp_pipes ordered with index low to high for 405 * plane in res_ctx. 406 * return - number of DPP pipes in the array. 407 */ 408 int resource_get_dpp_pipes_for_plane(const struct dc_plane_state *plane, 409 struct resource_context *res_ctx, 410 struct pipe_ctx *dpp_pipes[MAX_PIPES]); 411 412 /* 413 * Get the OTG master pipe for the input pipe context. 414 * return - the OTG master pipe for the input pipe 415 * context. 416 */ 417 struct pipe_ctx *resource_get_otg_master(const struct pipe_ctx *pipe_ctx); 418 419 /* 420 * Get the OPP head pipe for the input pipe context. 421 * return - the OPP head pipe for the input pipe 422 * context. 423 */ 424 struct pipe_ctx *resource_get_opp_head(const struct pipe_ctx *pipe_ctx); 425 426 /* 427 * Get the DPP pipe allocated for MPC slice 0 and ODM slice 0 of the plane 428 * associated with dpp_pipe. 429 */ 430 struct pipe_ctx *resource_get_primary_dpp_pipe(const struct pipe_ctx *dpp_pipe); 431 432 /* 433 * Get the MPC slice index counting from 0 from left most slice 434 * For example, if a DPP pipe is used as a secondary pipe in MPCC combine, MPC 435 * split index is greater than 0. 436 */ 437 int resource_get_mpc_slice_index(const struct pipe_ctx *dpp_pipe); 438 439 /* 440 * Get the number of MPC slices associated with the pipe. 441 * The function returns 0 if the pipe is not associated with an MPC combine 442 * pipe topology. 443 */ 444 int resource_get_mpc_slice_count(const struct pipe_ctx *pipe); 445 446 /* 447 * Get the number of ODM slices associated with the pipe. 448 * The function returns 0 if the pipe is not associated with an ODM combine 449 * pipe topology. 450 */ 451 int resource_get_odm_slice_count(const struct pipe_ctx *pipe); 452 453 /* Get the ODM slice index counting from 0 from left most slice */ 454 int resource_get_odm_slice_index(const struct pipe_ctx *opp_head); 455 456 /* Get ODM slice source rect in timing active as input to OPP block */ 457 struct rect resource_get_odm_slice_src_rect(struct pipe_ctx *pipe_ctx); 458 459 /* Get ODM slice destination rect in timing active as output from OPP block */ 460 struct rect resource_get_odm_slice_dst_rect(struct pipe_ctx *pipe_ctx); 461 462 /* Get ODM slice destination width in timing active as output from OPP block */ 463 int resource_get_odm_slice_dst_width(struct pipe_ctx *otg_master, 464 bool is_last_segment); 465 466 /* determine if pipe topology is changed between state a and state b */ 467 bool resource_is_pipe_topology_changed(const struct dc_state *state_a, 468 const struct dc_state *state_b); 469 470 /* 471 * determine if the two OTG master pipes have the same ODM topology 472 * return 473 * false - if pipes passed in are not OTG masters or ODM topology is 474 * changed. 475 * true - otherwise 476 */ 477 bool resource_is_odm_topology_changed(const struct pipe_ctx *otg_master_a, 478 const struct pipe_ctx *otg_master_b); 479 480 /* log the pipe topology update in state */ 481 void resource_log_pipe_topology_update(struct dc *dc, struct dc_state *state); 482 483 /* 484 * Look for a free pipe in new resource context that is used as a secondary OPP 485 * head by cur_otg_master. 486 * 487 * return - FREE_PIPE_INDEX_NOT_FOUND if free pipe is not found, otherwise 488 * pipe idx of the free pipe 489 */ 490 int resource_find_free_pipe_used_as_sec_opp_head_by_cur_otg_master( 491 const struct resource_context *cur_res_ctx, 492 struct resource_context *new_res_ctx, 493 const struct pipe_ctx *cur_otg_master); 494 495 /* 496 * Look for a free pipe in new resource context that is used as a secondary DPP 497 * pipe in MPC blending tree associated with input OPP head pipe. 498 * 499 * return - FREE_PIPE_INDEX_NOT_FOUND if free pipe is not found, otherwise 500 * pipe idx of the free pipe 501 */ 502 int resource_find_free_pipe_used_in_cur_mpc_blending_tree( 503 const struct resource_context *cur_res_ctx, 504 struct resource_context *new_res_ctx, 505 const struct pipe_ctx *cur_opp_head); 506 507 /* 508 * Look for a free pipe in new resource context that is not used in current 509 * resource context. 510 * 511 * return - FREE_PIPE_INDEX_NOT_FOUND if free pipe is not found, otherwise 512 * pipe idx of the free pipe 513 */ 514 int recource_find_free_pipe_not_used_in_cur_res_ctx( 515 const struct resource_context *cur_res_ctx, 516 struct resource_context *new_res_ctx, 517 const struct resource_pool *pool); 518 519 /* 520 * Look for a free pipe in new resource context that is used in current resource 521 * context as an OTG master pipe. 522 * 523 * return - FREE_PIPE_INDEX_NOT_FOUND if free pipe is not found, otherwise 524 * pipe idx of the free pipe 525 */ 526 int recource_find_free_pipe_used_as_otg_master_in_cur_res_ctx( 527 const struct resource_context *cur_res_ctx, 528 struct resource_context *new_res_ctx, 529 const struct resource_pool *pool); 530 531 /* 532 * Look for a free pipe in new resource context that is used as a secondary DPP 533 * pipe in current resource context. 534 * return - FREE_PIPE_INDEX_NOT_FOUND if free pipe is not found, otherwise 535 * pipe idx of the free pipe 536 */ 537 int resource_find_free_pipe_used_as_cur_sec_dpp( 538 const struct resource_context *cur_res_ctx, 539 struct resource_context *new_res_ctx, 540 const struct resource_pool *pool); 541 542 /* 543 * Look for a free pipe in new resource context that is used as a secondary DPP 544 * pipe in any MPCC combine in current resource context. 545 * return - FREE_PIPE_INDEX_NOT_FOUND if free pipe is not found, otherwise 546 * pipe idx of the free pipe 547 */ 548 int resource_find_free_pipe_used_as_cur_sec_dpp_in_mpcc_combine( 549 const struct resource_context *cur_res_ctx, 550 struct resource_context *new_res_ctx, 551 const struct resource_pool *pool); 552 553 /* 554 * Look for any free pipe in new resource context. 555 * return - FREE_PIPE_INDEX_NOT_FOUND if free pipe is not found, otherwise 556 * pipe idx of the free pipe 557 */ 558 int resource_find_any_free_pipe(struct resource_context *new_res_ctx, 559 const struct resource_pool *pool); 560 561 /* 562 * Legacy find free secondary pipe logic deprecated for newer DCNs as it doesn't 563 * find the most optimal free pipe to prevent from time consuming hardware state 564 * transitions. 565 */ 566 struct pipe_ctx *resource_find_free_secondary_pipe_legacy( 567 struct resource_context *res_ctx, 568 const struct resource_pool *pool, 569 const struct pipe_ctx *primary_pipe); 570 571 bool resource_validate_attach_surfaces( 572 const struct dc_validation_set set[], 573 int set_count, 574 const struct dc_state *old_context, 575 struct dc_state *context, 576 const struct resource_pool *pool); 577 578 enum dc_status resource_map_clock_resources( 579 const struct dc *dc, 580 struct dc_state *context, 581 struct dc_stream_state *stream); 582 583 enum dc_status resource_map_phy_clock_resources( 584 const struct dc *dc, 585 struct dc_state *context, 586 struct dc_stream_state *stream); 587 588 bool pipe_need_reprogram( 589 struct pipe_ctx *pipe_ctx_old, 590 struct pipe_ctx *pipe_ctx); 591 592 void resource_build_bit_depth_reduction_params(struct dc_stream_state *stream, 593 struct bit_depth_reduction_params *fmt_bit_depth); 594 595 void update_audio_usage( 596 struct resource_context *res_ctx, 597 const struct resource_pool *pool, 598 struct audio *audio, 599 bool acquired); 600 601 unsigned int resource_pixel_format_to_bpp(enum surface_pixel_format format); 602 603 bool get_temp_dp_link_res(struct dc_link *link, 604 struct link_resource *link_res, 605 struct dc_link_settings *link_settings); 606 607 void reset_syncd_pipes_from_disabled_pipes(struct dc *dc, 608 struct dc_state *context); 609 610 void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc, 611 struct dc_state *context, 612 uint8_t disabled_master_pipe_idx); 613 614 void reset_sync_context_for_pipe(const struct dc *dc, 615 struct dc_state *context, 616 uint8_t pipe_idx); 617 618 uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter); 619 620 const struct link_hwss *get_link_hwss(const struct dc_link *link, 621 const struct link_resource *link_res); 622 623 bool is_h_timing_divisible_by_2(struct dc_stream_state *stream); 624 625 bool dc_resource_acquire_secondary_pipe_for_mpc_odm_legacy( 626 const struct dc *dc, 627 struct dc_state *state, 628 struct pipe_ctx *pri_pipe, 629 struct pipe_ctx *sec_pipe, 630 bool odm); 631 632 /* A test harness interface that modifies dp encoder resources in the given dc 633 * state and bypasses the need to revalidate. The interface assumes that the 634 * test harness interface is called with pre-validated link config stored in the 635 * pipe_ctx and updates dp encoder resources according to the link config. 636 */ 637 enum dc_status update_dp_encoder_resources_for_test_harness(const struct dc *dc, 638 struct dc_state *context, 639 struct pipe_ctx *pipe_ctx); 640 641 /* Get hw programming parameters container from pipe context 642 * @pipe_ctx: pipe context 643 * @dscl_prog_data: struct to hold programmable hw reg values 644 */ 645 struct dscl_prog_data *resource_get_dscl_prog_data(struct pipe_ctx *pipe_ctx); 646 /* Setup dc callbacks for dml2 647 * @dc: the display core structure 648 * @dml2_options: struct to hold callbacks 649 */ 650 void resource_init_common_dml2_callbacks(struct dc *dc, struct dml2_configuration_options *dml2_options); 651 652 /* 653 *Calculate total DET allocated for all pipes for a given OTG_MASTER pipe 654 */ 655 int resource_calculate_det_for_stream(struct dc_state *state, struct pipe_ctx *otg_master); 656 657 bool resource_is_hpo_acquired(struct dc_state *context); 658 659 struct link_encoder *get_temp_dio_link_enc( 660 const struct resource_context *res_ctx, 661 const struct resource_pool *const pool, 662 const struct dc_link *link); 663 #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */ 664