drm/amd/display: use max_dsc_bpp in amdgpu_dm
authorjsg <jsg@openbsd.org>
Fri, 28 Jul 2023 06:50:28 +0000 (06:50 +0000)
committerjsg <jsg@openbsd.org>
Fri, 28 Jul 2023 06:50:28 +0000 (06:50 +0000)
From Hamza Mahfooz
374735cbe2f17dd80829adba5d0b764e9246341a in linux-6.1.y/6.1.42
6e5abe94c6eb9b281398e39819217e8fdd1c336f in mainline linux

sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c
sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

index 39e027e..43c148a 100644 (file)
@@ -5716,16 +5716,14 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,
 {
        struct drm_connector *drm_connector = &aconnector->base;
        uint32_t link_bandwidth_kbps;
-       uint32_t max_dsc_target_bpp_limit_override = 0;
        struct dc *dc = sink->ctx->dc;
        uint32_t max_supported_bw_in_kbps, timing_bw_in_kbps;
        uint32_t dsc_max_supported_bw_in_kbps;
+       uint32_t max_dsc_target_bpp_limit_override =
+               drm_connector->display_info.max_dsc_bpp;
 
        link_bandwidth_kbps = dc_link_bandwidth_kbps(aconnector->dc_link,
                                                        dc_link_get_link_cap(aconnector->dc_link));
-       if (stream->link && stream->link->local_sink)
-               max_dsc_target_bpp_limit_override =
-                       stream->link->local_sink->edid_caps.panel_patch.max_dsc_target_bpp_limit;
 
        /* Set DSC policy according to dsc_clock_en */
        dc_dsc_policy_set_enable_dsc_when_not_needed(
index e2f9141..994a370 100644 (file)
@@ -673,15 +673,18 @@ static void set_dsc_configs_from_fairness_vars(struct dsc_mst_fairness_params *p
                int count,
                int k)
 {
+       struct drm_connector *drm_connector;
        int i;
 
        for (i = 0; i < count; i++) {
+               drm_connector = &params[i].aconnector->base;
+
                memset(&params[i].timing->dsc_cfg, 0, sizeof(params[i].timing->dsc_cfg));
                if (vars[i + k].dsc_enabled && dc_dsc_compute_config(
                                        params[i].sink->ctx->dc->res_pool->dscs[0],
                                        &params[i].sink->dsc_caps.dsc_dec_caps,
                                        params[i].sink->ctx->dc->debug.dsc_min_slice_height_override,
-                                       params[i].sink->edid_caps.panel_patch.max_dsc_target_bpp_limit,
+                                       drm_connector->display_info.max_dsc_bpp,
                                        0,
                                        params[i].timing,
                                        &params[i].timing->dsc_cfg)) {
@@ -723,12 +726,16 @@ static int bpp_x16_from_pbn(struct dsc_mst_fairness_params param, int pbn)
        struct dc_dsc_config dsc_config;
        u64 kbps;
 
+       struct drm_connector *drm_connector = &param.aconnector->base;
+       uint32_t max_dsc_target_bpp_limit_override =
+               drm_connector->display_info.max_dsc_bpp;
+
        kbps = div_u64((u64)pbn * 994 * 8 * 54, 64);
        dc_dsc_compute_config(
                        param.sink->ctx->dc->res_pool->dscs[0],
                        &param.sink->dsc_caps.dsc_dec_caps,
                        param.sink->ctx->dc->debug.dsc_min_slice_height_override,
-                       param.sink->edid_caps.panel_patch.max_dsc_target_bpp_limit,
+                       max_dsc_target_bpp_limit_override,
                        (int) kbps, param.timing, &dsc_config);
 
        return dsc_config.bits_per_pixel;