Skip to content

Commit 3766a84

Browse files
Martin Tsaialexdeucher
authored andcommitted
drm/amd/display: Clean up dsc blocks in accelerated mode
[WHY] DSC on eDP could be enabled during VBIOS post. The enabled DSC may not be disabled when enter to OS, once the system was in second screen only mode before entering to S4. In this case, OS will not send setTimings to reset eDP path again. The enabled DSC HW will make a new stream without DSC cannot output normally if it reused this pipe with enabled DSC. [HOW] In accelerated mode, to clean up DSC blocks if eDP is on link but not active when we are not in fast boot and seamless boot. Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Reviewed-by: Charlene Liu <charlene.liu@amd.com> Signed-off-by: Martin Tsai <martin.tsai@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 401c90c commit 3766a84

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include "panel_cntl.h"
5858
#include "dc_state_priv.h"
5959
#include "dpcd_defs.h"
60+
#include "dsc.h"
6061
/* include DCE11 register header files */
6162
#include "dce/dce_11_0_d.h"
6263
#include "dce/dce_11_0_sh_mask.h"
@@ -1823,6 +1824,48 @@ static void get_edp_links_with_sink(
18231824
}
18241825
}
18251826

1827+
static void clean_up_dsc_blocks(struct dc *dc)
1828+
{
1829+
struct display_stream_compressor *dsc = NULL;
1830+
struct timing_generator *tg = NULL;
1831+
struct stream_encoder *se = NULL;
1832+
struct dccg *dccg = dc->res_pool->dccg;
1833+
struct pg_cntl *pg_cntl = dc->res_pool->pg_cntl;
1834+
int i;
1835+
1836+
if (dc->ctx->dce_version != DCN_VERSION_3_5 &&
1837+
dc->ctx->dce_version != DCN_VERSION_3_51)
1838+
return;
1839+
1840+
for (i = 0; i < dc->res_pool->res_cap->num_dsc; i++) {
1841+
struct dcn_dsc_state s = {0};
1842+
1843+
dsc = dc->res_pool->dscs[i];
1844+
dsc->funcs->dsc_read_state(dsc, &s);
1845+
if (s.dsc_fw_en) {
1846+
/* disable DSC in OPTC */
1847+
if (i < dc->res_pool->timing_generator_count) {
1848+
tg = dc->res_pool->timing_generators[i];
1849+
tg->funcs->set_dsc_config(tg, OPTC_DSC_DISABLED, 0, 0);
1850+
}
1851+
/* disable DSC in stream encoder */
1852+
if (i < dc->res_pool->stream_enc_count) {
1853+
se = dc->res_pool->stream_enc[i];
1854+
se->funcs->dp_set_dsc_config(se, OPTC_DSC_DISABLED, 0, 0);
1855+
se->funcs->dp_set_dsc_pps_info_packet(se, false, NULL, true);
1856+
}
1857+
/* disable DSC block */
1858+
if (dccg->funcs->set_ref_dscclk)
1859+
dccg->funcs->set_ref_dscclk(dccg, dsc->inst);
1860+
dsc->funcs->dsc_disable(dsc);
1861+
1862+
/* power down DSC */
1863+
if (pg_cntl != NULL)
1864+
pg_cntl->funcs->dsc_pg_control(pg_cntl, dsc->inst, false);
1865+
}
1866+
}
1867+
}
1868+
18261869
/*
18271870
* When ASIC goes from VBIOS/VGA mode to driver/accelerated mode we need:
18281871
* 1. Power down all DC HW blocks
@@ -1927,6 +1970,13 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
19271970
clk_mgr_exit_optimized_pwr_state(dc, dc->clk_mgr);
19281971

19291972
power_down_all_hw_blocks(dc);
1973+
1974+
/* DSC could be enabled on eDP during VBIOS post.
1975+
* To clean up dsc blocks if eDP is in link but not active.
1976+
*/
1977+
if (edp_link_with_sink && (edp_stream_num == 0))
1978+
clean_up_dsc_blocks(dc);
1979+
19301980
disable_vga_and_power_gate_all_controllers(dc);
19311981
if (edp_link_with_sink && !keep_edp_vdd_on)
19321982
dc->hwss.edp_power_control(edp_link_with_sink, false);

0 commit comments

Comments
 (0)