aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-11-30 18:15:57 -0500
committerDave Airlie <airlied@redhat.com>2017-11-30 18:15:57 -0500
commit503505bfea19b7d69e2572297e6defa0f9c2404e (patch)
treeb7c4d54fafe0caecddfbcd7271315063bd64b9c8
parent062076e861e3e2bf3cafc9313efa34fad7c827e5 (diff)
parent7fdf165a52505392eb059902b0df55e79a45c25f (diff)
Merge branch 'drm-fixes-4.15' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
Fixes for 4.15. Highlights: - DC fixes for S3, gamma, audio, pageflipping, etc. - fix a regression in radeon from kfd removal - fix a ttm regression with swiotlb disabled - misc other fixes * 'drm-fixes-4.15' of git://people.freedesktop.org/~agd5f/linux: (36 commits) drm/radeon: remove init of CIK VMIDs 8-16 for amdkfd drm/ttm: fix populate_and_map() functions once more drm/amd/display: USB-C / thunderbolt dock specific workaround drm/amd/display: Switch to drm_atomic_helper_wait_for_flip_done drm/amd/display: fix gamma setting drm/amd/display: Do not put drm_atomic_state on resume drm/amd/display: Fix couple more inconsistent NULL checks in dc_resource drm/amd/display: Fix potential NULL and mem leak in create_links drm/amd/display: Fix hubp check in set_cursor_position drm/amd/display: Fix use before NULL check in validate_timing drm/amd/display: Bunch of smatch error and warning fixes in DC drm/amd/display: Fix amdgpu_dm bugs found by smatch drm/amd/display: try to find matching audio inst for enc inst first drm/amd/display: fix seq issue: turn on clock before programming afmt. drm/amd/display: fix memory leaks on error exit return drm/amd/display: check plane state before validating fbc drm/amd/display: Do DC mode-change check when adding CRTCs drm/amd/display: Revert noisy assert messages drm/amd/display: fix split viewport rounding error drm/amd/display: Check aux channel before MST resume ...
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h18
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik.c111
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c16
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c2
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c31
-rw-r--r--drivers/gpu/drm/amd/display/dc/basics/log_helpers.c5
-rw-r--r--drivers/gpu/drm/amd/display/dc/bios/bios_parser.c4
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc.c15
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_link.c102
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c106
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_resource.c54
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_stream.c9
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_audio.c10
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c3
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c32
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c12
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c8
-rw-r--r--drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c6
-rw-r--r--drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c3
-rw-r--r--drivers/gpu/drm/amd/display/dc/inc/core_status.h2
-rw-r--r--drivers/gpu/drm/amd/display/dc/inc/hw/transform.h7
-rw-r--r--drivers/gpu/drm/radeon/cik.c24
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc.c2
-rw-r--r--include/drm/ttm/ttm_page_alloc.h32
30 files changed, 404 insertions, 230 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 5afaf6016b4a..0b14b5373783 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -717,7 +717,7 @@ int amdgpu_queue_mgr_fini(struct amdgpu_device *adev,
717 struct amdgpu_queue_mgr *mgr); 717 struct amdgpu_queue_mgr *mgr);
718int amdgpu_queue_mgr_map(struct amdgpu_device *adev, 718int amdgpu_queue_mgr_map(struct amdgpu_device *adev,
719 struct amdgpu_queue_mgr *mgr, 719 struct amdgpu_queue_mgr *mgr,
720 int hw_ip, int instance, int ring, 720 u32 hw_ip, u32 instance, u32 ring,
721 struct amdgpu_ring **out_ring); 721 struct amdgpu_ring **out_ring);
722 722
723/* 723/*
@@ -1572,18 +1572,14 @@ struct amdgpu_device {
1572 /* sdma */ 1572 /* sdma */
1573 struct amdgpu_sdma sdma; 1573 struct amdgpu_sdma sdma;
1574 1574
1575 union { 1575 /* uvd */
1576 struct { 1576 struct amdgpu_uvd uvd;
1577 /* uvd */
1578 struct amdgpu_uvd uvd;
1579 1577
1580 /* vce */ 1578 /* vce */
1581 struct amdgpu_vce vce; 1579 struct amdgpu_vce vce;
1582 };
1583 1580
1584 /* vcn */ 1581 /* vcn */
1585 struct amdgpu_vcn vcn; 1582 struct amdgpu_vcn vcn;
1586 };
1587 1583
1588 /* firmwares */ 1584 /* firmwares */
1589 struct amdgpu_firmware firmware; 1585 struct amdgpu_firmware firmware;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index a57cec737c18..57abf7abd7a9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -409,6 +409,10 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
409 if (candidate->robj == validated) 409 if (candidate->robj == validated)
410 break; 410 break;
411 411
412 /* We can't move pinned BOs here */
413 if (bo->pin_count)
414 continue;
415
412 other = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type); 416 other = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
413 417
414 /* Check if this BO is in one of the domains we need space for */ 418 /* Check if this BO is in one of the domains we need space for */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 2c574374d9b6..3573ecdb06ee 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1837,9 +1837,6 @@ static int amdgpu_fini(struct amdgpu_device *adev)
1837 adev->ip_blocks[i].status.hw = false; 1837 adev->ip_blocks[i].status.hw = false;
1838 } 1838 }
1839 1839
1840 if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
1841 amdgpu_ucode_fini_bo(adev);
1842
1843 for (i = adev->num_ip_blocks - 1; i >= 0; i--) { 1840 for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
1844 if (!adev->ip_blocks[i].status.sw) 1841 if (!adev->ip_blocks[i].status.sw)
1845 continue; 1842 continue;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index ec96bb1f9eaf..c2f414ffb2cc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -536,7 +536,7 @@ static const struct pci_device_id pciidlist[] = {
536 {0x1002, 0x686c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, 536 {0x1002, 0x686c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
537 {0x1002, 0x687f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, 537 {0x1002, 0x687f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10},
538 /* Raven */ 538 /* Raven */
539 {0x1002, 0x15dd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU|AMD_EXP_HW_SUPPORT}, 539 {0x1002, 0x15dd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RAVEN|AMD_IS_APU},
540 540
541 {0, 0, 0} 541 {0, 0, 0}
542}; 542};
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
index 033fba2def6f..5f5aa5fddc16 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
@@ -164,6 +164,9 @@ static int amdgpu_pp_hw_fini(void *handle)
164 ret = adev->powerplay.ip_funcs->hw_fini( 164 ret = adev->powerplay.ip_funcs->hw_fini(
165 adev->powerplay.pp_handle); 165 adev->powerplay.pp_handle);
166 166
167 if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
168 amdgpu_ucode_fini_bo(adev);
169
167 return ret; 170 return ret;
168} 171}
169 172
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 7714f4a6c8b0..447d446b5015 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -442,6 +442,8 @@ static int psp_hw_fini(void *handle)
442 if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) 442 if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
443 return 0; 443 return 0;
444 444
445 amdgpu_ucode_fini_bo(adev);
446
445 psp_ring_destroy(psp, PSP_RING_TYPE__KM); 447 psp_ring_destroy(psp, PSP_RING_TYPE__KM);
446 448
447 amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf); 449 amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c
index 190e28cb827e..93d86619e802 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c
@@ -63,7 +63,7 @@ static int amdgpu_update_cached_map(struct amdgpu_queue_mapper *mapper,
63 63
64static int amdgpu_identity_map(struct amdgpu_device *adev, 64static int amdgpu_identity_map(struct amdgpu_device *adev,
65 struct amdgpu_queue_mapper *mapper, 65 struct amdgpu_queue_mapper *mapper,
66 int ring, 66 u32 ring,
67 struct amdgpu_ring **out_ring) 67 struct amdgpu_ring **out_ring)
68{ 68{
69 switch (mapper->hw_ip) { 69 switch (mapper->hw_ip) {
@@ -121,7 +121,7 @@ static enum amdgpu_ring_type amdgpu_hw_ip_to_ring_type(int hw_ip)
121 121
122static int amdgpu_lru_map(struct amdgpu_device *adev, 122static int amdgpu_lru_map(struct amdgpu_device *adev,
123 struct amdgpu_queue_mapper *mapper, 123 struct amdgpu_queue_mapper *mapper,
124 int user_ring, bool lru_pipe_order, 124 u32 user_ring, bool lru_pipe_order,
125 struct amdgpu_ring **out_ring) 125 struct amdgpu_ring **out_ring)
126{ 126{
127 int r, i, j; 127 int r, i, j;
@@ -208,7 +208,7 @@ int amdgpu_queue_mgr_fini(struct amdgpu_device *adev,
208 */ 208 */
209int amdgpu_queue_mgr_map(struct amdgpu_device *adev, 209int amdgpu_queue_mgr_map(struct amdgpu_device *adev,
210 struct amdgpu_queue_mgr *mgr, 210 struct amdgpu_queue_mgr *mgr,
211 int hw_ip, int instance, int ring, 211 u32 hw_ip, u32 instance, u32 ring,
212 struct amdgpu_ring **out_ring) 212 struct amdgpu_ring **out_ring)
213{ 213{
214 int r, ip_num_rings; 214 int r, ip_num_rings;
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index 793b1470284d..a296f7bbe57c 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -1023,22 +1023,101 @@ static const struct amdgpu_allowed_register_entry cik_allowed_read_registers[] =
1023 {mmPA_SC_RASTER_CONFIG_1, true}, 1023 {mmPA_SC_RASTER_CONFIG_1, true},
1024}; 1024};
1025 1025
1026static uint32_t cik_read_indexed_register(struct amdgpu_device *adev, 1026
1027 u32 se_num, u32 sh_num, 1027static uint32_t cik_get_register_value(struct amdgpu_device *adev,
1028 u32 reg_offset) 1028 bool indexed, u32 se_num,
1029 u32 sh_num, u32 reg_offset)
1029{ 1030{
1030 uint32_t val; 1031 if (indexed) {
1032 uint32_t val;
1033 unsigned se_idx = (se_num == 0xffffffff) ? 0 : se_num;
1034 unsigned sh_idx = (sh_num == 0xffffffff) ? 0 : sh_num;
1035
1036 switch (reg_offset) {
1037 case mmCC_RB_BACKEND_DISABLE:
1038 return adev->gfx.config.rb_config[se_idx][sh_idx].rb_backend_disable;
1039 case mmGC_USER_RB_BACKEND_DISABLE:
1040 return adev->gfx.config.rb_config[se_idx][sh_idx].user_rb_backend_disable;
1041 case mmPA_SC_RASTER_CONFIG:
1042 return adev->gfx.config.rb_config[se_idx][sh_idx].raster_config;
1043 case mmPA_SC_RASTER_CONFIG_1:
1044 return adev->gfx.config.rb_config[se_idx][sh_idx].raster_config_1;
1045 }
1031 1046
1032 mutex_lock(&adev->grbm_idx_mutex); 1047 mutex_lock(&adev->grbm_idx_mutex);
1033 if (se_num != 0xffffffff || sh_num != 0xffffffff) 1048 if (se_num != 0xffffffff || sh_num != 0xffffffff)
1034 amdgpu_gfx_select_se_sh(adev, se_num, sh_num, 0xffffffff); 1049 amdgpu_gfx_select_se_sh(adev, se_num, sh_num, 0xffffffff);
1035 1050
1036 val = RREG32(reg_offset); 1051 val = RREG32(reg_offset);
1037 1052
1038 if (se_num != 0xffffffff || sh_num != 0xffffffff) 1053 if (se_num != 0xffffffff || sh_num != 0xffffffff)
1039 amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); 1054 amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
1040 mutex_unlock(&adev->grbm_idx_mutex); 1055 mutex_unlock(&adev->grbm_idx_mutex);
1041 return val; 1056 return val;
1057 } else {
1058 unsigned idx;
1059
1060 switch (reg_offset) {
1061 case mmGB_ADDR_CONFIG:
1062 return adev->gfx.config.gb_addr_config;
1063 case mmMC_ARB_RAMCFG:
1064 return adev->gfx.config.mc_arb_ramcfg;
1065 case mmGB_TILE_MODE0:
1066 case mmGB_TILE_MODE1:
1067 case mmGB_TILE_MODE2:
1068 case mmGB_TILE_MODE3:
1069 case mmGB_TILE_MODE4:
1070 case mmGB_TILE_MODE5:
1071 case mmGB_TILE_MODE6:
1072 case mmGB_TILE_MODE7:
1073 case mmGB_TILE_MODE8:
1074 case mmGB_TILE_MODE9:
1075 case mmGB_TILE_MODE10:
1076 case mmGB_TILE_MODE11:
1077 case mmGB_TILE_MODE12:
1078 case mmGB_TILE_MODE13:
1079 case mmGB_TILE_MODE14:
1080 case mmGB_TILE_MODE15:
1081 case mmGB_TILE_MODE16:
1082 case mmGB_TILE_MODE17:
1083 case mmGB_TILE_MODE18:
1084 case mmGB_TILE_MODE19:
1085 case mmGB_TILE_MODE20:
1086 case mmGB_TILE_MODE21:
1087 case mmGB_TILE_MODE22:
1088 case mmGB_TILE_MODE23:
1089 case mmGB_TILE_MODE24:
1090 case mmGB_TILE_MODE25:
1091 case mmGB_TILE_MODE26:
1092 case mmGB_TILE_MODE27:
1093 case mmGB_TILE_MODE28:
1094 case mmGB_TILE_MODE29:
1095 case mmGB_TILE_MODE30:
1096 case mmGB_TILE_MODE31:
1097 idx = (reg_offset - mmGB_TILE_MODE0);
1098 return adev->gfx.config.tile_mode_array[idx];
1099 case mmGB_MACROTILE_MODE0:
1100 case mmGB_MACROTILE_MODE1:
1101 case mmGB_MACROTILE_MODE2:
1102 case mmGB_MACROTILE_MODE3:
1103 case mmGB_MACROTILE_MODE4:
1104 case mmGB_MACROTILE_MODE5:
1105 case mmGB_MACROTILE_MODE6:
1106 case mmGB_MACROTILE_MODE7:
1107 case mmGB_MACROTILE_MODE8:
1108 case mmGB_MACROTILE_MODE9:
1109 case mmGB_MACROTILE_MODE10:
1110 case mmGB_MACROTILE_MODE11:
1111 case mmGB_MACROTILE_MODE12:
1112 case mmGB_MACROTILE_MODE13:
1113 case mmGB_MACROTILE_MODE14:
1114 case mmGB_MACROTILE_MODE15:
1115 idx = (reg_offset - mmGB_MACROTILE_MODE0);
1116 return adev->gfx.config.macrotile_mode_array[idx];
1117 default:
1118 return RREG32(reg_offset);
1119 }
1120 }
1042} 1121}
1043 1122
1044static int cik_read_register(struct amdgpu_device *adev, u32 se_num, 1123static int cik_read_register(struct amdgpu_device *adev, u32 se_num,
@@ -1048,13 +1127,13 @@ static int cik_read_register(struct amdgpu_device *adev, u32 se_num,
1048 1127
1049 *value = 0; 1128 *value = 0;
1050 for (i = 0; i < ARRAY_SIZE(cik_allowed_read_registers); i++) { 1129 for (i = 0; i < ARRAY_SIZE(cik_allowed_read_registers); i++) {
1130 bool indexed = cik_allowed_read_registers[i].grbm_indexed;
1131
1051 if (reg_offset != cik_allowed_read_registers[i].reg_offset) 1132 if (reg_offset != cik_allowed_read_registers[i].reg_offset)
1052 continue; 1133 continue;
1053 1134
1054 *value = cik_allowed_read_registers[i].grbm_indexed ? 1135 *value = cik_get_register_value(adev, indexed, se_num, sh_num,
1055 cik_read_indexed_register(adev, se_num, 1136 reg_offset);
1056 sh_num, reg_offset) :
1057 RREG32(reg_offset);
1058 return 0; 1137 return 0;
1059 } 1138 }
1060 return -EINVAL; 1139 return -EINVAL;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 5c8a7a48a4ad..419ba0ce7ee5 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -1819,6 +1819,22 @@ static void gfx_v7_0_setup_rb(struct amdgpu_device *adev)
1819 adev->gfx.config.backend_enable_mask, 1819 adev->gfx.config.backend_enable_mask,
1820 num_rb_pipes); 1820 num_rb_pipes);
1821 } 1821 }
1822
1823 /* cache the values for userspace */
1824 for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
1825 for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
1826 gfx_v7_0_select_se_sh(adev, i, j, 0xffffffff);
1827 adev->gfx.config.rb_config[i][j].rb_backend_disable =
1828 RREG32(mmCC_RB_BACKEND_DISABLE);
1829 adev->gfx.config.rb_config[i][j].user_rb_backend_disable =
1830 RREG32(mmGC_USER_RB_BACKEND_DISABLE);
1831 adev->gfx.config.rb_config[i][j].raster_config =
1832 RREG32(mmPA_SC_RASTER_CONFIG);
1833 adev->gfx.config.rb_config[i][j].raster_config_1 =
1834 RREG32(mmPA_SC_RASTER_CONFIG_1);
1835 }
1836 }
1837 gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
1822 mutex_unlock(&adev->grbm_idx_mutex); 1838 mutex_unlock(&adev->grbm_idx_mutex);
1823} 1839}
1824 1840
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
index 1eb4d79d6e30..0450ac5ba6b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
@@ -1175,7 +1175,7 @@ static const struct amdgpu_irq_src_funcs vcn_v1_0_irq_funcs = {
1175 1175
1176static void vcn_v1_0_set_irq_funcs(struct amdgpu_device *adev) 1176static void vcn_v1_0_set_irq_funcs(struct amdgpu_device *adev)
1177{ 1177{
1178 adev->uvd.irq.num_types = adev->vcn.num_enc_rings + 1; 1178 adev->vcn.irq.num_types = adev->vcn.num_enc_rings + 1;
1179 adev->vcn.irq.funcs = &vcn_v1_0_irq_funcs; 1179 adev->vcn.irq.funcs = &vcn_v1_0_irq_funcs;
1180} 1180}
1181 1181
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 889ed24084e8..f71fe6d2ddda 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -520,7 +520,8 @@ static int detect_mst_link_for_all_connectors(struct drm_device *dev)
520 520
521 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 521 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
522 aconnector = to_amdgpu_dm_connector(connector); 522 aconnector = to_amdgpu_dm_connector(connector);
523 if (aconnector->dc_link->type == dc_connection_mst_branch) { 523 if (aconnector->dc_link->type == dc_connection_mst_branch &&
524 aconnector->mst_mgr.aux) {
524 DRM_DEBUG_DRIVER("DM_MST: starting TM on aconnector: %p [id: %d]\n", 525 DRM_DEBUG_DRIVER("DM_MST: starting TM on aconnector: %p [id: %d]\n",
525 aconnector, aconnector->base.base.id); 526 aconnector, aconnector->base.base.id);
526 527
@@ -677,6 +678,10 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev)
677 678
678 mutex_lock(&aconnector->hpd_lock); 679 mutex_lock(&aconnector->hpd_lock);
679 dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD); 680 dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD);
681
682 if (aconnector->fake_enable && aconnector->dc_link->local_sink)
683 aconnector->fake_enable = false;
684
680 aconnector->dc_sink = NULL; 685 aconnector->dc_sink = NULL;
681 amdgpu_dm_update_connector_after_detect(aconnector); 686 amdgpu_dm_update_connector_after_detect(aconnector);
682 mutex_unlock(&aconnector->hpd_lock); 687 mutex_unlock(&aconnector->hpd_lock);
@@ -711,7 +716,6 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev)
711 716
712 ret = drm_atomic_helper_resume(ddev, adev->dm.cached_state); 717 ret = drm_atomic_helper_resume(ddev, adev->dm.cached_state);
713 718
714 drm_atomic_state_put(adev->dm.cached_state);
715 adev->dm.cached_state = NULL; 719 adev->dm.cached_state = NULL;
716 720
717 amdgpu_dm_irq_resume_late(adev); 721 amdgpu_dm_irq_resume_late(adev);
@@ -2704,7 +2708,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
2704 .link = aconnector->dc_link, 2708 .link = aconnector->dc_link,
2705 .sink_signal = SIGNAL_TYPE_VIRTUAL 2709 .sink_signal = SIGNAL_TYPE_VIRTUAL
2706 }; 2710 };
2707 struct edid *edid = (struct edid *) aconnector->base.edid_blob_ptr->data; 2711 struct edid *edid;
2708 2712
2709 if (!aconnector->base.edid_blob_ptr || 2713 if (!aconnector->base.edid_blob_ptr ||
2710 !aconnector->base.edid_blob_ptr->data) { 2714 !aconnector->base.edid_blob_ptr->data) {
@@ -2716,6 +2720,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
2716 return; 2720 return;
2717 } 2721 }
2718 2722
2723 edid = (struct edid *) aconnector->base.edid_blob_ptr->data;
2724
2719 aconnector->edid = edid; 2725 aconnector->edid = edid;
2720 2726
2721 aconnector->dc_em_sink = dc_link_add_remote_sink( 2727 aconnector->dc_em_sink = dc_link_add_remote_sink(
@@ -4193,13 +4199,13 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
4193 update_stream_scaling_settings(&dm_new_con_state->base.crtc->mode, 4199 update_stream_scaling_settings(&dm_new_con_state->base.crtc->mode,
4194 dm_new_con_state, (struct dc_stream_state *)dm_new_crtc_state->stream); 4200 dm_new_con_state, (struct dc_stream_state *)dm_new_crtc_state->stream);
4195 4201
4202 if (!dm_new_crtc_state->stream)
4203 continue;
4204
4196 status = dc_stream_get_status(dm_new_crtc_state->stream); 4205 status = dc_stream_get_status(dm_new_crtc_state->stream);
4197 WARN_ON(!status); 4206 WARN_ON(!status);
4198 WARN_ON(!status->plane_count); 4207 WARN_ON(!status->plane_count);
4199 4208
4200 if (!dm_new_crtc_state->stream)
4201 continue;
4202
4203 /*TODO How it works with MPO ?*/ 4209 /*TODO How it works with MPO ?*/
4204 if (!dc_commit_planes_to_stream( 4210 if (!dc_commit_planes_to_stream(
4205 dm->dc, 4211 dm->dc,
@@ -4253,7 +4259,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
4253 drm_atomic_helper_commit_hw_done(state); 4259 drm_atomic_helper_commit_hw_done(state);
4254 4260
4255 if (wait_for_vblank) 4261 if (wait_for_vblank)
4256 drm_atomic_helper_wait_for_vblanks(dev, state); 4262 drm_atomic_helper_wait_for_flip_done(dev, state);
4257 4263
4258 drm_atomic_helper_cleanup_planes(dev, state); 4264 drm_atomic_helper_cleanup_planes(dev, state);
4259} 4265}
@@ -4332,9 +4338,11 @@ void dm_restore_drm_connector_state(struct drm_device *dev,
4332 return; 4338 return;
4333 4339
4334 disconnected_acrtc = to_amdgpu_crtc(connector->encoder->crtc); 4340 disconnected_acrtc = to_amdgpu_crtc(connector->encoder->crtc);
4335 acrtc_state = to_dm_crtc_state(disconnected_acrtc->base.state); 4341 if (!disconnected_acrtc)
4342 return;
4336 4343
4337 if (!disconnected_acrtc || !acrtc_state->stream) 4344 acrtc_state = to_dm_crtc_state(disconnected_acrtc->base.state);
4345 if (!acrtc_state->stream)
4338 return; 4346 return;
4339 4347
4340 /* 4348 /*
@@ -4455,7 +4463,7 @@ static int dm_update_crtcs_state(struct dc *dc,
4455 } 4463 }
4456 } 4464 }
4457 4465
4458 if (dc_is_stream_unchanged(new_stream, dm_old_crtc_state->stream) && 4466 if (enable && dc_is_stream_unchanged(new_stream, dm_old_crtc_state->stream) &&
4459 dc_is_stream_scaling_unchanged(new_stream, dm_old_crtc_state->stream)) { 4467 dc_is_stream_scaling_unchanged(new_stream, dm_old_crtc_state->stream)) {
4460 4468
4461 new_crtc_state->mode_changed = false; 4469 new_crtc_state->mode_changed = false;
@@ -4709,7 +4717,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
4709 } 4717 }
4710 } else { 4718 } else {
4711 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { 4719 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
4712 if (!drm_atomic_crtc_needs_modeset(new_crtc_state)) 4720 if (!drm_atomic_crtc_needs_modeset(new_crtc_state) &&
4721 !new_crtc_state->color_mgmt_changed)
4713 continue; 4722 continue;
4714 4723
4715 if (!new_crtc_state->enable) 4724 if (!new_crtc_state->enable)
diff --git a/drivers/gpu/drm/amd/display/dc/basics/log_helpers.c b/drivers/gpu/drm/amd/display/dc/basics/log_helpers.c
index 785b943b60ed..6e43168fbdd6 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/log_helpers.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/log_helpers.c
@@ -75,6 +75,9 @@ void dc_conn_log(struct dc_context *ctx,
75 if (signal == signal_type_info_tbl[i].type) 75 if (signal == signal_type_info_tbl[i].type)
76 break; 76 break;
77 77
78 if (i == NUM_ELEMENTS(signal_type_info_tbl))
79 goto fail;
80
78 dm_logger_append(&entry, "[%s][ConnIdx:%d] ", 81 dm_logger_append(&entry, "[%s][ConnIdx:%d] ",
79 signal_type_info_tbl[i].name, 82 signal_type_info_tbl[i].name,
80 link->link_index); 83 link->link_index);
@@ -96,6 +99,8 @@ void dc_conn_log(struct dc_context *ctx,
96 99
97 dm_logger_append(&entry, "^\n"); 100 dm_logger_append(&entry, "^\n");
98 dm_helpers_dc_conn_log(ctx, &entry, event); 101 dm_helpers_dc_conn_log(ctx, &entry, event);
102
103fail:
99 dm_logger_close(&entry); 104 dm_logger_close(&entry);
100 105
101 va_end(args); 106 va_end(args);
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
index aaaebd06d7ee..86e6438c5cf3 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
@@ -249,7 +249,7 @@ static enum bp_result bios_parser_get_dst_obj(struct dc_bios *dcb,
249 struct graphics_object_id *dest_object_id) 249 struct graphics_object_id *dest_object_id)
250{ 250{
251 uint32_t number; 251 uint32_t number;
252 uint16_t *id; 252 uint16_t *id = NULL;
253 ATOM_OBJECT *object; 253 ATOM_OBJECT *object;
254 struct bios_parser *bp = BP_FROM_DCB(dcb); 254 struct bios_parser *bp = BP_FROM_DCB(dcb);
255 255
@@ -260,7 +260,7 @@ static enum bp_result bios_parser_get_dst_obj(struct dc_bios *dcb,
260 260
261 number = get_dest_obj_list(bp, object, &id); 261 number = get_dest_obj_list(bp, object, &id);
262 262
263 if (number <= index) 263 if (number <= index || !id)
264 return BP_RESULT_BADINPUT; 264 return BP_RESULT_BADINPUT;
265 265
266 *dest_object_id = object_id_from_bios_object_id(id[index]); 266 *dest_object_id = object_id_from_bios_object_id(id[index]);
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index fe63f5894d43..7240db2e6f09 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -121,6 +121,10 @@ static bool create_links(
121 goto failed_alloc; 121 goto failed_alloc;
122 } 122 }
123 123
124 link->link_index = dc->link_count;
125 dc->links[dc->link_count] = link;
126 dc->link_count++;
127
124 link->ctx = dc->ctx; 128 link->ctx = dc->ctx;
125 link->dc = dc; 129 link->dc = dc;
126 link->connector_signal = SIGNAL_TYPE_VIRTUAL; 130 link->connector_signal = SIGNAL_TYPE_VIRTUAL;
@@ -129,6 +133,13 @@ static bool create_links(
129 link->link_id.enum_id = ENUM_ID_1; 133 link->link_id.enum_id = ENUM_ID_1;
130 link->link_enc = kzalloc(sizeof(*link->link_enc), GFP_KERNEL); 134 link->link_enc = kzalloc(sizeof(*link->link_enc), GFP_KERNEL);
131 135
136 if (!link->link_enc) {
137 BREAK_TO_DEBUGGER();
138 goto failed_alloc;
139 }
140
141 link->link_status.dpcd_caps = &link->dpcd_caps;
142
132 enc_init.ctx = dc->ctx; 143 enc_init.ctx = dc->ctx;
133 enc_init.channel = CHANNEL_ID_UNKNOWN; 144 enc_init.channel = CHANNEL_ID_UNKNOWN;
134 enc_init.hpd_source = HPD_SOURCEID_UNKNOWN; 145 enc_init.hpd_source = HPD_SOURCEID_UNKNOWN;
@@ -138,10 +149,6 @@ static bool create_links(
138 enc_init.encoder.id = ENCODER_ID_INTERNAL_VIRTUAL; 149 enc_init.encoder.id = ENCODER_ID_INTERNAL_VIRTUAL;
139 enc_init.encoder.enum_id = ENUM_ID_1; 150 enc_init.encoder.enum_id = ENUM_ID_1;
140 virtual_link_encoder_construct(link->link_enc, &enc_init); 151 virtual_link_encoder_construct(link->link_enc, &enc_init);
141
142 link->link_index = dc->link_count;
143 dc->links[dc->link_count] = link;
144 dc->link_count++;
145 } 152 }
146 153
147 return true; 154 return true;
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 0602610489d7..e27ed4a45265 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -480,22 +480,6 @@ static void detect_dp(
480 sink_caps->signal = SIGNAL_TYPE_DISPLAY_PORT; 480 sink_caps->signal = SIGNAL_TYPE_DISPLAY_PORT;
481 detect_dp_sink_caps(link); 481 detect_dp_sink_caps(link);
482 482
483 /* DP active dongles */
484 if (is_dp_active_dongle(link)) {
485 link->type = dc_connection_active_dongle;
486 if (!link->dpcd_caps.sink_count.bits.SINK_COUNT) {
487 /*
488 * active dongle unplug processing for short irq
489 */
490 link_disconnect_sink(link);
491 return;
492 }
493
494 if (link->dpcd_caps.dongle_type !=
495 DISPLAY_DONGLE_DP_HDMI_CONVERTER) {
496 *converter_disable_audio = true;
497 }
498 }
499 if (is_mst_supported(link)) { 483 if (is_mst_supported(link)) {
500 sink_caps->signal = SIGNAL_TYPE_DISPLAY_PORT_MST; 484 sink_caps->signal = SIGNAL_TYPE_DISPLAY_PORT_MST;
501 link->type = dc_connection_mst_branch; 485 link->type = dc_connection_mst_branch;
@@ -535,6 +519,22 @@ static void detect_dp(
535 sink_caps->signal = SIGNAL_TYPE_DISPLAY_PORT; 519 sink_caps->signal = SIGNAL_TYPE_DISPLAY_PORT;
536 } 520 }
537 } 521 }
522
523 if (link->type != dc_connection_mst_branch &&
524 is_dp_active_dongle(link)) {
525 /* DP active dongles */
526 link->type = dc_connection_active_dongle;
527 if (!link->dpcd_caps.sink_count.bits.SINK_COUNT) {
528 /*
529 * active dongle unplug processing for short irq
530 */
531 link_disconnect_sink(link);
532 return;
533 }
534
535 if (link->dpcd_caps.dongle_type != DISPLAY_DONGLE_DP_HDMI_CONVERTER)
536 *converter_disable_audio = true;
537 }
538 } else { 538 } else {
539 /* DP passive dongles */ 539 /* DP passive dongles */
540 sink_caps->signal = dp_passive_dongle_detection(link->ddc, 540 sink_caps->signal = dp_passive_dongle_detection(link->ddc,
@@ -1801,12 +1801,75 @@ static void disable_link(struct dc_link *link, enum signal_type signal)
1801 link->link_enc->funcs->disable_output(link->link_enc, signal, link); 1801 link->link_enc->funcs->disable_output(link->link_enc, signal, link);
1802} 1802}
1803 1803
1804bool dp_active_dongle_validate_timing(
1805 const struct dc_crtc_timing *timing,
1806 const struct dc_dongle_caps *dongle_caps)
1807{
1808 unsigned int required_pix_clk = timing->pix_clk_khz;
1809
1810 if (dongle_caps->dongle_type != DISPLAY_DONGLE_DP_HDMI_CONVERTER ||
1811 dongle_caps->extendedCapValid == false)
1812 return true;
1813
1814 /* Check Pixel Encoding */
1815 switch (timing->pixel_encoding) {
1816 case PIXEL_ENCODING_RGB:
1817 case PIXEL_ENCODING_YCBCR444:
1818 break;
1819 case PIXEL_ENCODING_YCBCR422:
1820 if (!dongle_caps->is_dp_hdmi_ycbcr422_pass_through)
1821 return false;
1822 break;
1823 case PIXEL_ENCODING_YCBCR420:
1824 if (!dongle_caps->is_dp_hdmi_ycbcr420_pass_through)
1825 return false;
1826 break;
1827 default:
1828 /* Invalid Pixel Encoding*/
1829 return false;
1830 }
1831
1832
1833 /* Check Color Depth and Pixel Clock */
1834 if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420)
1835 required_pix_clk /= 2;
1836
1837 switch (timing->display_color_depth) {
1838 case COLOR_DEPTH_666:
1839 case COLOR_DEPTH_888:
1840 /*888 and 666 should always be supported*/
1841 break;
1842 case COLOR_DEPTH_101010:
1843 if (dongle_caps->dp_hdmi_max_bpc < 10)
1844 return false;
1845 required_pix_clk = required_pix_clk * 10 / 8;
1846 break;
1847 case COLOR_DEPTH_121212:
1848 if (dongle_caps->dp_hdmi_max_bpc < 12)
1849 return false;
1850 required_pix_clk = required_pix_clk * 12 / 8;
1851 break;
1852
1853 case COLOR_DEPTH_141414:
1854 case COLOR_DEPTH_161616:
1855 default:
1856 /* These color depths are currently not supported */
1857 return false;
1858 }
1859
1860 if (required_pix_clk > dongle_caps->dp_hdmi_max_pixel_clk)
1861 return false;
1862
1863 return true;
1864}
1865
1804enum dc_status dc_link_validate_mode_timing( 1866enum dc_status dc_link_validate_mode_timing(
1805 const struct dc_stream_state *stream, 1867 const struct dc_stream_state *stream,
1806 struct dc_link *link, 1868 struct dc_link *link,
1807 const struct dc_crtc_timing *timing) 1869 const struct dc_crtc_timing *timing)
1808{ 1870{
1809 uint32_t max_pix_clk = stream->sink->dongle_max_pix_clk; 1871 uint32_t max_pix_clk = stream->sink->dongle_max_pix_clk;
1872 struct dc_dongle_caps *dongle_caps = &link->link_status.dpcd_caps->dongle_caps;
1810 1873
1811 /* A hack to avoid failing any modes for EDID override feature on 1874 /* A hack to avoid failing any modes for EDID override feature on
1812 * topology change such as lower quality cable for DP or different dongle 1875 * topology change such as lower quality cable for DP or different dongle
@@ -1814,8 +1877,13 @@ enum dc_status dc_link_validate_mode_timing(
1814 if (link->remote_sinks[0]) 1877 if (link->remote_sinks[0])
1815 return DC_OK; 1878 return DC_OK;
1816 1879
1880 /* Passive Dongle */
1817 if (0 != max_pix_clk && timing->pix_clk_khz > max_pix_clk) 1881 if (0 != max_pix_clk && timing->pix_clk_khz > max_pix_clk)
1818 return DC_EXCEED_DONGLE_MAX_CLK; 1882 return DC_EXCEED_DONGLE_CAP;
1883
1884 /* Active Dongle*/
1885 if (!dp_active_dongle_validate_timing(timing, dongle_caps))
1886 return DC_EXCEED_DONGLE_CAP;
1819 1887
1820 switch (stream->signal) { 1888 switch (stream->signal) {
1821 case SIGNAL_TYPE_EDP: 1889 case SIGNAL_TYPE_EDP:
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index ced42484dcfc..e6bf05d76a94 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -1512,7 +1512,7 @@ static bool hpd_rx_irq_check_link_loss_status(
1512 struct dc_link *link, 1512 struct dc_link *link,
1513 union hpd_irq_data *hpd_irq_dpcd_data) 1513 union hpd_irq_data *hpd_irq_dpcd_data)
1514{ 1514{
1515 uint8_t irq_reg_rx_power_state; 1515 uint8_t irq_reg_rx_power_state = 0;
1516 enum dc_status dpcd_result = DC_ERROR_UNEXPECTED; 1516 enum dc_status dpcd_result = DC_ERROR_UNEXPECTED;
1517 union lane_status lane_status; 1517 union lane_status lane_status;
1518 uint32_t lane; 1518 uint32_t lane;
@@ -1524,60 +1524,55 @@ static bool hpd_rx_irq_check_link_loss_status(
1524 1524
1525 if (link->cur_link_settings.lane_count == 0) 1525 if (link->cur_link_settings.lane_count == 0)
1526 return return_code; 1526 return return_code;
1527 /*1. Check that we can handle interrupt: Not in FS DOS,
1528 * Not in "Display Timeout" state, Link is trained.
1529 */
1530 1527
1531 dpcd_result = core_link_read_dpcd(link, 1528 /*1. Check that Link Status changed, before re-training.*/
1532 DP_SET_POWER,
1533 &irq_reg_rx_power_state,
1534 sizeof(irq_reg_rx_power_state));
1535 1529
1536 if (dpcd_result != DC_OK) { 1530 /*parse lane status*/
1537 irq_reg_rx_power_state = DP_SET_POWER_D0; 1531 for (lane = 0; lane < link->cur_link_settings.lane_count; lane++) {
1538 dm_logger_write(link->ctx->logger, LOG_HW_HPD_IRQ, 1532 /* check status of lanes 0,1
1539 "%s: DPCD read failed to obtain power state.\n", 1533 * changed DpcdAddress_Lane01Status (0x202)
1540 __func__); 1534 */
1535 lane_status.raw = get_nibble_at_index(
1536 &hpd_irq_dpcd_data->bytes.lane01_status.raw,
1537 lane);
1538
1539 if (!lane_status.bits.CHANNEL_EQ_DONE_0 ||
1540 !lane_status.bits.CR_DONE_0 ||
1541 !lane_status.bits.SYMBOL_LOCKED_0) {
1542 /* if one of the channel equalization, clock
1543 * recovery or symbol lock is dropped
1544 * consider it as (link has been
1545 * dropped) dp sink status has changed
1546 */
1547 sink_status_changed = true;
1548 break;
1549 }
1541 } 1550 }
1542 1551
1543 if (irq_reg_rx_power_state == DP_SET_POWER_D0) { 1552 /* Check interlane align.*/
1544 1553 if (sink_status_changed ||
1545 /*2. Check that Link Status changed, before re-training.*/ 1554 !hpd_irq_dpcd_data->bytes.lane_status_updated.bits.INTERLANE_ALIGN_DONE) {
1546
1547 /*parse lane status*/
1548 for (lane = 0;
1549 lane < link->cur_link_settings.lane_count;
1550 lane++) {
1551 1555
1552 /* check status of lanes 0,1 1556 dm_logger_write(link->ctx->logger, LOG_HW_HPD_IRQ,
1553 * changed DpcdAddress_Lane01Status (0x202)*/ 1557 "%s: Link Status changed.\n", __func__);
1554 lane_status.raw = get_nibble_at_index(
1555 &hpd_irq_dpcd_data->bytes.lane01_status.raw,
1556 lane);
1557
1558 if (!lane_status.bits.CHANNEL_EQ_DONE_0 ||
1559 !lane_status.bits.CR_DONE_0 ||
1560 !lane_status.bits.SYMBOL_LOCKED_0) {
1561 /* if one of the channel equalization, clock
1562 * recovery or symbol lock is dropped
1563 * consider it as (link has been
1564 * dropped) dp sink status has changed*/
1565 sink_status_changed = true;
1566 break;
1567 }
1568 1558
1569 } 1559 return_code = true;
1570 1560
1571 /* Check interlane align.*/ 1561 /*2. Check that we can handle interrupt: Not in FS DOS,
1572 if (sink_status_changed || 1562 * Not in "Display Timeout" state, Link is trained.
1573 !hpd_irq_dpcd_data->bytes.lane_status_updated.bits. 1563 */
1574 INTERLANE_ALIGN_DONE) { 1564 dpcd_result = core_link_read_dpcd(link,
1565 DP_SET_POWER,
1566 &irq_reg_rx_power_state,
1567 sizeof(irq_reg_rx_power_state));
1575 1568
1569 if (dpcd_result != DC_OK) {
1576 dm_logger_write(link->ctx->logger, LOG_HW_HPD_IRQ, 1570 dm_logger_write(link->ctx->logger, LOG_HW_HPD_IRQ,
1577 "%s: Link Status changed.\n", 1571 "%s: DPCD read failed to obtain power state.\n",
1578 __func__); 1572 __func__);
1579 1573 } else {
1580 return_code = true; 1574 if (irq_reg_rx_power_state != DP_SET_POWER_D0)
1575 return_code = false;
1581 } 1576 }
1582 } 1577 }
1583 1578
@@ -2062,6 +2057,24 @@ bool is_dp_active_dongle(const struct dc_link *link)
2062 (dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER); 2057 (dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER);
2063} 2058}
2064 2059
2060static int translate_dpcd_max_bpc(enum dpcd_downstream_port_max_bpc bpc)
2061{
2062 switch (bpc) {
2063 case DOWN_STREAM_MAX_8BPC:
2064 return 8;
2065 case DOWN_STREAM_MAX_10BPC:
2066 return 10;
2067 case DOWN_STREAM_MAX_12BPC:
2068 return 12;
2069 case DOWN_STREAM_MAX_16BPC:
2070 return 16;
2071 default:
2072 break;
2073 }
2074
2075 return -1;
2076}
2077
2065static void get_active_converter_info( 2078static void get_active_converter_info(
2066 uint8_t data, struct dc_link *link) 2079 uint8_t data, struct dc_link *link)
2067{ 2080{
@@ -2131,7 +2144,8 @@ static void get_active_converter_info(
2131 hdmi_caps.bits.YCrCr420_CONVERSION; 2144 hdmi_caps.bits.YCrCr420_CONVERSION;
2132 2145
2133 link->dpcd_caps.dongle_caps.dp_hdmi_max_bpc = 2146 link->dpcd_caps.dongle_caps.dp_hdmi_max_bpc =
2134 hdmi_color_caps.bits.MAX_BITS_PER_COLOR_COMPONENT; 2147 translate_dpcd_max_bpc(
2148 hdmi_color_caps.bits.MAX_BITS_PER_COLOR_COMPONENT);
2135 2149
2136 link->dpcd_caps.dongle_caps.extendedCapValid = true; 2150 link->dpcd_caps.dongle_caps.extendedCapValid = true;
2137 } 2151 }
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index d1cdf9f8853d..b7422d3b71ef 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -516,13 +516,11 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
516 right_view = (plane_state->rotation == ROTATION_ANGLE_270) != sec_split; 516 right_view = (plane_state->rotation == ROTATION_ANGLE_270) != sec_split;
517 517
518 if (right_view) { 518 if (right_view) {
519 data->viewport.width /= 2; 519 data->viewport.x += data->viewport.width / 2;
520 data->viewport_c.width /= 2; 520 data->viewport_c.x += data->viewport_c.width / 2;
521 data->viewport.x += data->viewport.width;
522 data->viewport_c.x += data->viewport_c.width;
523 /* Ceil offset pipe */ 521 /* Ceil offset pipe */
524 data->viewport.width += data->viewport.width % 2; 522 data->viewport.width = (data->viewport.width + 1) / 2;
525 data->viewport_c.width += data->viewport_c.width % 2; 523 data->viewport_c.width = (data->viewport_c.width + 1) / 2;
526 } else { 524 } else {
527 data->viewport.width /= 2; 525 data->viewport.width /= 2;
528 data->viewport_c.width /= 2; 526 data->viewport_c.width /= 2;
@@ -580,14 +578,12 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip
580 if (pipe_ctx->top_pipe && pipe_ctx->top_pipe->plane_state == 578 if (pipe_ctx->top_pipe && pipe_ctx->top_pipe->plane_state ==
581 pipe_ctx->plane_state) { 579 pipe_ctx->plane_state) {
582 if (stream->view_format == VIEW_3D_FORMAT_TOP_AND_BOTTOM) { 580 if (stream->view_format == VIEW_3D_FORMAT_TOP_AND_BOTTOM) {
583 pipe_ctx->plane_res.scl_data.recout.height /= 2; 581 pipe_ctx->plane_res.scl_data.recout.y += pipe_ctx->plane_res.scl_data.recout.height / 2;
584 pipe_ctx->plane_res.scl_data.recout.y += pipe_ctx->plane_res.scl_data.recout.height;
585 /* Floor primary pipe, ceil 2ndary pipe */ 582 /* Floor primary pipe, ceil 2ndary pipe */
586 pipe_ctx->plane_res.scl_data.recout.height += pipe_ctx->plane_res.scl_data.recout.height % 2; 583 pipe_ctx->plane_res.scl_data.recout.height = (pipe_ctx->plane_res.scl_data.recout.height + 1) / 2;
587 } else { 584 } else {
588 pipe_ctx->plane_res.scl_data.recout.width /= 2; 585 pipe_ctx->plane_res.scl_data.recout.x += pipe_ctx->plane_res.scl_data.recout.width / 2;
589 pipe_ctx->plane_res.scl_data.recout.x += pipe_ctx->plane_res.scl_data.recout.width; 586 pipe_ctx->plane_res.scl_data.recout.width = (pipe_ctx->plane_res.scl_data.recout.width + 1) / 2;
590 pipe_ctx->plane_res.scl_data.recout.width += pipe_ctx->plane_res.scl_data.recout.width % 2;
591 } 587 }
592 } else if (pipe_ctx->bottom_pipe && 588 } else if (pipe_ctx->bottom_pipe &&
593 pipe_ctx->bottom_pipe->plane_state == pipe_ctx->plane_state) { 589 pipe_ctx->bottom_pipe->plane_state == pipe_ctx->plane_state) {
@@ -856,6 +852,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
856 pipe_ctx->plane_res.scl_data.h_active = timing->h_addressable + timing->h_border_left + timing->h_border_right; 852 pipe_ctx->plane_res.scl_data.h_active = timing->h_addressable + timing->h_border_left + timing->h_border_right;
857 pipe_ctx->plane_res.scl_data.v_active = timing->v_addressable + timing->v_border_top + timing->v_border_bottom; 853 pipe_ctx->plane_res.scl_data.v_active = timing->v_addressable + timing->v_border_top + timing->v_border_bottom;
858 854
855
859 /* Taps calculations */ 856 /* Taps calculations */
860 if (pipe_ctx->plane_res.xfm != NULL) 857 if (pipe_ctx->plane_res.xfm != NULL)
861 res = pipe_ctx->plane_res.xfm->funcs->transform_get_optimal_number_of_taps( 858 res = pipe_ctx->plane_res.xfm->funcs->transform_get_optimal_number_of_taps(
@@ -864,16 +861,21 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
864 if (pipe_ctx->plane_res.dpp != NULL) 861 if (pipe_ctx->plane_res.dpp != NULL)
865 res = pipe_ctx->plane_res.dpp->funcs->dpp_get_optimal_number_of_taps( 862 res = pipe_ctx->plane_res.dpp->funcs->dpp_get_optimal_number_of_taps(
866 pipe_ctx->plane_res.dpp, &pipe_ctx->plane_res.scl_data, &plane_state->scaling_quality); 863 pipe_ctx->plane_res.dpp, &pipe_ctx->plane_res.scl_data, &plane_state->scaling_quality);
867
868 if (!res) { 864 if (!res) {
869 /* Try 24 bpp linebuffer */ 865 /* Try 24 bpp linebuffer */
870 pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_24BPP; 866 pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_24BPP;
871 867
872 res = pipe_ctx->plane_res.xfm->funcs->transform_get_optimal_number_of_taps( 868 if (pipe_ctx->plane_res.xfm != NULL)
873 pipe_ctx->plane_res.xfm, &pipe_ctx->plane_res.scl_data, &plane_state->scaling_quality); 869 res = pipe_ctx->plane_res.xfm->funcs->transform_get_optimal_number_of_taps(
870 pipe_ctx->plane_res.xfm,
871 &pipe_ctx->plane_res.scl_data,
872 &plane_state->scaling_quality);
874 873
875 res = pipe_ctx->plane_res.dpp->funcs->dpp_get_optimal_number_of_taps( 874 if (pipe_ctx->plane_res.dpp != NULL)
876 pipe_ctx->plane_res.dpp, &pipe_ctx->plane_res.scl_data, &plane_state->scaling_quality); 875 res = pipe_ctx->plane_res.dpp->funcs->dpp_get_optimal_number_of_taps(
876 pipe_ctx->plane_res.dpp,
877 &pipe_ctx->plane_res.scl_data,
878 &plane_state->scaling_quality);
877 } 879 }
878 880
879 if (res) 881 if (res)
@@ -991,8 +993,10 @@ static struct pipe_ctx *acquire_free_pipe_for_stream(
991 993
992 head_pipe = resource_get_head_pipe_for_stream(res_ctx, stream); 994 head_pipe = resource_get_head_pipe_for_stream(res_ctx, stream);
993 995
994 if (!head_pipe) 996 if (!head_pipe) {
995 ASSERT(0); 997 ASSERT(0);
998 return NULL;
999 }
996 1000
997 if (!head_pipe->plane_state) 1001 if (!head_pipe->plane_state)
998 return head_pipe; 1002 return head_pipe;
@@ -1447,11 +1451,16 @@ static struct stream_encoder *find_first_free_match_stream_enc_for_link(
1447 1451
1448static struct audio *find_first_free_audio( 1452static struct audio *find_first_free_audio(
1449 struct resource_context *res_ctx, 1453 struct resource_context *res_ctx,
1450 const struct resource_pool *pool) 1454 const struct resource_pool *pool,
1455 enum engine_id id)
1451{ 1456{
1452 int i; 1457 int i;
1453 for (i = 0; i < pool->audio_count; i++) { 1458 for (i = 0; i < pool->audio_count; i++) {
1454 if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) { 1459 if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) {
1460 /*we have enough audio endpoint, find the matching inst*/
1461 if (id != i)
1462 continue;
1463
1455 return pool->audios[i]; 1464 return pool->audios[i];
1456 } 1465 }
1457 } 1466 }
@@ -1700,7 +1709,7 @@ enum dc_status resource_map_pool_resources(
1700 dc_is_audio_capable_signal(pipe_ctx->stream->signal) && 1709 dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
1701 stream->audio_info.mode_count) { 1710 stream->audio_info.mode_count) {
1702 pipe_ctx->stream_res.audio = find_first_free_audio( 1711 pipe_ctx->stream_res.audio = find_first_free_audio(
1703 &context->res_ctx, pool); 1712 &context->res_ctx, pool, pipe_ctx->stream_res.stream_enc->id);
1704 1713
1705 /* 1714 /*
1706 * Audio assigned in order first come first get. 1715 * Audio assigned in order first come first get.
@@ -1765,13 +1774,16 @@ enum dc_status dc_validate_global_state(
1765 enum dc_status result = DC_ERROR_UNEXPECTED; 1774 enum dc_status result = DC_ERROR_UNEXPECTED;
1766 int i, j; 1775 int i, j;
1767 1776
1777 if (!new_ctx)
1778 return DC_ERROR_UNEXPECTED;
1779
1768 if (dc->res_pool->funcs->validate_global) { 1780 if (dc->res_pool->funcs->validate_global) {
1769 result = dc->res_pool->funcs->validate_global(dc, new_ctx); 1781 result = dc->res_pool->funcs->validate_global(dc, new_ctx);
1770 if (result != DC_OK) 1782 if (result != DC_OK)
1771 return result; 1783 return result;
1772 } 1784 }
1773 1785
1774 for (i = 0; new_ctx && i < new_ctx->stream_count; i++) { 1786 for (i = 0; i < new_ctx->stream_count; i++) {
1775 struct dc_stream_state *stream = new_ctx->streams[i]; 1787 struct dc_stream_state *stream = new_ctx->streams[i];
1776 1788
1777 for (j = 0; j < dc->res_pool->pipe_count; j++) { 1789 for (j = 0; j < dc->res_pool->pipe_count; j++) {
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index b00a6040a697..e230cc44a0a7 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -263,7 +263,6 @@ bool dc_stream_set_cursor_position(
263 struct input_pixel_processor *ipp = pipe_ctx->plane_res.ipp; 263 struct input_pixel_processor *ipp = pipe_ctx->plane_res.ipp;
264 struct mem_input *mi = pipe_ctx->plane_res.mi; 264 struct mem_input *mi = pipe_ctx->plane_res.mi;
265 struct hubp *hubp = pipe_ctx->plane_res.hubp; 265 struct hubp *hubp = pipe_ctx->plane_res.hubp;
266 struct transform *xfm = pipe_ctx->plane_res.xfm;
267 struct dpp *dpp = pipe_ctx->plane_res.dpp; 266 struct dpp *dpp = pipe_ctx->plane_res.dpp;
268 struct dc_cursor_position pos_cpy = *position; 267 struct dc_cursor_position pos_cpy = *position;
269 struct dc_cursor_mi_param param = { 268 struct dc_cursor_mi_param param = {
@@ -294,11 +293,11 @@ bool dc_stream_set_cursor_position(
294 if (mi != NULL && mi->funcs->set_cursor_position != NULL) 293 if (mi != NULL && mi->funcs->set_cursor_position != NULL)
295 mi->funcs->set_cursor_position(mi, &pos_cpy, &param); 294 mi->funcs->set_cursor_position(mi, &pos_cpy, &param);
296 295
297 if (hubp != NULL && hubp->funcs->set_cursor_position != NULL) 296 if (!hubp)
298 hubp->funcs->set_cursor_position(hubp, &pos_cpy, &param); 297 continue;
299 298
300 if (xfm != NULL && xfm->funcs->set_cursor_position != NULL) 299 if (hubp->funcs->set_cursor_position != NULL)
301 xfm->funcs->set_cursor_position(xfm, &pos_cpy, &param, hubp->curs_attr.width); 300 hubp->funcs->set_cursor_position(hubp, &pos_cpy, &param);
302 301
303 if (dpp != NULL && dpp->funcs->set_cursor_position != NULL) 302 if (dpp != NULL && dpp->funcs->set_cursor_position != NULL)
304 dpp->funcs->set_cursor_position(dpp, &pos_cpy, &param, hubp->curs_attr.width); 303 dpp->funcs->set_cursor_position(dpp, &pos_cpy, &param, hubp->curs_attr.width);
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
index 81c40f8864db..0df9ecb2710c 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
@@ -352,11 +352,11 @@ void dce_aud_az_enable(struct audio *audio)
352 uint32_t value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL); 352 uint32_t value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL);
353 353
354 set_reg_field_value(value, 1, 354 set_reg_field_value(value, 1,
355 AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, 355 AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL,
356 CLOCK_GATING_DISABLE); 356 CLOCK_GATING_DISABLE);
357 set_reg_field_value(value, 1, 357 set_reg_field_value(value, 1,
358 AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, 358 AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL,
359 AUDIO_ENABLED); 359 AUDIO_ENABLED);
360 360
361 AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, value); 361 AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, value);
362 value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL); 362 value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL);
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
index 4fd49a16c3b6..e42b6eb1c1f0 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
@@ -87,6 +87,9 @@ static void dce110_update_generic_info_packet(
87 */ 87 */
88 uint32_t max_retries = 50; 88 uint32_t max_retries = 50;
89 89
90 /*we need turn on clock before programming AFMT block*/
91 REG_UPDATE(AFMT_CNTL, AFMT_AUDIO_CLOCK_EN, 1);
92
90 if (REG(AFMT_VBI_PACKET_CONTROL1)) { 93 if (REG(AFMT_VBI_PACKET_CONTROL1)) {
91 if (packet_index >= 8) 94 if (packet_index >= 8)
92 ASSERT(0); 95 ASSERT(0);
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 1229a3315018..07ff8d2faf3f 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -991,6 +991,16 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx, int option)
991 struct dc_link *link = stream->sink->link; 991 struct dc_link *link = stream->sink->link;
992 struct dc *dc = pipe_ctx->stream->ctx->dc; 992 struct dc *dc = pipe_ctx->stream->ctx->dc;
993 993
994 if (dc_is_hdmi_signal(pipe_ctx->stream->signal))
995 pipe_ctx->stream_res.stream_enc->funcs->stop_hdmi_info_packets(
996 pipe_ctx->stream_res.stream_enc);
997
998 if (dc_is_dp_signal(pipe_ctx->stream->signal))
999 pipe_ctx->stream_res.stream_enc->funcs->stop_dp_info_packets(
1000 pipe_ctx->stream_res.stream_enc);
1001
1002 pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control(
1003 pipe_ctx->stream_res.stream_enc, true);
994 if (pipe_ctx->stream_res.audio) { 1004 if (pipe_ctx->stream_res.audio) {
995 pipe_ctx->stream_res.audio->funcs->az_disable(pipe_ctx->stream_res.audio); 1005 pipe_ctx->stream_res.audio->funcs->az_disable(pipe_ctx->stream_res.audio);
996 1006
@@ -1015,18 +1025,6 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx, int option)
1015 */ 1025 */
1016 } 1026 }
1017 1027
1018 if (dc_is_hdmi_signal(pipe_ctx->stream->signal))
1019 pipe_ctx->stream_res.stream_enc->funcs->stop_hdmi_info_packets(
1020 pipe_ctx->stream_res.stream_enc);
1021
1022 if (dc_is_dp_signal(pipe_ctx->stream->signal))
1023 pipe_ctx->stream_res.stream_enc->funcs->stop_dp_info_packets(
1024 pipe_ctx->stream_res.stream_enc);
1025
1026 pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control(
1027 pipe_ctx->stream_res.stream_enc, true);
1028
1029
1030 /* blank at encoder level */ 1028 /* blank at encoder level */
1031 if (dc_is_dp_signal(pipe_ctx->stream->signal)) { 1029 if (dc_is_dp_signal(pipe_ctx->stream->signal)) {
1032 if (pipe_ctx->stream->sink->link->connector_signal == SIGNAL_TYPE_EDP) 1030 if (pipe_ctx->stream->sink->link->connector_signal == SIGNAL_TYPE_EDP)
@@ -1774,6 +1772,10 @@ static enum dc_status validate_fbc(struct dc *dc,
1774 if (pipe_ctx->stream->sink->link->psr_enabled) 1772 if (pipe_ctx->stream->sink->link->psr_enabled)
1775 return DC_ERROR_UNEXPECTED; 1773 return DC_ERROR_UNEXPECTED;
1776 1774
1775 /* Nothing to compress */
1776 if (!pipe_ctx->plane_state)
1777 return DC_ERROR_UNEXPECTED;
1778
1777 /* Only for non-linear tiling */ 1779 /* Only for non-linear tiling */
1778 if (pipe_ctx->plane_state->tiling_info.gfx8.array_mode == DC_ARRAY_LINEAR_GENERAL) 1780 if (pipe_ctx->plane_state->tiling_info.gfx8.array_mode == DC_ARRAY_LINEAR_GENERAL)
1779 return DC_ERROR_UNEXPECTED; 1781 return DC_ERROR_UNEXPECTED;
@@ -1868,8 +1870,10 @@ static void dce110_reset_hw_ctx_wrap(
1868 pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) { 1870 pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) {
1869 struct clock_source *old_clk = pipe_ctx_old->clock_source; 1871 struct clock_source *old_clk = pipe_ctx_old->clock_source;
1870 1872
1871 /* disable already, no need to disable again */ 1873 /* Disable if new stream is null. O/w, if stream is
1872 if (pipe_ctx->stream && !pipe_ctx->stream->dpms_off) 1874 * disabled already, no need to disable again.
1875 */
1876 if (!pipe_ctx->stream || !pipe_ctx->stream->dpms_off)
1873 core_link_disable_stream(pipe_ctx_old, FREE_ACQUIRED_RESOURCE); 1877 core_link_disable_stream(pipe_ctx_old, FREE_ACQUIRED_RESOURCE);
1874 1878
1875 pipe_ctx_old->stream_res.tg->funcs->set_blank(pipe_ctx_old->stream_res.tg, true); 1879 pipe_ctx_old->stream_res.tg->funcs->set_blank(pipe_ctx_old->stream_res.tg, true);
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
index db96d2b47ff1..61adb8174ce0 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
@@ -1037,11 +1037,13 @@ static bool underlay_create(struct dc_context *ctx, struct resource_pool *pool)
1037 struct dce110_opp *dce110_oppv = kzalloc(sizeof(*dce110_oppv), 1037 struct dce110_opp *dce110_oppv = kzalloc(sizeof(*dce110_oppv),
1038 GFP_KERNEL); 1038 GFP_KERNEL);
1039 1039
1040 if ((dce110_tgv == NULL) || 1040 if (!dce110_tgv || !dce110_xfmv || !dce110_miv || !dce110_oppv) {
1041 (dce110_xfmv == NULL) || 1041 kfree(dce110_tgv);
1042 (dce110_miv == NULL) || 1042 kfree(dce110_xfmv);
1043 (dce110_oppv == NULL)) 1043 kfree(dce110_miv);
1044 return false; 1044 kfree(dce110_oppv);
1045 return false;
1046 }
1045 1047
1046 dce110_opp_v_construct(dce110_oppv, ctx); 1048 dce110_opp_v_construct(dce110_oppv, ctx);
1047 1049
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
index 67ac737eaa7e..4befce6cd87a 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
@@ -1112,10 +1112,7 @@ bool dce110_timing_generator_validate_timing(
1112 enum signal_type signal) 1112 enum signal_type signal)
1113{ 1113{
1114 uint32_t h_blank; 1114 uint32_t h_blank;
1115 uint32_t h_back_porch; 1115 uint32_t h_back_porch, hsync_offset, h_sync_start;
1116 uint32_t hsync_offset = timing->h_border_right +
1117 timing->h_front_porch;
1118 uint32_t h_sync_start = timing->h_addressable + hsync_offset;
1119 1116
1120 struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg); 1117 struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
1121 1118
@@ -1124,6 +1121,9 @@ bool dce110_timing_generator_validate_timing(
1124 if (!timing) 1121 if (!timing)
1125 return false; 1122 return false;
1126 1123
1124 hsync_offset = timing->h_border_right + timing->h_front_porch;
1125 h_sync_start = timing->h_addressable + hsync_offset;
1126
1127 /* Currently we don't support 3D, so block all 3D timings */ 1127 /* Currently we don't support 3D, so block all 3D timings */
1128 if (timing->timing_3d_format != TIMING_3D_FORMAT_NONE) 1128 if (timing->timing_3d_format != TIMING_3D_FORMAT_NONE)
1129 return false; 1129 return false;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
index 4c4bd72d4e40..9fc8f827f2a1 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
@@ -912,11 +912,13 @@ static struct pipe_ctx *dcn10_acquire_idle_pipe_for_layer(
912 struct pipe_ctx *head_pipe = resource_get_head_pipe_for_stream(res_ctx, stream); 912 struct pipe_ctx *head_pipe = resource_get_head_pipe_for_stream(res_ctx, stream);
913 struct pipe_ctx *idle_pipe = find_idle_secondary_pipe(res_ctx, pool); 913 struct pipe_ctx *idle_pipe = find_idle_secondary_pipe(res_ctx, pool);
914 914
915 if (!head_pipe) 915 if (!head_pipe) {
916 ASSERT(0); 916 ASSERT(0);
917 return NULL;
918 }
917 919
918 if (!idle_pipe) 920 if (!idle_pipe)
919 return false; 921 return NULL;
920 922
921 idle_pipe->stream = head_pipe->stream; 923 idle_pipe->stream = head_pipe->stream;
922 idle_pipe->stream_res.tg = head_pipe->stream_res.tg; 924 idle_pipe->stream_res.tg = head_pipe->stream_res.tg;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c
index c7333cdf1802..fced178c8c79 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c
@@ -496,9 +496,6 @@ static bool tgn10_validate_timing(
496 timing->timing_3d_format != TIMING_3D_FORMAT_INBAND_FA) 496 timing->timing_3d_format != TIMING_3D_FORMAT_INBAND_FA)
497 return false; 497 return false;
498 498
499 if (timing->timing_3d_format != TIMING_3D_FORMAT_NONE &&
500 tg->ctx->dc->debug.disable_stereo_support)
501 return false;
502 /* Temporarily blocking interlacing mode until it's supported */ 499 /* Temporarily blocking interlacing mode until it's supported */
503 if (timing->flags.INTERLACE == 1) 500 if (timing->flags.INTERLACE == 1)
504 return false; 501 return false;
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_status.h b/drivers/gpu/drm/amd/display/dc/inc/core_status.h
index 01df85641684..94fc31080fda 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_status.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_status.h
@@ -38,7 +38,7 @@ enum dc_status {
38 DC_FAIL_DETACH_SURFACES = 8, 38 DC_FAIL_DETACH_SURFACES = 8,
39 DC_FAIL_SURFACE_VALIDATE = 9, 39 DC_FAIL_SURFACE_VALIDATE = 9,
40 DC_NO_DP_LINK_BANDWIDTH = 10, 40 DC_NO_DP_LINK_BANDWIDTH = 10,
41 DC_EXCEED_DONGLE_MAX_CLK = 11, 41 DC_EXCEED_DONGLE_CAP = 11,
42 DC_SURFACE_PIXEL_FORMAT_UNSUPPORTED = 12, 42 DC_SURFACE_PIXEL_FORMAT_UNSUPPORTED = 12,
43 DC_FAIL_BANDWIDTH_VALIDATE = 13, /* BW and Watermark validation */ 43 DC_FAIL_BANDWIDTH_VALIDATE = 13, /* BW and Watermark validation */
44 DC_FAIL_SCALING = 14, 44 DC_FAIL_SCALING = 14,
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h b/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
index 7c08bc62c1f5..ea88997e1bbd 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
@@ -259,13 +259,6 @@ struct transform_funcs {
259 struct transform *xfm_base, 259 struct transform *xfm_base,
260 const struct dc_cursor_attributes *attr); 260 const struct dc_cursor_attributes *attr);
261 261
262 void (*set_cursor_position)(
263 struct transform *xfm_base,
264 const struct dc_cursor_position *pos,
265 const struct dc_cursor_mi_param *param,
266 uint32_t width
267 );
268
269}; 262};
270 263
271const uint16_t *get_filter_2tap_16p(void); 264const uint16_t *get_filter_2tap_16p(void);
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 898f9a078830..a6511918f632 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -5451,28 +5451,6 @@ void cik_pcie_gart_tlb_flush(struct radeon_device *rdev)
5451 WREG32(VM_INVALIDATE_REQUEST, 0x1); 5451 WREG32(VM_INVALIDATE_REQUEST, 0x1);
5452} 5452}
5453 5453
5454static void cik_pcie_init_compute_vmid(struct radeon_device *rdev)
5455{
5456 int i;
5457 uint32_t sh_mem_bases, sh_mem_config;
5458
5459 sh_mem_bases = 0x6000 | 0x6000 << 16;
5460 sh_mem_config = ALIGNMENT_MODE(SH_MEM_ALIGNMENT_MODE_UNALIGNED);
5461 sh_mem_config |= DEFAULT_MTYPE(MTYPE_NONCACHED);
5462
5463 mutex_lock(&rdev->srbm_mutex);
5464 for (i = 8; i < 16; i++) {
5465 cik_srbm_select(rdev, 0, 0, 0, i);
5466 /* CP and shaders */
5467 WREG32(SH_MEM_CONFIG, sh_mem_config);
5468 WREG32(SH_MEM_APE1_BASE, 1);
5469 WREG32(SH_MEM_APE1_LIMIT, 0);
5470 WREG32(SH_MEM_BASES, sh_mem_bases);
5471 }
5472 cik_srbm_select(rdev, 0, 0, 0, 0);
5473 mutex_unlock(&rdev->srbm_mutex);
5474}
5475
5476/** 5454/**
5477 * cik_pcie_gart_enable - gart enable 5455 * cik_pcie_gart_enable - gart enable
5478 * 5456 *
@@ -5586,8 +5564,6 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev)
5586 cik_srbm_select(rdev, 0, 0, 0, 0); 5564 cik_srbm_select(rdev, 0, 0, 0, 0);
5587 mutex_unlock(&rdev->srbm_mutex); 5565 mutex_unlock(&rdev->srbm_mutex);
5588 5566
5589 cik_pcie_init_compute_vmid(rdev);
5590
5591 cik_pcie_gart_tlb_flush(rdev); 5567 cik_pcie_gart_tlb_flush(rdev);
5592 DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", 5568 DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
5593 (unsigned)(rdev->mc.gtt_size >> 20), 5569 (unsigned)(rdev->mc.gtt_size >> 20),
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index b0551aa677b8..8d7172e8381d 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -1062,7 +1062,6 @@ void ttm_pool_unpopulate(struct ttm_tt *ttm)
1062} 1062}
1063EXPORT_SYMBOL(ttm_pool_unpopulate); 1063EXPORT_SYMBOL(ttm_pool_unpopulate);
1064 1064
1065#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
1066int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt) 1065int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt)
1067{ 1066{
1068 unsigned i, j; 1067 unsigned i, j;
@@ -1133,7 +1132,6 @@ void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt)
1133 ttm_pool_unpopulate(&tt->ttm); 1132 ttm_pool_unpopulate(&tt->ttm);
1134} 1133}
1135EXPORT_SYMBOL(ttm_unmap_and_unpopulate_pages); 1134EXPORT_SYMBOL(ttm_unmap_and_unpopulate_pages);
1136#endif
1137 1135
1138int ttm_page_alloc_debugfs(struct seq_file *m, void *data) 1136int ttm_page_alloc_debugfs(struct seq_file *m, void *data)
1139{ 1137{
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 38a2b4770c35..593811362a91 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -59,11 +59,20 @@ int ttm_pool_populate(struct ttm_tt *ttm);
59void ttm_pool_unpopulate(struct ttm_tt *ttm); 59void ttm_pool_unpopulate(struct ttm_tt *ttm);
60 60
61/** 61/**
62 * Populates and DMA maps pages to fullfil a ttm_dma_populate() request
63 */
64int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt);
65
66/**
67 * Unpopulates and DMA unmaps pages as part of a
68 * ttm_dma_unpopulate() request */
69void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);
70
71/**
62 * Output the state of pools to debugfs file 72 * Output the state of pools to debugfs file
63 */ 73 */
64int ttm_page_alloc_debugfs(struct seq_file *m, void *data); 74int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
65 75
66
67#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU) 76#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
68/** 77/**
69 * Initialize pool allocator. 78 * Initialize pool allocator.
@@ -83,17 +92,6 @@ int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data);
83int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev); 92int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev);
84void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev); 93void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev);
85 94
86
87/**
88 * Populates and DMA maps pages to fullfil a ttm_dma_populate() request
89 */
90int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt);
91
92/**
93 * Unpopulates and DMA unmaps pages as part of a
94 * ttm_dma_unpopulate() request */
95void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);
96
97#else 95#else
98static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, 96static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob,
99 unsigned max_pages) 97 unsigned max_pages)
@@ -116,16 +114,6 @@ static inline void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma,
116 struct device *dev) 114 struct device *dev)
117{ 115{
118} 116}
119
120static inline int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt)
121{
122 return -ENOMEM;
123}
124
125static inline void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt)
126{
127}
128
129#endif 117#endif
130 118
131#endif 119#endif