Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'drm-next-5.2' of git://people.freedesktop.org/~agd5f/linux into drm-next

- Fixes for powerplay custom profiles
- DC bandwidth clean ups and fixes
- RAS fixes for vega20
- DC atomic resume fix
- Better plane handling in DC
- Freesync improvements
- Misc bug fixes and cleanups

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190411031242.3337-1-alexander.deucher@amd.com

+1317 -585
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 827 827 /* For pre-DCE11. DCE11 and later are in "struct amdgpu_device->dm" */ 828 828 struct work_struct hotplug_work; 829 829 struct amdgpu_irq_src crtc_irq; 830 + struct amdgpu_irq_src vupdate_irq; 830 831 struct amdgpu_irq_src pageflip_irq; 831 832 struct amdgpu_irq_src hpd_irq; 832 833
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 2471 2471 mutex_init(&adev->virt.vf_errors.lock); 2472 2472 hash_init(adev->mn_hash); 2473 2473 mutex_init(&adev->lock_reset); 2474 + mutex_init(&adev->virt.dpm_mutex); 2474 2475 2475 2476 amdgpu_device_check_arguments(adev); 2476 2477
+11
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
··· 31 31 #include <drm/amdgpu_drm.h> 32 32 #include "amdgpu.h" 33 33 #include "amdgpu_display.h" 34 + #include "amdgpu_xgmi.h" 34 35 35 36 void amdgpu_gem_object_free(struct drm_gem_object *gobj) 36 37 { ··· 669 668 struct amdgpu_device *adev = dev->dev_private; 670 669 struct drm_amdgpu_gem_op *args = data; 671 670 struct drm_gem_object *gobj; 671 + struct amdgpu_vm_bo_base *base; 672 672 struct amdgpu_bo *robj; 673 673 int r; 674 674 ··· 708 706 amdgpu_bo_unreserve(robj); 709 707 break; 710 708 } 709 + for (base = robj->vm_bo; base; base = base->next) 710 + if (amdgpu_xgmi_same_hive(amdgpu_ttm_adev(robj->tbo.bdev), 711 + amdgpu_ttm_adev(base->vm->root.base.bo->tbo.bdev))) { 712 + r = -EINVAL; 713 + amdgpu_bo_unreserve(robj); 714 + goto out; 715 + } 716 + 717 + 711 718 robj->preferred_domains = args->value & (AMDGPU_GEM_DOMAIN_VRAM | 712 719 AMDGPU_GEM_DOMAIN_GTT | 713 720 AMDGPU_GEM_DOMAIN_CPU);
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 696 696 if (adev->pm.dpm_enabled) { 697 697 dev_info.max_engine_clock = amdgpu_dpm_get_sclk(adev, false) * 10; 698 698 dev_info.max_memory_clock = amdgpu_dpm_get_mclk(adev, false) * 10; 699 + } else if (amdgpu_sriov_vf(adev) && amdgim_is_hwperf(adev) && 700 + adev->virt.ops->get_pp_clk) { 701 + dev_info.max_engine_clock = amdgpu_virt_get_sclk(adev, false) * 10; 702 + dev_info.max_memory_clock = amdgpu_virt_get_mclk(adev, false) * 10; 699 703 } else { 700 704 dev_info.max_engine_clock = adev->clock.default_sclk * 10; 701 705 dev_info.max_memory_clock = adev->clock.default_mclk * 10;
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
··· 58 58 #define to_amdgpu_encoder(x) container_of(x, struct amdgpu_encoder, base) 59 59 #define to_amdgpu_framebuffer(x) container_of(x, struct amdgpu_framebuffer, base) 60 60 61 - #define to_dm_plane_state(x) container_of(x, struct dm_plane_state, base); 61 + #define to_dm_plane_state(x) container_of(x, struct dm_plane_state, base) 62 62 63 63 #define AMDGPU_MAX_HPD_PINS 6 64 64 #define AMDGPU_MAX_CRTCS 6 ··· 406 406 struct amdgpu_flip_work *pflip_works; 407 407 enum amdgpu_flip_status pflip_status; 408 408 int deferred_flip_completion; 409 - u64 last_flip_vblank; 409 + u32 last_flip_vblank; 410 410 /* pll sharing */ 411 411 struct amdgpu_atom_ss ss; 412 412 bool ss_enabled;
+16
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
··· 327 327 goto fail; 328 328 } 329 329 330 + if (amdgpu_sriov_vf(adev)) { 331 + if (amdgim_is_hwperf(adev) && 332 + adev->virt.ops->force_dpm_level) { 333 + mutex_lock(&adev->pm.mutex); 334 + adev->virt.ops->force_dpm_level(adev, level); 335 + mutex_unlock(&adev->pm.mutex); 336 + return count; 337 + } else { 338 + return -EINVAL; 339 + } 340 + } 341 + 330 342 if (current_level == level) 331 343 return count; 332 344 ··· 801 789 { 802 790 struct drm_device *ddev = dev_get_drvdata(dev); 803 791 struct amdgpu_device *adev = ddev->dev_private; 792 + 793 + if (amdgpu_sriov_vf(adev) && amdgim_is_hwperf(adev) && 794 + adev->virt.ops->get_pp_clk) 795 + return adev->virt.ops->get_pp_clk(adev, PP_SCLK, buf); 804 796 805 797 if (is_support_sw_smu(adev)) 806 798 return smu_print_clk_levels(&adev->smu, PP_SCLK, buf);
+3 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 187 187 int ret; 188 188 189 189 /* 190 - * Allocate 3M memory aligned to 1M from Frame Buffer (local 191 - * physical). 190 + * According to HW engineer, they prefer the TMR address be "naturally 191 + * aligned" , e.g. the start address be an integer divide of TMR size. 192 192 * 193 193 * Note: this memory need be reserved till the driver 194 194 * uninitializes. 195 195 */ 196 - ret = amdgpu_bo_create_kernel(psp->adev, PSP_TMR_SIZE, 0x100000, 196 + ret = amdgpu_bo_create_kernel(psp->adev, PSP_TMR_SIZE, PSP_TMR_SIZE, 197 197 AMDGPU_GEM_DOMAIN_VRAM, 198 198 &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf); 199 199
+42 -9
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
··· 530 530 return 0; 531 531 } 532 532 533 + /* Only used in device probe stage and called only once. */ 534 + int amdgpu_ras_feature_enable_on_boot(struct amdgpu_device *adev, 535 + struct ras_common_if *head, bool enable) 536 + { 537 + struct amdgpu_ras *con = amdgpu_ras_get_context(adev); 538 + int ret; 539 + 540 + if (!con) 541 + return -EINVAL; 542 + 543 + if (con->flags & AMDGPU_RAS_FLAG_INIT_BY_VBIOS) { 544 + /* If ras is enabled by vbios, we set up ras object first in 545 + * both case. For enable, that is all what we need do. For 546 + * disable, we need perform a ras TA disable cmd after that. 547 + */ 548 + ret = __amdgpu_ras_feature_enable(adev, head, 1); 549 + if (ret) 550 + return ret; 551 + 552 + if (!enable) 553 + ret = amdgpu_ras_feature_enable(adev, head, 0); 554 + } else 555 + ret = amdgpu_ras_feature_enable(adev, head, enable); 556 + 557 + return ret; 558 + } 559 + 533 560 static int amdgpu_ras_disable_all_features(struct amdgpu_device *adev, 534 561 bool bypass) 535 562 { ··· 585 558 struct amdgpu_ras *con = amdgpu_ras_get_context(adev); 586 559 int ras_block_count = AMDGPU_RAS_BLOCK_COUNT; 587 560 int i; 561 + const enum amdgpu_ras_error_type default_ras_type = 562 + AMDGPU_RAS_ERROR__NONE; 588 563 589 564 for (i = 0; i < ras_block_count; i++) { 590 565 struct ras_common_if head = { 591 566 .block = i, 592 - .type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE, 567 + .type = default_ras_type, 593 568 .sub_block_index = 0, 594 569 }; 595 570 strcpy(head.name, ras_block_str(i)); ··· 1397 1368 1398 1369 amdgpu_ras_mask &= AMDGPU_RAS_BLOCK_MASK; 1399 1370 1400 - if (con->flags & AMDGPU_RAS_FLAG_INIT_BY_VBIOS) 1401 - amdgpu_ras_enable_all_features(adev, 1); 1402 - 1403 1371 if (amdgpu_ras_fs_init(adev)) 1404 1372 goto fs_out; 1405 1373 ··· 1424 1398 if (!con) 1425 1399 return; 1426 1400 1427 - /* We enable ras on all hw_supported block, but as boot parameter might 1428 - * disable some of them and one or more IP has not implemented yet. 1429 - * So we disable them on behalf. 1430 - */ 1431 1401 if (con->flags & AMDGPU_RAS_FLAG_INIT_BY_VBIOS) { 1402 + /* Set up all other IPs which are not implemented. There is a 1403 + * tricky thing that IP's actual ras error type should be 1404 + * MULTI_UNCORRECTABLE, but as driver does not handle it, so 1405 + * ERROR_NONE make sense anyway. 1406 + */ 1407 + amdgpu_ras_enable_all_features(adev, 1); 1408 + 1409 + /* We enable ras on all hw_supported block, but as boot 1410 + * parameter might disable some of them and one or more IP has 1411 + * not implemented yet. So we disable them on behalf. 1412 + */ 1432 1413 list_for_each_entry_safe(obj, tmp, &con->head, node) { 1433 1414 if (!amdgpu_ras_is_supported(adev, obj->head.block)) { 1434 1415 amdgpu_ras_feature_enable(adev, &obj->head, 0); 1435 1416 /* there should be no any reference. */ 1436 1417 WARN_ON(alive_obj(obj)); 1437 1418 } 1438 - }; 1419 + } 1439 1420 } 1440 1421 } 1441 1422
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
··· 262 262 int amdgpu_ras_feature_enable(struct amdgpu_device *adev, 263 263 struct ras_common_if *head, bool enable); 264 264 265 + int amdgpu_ras_feature_enable_on_boot(struct amdgpu_device *adev, 266 + struct ras_common_if *head, bool enable); 267 + 265 268 int amdgpu_ras_sysfs_create(struct amdgpu_device *adev, 266 269 struct ras_fs_if *head); 267 270
+2 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
··· 28 28 #define AMDGPU_MAX_SDMA_INSTANCES 2 29 29 30 30 enum amdgpu_sdma_irq { 31 - AMDGPU_SDMA_IRQ_TRAP0 = 0, 32 - AMDGPU_SDMA_IRQ_TRAP1, 33 - AMDGPU_SDMA_IRQ_ECC0, 34 - AMDGPU_SDMA_IRQ_ECC1, 35 - 31 + AMDGPU_SDMA_IRQ_INSTANCE0 = 0, 32 + AMDGPU_SDMA_IRQ_INSTANCE1, 36 33 AMDGPU_SDMA_IRQ_LAST 37 34 }; 38 35
+49
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
··· 375 375 } 376 376 } 377 377 378 + static uint32_t parse_clk(char *buf, bool min) 379 + { 380 + char *ptr = buf; 381 + uint32_t clk = 0; 382 + 383 + do { 384 + ptr = strchr(ptr, ':'); 385 + if (!ptr) 386 + break; 387 + ptr+=2; 388 + clk = simple_strtoul(ptr, NULL, 10); 389 + } while (!min); 390 + 391 + return clk * 100; 392 + } 393 + 394 + uint32_t amdgpu_virt_get_sclk(struct amdgpu_device *adev, bool lowest) 395 + { 396 + char *buf = NULL; 397 + uint32_t clk = 0; 398 + 399 + buf = kzalloc(PAGE_SIZE, GFP_KERNEL); 400 + if (!buf) 401 + return -ENOMEM; 402 + 403 + adev->virt.ops->get_pp_clk(adev, PP_SCLK, buf); 404 + clk = parse_clk(buf, lowest); 405 + 406 + kfree(buf); 407 + 408 + return clk; 409 + } 410 + 411 + uint32_t amdgpu_virt_get_mclk(struct amdgpu_device *adev, bool lowest) 412 + { 413 + char *buf = NULL; 414 + uint32_t clk = 0; 415 + 416 + buf = kzalloc(PAGE_SIZE, GFP_KERNEL); 417 + if (!buf) 418 + return -ENOMEM; 419 + 420 + adev->virt.ops->get_pp_clk(adev, PP_MCLK, buf); 421 + clk = parse_clk(buf, lowest); 422 + 423 + kfree(buf); 424 + 425 + return clk; 426 + } 378 427
+11
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
··· 57 57 int (*reset_gpu)(struct amdgpu_device *adev); 58 58 int (*wait_reset)(struct amdgpu_device *adev); 59 59 void (*trans_msg)(struct amdgpu_device *adev, u32 req, u32 data1, u32 data2, u32 data3); 60 + int (*get_pp_clk)(struct amdgpu_device *adev, u32 type, char *buf); 61 + int (*force_dpm_level)(struct amdgpu_device *adev, u32 level); 60 62 }; 61 63 62 64 /* ··· 85 83 AMDGIM_FEATURE_GIM_LOAD_UCODES = 0x2, 86 84 /* VRAM LOST by GIM */ 87 85 AMDGIM_FEATURE_GIM_FLR_VRAMLOST = 0x4, 86 + /* HW PERF SIM in GIM */ 87 + AMDGIM_FEATURE_HW_PERF_SIMULATION = (1 << 3), 88 88 }; 89 89 90 90 struct amd_sriov_msg_pf2vf_info_header { ··· 256 252 struct amdgpu_vf_error_buffer vf_errors; 257 253 struct amdgpu_virt_fw_reserve fw_reserve; 258 254 uint32_t gim_feature; 255 + /* protect DPM events to GIM */ 256 + struct mutex dpm_mutex; 259 257 }; 260 258 261 259 #define amdgpu_sriov_enabled(adev) \ ··· 284 278 #endif 285 279 } 286 280 281 + #define amdgim_is_hwperf(adev) \ 282 + ((adev)->virt.gim_feature & AMDGIM_FEATURE_HW_PERF_SIMULATION) 283 + 287 284 bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev); 288 285 void amdgpu_virt_init_setting(struct amdgpu_device *adev); 289 286 uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg); ··· 304 295 unsigned int key, 305 296 unsigned int chksum); 306 297 void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev); 298 + uint32_t amdgpu_virt_get_sclk(struct amdgpu_device *adev, bool lowest); 299 + uint32_t amdgpu_virt_get_mclk(struct amdgpu_device *adev, bool lowest); 307 300 308 301 #endif
+23 -12
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 769 769 770 770 addr = 0; 771 771 if (ats_entries) { 772 - uint64_t ats_value; 772 + uint64_t value = 0, flags; 773 773 774 - ats_value = AMDGPU_PTE_DEFAULT_ATC; 775 - if (level != AMDGPU_VM_PTB) 776 - ats_value |= AMDGPU_PDE_PTE; 774 + flags = AMDGPU_PTE_DEFAULT_ATC; 775 + if (level != AMDGPU_VM_PTB) { 776 + /* Handle leaf PDEs as PTEs */ 777 + flags |= AMDGPU_PDE_PTE; 778 + amdgpu_gmc_get_vm_pde(adev, level, &value, &flags); 779 + } 777 780 778 781 r = vm->update_funcs->update(&params, bo, addr, 0, ats_entries, 779 - 0, ats_value); 782 + value, flags); 780 783 if (r) 781 784 return r; 782 785 ··· 787 784 } 788 785 789 786 if (entries) { 790 - uint64_t value = 0; 787 + uint64_t value = 0, flags = 0; 791 788 792 - /* Workaround for fault priority problem on GMC9 */ 793 - if (level == AMDGPU_VM_PTB && 794 - adev->asic_type >= CHIP_VEGA10) 795 - value = AMDGPU_PTE_EXECUTABLE; 789 + if (adev->asic_type >= CHIP_VEGA10) { 790 + if (level != AMDGPU_VM_PTB) { 791 + /* Handle leaf PDEs as PTEs */ 792 + flags |= AMDGPU_PDE_PTE; 793 + amdgpu_gmc_get_vm_pde(adev, level, 794 + &value, &flags); 795 + } else { 796 + /* Workaround for fault priority problem on GMC9 */ 797 + flags = AMDGPU_PTE_EXECUTABLE; 798 + } 799 + } 796 800 797 801 r = vm->update_funcs->update(&params, bo, addr, 0, entries, 798 - 0, value); 802 + value, flags); 799 803 if (r) 800 804 return r; 801 805 } ··· 2037 2027 INIT_LIST_HEAD(&bo_va->valids); 2038 2028 INIT_LIST_HEAD(&bo_va->invalids); 2039 2029 2040 - if (bo && amdgpu_xgmi_same_hive(adev, amdgpu_ttm_adev(bo->tbo.bdev))) { 2030 + if (bo && amdgpu_xgmi_same_hive(adev, amdgpu_ttm_adev(bo->tbo.bdev)) && 2031 + (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM)) { 2041 2032 bo_va->is_xgmi = true; 2042 2033 mutex_lock(&adev->vm_manager.lock_pstate); 2043 2034 /* Power up XGMI if it can be potentially used */
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
··· 303 303 const struct amdgpu_vm_pte_funcs *vm_pte_funcs; 304 304 struct drm_sched_rq *vm_pte_rqs[AMDGPU_MAX_RINGS]; 305 305 unsigned vm_pte_num_rqs; 306 + struct amdgpu_ring *page_fault; 306 307 307 308 /* partial resident texture handling */ 308 309 spinlock_t prt_lock;
+4 -4
drivers/gpu/drm/amd/amdgpu/cik_sdma.c
··· 977 977 r = amdgpu_ring_init(adev, ring, 1024, 978 978 &adev->sdma.trap_irq, 979 979 (i == 0) ? 980 - AMDGPU_SDMA_IRQ_TRAP0 : 981 - AMDGPU_SDMA_IRQ_TRAP1); 980 + AMDGPU_SDMA_IRQ_INSTANCE0 : 981 + AMDGPU_SDMA_IRQ_INSTANCE1); 982 982 if (r) 983 983 return r; 984 984 } ··· 1114 1114 u32 sdma_cntl; 1115 1115 1116 1116 switch (type) { 1117 - case AMDGPU_SDMA_IRQ_TRAP0: 1117 + case AMDGPU_SDMA_IRQ_INSTANCE0: 1118 1118 switch (state) { 1119 1119 case AMDGPU_IRQ_STATE_DISABLE: 1120 1120 sdma_cntl = RREG32(mmSDMA0_CNTL + SDMA0_REGISTER_OFFSET); ··· 1130 1130 break; 1131 1131 } 1132 1132 break; 1133 - case AMDGPU_SDMA_IRQ_TRAP1: 1133 + case AMDGPU_SDMA_IRQ_INSTANCE1: 1134 1134 switch (state) { 1135 1135 case AMDGPU_IRQ_STATE_DISABLE: 1136 1136 sdma_cntl = RREG32(mmSDMA0_CNTL + SDMA1_REGISTER_OFFSET);
+9 -3
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
··· 3568 3568 int r; 3569 3569 3570 3570 if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) { 3571 - amdgpu_ras_feature_enable(adev, &ras_block, 0); 3571 + amdgpu_ras_feature_enable_on_boot(adev, &ras_block, 0); 3572 3572 return 0; 3573 3573 } 3574 3574 ··· 3581 3581 3582 3582 **ras_if = ras_block; 3583 3583 3584 - r = amdgpu_ras_feature_enable(adev, *ras_if, 1); 3584 + r = amdgpu_ras_feature_enable_on_boot(adev, *ras_if, 1); 3585 3585 if (r) 3586 3586 goto feature; 3587 3587 ··· 4840 4840 struct amdgpu_irq_src *source, 4841 4841 struct amdgpu_iv_entry *entry) 4842 4842 { 4843 + struct ras_common_if *ras_if = adev->gfx.ras_if; 4843 4844 struct ras_dispatch_if ih_data = { 4844 - .head = *adev->gfx.ras_if, 4845 4845 .entry = entry, 4846 4846 }; 4847 + 4848 + if (!ras_if) 4849 + return 0; 4850 + 4851 + ih_data.head = *ras_if; 4852 + 4847 4853 DRM_ERROR("CP ECC ERROR IRQ\n"); 4848 4854 amdgpu_ras_interrupt_dispatch(adev, &ih_data); 4849 4855 return 0;
+9 -3
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 248 248 struct amdgpu_irq_src *source, 249 249 struct amdgpu_iv_entry *entry) 250 250 { 251 + struct ras_common_if *ras_if = adev->gmc.ras_if; 251 252 struct ras_dispatch_if ih_data = { 252 - .head = *adev->gmc.ras_if, 253 253 .entry = entry, 254 254 }; 255 + 256 + if (!ras_if) 257 + return 0; 258 + 259 + ih_data.head = *ras_if; 260 + 255 261 amdgpu_ras_interrupt_dispatch(adev, &ih_data); 256 262 return 0; 257 263 } ··· 682 676 int r; 683 677 684 678 if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC)) { 685 - amdgpu_ras_feature_enable(adev, &ras_block, 0); 679 + amdgpu_ras_feature_enable_on_boot(adev, &ras_block, 0); 686 680 return 0; 687 681 } 688 682 /* handle resume path. */ ··· 695 689 696 690 **ras_if = ras_block; 697 691 698 - r = amdgpu_ras_feature_enable(adev, *ras_if, 1); 692 + r = amdgpu_ras_feature_enable_on_boot(adev, *ras_if, 1); 699 693 if (r) 700 694 goto feature; 701 695
+78
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
··· 157 157 xgpu_ai_mailbox_set_valid(adev, false); 158 158 } 159 159 160 + static int xgpu_ai_get_pp_clk(struct amdgpu_device *adev, u32 type, char *buf) 161 + { 162 + int r = 0; 163 + u32 req, val, size; 164 + 165 + if (!amdgim_is_hwperf(adev) || buf == NULL) 166 + return -EBADRQC; 167 + 168 + switch(type) { 169 + case PP_SCLK: 170 + req = IDH_IRQ_GET_PP_SCLK; 171 + break; 172 + case PP_MCLK: 173 + req = IDH_IRQ_GET_PP_MCLK; 174 + break; 175 + default: 176 + return -EBADRQC; 177 + } 178 + 179 + mutex_lock(&adev->virt.dpm_mutex); 180 + 181 + xgpu_ai_mailbox_trans_msg(adev, req, 0, 0, 0); 182 + 183 + r = xgpu_ai_poll_msg(adev, IDH_SUCCESS); 184 + if (!r && adev->fw_vram_usage.va != NULL) { 185 + val = RREG32_NO_KIQ( 186 + SOC15_REG_OFFSET(NBIO, 0, 187 + mmBIF_BX_PF0_MAILBOX_MSGBUF_RCV_DW1)); 188 + size = strnlen((((char *)adev->virt.fw_reserve.p_pf2vf) + 189 + val), PAGE_SIZE); 190 + 191 + if (size < PAGE_SIZE) 192 + strcpy(buf,((char *)adev->virt.fw_reserve.p_pf2vf + val)); 193 + else 194 + size = 0; 195 + 196 + r = size; 197 + goto out; 198 + } 199 + 200 + r = xgpu_ai_poll_msg(adev, IDH_FAIL); 201 + if(r) 202 + pr_info("%s DPM request failed", 203 + (type == PP_SCLK)? "SCLK" : "MCLK"); 204 + 205 + out: 206 + mutex_unlock(&adev->virt.dpm_mutex); 207 + return r; 208 + } 209 + 210 + static int xgpu_ai_force_dpm_level(struct amdgpu_device *adev, u32 level) 211 + { 212 + int r = 0; 213 + u32 req = IDH_IRQ_FORCE_DPM_LEVEL; 214 + 215 + if (!amdgim_is_hwperf(adev)) 216 + return -EBADRQC; 217 + 218 + mutex_lock(&adev->virt.dpm_mutex); 219 + xgpu_ai_mailbox_trans_msg(adev, req, level, 0, 0); 220 + 221 + r = xgpu_ai_poll_msg(adev, IDH_SUCCESS); 222 + if (!r) 223 + goto out; 224 + 225 + r = xgpu_ai_poll_msg(adev, IDH_FAIL); 226 + if (!r) 227 + pr_info("DPM request failed"); 228 + else 229 + pr_info("Mailbox is broken"); 230 + 231 + out: 232 + mutex_unlock(&adev->virt.dpm_mutex); 233 + return r; 234 + } 235 + 160 236 static int xgpu_ai_send_access_requests(struct amdgpu_device *adev, 161 237 enum idh_request req) 162 238 { ··· 451 375 .reset_gpu = xgpu_ai_request_reset, 452 376 .wait_reset = NULL, 453 377 .trans_msg = xgpu_ai_mailbox_trans_msg, 378 + .get_pp_clk = xgpu_ai_get_pp_clk, 379 + .force_dpm_level = xgpu_ai_force_dpm_level, 454 380 };
+6
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h
··· 35 35 IDH_REL_GPU_FINI_ACCESS, 36 36 IDH_REQ_GPU_RESET_ACCESS, 37 37 38 + IDH_IRQ_FORCE_DPM_LEVEL = 10, 39 + IDH_IRQ_GET_PP_SCLK, 40 + IDH_IRQ_GET_PP_MCLK, 41 + 38 42 IDH_LOG_VF_ERROR = 200, 39 43 }; 40 44 ··· 47 43 IDH_READY_TO_ACCESS_GPU, 48 44 IDH_FLR_NOTIFICATION, 49 45 IDH_FLR_NOTIFICATION_CMPL, 46 + IDH_SUCCESS, 47 + IDH_FAIL, 50 48 IDH_EVENT_MAX 51 49 }; 52 50
+1 -1
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
··· 674 674 for (i = 0; i < topology_info_input->num_nodes; i++) { 675 675 topology_info_input->nodes[i].node_id = topology->nodes[i].node_id; 676 676 topology_info_input->nodes[i].num_hops = topology->nodes[i].num_hops; 677 - topology_info_input->nodes[i].is_sharing_enabled = topology->nodes[i].is_sharing_enabled; 677 + topology_info_input->nodes[i].is_sharing_enabled = 1; 678 678 topology_info_input->nodes[i].sdma_engine = topology->nodes[i].sdma_engine; 679 679 } 680 680
+4 -4
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
··· 870 870 r = amdgpu_ring_init(adev, ring, 1024, 871 871 &adev->sdma.trap_irq, 872 872 (i == 0) ? 873 - AMDGPU_SDMA_IRQ_TRAP0 : 874 - AMDGPU_SDMA_IRQ_TRAP1); 873 + AMDGPU_SDMA_IRQ_INSTANCE0 : 874 + AMDGPU_SDMA_IRQ_INSTANCE1); 875 875 if (r) 876 876 return r; 877 877 } ··· 1006 1006 u32 sdma_cntl; 1007 1007 1008 1008 switch (type) { 1009 - case AMDGPU_SDMA_IRQ_TRAP0: 1009 + case AMDGPU_SDMA_IRQ_INSTANCE0: 1010 1010 switch (state) { 1011 1011 case AMDGPU_IRQ_STATE_DISABLE: 1012 1012 sdma_cntl = RREG32(mmSDMA0_CNTL + SDMA0_REGISTER_OFFSET); ··· 1022 1022 break; 1023 1023 } 1024 1024 break; 1025 - case AMDGPU_SDMA_IRQ_TRAP1: 1025 + case AMDGPU_SDMA_IRQ_INSTANCE1: 1026 1026 switch (state) { 1027 1027 case AMDGPU_IRQ_STATE_DISABLE: 1028 1028 sdma_cntl = RREG32(mmSDMA0_CNTL + SDMA1_REGISTER_OFFSET);
+4 -4
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
··· 1154 1154 r = amdgpu_ring_init(adev, ring, 1024, 1155 1155 &adev->sdma.trap_irq, 1156 1156 (i == 0) ? 1157 - AMDGPU_SDMA_IRQ_TRAP0 : 1158 - AMDGPU_SDMA_IRQ_TRAP1); 1157 + AMDGPU_SDMA_IRQ_INSTANCE0 : 1158 + AMDGPU_SDMA_IRQ_INSTANCE1); 1159 1159 if (r) 1160 1160 return r; 1161 1161 } ··· 1340 1340 u32 sdma_cntl; 1341 1341 1342 1342 switch (type) { 1343 - case AMDGPU_SDMA_IRQ_TRAP0: 1343 + case AMDGPU_SDMA_IRQ_INSTANCE0: 1344 1344 switch (state) { 1345 1345 case AMDGPU_IRQ_STATE_DISABLE: 1346 1346 sdma_cntl = RREG32(mmSDMA0_CNTL + SDMA0_REGISTER_OFFSET); ··· 1356 1356 break; 1357 1357 } 1358 1358 break; 1359 - case AMDGPU_SDMA_IRQ_TRAP1: 1359 + case AMDGPU_SDMA_IRQ_INSTANCE1: 1360 1360 switch (state) { 1361 1361 case AMDGPU_IRQ_STATE_DISABLE: 1362 1362 sdma_cntl = RREG32(mmSDMA0_CNTL + SDMA1_REGISTER_OFFSET);
+22 -16
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
··· 1518 1518 int r; 1519 1519 1520 1520 if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__SDMA)) { 1521 - amdgpu_ras_feature_enable(adev, &ras_block, 0); 1521 + amdgpu_ras_feature_enable_on_boot(adev, &ras_block, 0); 1522 1522 return 0; 1523 1523 } 1524 1524 ··· 1532 1532 1533 1533 **ras_if = ras_block; 1534 1534 1535 - r = amdgpu_ras_feature_enable(adev, *ras_if, 1); 1535 + r = amdgpu_ras_feature_enable_on_boot(adev, *ras_if, 1); 1536 1536 if (r) 1537 1537 goto feature; 1538 1538 ··· 1551 1551 if (r) 1552 1552 goto sysfs; 1553 1553 resume: 1554 - r = amdgpu_irq_get(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_ECC0); 1554 + r = amdgpu_irq_get(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_INSTANCE0); 1555 1555 if (r) 1556 1556 goto irq; 1557 1557 1558 - r = amdgpu_irq_get(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_ECC1); 1558 + r = amdgpu_irq_get(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_INSTANCE1); 1559 1559 if (r) { 1560 - amdgpu_irq_put(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_ECC0); 1560 + amdgpu_irq_put(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_INSTANCE0); 1561 1561 goto irq; 1562 1562 } 1563 1563 ··· 1621 1621 r = amdgpu_ring_init(adev, ring, 1024, 1622 1622 &adev->sdma.trap_irq, 1623 1623 (i == 0) ? 1624 - AMDGPU_SDMA_IRQ_TRAP0 : 1625 - AMDGPU_SDMA_IRQ_TRAP1); 1624 + AMDGPU_SDMA_IRQ_INSTANCE0 : 1625 + AMDGPU_SDMA_IRQ_INSTANCE1); 1626 1626 if (r) 1627 1627 return r; 1628 1628 ··· 1641 1641 r = amdgpu_ring_init(adev, ring, 1024, 1642 1642 &adev->sdma.trap_irq, 1643 1643 (i == 0) ? 1644 - AMDGPU_SDMA_IRQ_TRAP0 : 1645 - AMDGPU_SDMA_IRQ_TRAP1); 1644 + AMDGPU_SDMA_IRQ_INSTANCE0 : 1645 + AMDGPU_SDMA_IRQ_INSTANCE1); 1646 1646 if (r) 1647 1647 return r; 1648 1648 } ··· 1709 1709 if (amdgpu_sriov_vf(adev)) 1710 1710 return 0; 1711 1711 1712 - amdgpu_irq_put(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_ECC0); 1713 - amdgpu_irq_put(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_ECC1); 1712 + amdgpu_irq_put(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_INSTANCE0); 1713 + amdgpu_irq_put(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_INSTANCE1); 1714 1714 1715 1715 sdma_v4_0_ctx_switch_enable(adev, false); 1716 1716 sdma_v4_0_enable(adev, false); ··· 1780 1780 unsigned type, 1781 1781 enum amdgpu_interrupt_state state) 1782 1782 { 1783 - unsigned int instance = (type == AMDGPU_SDMA_IRQ_TRAP0) ? 0 : 1; 1784 1783 u32 sdma_cntl; 1785 1784 1786 - sdma_cntl = RREG32_SDMA(instance, mmSDMA0_CNTL); 1785 + sdma_cntl = RREG32_SDMA(type, mmSDMA0_CNTL); 1787 1786 sdma_cntl = REG_SET_FIELD(sdma_cntl, SDMA0_CNTL, TRAP_ENABLE, 1788 1787 state == AMDGPU_IRQ_STATE_ENABLE ? 1 : 0); 1789 - WREG32_SDMA(instance, mmSDMA0_CNTL, sdma_cntl); 1788 + WREG32_SDMA(type, mmSDMA0_CNTL, sdma_cntl); 1790 1789 1791 1790 return 0; 1792 1791 } ··· 1865 1866 struct amdgpu_irq_src *source, 1866 1867 struct amdgpu_iv_entry *entry) 1867 1868 { 1869 + struct ras_common_if *ras_if = adev->sdma.ras_if; 1868 1870 struct ras_dispatch_if ih_data = { 1869 - .head = *adev->sdma.ras_if, 1870 1871 .entry = entry, 1871 1872 }; 1873 + 1874 + if (!ras_if) 1875 + return 0; 1876 + 1877 + ih_data.head = *ras_if; 1878 + 1872 1879 amdgpu_ras_interrupt_dispatch(adev, &ih_data); 1873 1880 return 0; 1874 1881 } ··· 1913 1908 { 1914 1909 u32 sdma_edc_config; 1915 1910 1916 - u32 reg_offset = (type == AMDGPU_SDMA_IRQ_ECC0) ? 1911 + u32 reg_offset = (type == AMDGPU_SDMA_IRQ_INSTANCE0) ? 1917 1912 sdma_v4_0_get_reg_offset(adev, 0, mmSDMA0_EDC_CONFIG) : 1918 1913 sdma_v4_0_get_reg_offset(adev, 1, mmSDMA0_EDC_CONFIG); 1919 1914 ··· 2297 2292 &sched->sched_rq[DRM_SCHED_PRIORITY_KERNEL]; 2298 2293 } 2299 2294 adev->vm_manager.vm_pte_num_rqs = adev->sdma.num_instances - 1; 2295 + adev->vm_manager.page_fault = &adev->sdma.instance[0].page; 2300 2296 } else { 2301 2297 for (i = 0; i < adev->sdma.num_instances; i++) { 2302 2298 sched = &adev->sdma.instance[i].ring.sched;
+4 -4
drivers/gpu/drm/amd/amdgpu/si_dma.c
··· 503 503 r = amdgpu_ring_init(adev, ring, 1024, 504 504 &adev->sdma.trap_irq, 505 505 (i == 0) ? 506 - AMDGPU_SDMA_IRQ_TRAP0 : 507 - AMDGPU_SDMA_IRQ_TRAP1); 506 + AMDGPU_SDMA_IRQ_INSTANCE0 : 507 + AMDGPU_SDMA_IRQ_INSTANCE1); 508 508 if (r) 509 509 return r; 510 510 } ··· 591 591 u32 sdma_cntl; 592 592 593 593 switch (type) { 594 - case AMDGPU_SDMA_IRQ_TRAP0: 594 + case AMDGPU_SDMA_IRQ_INSTANCE0: 595 595 switch (state) { 596 596 case AMDGPU_IRQ_STATE_DISABLE: 597 597 sdma_cntl = RREG32(DMA_CNTL + DMA0_REGISTER_OFFSET); ··· 607 607 break; 608 608 } 609 609 break; 610 - case AMDGPU_SDMA_IRQ_TRAP1: 610 + case AMDGPU_SDMA_IRQ_INSTANCE1: 611 611 switch (state) { 612 612 case AMDGPU_IRQ_STATE_DISABLE: 613 613 sdma_cntl = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET);
+377 -80
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 111 111 112 112 static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, 113 113 struct drm_plane *plane, 114 - unsigned long possible_crtcs); 114 + unsigned long possible_crtcs, 115 + const struct dc_plane_cap *plane_cap); 115 116 static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, 116 117 struct drm_plane *plane, 117 118 uint32_t link_index); ··· 252 251 return NULL; 253 252 } 254 253 254 + static inline bool amdgpu_dm_vrr_active(struct dm_crtc_state *dm_state) 255 + { 256 + return dm_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE || 257 + dm_state->freesync_config.state == VRR_STATE_ACTIVE_FIXED; 258 + } 259 + 255 260 static void dm_pflip_high_irq(void *interrupt_params) 256 261 { 257 262 struct amdgpu_crtc *amdgpu_crtc; 258 263 struct common_irq_params *irq_params = interrupt_params; 259 264 struct amdgpu_device *adev = irq_params->adev; 260 265 unsigned long flags; 266 + struct drm_pending_vblank_event *e; 267 + struct dm_crtc_state *acrtc_state; 268 + uint32_t vpos, hpos, v_blank_start, v_blank_end; 269 + bool vrr_active; 261 270 262 271 amdgpu_crtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_PFLIP); 263 272 ··· 290 279 return; 291 280 } 292 281 293 - /* Update to correct count(s) if racing with vblank irq */ 294 - amdgpu_crtc->last_flip_vblank = drm_crtc_accurate_vblank_count(&amdgpu_crtc->base); 282 + /* page flip completed. */ 283 + e = amdgpu_crtc->event; 284 + amdgpu_crtc->event = NULL; 295 285 296 - /* wake up userspace */ 297 - if (amdgpu_crtc->event) { 298 - drm_crtc_send_vblank_event(&amdgpu_crtc->base, amdgpu_crtc->event); 299 - 300 - /* page flip completed. clean up */ 301 - amdgpu_crtc->event = NULL; 302 - 303 - } else 286 + if (!e) 304 287 WARN_ON(1); 288 + 289 + acrtc_state = to_dm_crtc_state(amdgpu_crtc->base.state); 290 + vrr_active = amdgpu_dm_vrr_active(acrtc_state); 291 + 292 + /* Fixed refresh rate, or VRR scanout position outside front-porch? */ 293 + if (!vrr_active || 294 + !dc_stream_get_scanoutpos(acrtc_state->stream, &v_blank_start, 295 + &v_blank_end, &hpos, &vpos) || 296 + (vpos < v_blank_start)) { 297 + /* Update to correct count and vblank timestamp if racing with 298 + * vblank irq. This also updates to the correct vblank timestamp 299 + * even in VRR mode, as scanout is past the front-porch atm. 300 + */ 301 + drm_crtc_accurate_vblank_count(&amdgpu_crtc->base); 302 + 303 + /* Wake up userspace by sending the pageflip event with proper 304 + * count and timestamp of vblank of flip completion. 305 + */ 306 + if (e) { 307 + drm_crtc_send_vblank_event(&amdgpu_crtc->base, e); 308 + 309 + /* Event sent, so done with vblank for this flip */ 310 + drm_crtc_vblank_put(&amdgpu_crtc->base); 311 + } 312 + } else if (e) { 313 + /* VRR active and inside front-porch: vblank count and 314 + * timestamp for pageflip event will only be up to date after 315 + * drm_crtc_handle_vblank() has been executed from late vblank 316 + * irq handler after start of back-porch (vline 0). We queue the 317 + * pageflip event for send-out by drm_crtc_handle_vblank() with 318 + * updated timestamp and count, once it runs after us. 319 + * 320 + * We need to open-code this instead of using the helper 321 + * drm_crtc_arm_vblank_event(), as that helper would 322 + * call drm_crtc_accurate_vblank_count(), which we must 323 + * not call in VRR mode while we are in front-porch! 324 + */ 325 + 326 + /* sequence will be replaced by real count during send-out. */ 327 + e->sequence = drm_crtc_vblank_count(&amdgpu_crtc->base); 328 + e->pipe = amdgpu_crtc->crtc_id; 329 + 330 + list_add_tail(&e->base.link, &adev->ddev->vblank_event_list); 331 + e = NULL; 332 + } 333 + 334 + /* Keep track of vblank of this flip for flip throttling. We use the 335 + * cooked hw counter, as that one incremented at start of this vblank 336 + * of pageflip completion, so last_flip_vblank is the forbidden count 337 + * for queueing new pageflips if vsync + VRR is enabled. 338 + */ 339 + amdgpu_crtc->last_flip_vblank = amdgpu_get_vblank_counter_kms(adev->ddev, 340 + amdgpu_crtc->crtc_id); 305 341 306 342 amdgpu_crtc->pflip_status = AMDGPU_FLIP_NONE; 307 343 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 308 344 309 - DRM_DEBUG_DRIVER("%s - crtc :%d[%p], pflip_stat:AMDGPU_FLIP_NONE\n", 310 - __func__, amdgpu_crtc->crtc_id, amdgpu_crtc); 345 + DRM_DEBUG_DRIVER("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_NONE, vrr[%d]-fp %d\n", 346 + amdgpu_crtc->crtc_id, amdgpu_crtc, 347 + vrr_active, (int) !e); 348 + } 311 349 312 - drm_crtc_vblank_put(&amdgpu_crtc->base); 350 + static void dm_vupdate_high_irq(void *interrupt_params) 351 + { 352 + struct common_irq_params *irq_params = interrupt_params; 353 + struct amdgpu_device *adev = irq_params->adev; 354 + struct amdgpu_crtc *acrtc; 355 + struct dm_crtc_state *acrtc_state; 356 + 357 + acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VUPDATE); 358 + 359 + if (acrtc) { 360 + acrtc_state = to_dm_crtc_state(acrtc->base.state); 361 + 362 + DRM_DEBUG_DRIVER("crtc:%d, vupdate-vrr:%d\n", acrtc->crtc_id, 363 + amdgpu_dm_vrr_active(acrtc_state)); 364 + 365 + /* Core vblank handling is done here after end of front-porch in 366 + * vrr mode, as vblank timestamping will give valid results 367 + * while now done after front-porch. This will also deliver 368 + * page-flip completion events that have been queued to us 369 + * if a pageflip happened inside front-porch. 370 + */ 371 + if (amdgpu_dm_vrr_active(acrtc_state)) 372 + drm_crtc_handle_vblank(&acrtc->base); 373 + } 313 374 } 314 375 315 376 static void dm_crtc_high_irq(void *interrupt_params) ··· 394 311 acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VBLANK); 395 312 396 313 if (acrtc) { 397 - drm_crtc_handle_vblank(&acrtc->base); 398 - amdgpu_dm_crtc_handle_crc_irq(&acrtc->base); 399 - 400 314 acrtc_state = to_dm_crtc_state(acrtc->base.state); 315 + 316 + DRM_DEBUG_DRIVER("crtc:%d, vupdate-vrr:%d\n", acrtc->crtc_id, 317 + amdgpu_dm_vrr_active(acrtc_state)); 318 + 319 + /* Core vblank handling at start of front-porch is only possible 320 + * in non-vrr mode, as only there vblank timestamping will give 321 + * valid results while done in front-porch. Otherwise defer it 322 + * to dm_vupdate_high_irq after end of front-porch. 323 + */ 324 + if (!amdgpu_dm_vrr_active(acrtc_state)) 325 + drm_crtc_handle_vblank(&acrtc->base); 326 + 327 + /* Following stuff must happen at start of vblank, for crc 328 + * computation and below-the-range btr support in vrr mode. 329 + */ 330 + amdgpu_dm_crtc_handle_crc_irq(&acrtc->base); 401 331 402 332 if (acrtc_state->stream && 403 333 acrtc_state->vrr_params.supported && ··· 984 888 struct drm_plane *plane; 985 889 struct drm_plane_state *new_plane_state; 986 890 struct dm_plane_state *dm_new_plane_state; 891 + struct dm_atomic_state *dm_state = to_dm_atomic_state(dm->atomic_obj.state); 987 892 enum dc_connection_type new_connection_type = dc_connection_none; 988 893 int i; 894 + 895 + /* Recreate dc_state - DC invalidates it when setting power state to S3. */ 896 + dc_release_state(dm_state->context); 897 + dm_state->context = dc_create_state(dm->dc); 898 + /* TODO: Remove dc_state->dccg, use dc->dccg directly. */ 899 + dc_resource_state_construct(dm->dc, dm_state->context); 989 900 990 901 /* power on hardware */ 991 902 dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0); ··· 1536 1433 dm_crtc_high_irq, c_irq_params); 1537 1434 } 1538 1435 1436 + /* Use VUPDATE interrupt */ 1437 + for (i = VISLANDS30_IV_SRCID_D1_V_UPDATE_INT; i <= VISLANDS30_IV_SRCID_D6_V_UPDATE_INT; i += 2) { 1438 + r = amdgpu_irq_add_id(adev, client_id, i, &adev->vupdate_irq); 1439 + if (r) { 1440 + DRM_ERROR("Failed to add vupdate irq id!\n"); 1441 + return r; 1442 + } 1443 + 1444 + int_params.int_context = INTERRUPT_HIGH_IRQ_CONTEXT; 1445 + int_params.irq_source = 1446 + dc_interrupt_to_irq_source(dc, i, 0); 1447 + 1448 + c_irq_params = &adev->dm.vupdate_params[int_params.irq_source - DC_IRQ_SOURCE_VUPDATE1]; 1449 + 1450 + c_irq_params->adev = adev; 1451 + c_irq_params->irq_src = int_params.irq_source; 1452 + 1453 + amdgpu_dm_irq_register_interrupt(adev, &int_params, 1454 + dm_vupdate_high_irq, c_irq_params); 1455 + } 1456 + 1539 1457 /* Use GRPH_PFLIP interrupt */ 1540 1458 for (i = VISLANDS30_IV_SRCID_D1_GRPH_PFLIP; 1541 1459 i <= VISLANDS30_IV_SRCID_D6_GRPH_PFLIP; i += 2) { ··· 1640 1516 1641 1517 amdgpu_dm_irq_register_interrupt(adev, &int_params, 1642 1518 dm_crtc_high_irq, c_irq_params); 1519 + } 1520 + 1521 + /* Use VUPDATE_NO_LOCK interrupt on DCN, which seems to correspond to 1522 + * the regular VUPDATE interrupt on DCE. We want DC_IRQ_SOURCE_VUPDATEx 1523 + * to trigger at end of each vblank, regardless of state of the lock, 1524 + * matching DCE behaviour. 1525 + */ 1526 + for (i = DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT; 1527 + i <= DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT + adev->mode_info.num_crtc - 1; 1528 + i++) { 1529 + r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_DCE, i, &adev->vupdate_irq); 1530 + 1531 + if (r) { 1532 + DRM_ERROR("Failed to add vupdate irq id!\n"); 1533 + return r; 1534 + } 1535 + 1536 + int_params.int_context = INTERRUPT_HIGH_IRQ_CONTEXT; 1537 + int_params.irq_source = 1538 + dc_interrupt_to_irq_source(dc, i, 0); 1539 + 1540 + c_irq_params = &adev->dm.vupdate_params[int_params.irq_source - DC_IRQ_SOURCE_VUPDATE1]; 1541 + 1542 + c_irq_params->adev = adev; 1543 + c_irq_params->irq_src = int_params.irq_source; 1544 + 1545 + amdgpu_dm_irq_register_interrupt(adev, &int_params, 1546 + dm_vupdate_high_irq, c_irq_params); 1643 1547 } 1644 1548 1645 1549 /* Use GRPH_PFLIP interrupt */ ··· 1781 1629 1782 1630 __drm_atomic_helper_private_obj_duplicate_state(obj, &new_state->base); 1783 1631 1784 - new_state->context = dc_create_state(); 1632 + old_state = to_dm_atomic_state(obj->state); 1633 + 1634 + if (old_state && old_state->context) 1635 + new_state->context = dc_copy_state(old_state->context); 1636 + 1785 1637 if (!new_state->context) { 1786 1638 kfree(new_state); 1787 1639 return NULL; 1788 1640 } 1789 - 1790 - old_state = to_dm_atomic_state(obj->state); 1791 - if (old_state && old_state->context) 1792 - dc_resource_state_copy_construct(old_state->context, 1793 - new_state->context); 1794 1641 1795 1642 return &new_state->base; 1796 1643 } ··· 1834 1683 if (!state) 1835 1684 return -ENOMEM; 1836 1685 1837 - state->context = dc_create_state(); 1686 + state->context = dc_create_state(adev->dm.dc); 1838 1687 if (!state->context) { 1839 1688 kfree(state); 1840 1689 return -ENOMEM; ··· 1962 1811 1963 1812 static int initialize_plane(struct amdgpu_display_manager *dm, 1964 1813 struct amdgpu_mode_info *mode_info, int plane_id, 1965 - enum drm_plane_type plane_type) 1814 + enum drm_plane_type plane_type, 1815 + const struct dc_plane_cap *plane_cap) 1966 1816 { 1967 1817 struct drm_plane *plane; 1968 1818 unsigned long possible_crtcs; ··· 1986 1834 if (plane_id >= dm->dc->caps.max_streams) 1987 1835 possible_crtcs = 0xff; 1988 1836 1989 - ret = amdgpu_dm_plane_init(dm, plane, possible_crtcs); 1837 + ret = amdgpu_dm_plane_init(dm, plane, possible_crtcs, plane_cap); 1990 1838 1991 1839 if (ret) { 1992 1840 DRM_ERROR("KMS: Failed to initialize plane\n"); ··· 2039 1887 struct amdgpu_encoder *aencoder = NULL; 2040 1888 struct amdgpu_mode_info *mode_info = &adev->mode_info; 2041 1889 uint32_t link_cnt; 2042 - int32_t overlay_planes, primary_planes; 1890 + int32_t primary_planes; 2043 1891 enum dc_connection_type new_connection_type = dc_connection_none; 1892 + const struct dc_plane_cap *plane; 2044 1893 2045 1894 link_cnt = dm->dc->caps.max_links; 2046 1895 if (amdgpu_dm_mode_config_init(dm->adev)) { 2047 1896 DRM_ERROR("DM: Failed to initialize mode config\n"); 2048 1897 return -EINVAL; 2049 1898 } 2050 - 2051 - /* 2052 - * Determine the number of overlay planes supported. 2053 - * Only support DCN for now, and cap so we don't encourage 2054 - * userspace to use up all the planes. 2055 - */ 2056 - overlay_planes = 0; 2057 - 2058 - for (i = 0; i < dm->dc->caps.max_planes; ++i) { 2059 - struct dc_plane_cap *plane = &dm->dc->caps.planes[i]; 2060 - 2061 - if (plane->type == DC_PLANE_TYPE_DCN_UNIVERSAL && 2062 - plane->blends_with_above && plane->blends_with_below && 2063 - plane->supports_argb8888) 2064 - overlay_planes += 1; 2065 - } 2066 - 2067 - overlay_planes = min(overlay_planes, 1); 2068 1899 2069 1900 /* There is one primary plane per CRTC */ 2070 1901 primary_planes = dm->dc->caps.max_streams; ··· 2058 1923 * Order is reversed to match iteration order in atomic check. 2059 1924 */ 2060 1925 for (i = (primary_planes - 1); i >= 0; i--) { 1926 + plane = &dm->dc->caps.planes[i]; 1927 + 2061 1928 if (initialize_plane(dm, mode_info, i, 2062 - DRM_PLANE_TYPE_PRIMARY)) { 1929 + DRM_PLANE_TYPE_PRIMARY, plane)) { 2063 1930 DRM_ERROR("KMS: Failed to initialize primary plane\n"); 2064 1931 goto fail; 2065 1932 } ··· 2072 1935 * These planes have a higher DRM index than the primary planes since 2073 1936 * they should be considered as having a higher z-order. 2074 1937 * Order is reversed to match iteration order in atomic check. 1938 + * 1939 + * Only support DCN for now, and only expose one so we don't encourage 1940 + * userspace to use up all the pipes. 2075 1941 */ 2076 - for (i = (overlay_planes - 1); i >= 0; i--) { 1942 + for (i = 0; i < dm->dc->caps.max_planes; ++i) { 1943 + struct dc_plane_cap *plane = &dm->dc->caps.planes[i]; 1944 + 1945 + if (plane->type != DC_PLANE_TYPE_DCN_UNIVERSAL) 1946 + continue; 1947 + 1948 + if (!plane->blends_with_above || !plane->blends_with_below) 1949 + continue; 1950 + 1951 + if (!plane->supports_argb8888) 1952 + continue; 1953 + 2077 1954 if (initialize_plane(dm, NULL, primary_planes + i, 2078 - DRM_PLANE_TYPE_OVERLAY)) { 1955 + DRM_PLANE_TYPE_OVERLAY, plane)) { 2079 1956 DRM_ERROR("KMS: Failed to initialize overlay plane\n"); 2080 1957 goto fail; 2081 1958 } 1959 + 1960 + /* Only create one overlay plane. */ 1961 + break; 2082 1962 } 2083 1963 2084 1964 for (i = 0; i < dm->dc->caps.max_streams; i++) ··· 2755 2601 } 2756 2602 } 2757 2603 2604 + static int 2605 + fill_plane_color_attributes(const struct drm_plane_state *plane_state, 2606 + const struct dc_plane_state *dc_plane_state, 2607 + enum dc_color_space *color_space) 2608 + { 2609 + bool full_range; 2610 + 2611 + *color_space = COLOR_SPACE_SRGB; 2612 + 2613 + /* DRM color properties only affect non-RGB formats. */ 2614 + if (dc_plane_state->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) 2615 + return 0; 2616 + 2617 + full_range = (plane_state->color_range == DRM_COLOR_YCBCR_FULL_RANGE); 2618 + 2619 + switch (plane_state->color_encoding) { 2620 + case DRM_COLOR_YCBCR_BT601: 2621 + if (full_range) 2622 + *color_space = COLOR_SPACE_YCBCR601; 2623 + else 2624 + *color_space = COLOR_SPACE_YCBCR601_LIMITED; 2625 + break; 2626 + 2627 + case DRM_COLOR_YCBCR_BT709: 2628 + if (full_range) 2629 + *color_space = COLOR_SPACE_YCBCR709; 2630 + else 2631 + *color_space = COLOR_SPACE_YCBCR709_LIMITED; 2632 + break; 2633 + 2634 + case DRM_COLOR_YCBCR_BT2020: 2635 + if (full_range) 2636 + *color_space = COLOR_SPACE_2020_YCBCR; 2637 + else 2638 + return -EINVAL; 2639 + break; 2640 + 2641 + default: 2642 + return -EINVAL; 2643 + } 2644 + 2645 + return 0; 2646 + } 2647 + 2758 2648 static int fill_plane_attributes(struct amdgpu_device *adev, 2759 2649 struct dc_plane_state *dc_plane_state, 2760 2650 struct drm_plane_state *plane_state, ··· 2817 2619 dc_plane_state, 2818 2620 amdgpu_fb); 2819 2621 2622 + if (ret) 2623 + return ret; 2624 + 2625 + ret = fill_plane_color_attributes(plane_state, dc_plane_state, 2626 + &dc_plane_state->color_space); 2820 2627 if (ret) 2821 2628 return ret; 2822 2629 ··· 3413 3210 return &state->base; 3414 3211 } 3415 3212 3213 + static inline int dm_set_vupdate_irq(struct drm_crtc *crtc, bool enable) 3214 + { 3215 + enum dc_irq_source irq_source; 3216 + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); 3217 + struct amdgpu_device *adev = crtc->dev->dev_private; 3218 + int rc; 3219 + 3220 + irq_source = IRQ_TYPE_VUPDATE + acrtc->otg_inst; 3221 + 3222 + rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY; 3223 + 3224 + DRM_DEBUG_DRIVER("crtc %d - vupdate irq %sabling: r=%d\n", 3225 + acrtc->crtc_id, enable ? "en" : "dis", rc); 3226 + return rc; 3227 + } 3416 3228 3417 3229 static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable) 3418 3230 { 3419 3231 enum dc_irq_source irq_source; 3420 3232 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); 3421 3233 struct amdgpu_device *adev = crtc->dev->dev_private; 3234 + struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state); 3235 + int rc = 0; 3236 + 3237 + if (enable) { 3238 + /* vblank irq on -> Only need vupdate irq in vrr mode */ 3239 + if (amdgpu_dm_vrr_active(acrtc_state)) 3240 + rc = dm_set_vupdate_irq(crtc, true); 3241 + } else { 3242 + /* vblank irq off -> vupdate irq off */ 3243 + rc = dm_set_vupdate_irq(crtc, false); 3244 + } 3245 + 3246 + if (rc) 3247 + return rc; 3422 3248 3423 3249 irq_source = IRQ_TYPE_VBLANK + acrtc->otg_inst; 3424 3250 return dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY; ··· 4123 3891 4124 3892 static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, 4125 3893 struct drm_plane *plane, 4126 - unsigned long possible_crtcs) 3894 + unsigned long possible_crtcs, 3895 + const struct dc_plane_cap *plane_cap) 4127 3896 { 4128 3897 int res = -EPERM; 4129 3898 ··· 4161 3928 break; 4162 3929 } 4163 3930 4164 - /* TODO: Check DC plane caps explicitly here for adding propertes */ 4165 - if (plane->type == DRM_PLANE_TYPE_OVERLAY) { 3931 + if (plane->type == DRM_PLANE_TYPE_OVERLAY && 3932 + plane_cap && plane_cap->per_pixel_alpha) { 4166 3933 unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | 4167 3934 BIT(DRM_MODE_BLEND_PREMULTI); 4168 3935 ··· 4194 3961 goto fail; 4195 3962 4196 3963 cursor_plane->type = DRM_PLANE_TYPE_CURSOR; 4197 - res = amdgpu_dm_plane_init(dm, cursor_plane, 0); 3964 + res = amdgpu_dm_plane_init(dm, cursor_plane, 0, NULL); 4198 3965 4199 3966 acrtc = kzalloc(sizeof(struct amdgpu_crtc), GFP_KERNEL); 4200 3967 if (!acrtc) ··· 4879 4646 { 4880 4647 struct mod_vrr_params vrr_params = new_crtc_state->vrr_params; 4881 4648 struct dc_info_packet vrr_infopacket = {0}; 4882 - struct mod_freesync_config config = new_crtc_state->freesync_config; 4883 4649 4884 4650 if (!new_stream) 4885 4651 return; ··· 4890 4658 4891 4659 if (!new_stream->timing.h_total || !new_stream->timing.v_total) 4892 4660 return; 4893 - 4894 - if (new_crtc_state->vrr_supported && 4895 - config.min_refresh_in_uhz && 4896 - config.max_refresh_in_uhz) { 4897 - config.state = new_crtc_state->base.vrr_enabled ? 4898 - VRR_STATE_ACTIVE_VARIABLE : 4899 - VRR_STATE_INACTIVE; 4900 - } else { 4901 - config.state = VRR_STATE_UNSUPPORTED; 4902 - } 4903 - 4904 - mod_freesync_build_vrr_params(dm->freesync_module, 4905 - new_stream, 4906 - &config, &vrr_params); 4907 4661 4908 4662 if (surface) { 4909 4663 mod_freesync_handle_preflip( ··· 4931 4713 (int)vrr_params.state); 4932 4714 } 4933 4715 4716 + static void pre_update_freesync_state_on_stream( 4717 + struct amdgpu_display_manager *dm, 4718 + struct dm_crtc_state *new_crtc_state) 4719 + { 4720 + struct dc_stream_state *new_stream = new_crtc_state->stream; 4721 + struct mod_vrr_params vrr_params = new_crtc_state->vrr_params; 4722 + struct mod_freesync_config config = new_crtc_state->freesync_config; 4723 + 4724 + if (!new_stream) 4725 + return; 4726 + 4727 + /* 4728 + * TODO: Determine why min/max totals and vrefresh can be 0 here. 4729 + * For now it's sufficient to just guard against these conditions. 4730 + */ 4731 + if (!new_stream->timing.h_total || !new_stream->timing.v_total) 4732 + return; 4733 + 4734 + if (new_crtc_state->vrr_supported && 4735 + config.min_refresh_in_uhz && 4736 + config.max_refresh_in_uhz) { 4737 + config.state = new_crtc_state->base.vrr_enabled ? 4738 + VRR_STATE_ACTIVE_VARIABLE : 4739 + VRR_STATE_INACTIVE; 4740 + } else { 4741 + config.state = VRR_STATE_UNSUPPORTED; 4742 + } 4743 + 4744 + mod_freesync_build_vrr_params(dm->freesync_module, 4745 + new_stream, 4746 + &config, &vrr_params); 4747 + 4748 + new_crtc_state->freesync_timing_changed |= 4749 + (memcmp(&new_crtc_state->vrr_params.adjust, 4750 + &vrr_params.adjust, 4751 + sizeof(vrr_params.adjust)) != 0); 4752 + 4753 + new_crtc_state->vrr_params = vrr_params; 4754 + } 4755 + 4756 + static void amdgpu_dm_handle_vrr_transition(struct dm_crtc_state *old_state, 4757 + struct dm_crtc_state *new_state) 4758 + { 4759 + bool old_vrr_active = amdgpu_dm_vrr_active(old_state); 4760 + bool new_vrr_active = amdgpu_dm_vrr_active(new_state); 4761 + 4762 + if (!old_vrr_active && new_vrr_active) { 4763 + /* Transition VRR inactive -> active: 4764 + * While VRR is active, we must not disable vblank irq, as a 4765 + * reenable after disable would compute bogus vblank/pflip 4766 + * timestamps if it likely happened inside display front-porch. 4767 + * 4768 + * We also need vupdate irq for the actual core vblank handling 4769 + * at end of vblank. 4770 + */ 4771 + dm_set_vupdate_irq(new_state->base.crtc, true); 4772 + drm_crtc_vblank_get(new_state->base.crtc); 4773 + DRM_DEBUG_DRIVER("%s: crtc=%u VRR off->on: Get vblank ref\n", 4774 + __func__, new_state->base.crtc->base.id); 4775 + } else if (old_vrr_active && !new_vrr_active) { 4776 + /* Transition VRR active -> inactive: 4777 + * Allow vblank irq disable again for fixed refresh rate. 4778 + */ 4779 + dm_set_vupdate_irq(new_state->base.crtc, false); 4780 + drm_crtc_vblank_put(new_state->base.crtc); 4781 + DRM_DEBUG_DRIVER("%s: crtc=%u VRR on->off: Drop vblank ref\n", 4782 + __func__, new_state->base.crtc->base.id); 4783 + } 4784 + } 4785 + 4934 4786 static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, 4935 4787 struct dc_state *dc_state, 4936 4788 struct drm_device *dev, ··· 5022 4734 unsigned long flags; 5023 4735 struct amdgpu_bo *abo; 5024 4736 uint64_t tiling_flags; 5025 - uint32_t target, target_vblank; 5026 - uint64_t last_flip_vblank; 5027 - bool vrr_active = acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE; 4737 + uint32_t target_vblank, last_flip_vblank; 4738 + bool vrr_active = amdgpu_dm_vrr_active(acrtc_state); 5028 4739 bool pflip_present = false; 5029 - 5030 4740 struct { 5031 4741 struct dc_surface_update surface_updates[MAX_SURFACES]; 5032 4742 struct dc_plane_info plane_infos[MAX_SURFACES]; ··· 5076 4790 bundle->scaling_infos[planes_count].clip_rect = dc_plane->clip_rect; 5077 4791 bundle->surface_updates[planes_count].scaling_info = &bundle->scaling_infos[planes_count]; 5078 4792 4793 + fill_plane_color_attributes( 4794 + new_plane_state, dc_plane, 4795 + &bundle->plane_infos[planes_count].color_space); 5079 4796 5080 - bundle->plane_infos[planes_count].color_space = dc_plane->color_space; 5081 4797 bundle->plane_infos[planes_count].format = dc_plane->format; 5082 4798 bundle->plane_infos[planes_count].plane_size = dc_plane->plane_size; 5083 4799 bundle->plane_infos[planes_count].rotation = dc_plane->rotation; ··· 5168 4880 * clients using the GLX_OML_sync_control extension or 5169 4881 * DRI3/Present extension with defined target_msc. 5170 4882 */ 5171 - last_flip_vblank = drm_crtc_vblank_count(pcrtc); 4883 + last_flip_vblank = amdgpu_get_vblank_counter_kms(dm->ddev, acrtc_attach->crtc_id); 5172 4884 } 5173 4885 else { 5174 4886 /* For variable refresh rate mode only: ··· 5184 4896 spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags); 5185 4897 } 5186 4898 5187 - target = (uint32_t)last_flip_vblank + wait_for_vblank; 5188 - 5189 - /* Prepare wait for target vblank early - before the fence-waits */ 5190 - target_vblank = target - (uint32_t)drm_crtc_vblank_count(pcrtc) + 5191 - amdgpu_get_vblank_counter_kms(pcrtc->dev, acrtc_attach->crtc_id); 4899 + target_vblank = last_flip_vblank + wait_for_vblank; 5192 4900 5193 4901 /* 5194 4902 * Wait until we're out of the vertical blank period before the one ··· 5349 5065 dc_state = dm_state->context; 5350 5066 } else { 5351 5067 /* No state changes, retain current state. */ 5352 - dc_state_temp = dc_create_state(); 5068 + dc_state_temp = dc_create_state(dm->dc); 5353 5069 ASSERT(dc_state_temp); 5354 5070 dc_state = dc_state_temp; 5355 5071 dc_resource_state_copy_construct_current(dm->dc, dc_state); ··· 5518 5234 mutex_unlock(&dm->dc_lock); 5519 5235 } 5520 5236 5237 + /* Update freesync state before amdgpu_dm_handle_vrr_transition(). */ 5238 + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { 5239 + dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); 5240 + pre_update_freesync_state_on_stream(dm, dm_new_crtc_state); 5241 + } 5242 + 5521 5243 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, 5522 5244 new_crtc_state, i) { 5523 5245 /* ··· 5537 5247 5538 5248 dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); 5539 5249 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); 5250 + 5251 + /* Handle vrr on->off / off->on transitions */ 5252 + amdgpu_dm_handle_vrr_transition(dm_old_crtc_state, 5253 + dm_new_crtc_state); 5254 + 5540 5255 modeset_needed = modeset_required( 5541 5256 new_crtc_state, 5542 5257 dm_new_crtc_state->stream, ··· 6186 5891 } 6187 5892 6188 5893 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { 6189 - struct dc_stream_update stream_update = { 0 }; 5894 + struct dc_stream_update stream_update; 5895 + 5896 + memset(&stream_update, 0, sizeof(stream_update)); 6190 5897 6191 5898 new_dm_crtc_state = to_dm_crtc_state(new_crtc_state); 6192 5899 old_dm_crtc_state = to_dm_crtc_state(old_crtc_state);
+9
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
··· 182 182 struct common_irq_params 183 183 vblank_params[DC_IRQ_SOURCE_VBLANK6 - DC_IRQ_SOURCE_VBLANK1 + 1]; 184 184 185 + /** 186 + * @vupdate_params: 187 + * 188 + * Vertical update IRQ parameters, passed to registered handlers when 189 + * triggered. 190 + */ 191 + struct common_irq_params 192 + vupdate_params[DC_IRQ_SOURCE_VUPDATE6 - DC_IRQ_SOURCE_VUPDATE1 + 1]; 193 + 185 194 spinlock_t irq_handler_list_table_lock; 186 195 187 196 struct backlight_device *backlight_dev;
+38 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
··· 995 995 {"amdgpu_target_backlight_pwm", &target_backlight_read}, 996 996 }; 997 997 998 + /* 999 + * Sets the DC visual confirm debug option from the given string. 1000 + * Example usage: echo 1 > /sys/kernel/debug/dri/0/amdgpu_visual_confirm 1001 + */ 1002 + static int visual_confirm_set(void *data, u64 val) 1003 + { 1004 + struct amdgpu_device *adev = data; 1005 + 1006 + adev->dm.dc->debug.visual_confirm = (enum visual_confirm)val; 1007 + 1008 + return 0; 1009 + } 1010 + 1011 + /* 1012 + * Reads the DC visual confirm debug option value into the given buffer. 1013 + * Example usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_visual_confirm 1014 + */ 1015 + static int visual_confirm_get(void *data, u64 *val) 1016 + { 1017 + struct amdgpu_device *adev = data; 1018 + 1019 + *val = adev->dm.dc->debug.visual_confirm; 1020 + 1021 + return 0; 1022 + } 1023 + 1024 + DEFINE_DEBUGFS_ATTRIBUTE(visual_confirm_fops, visual_confirm_get, 1025 + visual_confirm_set, "%llu\n"); 1026 + 998 1027 int dtn_debugfs_init(struct amdgpu_device *adev) 999 1028 { 1000 1029 static const struct file_operations dtn_log_fops = { ··· 1049 1020 adev, 1050 1021 &dtn_log_fops); 1051 1022 1052 - return PTR_ERR_OR_ZERO(ent); 1023 + if (IS_ERR(ent)) 1024 + return PTR_ERR(ent); 1025 + 1026 + ent = debugfs_create_file_unsafe("amdgpu_dm_visual_confirm", 0644, root, 1027 + adev, &visual_confirm_fops); 1028 + if (IS_ERR(ent)) 1029 + return PTR_ERR(ent); 1030 + 1031 + return 0; 1053 1032 }
+22
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
··· 674 674 __func__); 675 675 } 676 676 677 + static int amdgpu_dm_set_vupdate_irq_state(struct amdgpu_device *adev, 678 + struct amdgpu_irq_src *source, 679 + unsigned int crtc_id, 680 + enum amdgpu_interrupt_state state) 681 + { 682 + return dm_irq_state( 683 + adev, 684 + source, 685 + crtc_id, 686 + state, 687 + IRQ_TYPE_VUPDATE, 688 + __func__); 689 + } 690 + 677 691 static const struct amdgpu_irq_src_funcs dm_crtc_irq_funcs = { 678 692 .set = amdgpu_dm_set_crtc_irq_state, 693 + .process = amdgpu_dm_irq_handler, 694 + }; 695 + 696 + static const struct amdgpu_irq_src_funcs dm_vupdate_irq_funcs = { 697 + .set = amdgpu_dm_set_vupdate_irq_state, 679 698 .process = amdgpu_dm_irq_handler, 680 699 }; 681 700 ··· 713 694 714 695 adev->crtc_irq.num_types = adev->mode_info.num_crtc; 715 696 adev->crtc_irq.funcs = &dm_crtc_irq_funcs; 697 + 698 + adev->vupdate_irq.num_types = adev->mode_info.num_crtc; 699 + adev->vupdate_irq.funcs = &dm_vupdate_irq_funcs; 716 700 717 701 adev->pageflip_irq.num_types = adev->mode_info.num_crtc; 718 702 adev->pageflip_irq.funcs = &dm_pageflip_irq_funcs;
+49 -49
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c
··· 544 544 v->fabric_and_dram_bandwidth = v->fabric_and_dram_bandwidth_vnom0p8; 545 545 dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation(v); 546 546 547 - context->bw.dcn.watermarks.b.cstate_pstate.cstate_exit_ns = 547 + context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_exit_ns = 548 548 v->stutter_exit_watermark * 1000; 549 - context->bw.dcn.watermarks.b.cstate_pstate.cstate_enter_plus_exit_ns = 549 + context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_enter_plus_exit_ns = 550 550 v->stutter_enter_plus_exit_watermark * 1000; 551 - context->bw.dcn.watermarks.b.cstate_pstate.pstate_change_ns = 551 + context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.pstate_change_ns = 552 552 v->dram_clock_change_watermark * 1000; 553 - context->bw.dcn.watermarks.b.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 554 - context->bw.dcn.watermarks.b.urgent_ns = v->urgent_watermark * 1000; 553 + context->bw_ctx.bw.dcn.watermarks.b.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 554 + context->bw_ctx.bw.dcn.watermarks.b.urgent_ns = v->urgent_watermark * 1000; 555 555 556 556 v->dcfclk_per_state[1] = v->dcfclkv_nom0p8; 557 557 v->dcfclk_per_state[0] = v->dcfclkv_nom0p8; 558 558 v->dcfclk = v->dcfclkv_nom0p8; 559 559 dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation(v); 560 560 561 - context->bw.dcn.watermarks.c.cstate_pstate.cstate_exit_ns = 561 + context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_exit_ns = 562 562 v->stutter_exit_watermark * 1000; 563 - context->bw.dcn.watermarks.c.cstate_pstate.cstate_enter_plus_exit_ns = 563 + context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_enter_plus_exit_ns = 564 564 v->stutter_enter_plus_exit_watermark * 1000; 565 - context->bw.dcn.watermarks.c.cstate_pstate.pstate_change_ns = 565 + context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.pstate_change_ns = 566 566 v->dram_clock_change_watermark * 1000; 567 - context->bw.dcn.watermarks.c.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 568 - context->bw.dcn.watermarks.c.urgent_ns = v->urgent_watermark * 1000; 567 + context->bw_ctx.bw.dcn.watermarks.c.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 568 + context->bw_ctx.bw.dcn.watermarks.c.urgent_ns = v->urgent_watermark * 1000; 569 569 } 570 570 571 571 if (v->voltage_level < 3) { ··· 579 579 v->dcfclk = v->dcfclkv_max0p9; 580 580 dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation(v); 581 581 582 - context->bw.dcn.watermarks.d.cstate_pstate.cstate_exit_ns = 582 + context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_exit_ns = 583 583 v->stutter_exit_watermark * 1000; 584 - context->bw.dcn.watermarks.d.cstate_pstate.cstate_enter_plus_exit_ns = 584 + context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_enter_plus_exit_ns = 585 585 v->stutter_enter_plus_exit_watermark * 1000; 586 - context->bw.dcn.watermarks.d.cstate_pstate.pstate_change_ns = 586 + context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.pstate_change_ns = 587 587 v->dram_clock_change_watermark * 1000; 588 - context->bw.dcn.watermarks.d.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 589 - context->bw.dcn.watermarks.d.urgent_ns = v->urgent_watermark * 1000; 588 + context->bw_ctx.bw.dcn.watermarks.d.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 589 + context->bw_ctx.bw.dcn.watermarks.d.urgent_ns = v->urgent_watermark * 1000; 590 590 } 591 591 592 592 v->fabric_and_dram_bandwidth_per_state[2] = v->fabric_and_dram_bandwidth_vnom0p8; ··· 599 599 v->dcfclk = v->dcfclk_per_state[v->voltage_level]; 600 600 dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation(v); 601 601 602 - context->bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns = 602 + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns = 603 603 v->stutter_exit_watermark * 1000; 604 - context->bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns = 604 + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns = 605 605 v->stutter_enter_plus_exit_watermark * 1000; 606 - context->bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns = 606 + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns = 607 607 v->dram_clock_change_watermark * 1000; 608 - context->bw.dcn.watermarks.a.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 609 - context->bw.dcn.watermarks.a.urgent_ns = v->urgent_watermark * 1000; 608 + context->bw_ctx.bw.dcn.watermarks.a.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 609 + context->bw_ctx.bw.dcn.watermarks.a.urgent_ns = v->urgent_watermark * 1000; 610 610 if (v->voltage_level >= 2) { 611 - context->bw.dcn.watermarks.b = context->bw.dcn.watermarks.a; 612 - context->bw.dcn.watermarks.c = context->bw.dcn.watermarks.a; 611 + context->bw_ctx.bw.dcn.watermarks.b = context->bw_ctx.bw.dcn.watermarks.a; 612 + context->bw_ctx.bw.dcn.watermarks.c = context->bw_ctx.bw.dcn.watermarks.a; 613 613 } 614 614 if (v->voltage_level >= 3) 615 - context->bw.dcn.watermarks.d = context->bw.dcn.watermarks.a; 615 + context->bw_ctx.bw.dcn.watermarks.d = context->bw_ctx.bw.dcn.watermarks.a; 616 616 } 617 617 #endif 618 618 ··· 1008 1008 dc->debug.sr_enter_plus_exit_time_dpm0_ns / 1000.0f; 1009 1009 if (dc->debug.sr_exit_time_dpm0_ns) 1010 1010 v->sr_exit_time = dc->debug.sr_exit_time_dpm0_ns / 1000.0f; 1011 - dc->dml.soc.sr_enter_plus_exit_time_us = v->sr_enter_plus_exit_time; 1012 - dc->dml.soc.sr_exit_time_us = v->sr_exit_time; 1011 + context->bw_ctx.dml.soc.sr_enter_plus_exit_time_us = v->sr_enter_plus_exit_time; 1012 + context->bw_ctx.dml.soc.sr_exit_time_us = v->sr_exit_time; 1013 1013 mode_support_and_system_configuration(v); 1014 1014 } 1015 1015 ··· 1035 1035 */ 1036 1036 dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation(v); 1037 1037 1038 - context->bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns = 1038 + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns = 1039 1039 v->stutter_exit_watermark * 1000; 1040 - context->bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns = 1040 + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns = 1041 1041 v->stutter_enter_plus_exit_watermark * 1000; 1042 - context->bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns = 1042 + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns = 1043 1043 v->dram_clock_change_watermark * 1000; 1044 - context->bw.dcn.watermarks.a.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 1045 - context->bw.dcn.watermarks.a.urgent_ns = v->urgent_watermark * 1000; 1046 - context->bw.dcn.watermarks.b = context->bw.dcn.watermarks.a; 1047 - context->bw.dcn.watermarks.c = context->bw.dcn.watermarks.a; 1048 - context->bw.dcn.watermarks.d = context->bw.dcn.watermarks.a; 1044 + context->bw_ctx.bw.dcn.watermarks.a.pte_meta_urgent_ns = v->ptemeta_urgent_watermark * 1000; 1045 + context->bw_ctx.bw.dcn.watermarks.a.urgent_ns = v->urgent_watermark * 1000; 1046 + context->bw_ctx.bw.dcn.watermarks.b = context->bw_ctx.bw.dcn.watermarks.a; 1047 + context->bw_ctx.bw.dcn.watermarks.c = context->bw_ctx.bw.dcn.watermarks.a; 1048 + context->bw_ctx.bw.dcn.watermarks.d = context->bw_ctx.bw.dcn.watermarks.a; 1049 1049 1050 - context->bw.dcn.clk.fclk_khz = (int)(bw_consumed * 1000000 / 1050 + context->bw_ctx.bw.dcn.clk.fclk_khz = (int)(bw_consumed * 1000000 / 1051 1051 (ddr4_dram_factor_single_Channel * v->number_of_channels)); 1052 1052 if (bw_consumed == v->fabric_and_dram_bandwidth_vmin0p65) { 1053 - context->bw.dcn.clk.fclk_khz = (int)(bw_consumed * 1000000 / 32); 1053 + context->bw_ctx.bw.dcn.clk.fclk_khz = (int)(bw_consumed * 1000000 / 32); 1054 1054 } 1055 1055 1056 - context->bw.dcn.clk.dcfclk_deep_sleep_khz = (int)(v->dcf_clk_deep_sleep * 1000); 1057 - context->bw.dcn.clk.dcfclk_khz = (int)(v->dcfclk * 1000); 1056 + context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz = (int)(v->dcf_clk_deep_sleep * 1000); 1057 + context->bw_ctx.bw.dcn.clk.dcfclk_khz = (int)(v->dcfclk * 1000); 1058 1058 1059 - context->bw.dcn.clk.dispclk_khz = (int)(v->dispclk * 1000); 1059 + context->bw_ctx.bw.dcn.clk.dispclk_khz = (int)(v->dispclk * 1000); 1060 1060 if (dc->debug.max_disp_clk == true) 1061 - context->bw.dcn.clk.dispclk_khz = (int)(dc->dcn_soc->max_dispclk_vmax0p9 * 1000); 1061 + context->bw_ctx.bw.dcn.clk.dispclk_khz = (int)(dc->dcn_soc->max_dispclk_vmax0p9 * 1000); 1062 1062 1063 - if (context->bw.dcn.clk.dispclk_khz < 1063 + if (context->bw_ctx.bw.dcn.clk.dispclk_khz < 1064 1064 dc->debug.min_disp_clk_khz) { 1065 - context->bw.dcn.clk.dispclk_khz = 1065 + context->bw_ctx.bw.dcn.clk.dispclk_khz = 1066 1066 dc->debug.min_disp_clk_khz; 1067 1067 } 1068 1068 1069 - context->bw.dcn.clk.dppclk_khz = context->bw.dcn.clk.dispclk_khz / v->dispclk_dppclk_ratio; 1070 - context->bw.dcn.clk.phyclk_khz = v->phyclk_per_state[v->voltage_level]; 1069 + context->bw_ctx.bw.dcn.clk.dppclk_khz = context->bw_ctx.bw.dcn.clk.dispclk_khz / v->dispclk_dppclk_ratio; 1070 + context->bw_ctx.bw.dcn.clk.phyclk_khz = v->phyclk_per_state[v->voltage_level]; 1071 1071 switch (v->voltage_level) { 1072 1072 case 0: 1073 - context->bw.dcn.clk.max_supported_dppclk_khz = 1073 + context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = 1074 1074 (int)(dc->dcn_soc->max_dppclk_vmin0p65 * 1000); 1075 1075 break; 1076 1076 case 1: 1077 - context->bw.dcn.clk.max_supported_dppclk_khz = 1077 + context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = 1078 1078 (int)(dc->dcn_soc->max_dppclk_vmid0p72 * 1000); 1079 1079 break; 1080 1080 case 2: 1081 - context->bw.dcn.clk.max_supported_dppclk_khz = 1081 + context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = 1082 1082 (int)(dc->dcn_soc->max_dppclk_vnom0p8 * 1000); 1083 1083 break; 1084 1084 default: 1085 - context->bw.dcn.clk.max_supported_dppclk_khz = 1085 + context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = 1086 1086 (int)(dc->dcn_soc->max_dppclk_vmax0p9 * 1000); 1087 1087 break; 1088 1088 } ··· 1181 1181 1182 1182 if (v->voltage_level == 0) { 1183 1183 1184 - dc->dml.soc.sr_enter_plus_exit_time_us = 1184 + context->bw_ctx.dml.soc.sr_enter_plus_exit_time_us = 1185 1185 dc->dcn_soc->sr_enter_plus_exit_time; 1186 - dc->dml.soc.sr_exit_time_us = dc->dcn_soc->sr_exit_time; 1186 + context->bw_ctx.dml.soc.sr_exit_time_us = dc->dcn_soc->sr_exit_time; 1187 1187 } 1188 1188 1189 1189 /*
+90 -21
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 584 584 cust_pattern_size); 585 585 } 586 586 587 + uint32_t dc_link_bandwidth_kbps( 588 + const struct dc_link *link, 589 + const struct dc_link_settings *link_setting) 590 + { 591 + uint32_t link_bw_kbps = link_setting->link_rate * LINK_RATE_REF_FREQ_IN_KHZ; /* bytes per sec */ 592 + 593 + link_bw_kbps *= 8; /* 8 bits per byte*/ 594 + link_bw_kbps *= link_setting->lane_count; 595 + 596 + return link_bw_kbps; 597 + 598 + } 599 + 600 + const struct dc_link_settings *dc_link_get_verified_link_cap( 601 + const struct dc_link *link) 602 + { 603 + if (link->preferred_link_setting.lane_count != LANE_COUNT_UNKNOWN && 604 + link->preferred_link_setting.link_rate != LINK_RATE_UNKNOWN) 605 + return &link->preferred_link_setting; 606 + return &link->verified_link_cap; 607 + } 608 + 587 609 static void destruct(struct dc *dc) 588 610 { 589 611 dc_release_state(dc->current_state); ··· 654 632 #endif 655 633 656 634 enum dce_version dc_version = DCE_VERSION_UNKNOWN; 635 + dc->config = init_params->flags; 636 + 657 637 memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides)); 658 638 659 639 dc_dceip = kzalloc(sizeof(*dc_dceip), GFP_KERNEL); ··· 704 680 dc_ctx->dc_sink_id_count = 0; 705 681 dc_ctx->dc_stream_id_count = 0; 706 682 dc->ctx = dc_ctx; 707 - 708 - dc->current_state = dc_create_state(); 709 - 710 - if (!dc->current_state) { 711 - dm_error("%s: failed to create validate ctx\n", __func__); 712 - goto fail; 713 - } 714 683 715 684 /* Create logger */ 716 685 ··· 756 739 if (!dc->res_pool) 757 740 goto fail; 758 741 742 + /* Creation of current_state must occur after dc->dml 743 + * is initialized in dc_create_resource_pool because 744 + * on creation it copies the contents of dc->dml 745 + */ 746 + 747 + dc->current_state = dc_create_state(dc); 748 + 749 + if (!dc->current_state) { 750 + dm_error("%s: failed to create validate ctx\n", __func__); 751 + goto fail; 752 + } 753 + 759 754 dc_resource_state_construct(dc, dc->current_state); 760 755 761 756 if (!create_links(dc, init_params->num_virtual_links)) ··· 784 755 static void disable_dangling_plane(struct dc *dc, struct dc_state *context) 785 756 { 786 757 int i, j; 787 - struct dc_state *dangling_context = dc_create_state(); 758 + struct dc_state *dangling_context = dc_create_state(dc); 788 759 struct dc_state *current_ctx; 789 760 790 761 if (dangling_context == NULL) ··· 848 819 849 820 if (dc->res_pool->dmcu != NULL) 850 821 dc->versions.dmcu_version = dc->res_pool->dmcu->dmcu_version; 851 - 852 - dc->config = init_params->flags; 853 822 854 823 dc->build_id = DC_BUILD_ID; 855 824 ··· 1240 1213 return true; 1241 1214 } 1242 1215 1243 - struct dc_state *dc_create_state(void) 1216 + struct dc_state *dc_create_state(struct dc *dc) 1244 1217 { 1245 1218 struct dc_state *context = kzalloc(sizeof(struct dc_state), 1246 1219 GFP_KERNEL); 1247 1220 1248 1221 if (!context) 1249 1222 return NULL; 1223 + /* Each context must have their own instance of VBA and in order to 1224 + * initialize and obtain IP and SOC the base DML instance from DC is 1225 + * initially copied into every context 1226 + */ 1227 + #ifdef CONFIG_DRM_AMD_DC_DCN1_0 1228 + memcpy(&context->bw_ctx.dml, &dc->dml, sizeof(struct display_mode_lib)); 1229 + #endif 1250 1230 1251 1231 kref_init(&context->refcount); 1232 + 1252 1233 return context; 1234 + } 1235 + 1236 + struct dc_state *dc_copy_state(struct dc_state *src_ctx) 1237 + { 1238 + int i, j; 1239 + struct dc_state *new_ctx = kzalloc(sizeof(struct dc_state), 1240 + GFP_KERNEL); 1241 + 1242 + if (!new_ctx) 1243 + return NULL; 1244 + 1245 + memcpy(new_ctx, src_ctx, sizeof(struct dc_state)); 1246 + 1247 + for (i = 0; i < MAX_PIPES; i++) { 1248 + struct pipe_ctx *cur_pipe = &new_ctx->res_ctx.pipe_ctx[i]; 1249 + 1250 + if (cur_pipe->top_pipe) 1251 + cur_pipe->top_pipe = &new_ctx->res_ctx.pipe_ctx[cur_pipe->top_pipe->pipe_idx]; 1252 + 1253 + if (cur_pipe->bottom_pipe) 1254 + cur_pipe->bottom_pipe = &new_ctx->res_ctx.pipe_ctx[cur_pipe->bottom_pipe->pipe_idx]; 1255 + 1256 + } 1257 + 1258 + for (i = 0; i < new_ctx->stream_count; i++) { 1259 + dc_stream_retain(new_ctx->streams[i]); 1260 + for (j = 0; j < new_ctx->stream_status[i].plane_count; j++) 1261 + dc_plane_state_retain( 1262 + new_ctx->stream_status[i].plane_states[j]); 1263 + } 1264 + 1265 + kref_init(&new_ctx->refcount); 1266 + 1267 + return new_ctx; 1253 1268 } 1254 1269 1255 1270 void dc_retain_state(struct dc_state *context) ··· 1893 1824 if (update_type >= UPDATE_TYPE_FULL) { 1894 1825 1895 1826 /* initialize scratch memory for building context */ 1896 - context = dc_create_state(); 1827 + context = dc_create_state(dc); 1897 1828 if (context == NULL) { 1898 1829 DC_ERROR("Failed to allocate new validate context!\n"); 1899 1830 return; ··· 2178 2109 2179 2110 void get_clock_requirements_for_state(struct dc_state *state, struct AsicStateEx *info) 2180 2111 { 2181 - info->displayClock = (unsigned int)state->bw.dcn.clk.dispclk_khz; 2182 - info->engineClock = (unsigned int)state->bw.dcn.clk.dcfclk_khz; 2183 - info->memoryClock = (unsigned int)state->bw.dcn.clk.dramclk_khz; 2184 - info->maxSupportedDppClock = (unsigned int)state->bw.dcn.clk.max_supported_dppclk_khz; 2185 - info->dppClock = (unsigned int)state->bw.dcn.clk.dppclk_khz; 2186 - info->socClock = (unsigned int)state->bw.dcn.clk.socclk_khz; 2187 - info->dcfClockDeepSleep = (unsigned int)state->bw.dcn.clk.dcfclk_deep_sleep_khz; 2188 - info->fClock = (unsigned int)state->bw.dcn.clk.fclk_khz; 2189 - info->phyClock = (unsigned int)state->bw.dcn.clk.phyclk_khz; 2112 + info->displayClock = (unsigned int)state->bw_ctx.bw.dcn.clk.dispclk_khz; 2113 + info->engineClock = (unsigned int)state->bw_ctx.bw.dcn.clk.dcfclk_khz; 2114 + info->memoryClock = (unsigned int)state->bw_ctx.bw.dcn.clk.dramclk_khz; 2115 + info->maxSupportedDppClock = (unsigned int)state->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz; 2116 + info->dppClock = (unsigned int)state->bw_ctx.bw.dcn.clk.dppclk_khz; 2117 + info->socClock = (unsigned int)state->bw_ctx.bw.dcn.clk.socclk_khz; 2118 + info->dcfClockDeepSleep = (unsigned int)state->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz; 2119 + info->fClock = (unsigned int)state->bw_ctx.bw.dcn.clk.fclk_khz; 2120 + info->phyClock = (unsigned int)state->bw_ctx.bw.dcn.clk.phyclk_khz; 2190 2121 }
+12 -12
drivers/gpu/drm/amd/display/dc/core/dc_debug.c
··· 351 351 DC_LOGGER_INIT(dc->ctx->logger); 352 352 CLOCK_TRACE("Current: dispclk_khz:%d max_dppclk_khz:%d dcfclk_khz:%d\n" 353 353 "dcfclk_deep_sleep_khz:%d fclk_khz:%d socclk_khz:%d\n", 354 - context->bw.dcn.clk.dispclk_khz, 355 - context->bw.dcn.clk.dppclk_khz, 356 - context->bw.dcn.clk.dcfclk_khz, 357 - context->bw.dcn.clk.dcfclk_deep_sleep_khz, 358 - context->bw.dcn.clk.fclk_khz, 359 - context->bw.dcn.clk.socclk_khz); 354 + context->bw_ctx.bw.dcn.clk.dispclk_khz, 355 + context->bw_ctx.bw.dcn.clk.dppclk_khz, 356 + context->bw_ctx.bw.dcn.clk.dcfclk_khz, 357 + context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz, 358 + context->bw_ctx.bw.dcn.clk.fclk_khz, 359 + context->bw_ctx.bw.dcn.clk.socclk_khz); 360 360 CLOCK_TRACE("Calculated: dispclk_khz:%d max_dppclk_khz:%d dcfclk_khz:%d\n" 361 361 "dcfclk_deep_sleep_khz:%d fclk_khz:%d socclk_khz:%d\n", 362 - context->bw.dcn.clk.dispclk_khz, 363 - context->bw.dcn.clk.dppclk_khz, 364 - context->bw.dcn.clk.dcfclk_khz, 365 - context->bw.dcn.clk.dcfclk_deep_sleep_khz, 366 - context->bw.dcn.clk.fclk_khz, 367 - context->bw.dcn.clk.socclk_khz); 362 + context->bw_ctx.bw.dcn.clk.dispclk_khz, 363 + context->bw_ctx.bw.dcn.clk.dppclk_khz, 364 + context->bw_ctx.bw.dcn.clk.dcfclk_khz, 365 + context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz, 366 + context->bw_ctx.bw.dcn.clk.fclk_khz, 367 + context->bw_ctx.bw.dcn.clk.socclk_khz); 368 368 #endif 369 369 }
+64 -11
drivers/gpu/drm/amd/display/dc/core/dc_link.c
··· 58 58 ******************************************************************************/ 59 59 60 60 enum { 61 - LINK_RATE_REF_FREQ_IN_MHZ = 27, 62 61 PEAK_FACTOR_X1000 = 1006, 63 62 /* 64 63 * Some receivers fail to train on first try and are good ··· 1396 1397 /* get link settings for video mode timing */ 1397 1398 decide_link_settings(stream, &link_settings); 1398 1399 1400 + /* If link settings are different than current and link already enabled 1401 + * then need to disable before programming to new rate. 1402 + */ 1403 + if (link->link_status.link_active && 1404 + (link->cur_link_settings.lane_count != link_settings.lane_count || 1405 + link->cur_link_settings.link_rate != link_settings.link_rate)) { 1406 + dp_disable_link_phy(link, pipe_ctx->stream->signal); 1407 + } 1408 + 1399 1409 pipe_ctx->stream_res.pix_clk_params.requested_sym_clk = 1400 1410 link_settings.link_rate * LINK_RATE_REF_FREQ_IN_KHZ; 1401 - state->dccg->funcs->update_clocks(state->dccg, state, false); 1411 + state->clk_mgr->funcs->update_clocks(state->clk_mgr, state, false); 1402 1412 1403 1413 dp_enable_link_phy( 1404 1414 link, ··· 2158 2150 return false; 2159 2151 } 2160 2152 2161 - if (get_timing_pixel_clock_100hz(timing) > (dongle_caps->dp_hdmi_max_pixel_clk * 10)) 2153 + if (get_timing_pixel_clock_100hz(timing) > (dongle_caps->dp_hdmi_max_pixel_clk_in_khz * 10)) 2162 2154 return false; 2163 2155 2164 2156 return true; ··· 2297 2289 2298 2290 static struct fixed31_32 get_pbn_per_slot(struct dc_stream_state *stream) 2299 2291 { 2300 - struct dc_link_settings *link_settings = 2301 - &stream->link->cur_link_settings; 2302 - uint32_t link_rate_in_mbps = 2303 - link_settings->link_rate * LINK_RATE_REF_FREQ_IN_MHZ; 2304 - struct fixed31_32 mbps = dc_fixpt_from_int( 2305 - link_rate_in_mbps * link_settings->lane_count); 2292 + struct fixed31_32 mbytes_per_sec; 2293 + uint32_t link_rate_in_mbytes_per_sec = dc_link_bandwidth_kbps(stream->link, &stream->link->cur_link_settings); 2294 + link_rate_in_mbytes_per_sec /= 8000; /* Kbits to MBytes */ 2306 2295 2307 - return dc_fixpt_div_int(mbps, 54); 2296 + mbytes_per_sec = dc_fixpt_from_int(link_rate_in_mbytes_per_sec); 2297 + 2298 + return dc_fixpt_div_int(mbytes_per_sec, 54); 2308 2299 } 2309 2300 2310 2301 static int get_color_depth(enum dc_color_depth color_depth) ··· 2328 2321 uint32_t denominator; 2329 2322 2330 2323 bpc = get_color_depth(pipe_ctx->stream_res.pix_clk_params.color_depth); 2331 - kbps = pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz / 10 * bpc * 3; 2324 + kbps = dc_bandwidth_in_kbps_from_timing(&pipe_ctx->stream->timing); 2332 2325 2333 2326 /* 2334 2327 * margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006 ··· 2743 2736 } 2744 2737 } 2745 2738 2739 + uint32_t dc_bandwidth_in_kbps_from_timing( 2740 + const struct dc_crtc_timing *timing) 2741 + { 2742 + uint32_t bits_per_channel = 0; 2743 + uint32_t kbps; 2744 + 2745 + switch (timing->display_color_depth) { 2746 + case COLOR_DEPTH_666: 2747 + bits_per_channel = 6; 2748 + break; 2749 + case COLOR_DEPTH_888: 2750 + bits_per_channel = 8; 2751 + break; 2752 + case COLOR_DEPTH_101010: 2753 + bits_per_channel = 10; 2754 + break; 2755 + case COLOR_DEPTH_121212: 2756 + bits_per_channel = 12; 2757 + break; 2758 + case COLOR_DEPTH_141414: 2759 + bits_per_channel = 14; 2760 + break; 2761 + case COLOR_DEPTH_161616: 2762 + bits_per_channel = 16; 2763 + break; 2764 + default: 2765 + break; 2766 + } 2767 + 2768 + ASSERT(bits_per_channel != 0); 2769 + 2770 + kbps = timing->pix_clk_100hz / 10; 2771 + kbps *= bits_per_channel; 2772 + 2773 + if (timing->flags.Y_ONLY != 1) { 2774 + /*Only YOnly make reduce bandwidth by 1/3 compares to RGB*/ 2775 + kbps *= 3; 2776 + if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420) 2777 + kbps /= 2; 2778 + else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR422) 2779 + kbps = kbps * 2 / 3; 2780 + } 2781 + 2782 + return kbps; 2783 + 2784 + }
+4 -9
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 1305 1305 bool dc_res_is_odm_head_pipe(struct pipe_ctx *pipe_ctx) 1306 1306 { 1307 1307 struct pipe_ctx *top_pipe = pipe_ctx->top_pipe; 1308 - bool result = false; 1309 1308 1309 + if (!top_pipe) 1310 + return false; 1310 1311 if (top_pipe && top_pipe->stream_res.opp == pipe_ctx->stream_res.opp) 1311 1312 return false; 1312 1313 1313 - while (top_pipe) { 1314 - if (!top_pipe->top_pipe && top_pipe->stream_res.opp != pipe_ctx->stream_res.opp) 1315 - result = true; 1316 - top_pipe = top_pipe->top_pipe; 1317 - } 1318 - 1319 - return result; 1314 + return true; 1320 1315 } 1321 1316 1322 1317 bool dc_remove_plane_from_context( ··· 2059 2064 const struct dc *dc, 2060 2065 struct dc_state *dst_ctx) 2061 2066 { 2062 - dst_ctx->dccg = dc->res_pool->clk_mgr; 2067 + dst_ctx->clk_mgr = dc->res_pool->clk_mgr; 2063 2068 } 2064 2069 2065 2070 /**
+3 -2
drivers/gpu/drm/amd/display/dc/dc.h
··· 39 39 #include "inc/hw/dmcu.h" 40 40 #include "dml/display_mode_lib.h" 41 41 42 - #define DC_VER "3.2.24" 42 + #define DC_VER "3.2.25" 43 43 44 44 #define MAX_SURFACES 3 45 45 #define MAX_PLANES 6 ··· 669 669 bool dc_commit_state(struct dc *dc, struct dc_state *context); 670 670 671 671 672 - struct dc_state *dc_create_state(void); 672 + struct dc_state *dc_create_state(struct dc *dc); 673 + struct dc_state *dc_copy_state(struct dc_state *src_ctx); 673 674 void dc_retain_state(struct dc_state *context); 674 675 void dc_release_state(struct dc_state *context); 675 676
+8
drivers/gpu/drm/amd/display/dc/dc_link.h
··· 246 246 const struct link_training_settings *p_link_settings, 247 247 const unsigned char *p_custom_pattern, 248 248 unsigned int cust_pattern_size); 249 + uint32_t dc_link_bandwidth_kbps( 250 + const struct dc_link *link, 251 + const struct dc_link_settings *link_setting); 252 + 253 + const struct dc_link_settings *dc_link_get_verified_link_cap( 254 + const struct dc_link *link); 249 255 250 256 bool dc_submit_i2c( 251 257 struct dc *dc, 252 258 uint32_t link_index, 253 259 struct i2c_command *cmd); 254 260 261 + uint32_t dc_bandwidth_in_kbps_from_timing( 262 + const struct dc_crtc_timing *timing); 255 263 #endif /* DC_LINK_H_ */
+1 -1
drivers/gpu/drm/amd/display/dc/dc_types.h
··· 395 395 bool is_dp_hdmi_ycbcr422_converter; 396 396 bool is_dp_hdmi_ycbcr420_converter; 397 397 uint32_t dp_hdmi_max_bpc; 398 - uint32_t dp_hdmi_max_pixel_clk; 398 + uint32_t dp_hdmi_max_pixel_clk_in_khz; 399 399 }; 400 400 /* Scaling format */ 401 401 enum scaling_transformation {
+15 -15
drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c
··· 222 222 * all required clocks 223 223 */ 224 224 for (i = clk_mgr_dce->max_clks_state; i >= DM_PP_CLOCKS_STATE_ULTRA_LOW; i--) 225 - if (context->bw.dce.dispclk_khz > 225 + if (context->bw_ctx.bw.dce.dispclk_khz > 226 226 clk_mgr_dce->max_clks_by_state[i].display_clk_khz 227 227 || max_pix_clk > 228 228 clk_mgr_dce->max_clks_by_state[i].pixel_clk_khz) ··· 232 232 if (low_req_clk > clk_mgr_dce->max_clks_state) { 233 233 /* set max clock state for high phyclock, invalid on exceeding display clock */ 234 234 if (clk_mgr_dce->max_clks_by_state[clk_mgr_dce->max_clks_state].display_clk_khz 235 - < context->bw.dce.dispclk_khz) 235 + < context->bw_ctx.bw.dce.dispclk_khz) 236 236 low_req_clk = DM_PP_CLOCKS_STATE_INVALID; 237 237 else 238 238 low_req_clk = clk_mgr_dce->max_clks_state; ··· 610 610 struct dm_pp_display_configuration *pp_display_cfg = &context->pp_display_cfg; 611 611 612 612 pp_display_cfg->all_displays_in_sync = 613 - context->bw.dce.all_displays_in_sync; 613 + context->bw_ctx.bw.dce.all_displays_in_sync; 614 614 pp_display_cfg->nb_pstate_switch_disable = 615 - context->bw.dce.nbp_state_change_enable == false; 615 + context->bw_ctx.bw.dce.nbp_state_change_enable == false; 616 616 pp_display_cfg->cpu_cc6_disable = 617 - context->bw.dce.cpuc_state_change_enable == false; 617 + context->bw_ctx.bw.dce.cpuc_state_change_enable == false; 618 618 pp_display_cfg->cpu_pstate_disable = 619 - context->bw.dce.cpup_state_change_enable == false; 619 + context->bw_ctx.bw.dce.cpup_state_change_enable == false; 620 620 pp_display_cfg->cpu_pstate_separation_time = 621 - context->bw.dce.blackout_recovery_time_us; 621 + context->bw_ctx.bw.dce.blackout_recovery_time_us; 622 622 623 - pp_display_cfg->min_memory_clock_khz = context->bw.dce.yclk_khz 623 + pp_display_cfg->min_memory_clock_khz = context->bw_ctx.bw.dce.yclk_khz 624 624 / MEMORY_TYPE_MULTIPLIER_CZ; 625 625 626 626 pp_display_cfg->min_engine_clock_khz = determine_sclk_from_bounding_box( 627 627 dc, 628 - context->bw.dce.sclk_khz); 628 + context->bw_ctx.bw.dce.sclk_khz); 629 629 630 630 /* 631 631 * As workaround for >4x4K lightup set dcfclock to min_engine_clock value. ··· 638 638 pp_display_cfg->min_engine_clock_khz : 0; 639 639 640 640 pp_display_cfg->min_engine_clock_deep_sleep_khz 641 - = context->bw.dce.sclk_deep_sleep_khz; 641 + = context->bw_ctx.bw.dce.sclk_deep_sleep_khz; 642 642 643 643 pp_display_cfg->avail_mclk_switch_time_us = 644 644 dce110_get_min_vblank_time_us(context); ··· 669 669 { 670 670 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr); 671 671 struct dm_pp_power_level_change_request level_change_req; 672 - int patched_disp_clk = context->bw.dce.dispclk_khz; 672 + int patched_disp_clk = context->bw_ctx.bw.dce.dispclk_khz; 673 673 674 674 /*TODO: W/A for dal3 linux, investigate why this works */ 675 675 if (!clk_mgr_dce->dfs_bypass_active) ··· 696 696 { 697 697 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr); 698 698 struct dm_pp_power_level_change_request level_change_req; 699 - int patched_disp_clk = context->bw.dce.dispclk_khz; 699 + int patched_disp_clk = context->bw_ctx.bw.dce.dispclk_khz; 700 700 701 701 /*TODO: W/A for dal3 linux, investigate why this works */ 702 702 if (!clk_mgr_dce->dfs_bypass_active) ··· 711 711 } 712 712 713 713 if (should_set_clock(safe_to_lower, patched_disp_clk, clk_mgr->clks.dispclk_khz)) { 714 - context->bw.dce.dispclk_khz = dce_set_clock(clk_mgr, patched_disp_clk); 714 + context->bw_ctx.bw.dce.dispclk_khz = dce_set_clock(clk_mgr, patched_disp_clk); 715 715 clk_mgr->clks.dispclk_khz = patched_disp_clk; 716 716 } 717 717 dce11_pplib_apply_display_requirements(clk_mgr->ctx->dc, context); ··· 723 723 { 724 724 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr); 725 725 struct dm_pp_power_level_change_request level_change_req; 726 - int patched_disp_clk = context->bw.dce.dispclk_khz; 726 + int patched_disp_clk = context->bw_ctx.bw.dce.dispclk_khz; 727 727 728 728 /*TODO: W/A for dal3 linux, investigate why this works */ 729 729 if (!clk_mgr_dce->dfs_bypass_active) ··· 751 751 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr); 752 752 struct dm_pp_clock_for_voltage_req clock_voltage_req = {0}; 753 753 int max_pix_clk = get_max_pixel_clock_for_all_paths(context); 754 - int patched_disp_clk = context->bw.dce.dispclk_khz; 754 + int patched_disp_clk = context->bw_ctx.bw.dce.dispclk_khz; 755 755 756 756 /*TODO: W/A for dal3 linux, investigate why this works */ 757 757 if (!clk_mgr_dce->dfs_bypass_active)
+4 -4
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
··· 773 773 774 774 if (at_least_one_pipe) { 775 775 /* TODO implement when needed but for now hardcode max value*/ 776 - context->bw.dce.dispclk_khz = 681000; 777 - context->bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; 776 + context->bw_ctx.bw.dce.dispclk_khz = 681000; 777 + context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; 778 778 } else { 779 - context->bw.dce.dispclk_khz = 0; 780 - context->bw.dce.yclk_khz = 0; 779 + context->bw_ctx.bw.dce.dispclk_khz = 0; 780 + context->bw_ctx.bw.dce.yclk_khz = 0; 781 781 } 782 782 783 783 return true;
+9 -9
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
··· 1166 1166 if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT || 1167 1167 pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) { 1168 1168 audio_output->pll_info.dp_dto_source_clock_in_khz = 1169 - state->dccg->funcs->get_dp_ref_clk_frequency( 1170 - state->dccg); 1169 + state->clk_mgr->funcs->get_dp_ref_clk_frequency( 1170 + state->clk_mgr); 1171 1171 } 1172 1172 1173 1173 audio_output->pll_info.feed_back_divider = ··· 1630 1630 dc->bw_vbios->blackout_duration, pipe_ctx->stream); 1631 1631 pipe_ctx->plane_res.mi->funcs->mem_input_program_display_marks( 1632 1632 pipe_ctx->plane_res.mi, 1633 - context->bw.dce.nbp_state_change_wm_ns[num_pipes], 1634 - context->bw.dce.stutter_exit_wm_ns[num_pipes], 1635 - context->bw.dce.stutter_entry_wm_ns[num_pipes], 1636 - context->bw.dce.urgent_wm_ns[num_pipes], 1633 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[num_pipes], 1634 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[num_pipes], 1635 + context->bw_ctx.bw.dce.stutter_entry_wm_ns[num_pipes], 1636 + context->bw_ctx.bw.dce.urgent_wm_ns[num_pipes], 1637 1637 total_dest_line_time_ns); 1638 1638 if (i == underlay_idx) { 1639 1639 num_pipes++; 1640 1640 pipe_ctx->plane_res.mi->funcs->mem_input_program_chroma_display_marks( 1641 1641 pipe_ctx->plane_res.mi, 1642 - context->bw.dce.nbp_state_change_wm_ns[num_pipes], 1643 - context->bw.dce.stutter_exit_wm_ns[num_pipes], 1644 - context->bw.dce.urgent_wm_ns[num_pipes], 1642 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[num_pipes], 1643 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[num_pipes], 1644 + context->bw_ctx.bw.dce.urgent_wm_ns[num_pipes], 1645 1645 total_dest_line_time_ns); 1646 1646 } 1647 1647 num_pipes++;
+31 -31
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
··· 883 883 dc->bw_vbios, 884 884 context->res_ctx.pipe_ctx, 885 885 dc->res_pool->pipe_count, 886 - &context->bw.dce)) 886 + &context->bw_ctx.bw.dce)) 887 887 result = true; 888 888 889 889 if (!result) ··· 893 893 context->streams[0]->timing.v_addressable, 894 894 context->streams[0]->timing.pix_clk_100hz / 10); 895 895 896 - if (memcmp(&dc->current_state->bw.dce, 897 - &context->bw.dce, sizeof(context->bw.dce))) { 896 + if (memcmp(&dc->current_state->bw_ctx.bw.dce, 897 + &context->bw_ctx.bw.dce, sizeof(context->bw_ctx.bw.dce))) { 898 898 899 899 DC_LOG_BANDWIDTH_CALCS( 900 900 "%s: finish,\n" ··· 908 908 "sclk: %d sclk_sleep: %d yclk: %d blackout_recovery_time_us: %d\n" 909 909 , 910 910 __func__, 911 - context->bw.dce.nbp_state_change_wm_ns[0].b_mark, 912 - context->bw.dce.nbp_state_change_wm_ns[0].a_mark, 913 - context->bw.dce.urgent_wm_ns[0].b_mark, 914 - context->bw.dce.urgent_wm_ns[0].a_mark, 915 - context->bw.dce.stutter_exit_wm_ns[0].b_mark, 916 - context->bw.dce.stutter_exit_wm_ns[0].a_mark, 917 - context->bw.dce.nbp_state_change_wm_ns[1].b_mark, 918 - context->bw.dce.nbp_state_change_wm_ns[1].a_mark, 919 - context->bw.dce.urgent_wm_ns[1].b_mark, 920 - context->bw.dce.urgent_wm_ns[1].a_mark, 921 - context->bw.dce.stutter_exit_wm_ns[1].b_mark, 922 - context->bw.dce.stutter_exit_wm_ns[1].a_mark, 923 - context->bw.dce.nbp_state_change_wm_ns[2].b_mark, 924 - context->bw.dce.nbp_state_change_wm_ns[2].a_mark, 925 - context->bw.dce.urgent_wm_ns[2].b_mark, 926 - context->bw.dce.urgent_wm_ns[2].a_mark, 927 - context->bw.dce.stutter_exit_wm_ns[2].b_mark, 928 - context->bw.dce.stutter_exit_wm_ns[2].a_mark, 929 - context->bw.dce.stutter_mode_enable, 930 - context->bw.dce.cpuc_state_change_enable, 931 - context->bw.dce.cpup_state_change_enable, 932 - context->bw.dce.nbp_state_change_enable, 933 - context->bw.dce.all_displays_in_sync, 934 - context->bw.dce.dispclk_khz, 935 - context->bw.dce.sclk_khz, 936 - context->bw.dce.sclk_deep_sleep_khz, 937 - context->bw.dce.yclk_khz, 938 - context->bw.dce.blackout_recovery_time_us); 911 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[0].b_mark, 912 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[0].a_mark, 913 + context->bw_ctx.bw.dce.urgent_wm_ns[0].b_mark, 914 + context->bw_ctx.bw.dce.urgent_wm_ns[0].a_mark, 915 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[0].b_mark, 916 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[0].a_mark, 917 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[1].b_mark, 918 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[1].a_mark, 919 + context->bw_ctx.bw.dce.urgent_wm_ns[1].b_mark, 920 + context->bw_ctx.bw.dce.urgent_wm_ns[1].a_mark, 921 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[1].b_mark, 922 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[1].a_mark, 923 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[2].b_mark, 924 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[2].a_mark, 925 + context->bw_ctx.bw.dce.urgent_wm_ns[2].b_mark, 926 + context->bw_ctx.bw.dce.urgent_wm_ns[2].a_mark, 927 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[2].b_mark, 928 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[2].a_mark, 929 + context->bw_ctx.bw.dce.stutter_mode_enable, 930 + context->bw_ctx.bw.dce.cpuc_state_change_enable, 931 + context->bw_ctx.bw.dce.cpup_state_change_enable, 932 + context->bw_ctx.bw.dce.nbp_state_change_enable, 933 + context->bw_ctx.bw.dce.all_displays_in_sync, 934 + context->bw_ctx.bw.dce.dispclk_khz, 935 + context->bw_ctx.bw.dce.sclk_khz, 936 + context->bw_ctx.bw.dce.sclk_deep_sleep_khz, 937 + context->bw_ctx.bw.dce.yclk_khz, 938 + context->bw_ctx.bw.dce.blackout_recovery_time_us); 939 939 } 940 940 return result; 941 941 }
+31 -31
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
··· 823 823 dc->bw_vbios, 824 824 context->res_ctx.pipe_ctx, 825 825 dc->res_pool->pipe_count, 826 - &context->bw.dce)) 826 + &context->bw_ctx.bw.dce)) 827 827 result = true; 828 828 829 829 if (!result) ··· 831 831 "%s: Bandwidth validation failed!", 832 832 __func__); 833 833 834 - if (memcmp(&dc->current_state->bw.dce, 835 - &context->bw.dce, sizeof(context->bw.dce))) { 834 + if (memcmp(&dc->current_state->bw_ctx.bw.dce, 835 + &context->bw_ctx.bw.dce, sizeof(context->bw_ctx.bw.dce))) { 836 836 837 837 DC_LOG_BANDWIDTH_CALCS( 838 838 "%s: finish,\n" ··· 846 846 "sclk: %d sclk_sleep: %d yclk: %d blackout_recovery_time_us: %d\n" 847 847 , 848 848 __func__, 849 - context->bw.dce.nbp_state_change_wm_ns[0].b_mark, 850 - context->bw.dce.nbp_state_change_wm_ns[0].a_mark, 851 - context->bw.dce.urgent_wm_ns[0].b_mark, 852 - context->bw.dce.urgent_wm_ns[0].a_mark, 853 - context->bw.dce.stutter_exit_wm_ns[0].b_mark, 854 - context->bw.dce.stutter_exit_wm_ns[0].a_mark, 855 - context->bw.dce.nbp_state_change_wm_ns[1].b_mark, 856 - context->bw.dce.nbp_state_change_wm_ns[1].a_mark, 857 - context->bw.dce.urgent_wm_ns[1].b_mark, 858 - context->bw.dce.urgent_wm_ns[1].a_mark, 859 - context->bw.dce.stutter_exit_wm_ns[1].b_mark, 860 - context->bw.dce.stutter_exit_wm_ns[1].a_mark, 861 - context->bw.dce.nbp_state_change_wm_ns[2].b_mark, 862 - context->bw.dce.nbp_state_change_wm_ns[2].a_mark, 863 - context->bw.dce.urgent_wm_ns[2].b_mark, 864 - context->bw.dce.urgent_wm_ns[2].a_mark, 865 - context->bw.dce.stutter_exit_wm_ns[2].b_mark, 866 - context->bw.dce.stutter_exit_wm_ns[2].a_mark, 867 - context->bw.dce.stutter_mode_enable, 868 - context->bw.dce.cpuc_state_change_enable, 869 - context->bw.dce.cpup_state_change_enable, 870 - context->bw.dce.nbp_state_change_enable, 871 - context->bw.dce.all_displays_in_sync, 872 - context->bw.dce.dispclk_khz, 873 - context->bw.dce.sclk_khz, 874 - context->bw.dce.sclk_deep_sleep_khz, 875 - context->bw.dce.yclk_khz, 876 - context->bw.dce.blackout_recovery_time_us); 849 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[0].b_mark, 850 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[0].a_mark, 851 + context->bw_ctx.bw.dce.urgent_wm_ns[0].b_mark, 852 + context->bw_ctx.bw.dce.urgent_wm_ns[0].a_mark, 853 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[0].b_mark, 854 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[0].a_mark, 855 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[1].b_mark, 856 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[1].a_mark, 857 + context->bw_ctx.bw.dce.urgent_wm_ns[1].b_mark, 858 + context->bw_ctx.bw.dce.urgent_wm_ns[1].a_mark, 859 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[1].b_mark, 860 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[1].a_mark, 861 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[2].b_mark, 862 + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[2].a_mark, 863 + context->bw_ctx.bw.dce.urgent_wm_ns[2].b_mark, 864 + context->bw_ctx.bw.dce.urgent_wm_ns[2].a_mark, 865 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[2].b_mark, 866 + context->bw_ctx.bw.dce.stutter_exit_wm_ns[2].a_mark, 867 + context->bw_ctx.bw.dce.stutter_mode_enable, 868 + context->bw_ctx.bw.dce.cpuc_state_change_enable, 869 + context->bw_ctx.bw.dce.cpup_state_change_enable, 870 + context->bw_ctx.bw.dce.nbp_state_change_enable, 871 + context->bw_ctx.bw.dce.all_displays_in_sync, 872 + context->bw_ctx.bw.dce.dispclk_khz, 873 + context->bw_ctx.bw.dce.sclk_khz, 874 + context->bw_ctx.bw.dce.sclk_deep_sleep_khz, 875 + context->bw_ctx.bw.dce.yclk_khz, 876 + context->bw_ctx.bw.dce.blackout_recovery_time_us); 877 877 } 878 878 return result; 879 879 }
+4 -4
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
··· 807 807 808 808 if (at_least_one_pipe) { 809 809 /* TODO implement when needed but for now hardcode max value*/ 810 - context->bw.dce.dispclk_khz = 681000; 811 - context->bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; 810 + context->bw_ctx.bw.dce.dispclk_khz = 681000; 811 + context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; 812 812 } else { 813 - context->bw.dce.dispclk_khz = 0; 814 - context->bw.dce.yclk_khz = 0; 813 + context->bw_ctx.bw.dce.dispclk_khz = 0; 814 + context->bw_ctx.bw.dce.yclk_khz = 0; 815 815 } 816 816 817 817 return true;
+1 -1
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c
··· 150 150 { 151 151 struct dc *dc = clk_mgr->ctx->dc; 152 152 struct dc_debug_options *debug = &dc->debug; 153 - struct dc_clocks *new_clocks = &context->bw.dcn.clk; 153 + struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk; 154 154 struct pp_smu_display_requirement_rv *smu_req_cur = 155 155 &dc->res_pool->pp_smu_req; 156 156 struct pp_smu_display_requirement_rv smu_req = *smu_req_cur;
+5 -1
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp.c
··· 385 385 default: 386 386 break; 387 387 } 388 + 389 + /* Set default color space based on format if none is given. */ 390 + color_space = input_color_space ? input_color_space : color_space; 391 + 388 392 REG_SET(CNVC_SURFACE_PIXEL_FORMAT, 0, 389 393 CNVC_SURFACE_PIXEL_FORMAT, pixel_format); 390 394 REG_UPDATE(FORMAT_CONTROL, FORMAT_CONTROL__ALPHA_EN, alpha_en); ··· 400 396 for (i = 0; i < 12; i++) 401 397 tbl_entry.regval[i] = input_csc_color_matrix.matrix[i]; 402 398 403 - tbl_entry.color_space = input_color_space; 399 + tbl_entry.color_space = color_space; 404 400 405 401 if (color_space >= COLOR_SPACE_YCBCR601) 406 402 select = INPUT_CSC_SELECT_ICSC;
+72 -41
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
··· 345 345 346 346 DTN_INFO("\nCALCULATED Clocks: dcfclk_khz:%d dcfclk_deep_sleep_khz:%d dispclk_khz:%d\n" 347 347 "dppclk_khz:%d max_supported_dppclk_khz:%d fclk_khz:%d socclk_khz:%d\n\n", 348 - dc->current_state->bw.dcn.clk.dcfclk_khz, 349 - dc->current_state->bw.dcn.clk.dcfclk_deep_sleep_khz, 350 - dc->current_state->bw.dcn.clk.dispclk_khz, 351 - dc->current_state->bw.dcn.clk.dppclk_khz, 352 - dc->current_state->bw.dcn.clk.max_supported_dppclk_khz, 353 - dc->current_state->bw.dcn.clk.fclk_khz, 354 - dc->current_state->bw.dcn.clk.socclk_khz); 348 + dc->current_state->bw_ctx.bw.dcn.clk.dcfclk_khz, 349 + dc->current_state->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz, 350 + dc->current_state->bw_ctx.bw.dcn.clk.dispclk_khz, 351 + dc->current_state->bw_ctx.bw.dcn.clk.dppclk_khz, 352 + dc->current_state->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz, 353 + dc->current_state->bw_ctx.bw.dcn.clk.fclk_khz, 354 + dc->current_state->bw_ctx.bw.dcn.clk.socclk_khz); 355 355 356 356 log_mpc_crc(dc, log_ctx); 357 357 ··· 979 979 * to non-preferred front end. If pipe_ctx->stream is not NULL, 980 980 * we will use the pipe, so don't disable 981 981 */ 982 - if (pipe_ctx->stream != NULL) 982 + if (pipe_ctx->stream != NULL && can_apply_seamless_boot) 983 983 continue; 984 - 985 - if (tg->funcs->is_tg_enabled(tg)) 986 - tg->funcs->lock(tg); 987 984 988 985 /* Blank controller using driver code instead of 989 986 * command table. 990 987 */ 991 988 if (tg->funcs->is_tg_enabled(tg)) { 989 + tg->funcs->lock(tg); 992 990 tg->funcs->set_blank(tg, true); 993 991 hwss_wait_for_blank_complete(tg); 994 992 } ··· 1852 1854 1853 1855 switch (top_pipe_ctx->plane_res.scl_data.format) { 1854 1856 case PIXEL_FORMAT_ARGB2101010: 1855 - if (top_pipe_ctx->stream->out_transfer_func->tf == TRANSFER_FUNCTION_UNITY) { 1857 + if (top_pipe_ctx->stream->out_transfer_func->tf == TRANSFER_FUNCTION_PQ) { 1856 1858 /* HDR10, ARGB2101010 - set boarder color to red */ 1857 1859 color->color_r_cr = color_value; 1858 1860 } ··· 1947 1949 plane_state->format, 1948 1950 EXPANSION_MODE_ZERO, 1949 1951 plane_state->input_csc_color_matrix, 1950 - COLOR_SPACE_YCBCR601_LIMITED); 1952 + plane_state->color_space); 1951 1953 1952 1954 //set scale and bias registers 1953 1955 build_prescale_params(&bns_params, plane_state); ··· 2067 2069 * divided by 2 2068 2070 */ 2069 2071 if (plane_state->update_flags.bits.full_update) { 2070 - bool should_divided_by_2 = context->bw.dcn.clk.dppclk_khz <= 2072 + bool should_divided_by_2 = context->bw_ctx.bw.dcn.clk.dppclk_khz <= 2071 2073 dc->res_pool->clk_mgr->clks.dispclk_khz / 2; 2072 2074 2073 2075 dpp->funcs->dpp_dppclk_control( ··· 2136 2138 if (pipe_ctx->stream->cursor_attributes.address.quad_part != 0) { 2137 2139 dc->hwss.set_cursor_position(pipe_ctx); 2138 2140 dc->hwss.set_cursor_attribute(pipe_ctx); 2141 + 2142 + if (dc->hwss.set_cursor_sdr_white_level) 2143 + dc->hwss.set_cursor_sdr_white_level(pipe_ctx); 2139 2144 } 2140 2145 2141 2146 if (plane_state->update_flags.bits.full_update) { ··· 2329 2328 int i; 2330 2329 struct timing_generator *tg; 2331 2330 bool removed_pipe[4] = { false }; 2331 + bool interdependent_update = false; 2332 2332 struct pipe_ctx *top_pipe_to_program = 2333 2333 find_top_pipe_for_stream(dc, context, stream); 2334 2334 DC_LOGGER_INIT(dc->ctx->logger); ··· 2339 2337 2340 2338 tg = top_pipe_to_program->stream_res.tg; 2341 2339 2342 - dcn10_pipe_control_lock(dc, top_pipe_to_program, true); 2340 + interdependent_update = top_pipe_to_program->plane_state && 2341 + top_pipe_to_program->plane_state->update_flags.bits.full_update; 2342 + 2343 + if (interdependent_update) 2344 + lock_all_pipes(dc, context, true); 2345 + else 2346 + dcn10_pipe_control_lock(dc, top_pipe_to_program, true); 2343 2347 2344 2348 if (num_planes == 0) { 2345 2349 /* OTG blank before remove all front end */ ··· 2365 2357 */ 2366 2358 if (pipe_ctx->plane_state && !old_pipe_ctx->plane_state) { 2367 2359 if (old_pipe_ctx->stream_res.tg == tg && 2368 - old_pipe_ctx->plane_res.hubp && 2369 - old_pipe_ctx->plane_res.hubp->opp_id != 0xf) { 2360 + old_pipe_ctx->plane_res.hubp && 2361 + old_pipe_ctx->plane_res.hubp->opp_id != 0xf) 2370 2362 dcn10_disable_plane(dc, old_pipe_ctx); 2371 - /* 2372 - * power down fe will unlock when calling reset, need 2373 - * to lock it back here. Messy, need rework. 2374 - */ 2375 - pipe_ctx->stream_res.tg->funcs->lock(pipe_ctx->stream_res.tg); 2376 - } 2377 2363 } 2378 2364 2379 2365 if ((!pipe_ctx->plane_state || ··· 2386 2384 if (num_planes > 0) 2387 2385 program_all_pipe_in_tree(dc, top_pipe_to_program, context); 2388 2386 2389 - dcn10_pipe_control_lock(dc, top_pipe_to_program, false); 2390 - 2391 - if (top_pipe_to_program->plane_state && 2392 - top_pipe_to_program->plane_state->update_flags.bits.full_update) 2387 + if (interdependent_update) 2393 2388 for (i = 0; i < dc->res_pool->pipe_count; i++) { 2394 2389 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; 2395 - tg = pipe_ctx->stream_res.tg; 2396 2390 /* Skip inactive pipes and ones already updated */ 2397 - if (!pipe_ctx->stream || pipe_ctx->stream == stream 2398 - || !pipe_ctx->plane_state 2399 - || !tg->funcs->is_tg_enabled(tg)) 2391 + if (!pipe_ctx->stream || pipe_ctx->stream == stream || 2392 + !pipe_ctx->plane_state || !tg->funcs->is_tg_enabled(tg)) 2400 2393 continue; 2401 - 2402 - tg->funcs->lock(tg); 2403 2394 2404 2395 pipe_ctx->plane_res.hubp->funcs->hubp_setup_interdependent( 2405 2396 pipe_ctx->plane_res.hubp, 2406 2397 &pipe_ctx->dlg_regs, 2407 2398 &pipe_ctx->ttu_regs); 2408 - 2409 - tg->funcs->unlock(tg); 2410 2399 } 2400 + 2401 + if (interdependent_update) 2402 + lock_all_pipes(dc, context, false); 2403 + else 2404 + dcn10_pipe_control_lock(dc, top_pipe_to_program, false); 2411 2405 2412 2406 if (num_planes == 0) 2413 2407 false_optc_underflow_wa(dc, stream, tg); ··· 2441 2443 2442 2444 if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) { 2443 2445 if (context->stream_count == 0) 2444 - context->bw.dcn.clk.phyclk_khz = 0; 2446 + context->bw_ctx.bw.dcn.clk.phyclk_khz = 0; 2445 2447 2446 2448 dc->res_pool->clk_mgr->funcs->update_clocks( 2447 2449 dc->res_pool->clk_mgr, ··· 2450 2452 } 2451 2453 2452 2454 hubbub1_program_watermarks(dc->res_pool->hubbub, 2453 - &context->bw.dcn.watermarks, 2455 + &context->bw_ctx.bw.dcn.watermarks, 2454 2456 dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000, 2455 2457 true); 2456 2458 dcn10_stereo_hw_frame_pack_wa(dc, context); ··· 2471 2473 2472 2474 if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) { 2473 2475 if (context->stream_count == 0) 2474 - context->bw.dcn.clk.phyclk_khz = 0; 2476 + context->bw_ctx.bw.dcn.clk.phyclk_khz = 0; 2475 2477 2476 2478 dc->res_pool->clk_mgr->funcs->update_clocks( 2477 2479 dc->res_pool->clk_mgr, ··· 2480 2482 } 2481 2483 2482 2484 hubbub1_program_watermarks(dc->res_pool->hubbub, 2483 - &context->bw.dcn.watermarks, 2485 + &context->bw_ctx.bw.dcn.watermarks, 2484 2486 dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000, 2485 2487 true); 2486 2488 dcn10_stereo_hw_frame_pack_wa(dc, context); ··· 2708 2710 .rotation = pipe_ctx->plane_state->rotation, 2709 2711 .mirror = pipe_ctx->plane_state->horizontal_mirror 2710 2712 }; 2713 + uint32_t x_plane = pipe_ctx->plane_state->dst_rect.x; 2714 + uint32_t y_plane = pipe_ctx->plane_state->dst_rect.y; 2715 + uint32_t x_offset = min(x_plane, pos_cpy.x); 2716 + uint32_t y_offset = min(y_plane, pos_cpy.y); 2711 2717 2712 - pos_cpy.x_hotspot += pipe_ctx->plane_state->dst_rect.x; 2713 - pos_cpy.y_hotspot += pipe_ctx->plane_state->dst_rect.y; 2718 + pos_cpy.x -= x_offset; 2719 + pos_cpy.y -= y_offset; 2720 + pos_cpy.x_hotspot += (x_plane - x_offset); 2721 + pos_cpy.y_hotspot += (y_plane - y_offset); 2714 2722 2715 2723 if (pipe_ctx->plane_state->address.type 2716 2724 == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE) ··· 2809 2805 optc->dlg_otg_param.vstartup_start + 1; 2810 2806 2811 2807 return vertical_line_start; 2808 + } 2809 + 2810 + void lock_all_pipes(struct dc *dc, 2811 + struct dc_state *context, 2812 + bool lock) 2813 + { 2814 + struct pipe_ctx *pipe_ctx; 2815 + struct timing_generator *tg; 2816 + int i; 2817 + 2818 + for (i = 0; i < dc->res_pool->pipe_count; i++) { 2819 + pipe_ctx = &context->res_ctx.pipe_ctx[i]; 2820 + tg = pipe_ctx->stream_res.tg; 2821 + /* 2822 + * Only lock the top pipe's tg to prevent redundant 2823 + * (un)locking. Also skip if pipe is disabled. 2824 + */ 2825 + if (pipe_ctx->top_pipe || 2826 + !pipe_ctx->stream || !pipe_ctx->plane_state || 2827 + !tg->funcs->is_tg_enabled(tg)) 2828 + continue; 2829 + 2830 + if (lock) 2831 + tg->funcs->lock(tg); 2832 + else 2833 + tg->funcs->unlock(tg); 2834 + } 2812 2835 } 2813 2836 2814 2837 static void calc_vupdate_position(
+4
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h
··· 83 83 84 84 int get_vupdate_offset_from_vsync(struct pipe_ctx *pipe_ctx); 85 85 86 + void lock_all_pipes(struct dc *dc, 87 + struct dc_state *context, 88 + bool lock); 89 + 86 90 #endif /* __DC_HWSS_DCN10_H__ */
+6 -6
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c
··· 472 472 chars_printed = snprintf_count(pBuf, bufSize, "dcfclk,dcfclk_deep_sleep,dispclk," 473 473 "dppclk,fclk,socclk\n" 474 474 "%d,%d,%d,%d,%d,%d\n", 475 - dc->current_state->bw.dcn.clk.dcfclk_khz, 476 - dc->current_state->bw.dcn.clk.dcfclk_deep_sleep_khz, 477 - dc->current_state->bw.dcn.clk.dispclk_khz, 478 - dc->current_state->bw.dcn.clk.dppclk_khz, 479 - dc->current_state->bw.dcn.clk.fclk_khz, 480 - dc->current_state->bw.dcn.clk.socclk_khz); 475 + dc->current_state->bw_ctx.bw.dcn.clk.dcfclk_khz, 476 + dc->current_state->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz, 477 + dc->current_state->bw_ctx.bw.dcn.clk.dispclk_khz, 478 + dc->current_state->bw_ctx.bw.dcn.clk.dppclk_khz, 479 + dc->current_state->bw_ctx.bw.dcn.clk.fclk_khz, 480 + dc->current_state->bw_ctx.bw.dcn.clk.socclk_khz); 481 481 482 482 remaining_buffer -= chars_printed; 483 483 pBuf += chars_printed;
+1 -1
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
··· 1146 1146 continue; 1147 1147 1148 1148 if (context->stream_status[i].plane_count > 2) 1149 - return false; 1149 + return DC_FAIL_UNSUPPORTED_1; 1150 1150 1151 1151 for (j = 0; j < context->stream_status[i].plane_count; j++) { 1152 1152 struct dc_plane_state *plane =
+1 -1
drivers/gpu/drm/amd/display/dc/inc/core_status.h
··· 43 43 DC_FAIL_BANDWIDTH_VALIDATE = 13, /* BW and Watermark validation */ 44 44 DC_FAIL_SCALING = 14, 45 45 DC_FAIL_DP_LINK_TRAINING = 15, 46 - 46 + DC_FAIL_UNSUPPORTED_1 = 18, 47 47 DC_ERROR_UNEXPECTED = -1 48 48 }; 49 49
+8 -4
drivers/gpu/drm/amd/display/dc/inc/core_types.h
··· 266 266 struct dcn_watermark_set watermarks; 267 267 }; 268 268 269 - union bw_context { 269 + union bw_output { 270 270 struct dcn_bw_output dcn; 271 271 struct dce_bw_output dce; 272 272 }; 273 273 274 + struct bw_context { 275 + union bw_output bw; 276 + struct display_mode_lib dml; 277 + }; 274 278 /** 275 279 * struct dc_state - The full description of a state requested by a user 276 280 * 277 281 * @streams: Stream properties 278 282 * @stream_status: The planes on a given stream 279 283 * @res_ctx: Persistent state of resources 280 - * @bw: The output from bandwidth and watermark calculations 284 + * @bw_ctx: The output from bandwidth and watermark calculations and the DML 281 285 * @pp_display_cfg: PowerPlay clocks and settings 282 286 * @dcn_bw_vars: non-stack memory to support bandwidth calculations 283 287 * ··· 293 289 294 290 struct resource_context res_ctx; 295 291 296 - union bw_context bw; 292 + struct bw_context bw_ctx; 297 293 298 294 /* Note: these are big structures, do *not* put on stack! */ 299 295 struct dm_pp_display_configuration pp_display_cfg; ··· 301 297 struct dcn_bw_internal_vars dcn_bw_vars; 302 298 #endif 303 299 304 - struct clk_mgr *dccg; 300 + struct clk_mgr *clk_mgr; 305 301 306 302 struct { 307 303 bool full_update_needed : 1;
+6 -1
drivers/gpu/drm/amd/display/dc/irq/dce110/irq_service_dce110.c
··· 81 81 .ack = NULL 82 82 }; 83 83 84 + static const struct irq_source_info_funcs vupdate_irq_info_funcs = { 85 + .set = NULL, 86 + .ack = NULL 87 + }; 88 + 84 89 #define hpd_int_entry(reg_num)\ 85 90 [DC_IRQ_SOURCE_HPD1 + reg_num] = {\ 86 91 .enable_reg = mmHPD ## reg_num ## _DC_HPD_INT_CONTROL,\ ··· 142 137 CRTC_V_UPDATE_INT_STATUS__CRTC_V_UPDATE_INT_CLEAR_MASK,\ 143 138 .ack_value =\ 144 139 CRTC_V_UPDATE_INT_STATUS__CRTC_V_UPDATE_INT_CLEAR_MASK,\ 145 - .funcs = &vblank_irq_info_funcs\ 140 + .funcs = &vupdate_irq_info_funcs\ 146 141 } 147 142 148 143 #define vblank_int_entry(reg_num)\
+6 -1
drivers/gpu/drm/amd/display/dc/irq/dce120/irq_service_dce120.c
··· 84 84 .ack = NULL 85 85 }; 86 86 87 + static const struct irq_source_info_funcs vupdate_irq_info_funcs = { 88 + .set = NULL, 89 + .ack = NULL 90 + }; 91 + 87 92 #define BASE_INNER(seg) \ 88 93 DCE_BASE__INST0_SEG ## seg 89 94 ··· 145 140 IRQ_REG_ENTRY(CRTC, reg_num,\ 146 141 CRTC_INTERRUPT_CONTROL, CRTC_V_UPDATE_INT_MSK,\ 147 142 CRTC_V_UPDATE_INT_STATUS, CRTC_V_UPDATE_INT_CLEAR),\ 148 - .funcs = &vblank_irq_info_funcs\ 143 + .funcs = &vupdate_irq_info_funcs\ 149 144 } 150 145 151 146 #define vblank_int_entry(reg_num)\
+5 -1
drivers/gpu/drm/amd/display/dc/irq/dce80/irq_service_dce80.c
··· 84 84 .ack = NULL 85 85 }; 86 86 87 + static const struct irq_source_info_funcs vupdate_irq_info_funcs = { 88 + .set = NULL, 89 + .ack = NULL 90 + }; 87 91 88 92 #define hpd_int_entry(reg_num)\ 89 93 [DC_IRQ_SOURCE_INVALID + reg_num] = {\ ··· 146 142 CRTC_V_UPDATE_INT_STATUS__CRTC_V_UPDATE_INT_CLEAR_MASK,\ 147 143 .ack_value =\ 148 144 CRTC_V_UPDATE_INT_STATUS__CRTC_V_UPDATE_INT_CLEAR_MASK,\ 149 - .funcs = &vblank_irq_info_funcs\ 145 + .funcs = &vupdate_irq_info_funcs\ 150 146 } 151 147 152 148 #define vblank_int_entry(reg_num)\
+30 -10
drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c
··· 56 56 return DC_IRQ_SOURCE_VBLANK5; 57 57 case DCN_1_0__SRCID__DC_D6_OTG_VSTARTUP: 58 58 return DC_IRQ_SOURCE_VBLANK6; 59 + case DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT: 60 + return DC_IRQ_SOURCE_VUPDATE1; 61 + case DCN_1_0__SRCID__OTG1_IHC_V_UPDATE_NO_LOCK_INTERRUPT: 62 + return DC_IRQ_SOURCE_VUPDATE2; 63 + case DCN_1_0__SRCID__OTG2_IHC_V_UPDATE_NO_LOCK_INTERRUPT: 64 + return DC_IRQ_SOURCE_VUPDATE3; 65 + case DCN_1_0__SRCID__OTG3_IHC_V_UPDATE_NO_LOCK_INTERRUPT: 66 + return DC_IRQ_SOURCE_VUPDATE4; 67 + case DCN_1_0__SRCID__OTG4_IHC_V_UPDATE_NO_LOCK_INTERRUPT: 68 + return DC_IRQ_SOURCE_VUPDATE5; 69 + case DCN_1_0__SRCID__OTG5_IHC_V_UPDATE_NO_LOCK_INTERRUPT: 70 + return DC_IRQ_SOURCE_VUPDATE6; 59 71 case DCN_1_0__SRCID__HUBP0_FLIP_INTERRUPT: 60 72 return DC_IRQ_SOURCE_PFLIP1; 61 73 case DCN_1_0__SRCID__HUBP1_FLIP_INTERRUPT: ··· 165 153 .ack = NULL 166 154 }; 167 155 156 + static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { 157 + .set = NULL, 158 + .ack = NULL 159 + }; 160 + 168 161 #define BASE_INNER(seg) \ 169 162 DCE_BASE__INST0_SEG ## seg 170 163 ··· 220 203 .funcs = &pflip_irq_info_funcs\ 221 204 } 222 205 223 - #define vupdate_int_entry(reg_num)\ 206 + /* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic 207 + * of DCE's DC_IRQ_SOURCE_VUPDATEx. 208 + */ 209 + #define vupdate_no_lock_int_entry(reg_num)\ 224 210 [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\ 225 211 IRQ_REG_ENTRY(OTG, reg_num,\ 226 - OTG_GLOBAL_SYNC_STATUS, VUPDATE_INT_EN,\ 227 - OTG_GLOBAL_SYNC_STATUS, VUPDATE_EVENT_CLEAR),\ 228 - .funcs = &vblank_irq_info_funcs\ 212 + OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_INT_EN,\ 213 + OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_EVENT_CLEAR),\ 214 + .funcs = &vupdate_no_lock_irq_info_funcs\ 229 215 } 230 216 231 217 #define vblank_int_entry(reg_num)\ ··· 335 315 dc_underflow_int_entry(6), 336 316 [DC_IRQ_SOURCE_DMCU_SCP] = dummy_irq_entry(), 337 317 [DC_IRQ_SOURCE_VBIOS_SW] = dummy_irq_entry(), 338 - vupdate_int_entry(0), 339 - vupdate_int_entry(1), 340 - vupdate_int_entry(2), 341 - vupdate_int_entry(3), 342 - vupdate_int_entry(4), 343 - vupdate_int_entry(5), 318 + vupdate_no_lock_int_entry(0), 319 + vupdate_no_lock_int_entry(1), 320 + vupdate_no_lock_int_entry(2), 321 + vupdate_no_lock_int_entry(3), 322 + vupdate_no_lock_int_entry(4), 323 + vupdate_no_lock_int_entry(5), 344 324 vblank_int_entry(0), 345 325 vblank_int_entry(1), 346 326 vblank_int_entry(2),
+2 -2
drivers/gpu/drm/amd/display/modules/power/power_helpers.c
··· 43 43 44 44 /* Possible ABM 2.2 Min Reduction configs from least aggressive to most aggressive 45 45 * 0 1 2 3 4 5 6 7 8 9 10 11 12 46 - * 100 100 100 100 100 100 100 90.2 85.1 80.0 80.0 75.3 75.3 % 46 + * 100 100 100 100 100 100 100 100 100 92.2 83.1 75.3 75.3 % 47 47 */ 48 48 static const unsigned char min_reduction_table_v_2_2[13] = { 49 - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe6, 0xd9, 0xcc, 0xcc, 0xc0, 0xc0}; 49 + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xeb, 0xd4, 0xc0, 0xc0}; 50 50 51 51 /* Possible ABM 2.2 Max Reduction configs from least aggressive to most aggressive 52 52 * 0 1 2 3 4 5 6 7 8 9 10 11 12
+5 -2
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
··· 97 97 return ret; 98 98 } 99 99 100 - int smu_update_table(struct smu_context *smu, uint32_t table_id, 100 + int smu_update_table_with_arg(struct smu_context *smu, uint16_t table_id, uint16_t exarg, 101 101 void *table_data, bool drv2smu) 102 102 { 103 103 struct smu_table_context *smu_table = &smu->smu_table; 104 104 struct smu_table *table = NULL; 105 105 int ret = 0; 106 + uint32_t table_index; 106 107 107 108 if (!table_data || table_id >= smu_table->table_count) 108 109 return -EINVAL; 110 + 111 + table_index = (exarg << 16) | table_id; 109 112 110 113 table = &smu_table->tables[table_id]; 111 114 ··· 126 123 ret = smu_send_smc_msg_with_param(smu, drv2smu ? 127 124 SMU_MSG_TransferTableDram2Smu : 128 125 SMU_MSG_TransferTableSmu2Dram, 129 - table_id); 126 + table_index); 130 127 if (ret) 131 128 return ret; 132 129
+21 -11
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
··· 77 77 #define PCIE_BUS_CLK 10000 78 78 #define TCLK (PCIE_BUS_CLK / 10) 79 79 80 - static const struct profile_mode_setting smu7_profiling[7] = 80 + static struct profile_mode_setting smu7_profiling[7] = 81 81 {{0, 0, 0, 0, 0, 0, 0, 0}, 82 82 {1, 0, 100, 30, 1, 0, 100, 10}, 83 83 {1, 10, 0, 30, 0, 0, 0, 0}, ··· 4984 4984 mode = input[size]; 4985 4985 switch (mode) { 4986 4986 case PP_SMC_POWER_PROFILE_CUSTOM: 4987 - if (size < 8) 4987 + if (size < 8 && size != 0) 4988 4988 return -EINVAL; 4989 - 4990 - tmp.bupdate_sclk = input[0]; 4991 - tmp.sclk_up_hyst = input[1]; 4992 - tmp.sclk_down_hyst = input[2]; 4993 - tmp.sclk_activity = input[3]; 4994 - tmp.bupdate_mclk = input[4]; 4995 - tmp.mclk_up_hyst = input[5]; 4996 - tmp.mclk_down_hyst = input[6]; 4997 - tmp.mclk_activity = input[7]; 4989 + /* If only CUSTOM is passed in, use the saved values. Check 4990 + * that we actually have a CUSTOM profile by ensuring that 4991 + * the "use sclk" or the "use mclk" bits are set 4992 + */ 4993 + tmp = smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM]; 4994 + if (size == 0) { 4995 + if (tmp.bupdate_sclk == 0 && tmp.bupdate_mclk == 0) 4996 + return -EINVAL; 4997 + } else { 4998 + tmp.bupdate_sclk = input[0]; 4999 + tmp.sclk_up_hyst = input[1]; 5000 + tmp.sclk_down_hyst = input[2]; 5001 + tmp.sclk_activity = input[3]; 5002 + tmp.bupdate_mclk = input[4]; 5003 + tmp.mclk_up_hyst = input[5]; 5004 + tmp.mclk_down_hyst = input[6]; 5005 + tmp.mclk_activity = input[7]; 5006 + smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM] = tmp; 5007 + } 4998 5008 if (!smum_update_dpm_settings(hwmgr, &tmp)) { 4999 5009 memcpy(&data->current_profile_setting, &tmp, sizeof(struct profile_mode_setting)); 5000 5010 hwmgr->power_profile_mode = mode;
+24 -4
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
··· 1427 1427 1428 1428 vega10_setup_default_pcie_table(hwmgr); 1429 1429 1430 + /* Zero out the saved copy of the CUSTOM profile 1431 + * This will be checked when trying to set the profile 1432 + * and will require that new values be passed in 1433 + */ 1434 + data->custom_profile_mode[0] = 0; 1435 + data->custom_profile_mode[1] = 0; 1436 + data->custom_profile_mode[2] = 0; 1437 + data->custom_profile_mode[3] = 0; 1438 + 1430 1439 /* save a copy of the default DPM table */ 1431 1440 memcpy(&(data->golden_dpm_table), &(data->dpm_table), 1432 1441 sizeof(struct vega10_dpm_table)); ··· 4915 4906 uint8_t min_active_level; 4916 4907 uint32_t power_profile_mode = input[size]; 4917 4908 4918 - smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask, 4919 - 1 << power_profile_mode); 4920 - 4921 4909 if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) { 4922 - if (size == 0 || size > 4) 4910 + if (size != 0 && size != 4) 4923 4911 return -EINVAL; 4912 + 4913 + /* If size = 0 and the CUSTOM profile has been set already 4914 + * then just apply the profile. The copy stored in the hwmgr 4915 + * is zeroed out on init 4916 + */ 4917 + if (size == 0) { 4918 + if (data->custom_profile_mode[0] != 0) 4919 + goto out; 4920 + else 4921 + return -EINVAL; 4922 + } 4924 4923 4925 4924 data->custom_profile_mode[0] = busy_set_point = input[0]; 4926 4925 data->custom_profile_mode[1] = FPS = input[1]; ··· 4940 4923 use_rlc_busy << 16 | min_active_level<<24); 4941 4924 } 4942 4925 4926 + out: 4927 + smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask, 4928 + 1 << power_profile_mode); 4943 4929 hwmgr->power_profile_mode = power_profile_mode; 4944 4930 4945 4931 return 0;
+15 -1
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
··· 427 427 hwmgr->platform_descriptor.clockStep.memoryClock = 500; 428 428 429 429 data->total_active_cus = adev->gfx.cu_info.number; 430 + data->is_custom_profile_set = false; 430 431 431 432 return 0; 432 433 } ··· 3828 3827 } 3829 3828 3830 3829 if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) { 3831 - if (size < 10) 3830 + struct vega20_hwmgr *data = 3831 + (struct vega20_hwmgr *)(hwmgr->backend); 3832 + if (size == 0 && !data->is_custom_profile_set) 3833 + return -EINVAL; 3834 + if (size < 10 && size != 0) 3832 3835 return -EINVAL; 3833 3836 3834 3837 result = vega20_get_activity_monitor_coeff(hwmgr, ··· 3841 3836 PP_ASSERT_WITH_CODE(!result, 3842 3837 "[SetPowerProfile] Failed to get activity monitor!", 3843 3838 return result); 3839 + 3840 + /* If size==0, then we want to apply the already-configured 3841 + * CUSTOM profile again. Just apply it, since we checked its 3842 + * validity above 3843 + */ 3844 + if (size == 0) 3845 + goto out; 3844 3846 3845 3847 switch (input[0]) { 3846 3848 case 0: /* Gfxclk */ ··· 3899 3887 result = vega20_set_activity_monitor_coeff(hwmgr, 3900 3888 (uint8_t *)(&activity_monitor), 3901 3889 WORKLOAD_PPLIB_CUSTOM_BIT); 3890 + data->is_custom_profile_set = true; 3902 3891 PP_ASSERT_WITH_CODE(!result, 3903 3892 "[SetPowerProfile] Failed to set activity monitor!", 3904 3893 return result); 3905 3894 } 3906 3895 3896 + out: 3907 3897 /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ 3908 3898 workload_type = 3909 3899 conv_power_profile_to_pplib_workload(power_profile_mode);
+2
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h
··· 530 530 bool pcie_parameters_override; 531 531 uint32_t pcie_gen_level1; 532 532 uint32_t pcie_width_level1; 533 + 534 + bool is_custom_profile_set; 533 535 }; 534 536 535 537 #define VEGA20_DPM2_NEAR_TDP_DEC 10
+4 -7
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
··· 524 524 struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges); 525 525 int (*set_od8_default_settings)(struct smu_context *smu, 526 526 bool initialize); 527 - int (*get_activity_monitor_coeff)(struct smu_context *smu, 528 - uint8_t *table, 529 - uint16_t workload_type); 530 - int (*set_activity_monitor_coeff)(struct smu_context *smu, 531 - uint8_t *table, 532 - uint16_t workload_type); 533 527 int (*conv_power_profile_to_pplib_workload)(int power_profile); 534 528 int (*get_power_profile_mode)(struct smu_context *smu, char *buf); 535 529 int (*set_power_profile_mode)(struct smu_context *smu, long *input, uint32_t size); ··· 739 745 extern int smu_feature_is_supported(struct smu_context *smu, int feature_id); 740 746 extern int smu_feature_set_supported(struct smu_context *smu, int feature_id, bool enable); 741 747 742 - int smu_update_table(struct smu_context *smu, uint32_t table_id, 748 + int smu_update_table_with_arg(struct smu_context *smu, uint16_t table_id, uint16_t exarg, 743 749 void *table_data, bool drv2smu); 750 + #define smu_update_table(smu, table_id, table_data, drv2smu) \ 751 + smu_update_table_with_arg((smu), (table_id), 0, (table_data), (drv2smu)) 752 + 744 753 bool is_support_sw_smu(struct amdgpu_device *adev); 745 754 int smu_reset(struct smu_context *smu); 746 755 int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
+7 -68
drivers/gpu/drm/amd/powerplay/smu_v11_0.c
··· 1460 1460 return 0; 1461 1461 } 1462 1462 1463 - static int smu_v11_0_set_activity_monitor_coeff(struct smu_context *smu, 1464 - uint8_t *table, uint16_t workload_type) 1465 - { 1466 - int ret = 0; 1467 - memcpy(smu->smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].cpu_addr, 1468 - table, smu->smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].size); 1469 - ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetDriverDramAddrHigh, 1470 - upper_32_bits(smu->smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].mc_address)); 1471 - if (ret) { 1472 - pr_err("[%s] Attempt to Set Dram Addr High Failed!", __func__); 1473 - return ret; 1474 - } 1475 - ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetDriverDramAddrLow, 1476 - lower_32_bits(smu->smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].mc_address)); 1477 - if (ret) { 1478 - pr_err("[%s] Attempt to Set Dram Addr Low Failed!", __func__); 1479 - return ret; 1480 - } 1481 - ret = smu_send_smc_msg_with_param(smu, SMU_MSG_TransferTableSmu2Dram, 1482 - TABLE_ACTIVITY_MONITOR_COEFF | (workload_type << 16)); 1483 - if (ret) { 1484 - pr_err("[%s] Attempt to Transfer Table From SMU Failed!", __func__); 1485 - return ret; 1486 - } 1487 - 1488 - return ret; 1489 - } 1490 - 1491 - static int smu_v11_0_get_activity_monitor_coeff(struct smu_context *smu, 1492 - uint8_t *table, uint16_t workload_type) 1493 - { 1494 - int ret = 0; 1495 - ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetDriverDramAddrHigh, 1496 - upper_32_bits(smu->smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].mc_address)); 1497 - if (ret) { 1498 - pr_err("[%s] Attempt to Set Dram Addr High Failed!", __func__); 1499 - return ret; 1500 - } 1501 - 1502 - ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetDriverDramAddrLow, 1503 - lower_32_bits(smu->smu_table.tables[TABLE_ACTIVITY_MONITOR_COEFF].mc_address)); 1504 - if (ret) { 1505 - pr_err("[%s] Attempt to Set Dram Addr Low Failed!", __func__); 1506 - return ret; 1507 - } 1508 - 1509 - ret = smu_send_smc_msg_with_param(smu, SMU_MSG_TransferTableSmu2Dram, 1510 - TABLE_ACTIVITY_MONITOR_COEFF | (workload_type << 16)); 1511 - if (ret) { 1512 - pr_err("[%s] Attempt to Transfer Table From SMU Failed!", __func__); 1513 - return ret; 1514 - } 1515 - 1516 - return ret; 1517 - } 1518 - 1519 1463 static int smu_v11_0_conv_power_profile_to_pplib_workload(int power_profile) 1520 1464 { 1521 1465 int pplib_workload = 0; ··· 1528 1584 for (i = 0; i <= PP_SMC_POWER_PROFILE_CUSTOM; i++) { 1529 1585 /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */ 1530 1586 workload_type = smu_v11_0_conv_power_profile_to_pplib_workload(i); 1531 - result = smu_v11_0_get_activity_monitor_coeff(smu, 1532 - (uint8_t *)(&activity_monitor), 1533 - workload_type); 1587 + result = smu_update_table_with_arg(smu, TABLE_ACTIVITY_MONITOR_COEFF, 1588 + workload_type, &activity_monitor, false); 1534 1589 if (result) { 1535 1590 pr_err("[%s] Failed to get activity monitor!", __func__); 1536 1591 return result; ··· 1601 1658 static int smu_v11_0_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size) 1602 1659 { 1603 1660 DpmActivityMonitorCoeffInt_t activity_monitor; 1604 - int workload_type, ret = 0; 1661 + int workload_type = 0, ret = 0; 1605 1662 1606 1663 smu->power_profile_mode = input[size]; 1607 1664 ··· 1611 1668 } 1612 1669 1613 1670 if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) { 1614 - ret = smu_v11_0_get_activity_monitor_coeff(smu, 1615 - (uint8_t *)(&activity_monitor), 1616 - WORKLOAD_PPLIB_CUSTOM_BIT); 1671 + ret = smu_update_table_with_arg(smu, TABLE_ACTIVITY_MONITOR_COEFF, 1672 + WORKLOAD_PPLIB_CUSTOM_BIT, &activity_monitor, false); 1617 1673 if (ret) { 1618 1674 pr_err("[%s] Failed to get activity monitor!", __func__); 1619 1675 return ret; ··· 1665 1723 break; 1666 1724 } 1667 1725 1668 - ret = smu_v11_0_set_activity_monitor_coeff(smu, 1669 - (uint8_t *)(&activity_monitor), 1670 - WORKLOAD_PPLIB_CUSTOM_BIT); 1726 + ret = smu_update_table_with_arg(smu, TABLE_ACTIVITY_MONITOR_COEFF, 1727 + WORKLOAD_PPLIB_COMPUTE_BIT, &activity_monitor, true); 1671 1728 if (ret) { 1672 1729 pr_err("[%s] Failed to set activity monitor!", __func__); 1673 1730 return ret; ··· 1935 1994 .get_sclk = smu_v11_0_dpm_get_sclk, 1936 1995 .get_mclk = smu_v11_0_dpm_get_mclk, 1937 1996 .set_od8_default_settings = smu_v11_0_set_od8_default_settings, 1938 - .get_activity_monitor_coeff = smu_v11_0_get_activity_monitor_coeff, 1939 - .set_activity_monitor_coeff = smu_v11_0_set_activity_monitor_coeff, 1940 1997 .conv_power_profile_to_pplib_workload = smu_v11_0_conv_power_profile_to_pplib_workload, 1941 1998 .get_power_profile_mode = smu_v11_0_get_power_profile_mode, 1942 1999 .set_power_profile_mode = smu_v11_0_set_power_profile_mode,