disp: msm: dp: remove usage of compression ratio enum from DP driver
As overall display driver is moving away from hard-coded compression ratios, prepare the DP driver for the same by removing the usage of the compression ratio enum. Change-Id: I298db7d20baed8afec9f96dff8c7e950702bfec9 Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
64ee2c4d72
commit
27844b7b60
@@ -1002,7 +1002,7 @@ static void dp_ctrl_mst_calculate_rg(struct dp_ctrl_private *ctrl,
|
|||||||
u32 x_int = 0, y_frac_enum = 0;
|
u32 x_int = 0, y_frac_enum = 0;
|
||||||
u64 target_strm_sym, ts_int_fixp, ts_frac_fixp, y_frac_enum_fixp;
|
u64 target_strm_sym, ts_int_fixp, ts_frac_fixp, y_frac_enum_fixp;
|
||||||
|
|
||||||
if (panel->pinfo.comp_info.comp_ratio)
|
if (panel->pinfo.comp_info.comp_ratio > 1)
|
||||||
bpp = DSC_BPP(panel->pinfo.comp_info.dsc_info.config);
|
bpp = DSC_BPP(panel->pinfo.comp_info.dsc_info.config);
|
||||||
|
|
||||||
/* min_slot_cnt */
|
/* min_slot_cnt */
|
||||||
|
@@ -1721,7 +1721,7 @@ static void dp_display_update_dsc_resources(struct dp_display_private *dp,
|
|||||||
u32 dsc_blk_cnt = 0;
|
u32 dsc_blk_cnt = 0;
|
||||||
|
|
||||||
if (panel->pinfo.comp_info.comp_type == MSM_DISPLAY_COMPRESSION_DSC &&
|
if (panel->pinfo.comp_info.comp_type == MSM_DISPLAY_COMPRESSION_DSC &&
|
||||||
panel->pinfo.comp_info.comp_ratio) {
|
(panel->pinfo.comp_info.comp_ratio > 1)) {
|
||||||
dsc_blk_cnt = panel->pinfo.h_active /
|
dsc_blk_cnt = panel->pinfo.h_active /
|
||||||
dp->parser->max_dp_dsc_input_width_pixs;
|
dp->parser->max_dp_dsc_input_width_pixs;
|
||||||
if (panel->pinfo.h_active %
|
if (panel->pinfo.h_active %
|
||||||
@@ -2084,7 +2084,7 @@ static enum drm_mode_status dp_display_validate_mode(
|
|||||||
|
|
||||||
dp_display->convert_to_dp_mode(dp_display, panel, mode, &dp_mode);
|
dp_display->convert_to_dp_mode(dp_display, panel, mode, &dp_mode);
|
||||||
|
|
||||||
dsc_en = dp_mode.timing.comp_info.comp_ratio ? true : false;
|
dsc_en = (dp_mode.timing.comp_info.comp_ratio > 1) ? true : false;
|
||||||
mode_bpp = dsc_en ?
|
mode_bpp = dsc_en ?
|
||||||
DSC_BPP(dp_mode.timing.comp_info.dsc_info.config)
|
DSC_BPP(dp_mode.timing.comp_info.dsc_info.config)
|
||||||
: dp_mode.timing.bpp;
|
: dp_mode.timing.bpp;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <drm/drm_atomic_helper.h>
|
#include <drm/drm_atomic_helper.h>
|
||||||
@@ -418,7 +418,7 @@ int dp_connector_get_mode_info(struct drm_connector *connector,
|
|||||||
|
|
||||||
dp_disp->convert_to_dp_mode(dp_disp, dp_panel, drm_mode, &dp_mode);
|
dp_disp->convert_to_dp_mode(dp_disp, dp_panel, drm_mode, &dp_mode);
|
||||||
|
|
||||||
if (dp_mode.timing.comp_info.comp_ratio) {
|
if (dp_mode.timing.comp_info.comp_ratio > 1) {
|
||||||
memcpy(&mode_info->comp_info,
|
memcpy(&mode_info->comp_info,
|
||||||
&dp_mode.timing.comp_info,
|
&dp_mode.timing.comp_info,
|
||||||
sizeof(mode_info->comp_info));
|
sizeof(mode_info->comp_info));
|
||||||
|
@@ -526,7 +526,7 @@ static int dp_mst_calc_pbn_mode(struct dp_display_mode *dp_mode)
|
|||||||
bool dsc_en;
|
bool dsc_en;
|
||||||
s64 pbn_fp;
|
s64 pbn_fp;
|
||||||
|
|
||||||
dsc_en = dp_mode->timing.comp_info.comp_ratio ? true : false;
|
dsc_en = (dp_mode->timing.comp_info.comp_ratio > 1) ? true : false;
|
||||||
bpp = dsc_en ?
|
bpp = dsc_en ?
|
||||||
DSC_BPP(dp_mode->timing.comp_info.dsc_info.config)
|
DSC_BPP(dp_mode->timing.comp_info.dsc_info.config)
|
||||||
: dp_mode->timing.bpp;
|
: dp_mode->timing.bpp;
|
||||||
|
@@ -20,6 +20,10 @@
|
|||||||
#define VSC_EXT_VESA_SDP_SUPPORTED BIT(4)
|
#define VSC_EXT_VESA_SDP_SUPPORTED BIT(4)
|
||||||
#define VSC_EXT_VESA_SDP_CHAINING_SUPPORTED BIT(5)
|
#define VSC_EXT_VESA_SDP_CHAINING_SUPPORTED BIT(5)
|
||||||
|
|
||||||
|
#define DP_COMPRESSION_RATIO_2_TO_1 2
|
||||||
|
#define DP_COMPRESSION_RATIO_3_TO_1 3
|
||||||
|
#define DP_COMPRESSION_RATIO_NONE 1
|
||||||
|
|
||||||
enum dp_panel_hdr_pixel_encoding {
|
enum dp_panel_hdr_pixel_encoding {
|
||||||
RGB,
|
RGB,
|
||||||
YCbCr444,
|
YCbCr444,
|
||||||
@@ -1001,16 +1005,8 @@ static void dp_panel_calc_tu_parameters(struct dp_panel *dp_panel,
|
|||||||
in.fec_en = dp_panel->fec_en;
|
in.fec_en = dp_panel->fec_en;
|
||||||
in.num_of_dsc_slices = pinfo->comp_info.dsc_info.slice_per_pkt;
|
in.num_of_dsc_slices = pinfo->comp_info.dsc_info.slice_per_pkt;
|
||||||
|
|
||||||
switch (pinfo->comp_info.comp_ratio) {
|
if (pinfo->comp_info.comp_ratio)
|
||||||
case MSM_DISPLAY_COMPRESSION_RATIO_2_TO_1:
|
in.compress_ratio = pinfo->comp_info.comp_ratio * 100;
|
||||||
in.compress_ratio = 200;
|
|
||||||
break;
|
|
||||||
case MSM_DISPLAY_COMPRESSION_RATIO_3_TO_1:
|
|
||||||
in.compress_ratio = 300;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
in.compress_ratio = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
_dp_panel_calc_tu(&in, tu_table);
|
_dp_panel_calc_tu(&in, tu_table);
|
||||||
}
|
}
|
||||||
@@ -1064,32 +1060,25 @@ static void dp_panel_config_tr_unit(struct dp_panel *dp_panel)
|
|||||||
catalog->update_transfer_unit(catalog);
|
catalog->update_transfer_unit(catalog);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dp_dsc_dto_data {
|
static void dp_panel_get_dto_params(u8 comp_ratio, u32 *num, u32 *denom,
|
||||||
enum msm_display_compression_ratio comp_ratio;
|
u32 org_bpp)
|
||||||
u32 org_bpp; /* bits */
|
|
||||||
u32 dto_numerator;
|
|
||||||
u32 dto_denominator;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct dp_dsc_dto_data dto_tbl[] = {
|
|
||||||
{MSM_DISPLAY_COMPRESSION_RATIO_2_TO_1, 24, 1, 2},
|
|
||||||
{MSM_DISPLAY_COMPRESSION_RATIO_2_TO_1, 30, 5, 8},
|
|
||||||
{MSM_DISPLAY_COMPRESSION_RATIO_3_TO_1, 24, 1, 3},
|
|
||||||
{MSM_DISPLAY_COMPRESSION_RATIO_3_TO_1, 30, 5, 12},
|
|
||||||
};
|
|
||||||
|
|
||||||
static void _dp_panel_get_dto_m_n(enum msm_display_compression_ratio ratio,
|
|
||||||
u32 org_bpp, u32 *dto_n, u32 *dto_d)
|
|
||||||
{
|
{
|
||||||
u32 idx;
|
if ((comp_ratio == 2) && (org_bpp == 24)) {
|
||||||
|
*num = 1;
|
||||||
for (idx = 0; idx < ARRAY_SIZE(dto_tbl); idx++) {
|
*denom = 2;
|
||||||
if (ratio == dto_tbl[idx].comp_ratio &&
|
} else if ((comp_ratio == 2) && (org_bpp == 30)) {
|
||||||
org_bpp == dto_tbl[idx].org_bpp) {
|
*num = 5;
|
||||||
*dto_n = dto_tbl[idx].dto_numerator;
|
*denom = 8;
|
||||||
*dto_d = dto_tbl[idx].dto_denominator;
|
} else if ((comp_ratio == 3) && (org_bpp == 24)) {
|
||||||
return;
|
*num = 1;
|
||||||
}
|
*denom = 3;
|
||||||
|
} else if ((comp_ratio == 3) && (org_bpp == 30)) {
|
||||||
|
*num = 5;
|
||||||
|
*denom = 12;
|
||||||
|
} else {
|
||||||
|
DP_ERR("dto params not found\n");
|
||||||
|
*num = 0;
|
||||||
|
*denom = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1134,7 +1123,7 @@ static void dp_panel_dsc_prepare_pps_packet(struct dp_panel *dp_panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void _dp_panel_dsc_get_num_extra_pclk(struct msm_display_dsc_info *dsc,
|
static void _dp_panel_dsc_get_num_extra_pclk(struct msm_display_dsc_info *dsc,
|
||||||
enum msm_display_compression_ratio ratio)
|
u8 ratio)
|
||||||
{
|
{
|
||||||
unsigned int dto_n = 0, dto_d = 0, remainder;
|
unsigned int dto_n = 0, dto_d = 0, remainder;
|
||||||
int ack_required, last_few_ack_required, accum_ack;
|
int ack_required, last_few_ack_required, accum_ack;
|
||||||
@@ -1142,8 +1131,8 @@ static void _dp_panel_dsc_get_num_extra_pclk(struct msm_display_dsc_info *dsc,
|
|||||||
int start, temp, line_width = dsc->config.pic_width/2;
|
int start, temp, line_width = dsc->config.pic_width/2;
|
||||||
s64 temp1_fp, temp2_fp;
|
s64 temp1_fp, temp2_fp;
|
||||||
|
|
||||||
_dp_panel_get_dto_m_n(ratio, dsc->config.bits_per_component * 3,
|
dp_panel_get_dto_params(ratio, &dto_n, &dto_d,
|
||||||
&dto_n, &dto_d);
|
dsc->config.bits_per_component * 3);
|
||||||
|
|
||||||
ack_required = dsc->pclk_per_line;
|
ack_required = dsc->pclk_per_line;
|
||||||
|
|
||||||
@@ -1219,7 +1208,7 @@ static void _dp_panel_dsc_bw_overhead_calc(struct dp_panel *dp_panel,
|
|||||||
|
|
||||||
static void dp_panel_dsc_pclk_param_calc(struct dp_panel *dp_panel,
|
static void dp_panel_dsc_pclk_param_calc(struct dp_panel *dp_panel,
|
||||||
struct msm_display_dsc_info *dsc,
|
struct msm_display_dsc_info *dsc,
|
||||||
enum msm_display_compression_ratio ratio,
|
u8 ratio,
|
||||||
struct dp_display_mode *dp_mode)
|
struct dp_display_mode *dp_mode)
|
||||||
{
|
{
|
||||||
int comp_ratio, intf_width;
|
int comp_ratio, intf_width;
|
||||||
@@ -1238,17 +1227,8 @@ static void dp_panel_dsc_pclk_param_calc(struct dp_panel *dp_panel,
|
|||||||
slice_per_intf = DIV_ROUND_UP(intf_width,
|
slice_per_intf = DIV_ROUND_UP(intf_width,
|
||||||
dsc->config.slice_width);
|
dsc->config.slice_width);
|
||||||
|
|
||||||
switch (ratio) {
|
if (ratio)
|
||||||
case MSM_DISPLAY_COMPRESSION_RATIO_2_TO_1:
|
comp_ratio = ratio * 100;
|
||||||
comp_ratio = 200;
|
|
||||||
break;
|
|
||||||
case MSM_DISPLAY_COMPRESSION_RATIO_3_TO_1:
|
|
||||||
comp_ratio = 300;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
comp_ratio = 100;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
temp1_fp = drm_fixp_from_fraction(comp_ratio, 100);
|
temp1_fp = drm_fixp_from_fraction(comp_ratio, 100);
|
||||||
temp2_fp = drm_fixp_from_fraction(slice_per_pkt * 8, 1);
|
temp2_fp = drm_fixp_from_fraction(slice_per_pkt * 8, 1);
|
||||||
@@ -1457,7 +1437,7 @@ static int dp_panel_dsc_prepare_basic_params(
|
|||||||
DIV_ROUND_UP(dp_mode->timing.h_active, slice_width);
|
DIV_ROUND_UP(dp_mode->timing.h_active, slice_width);
|
||||||
|
|
||||||
comp_info->comp_type = MSM_DISPLAY_COMPRESSION_DSC;
|
comp_info->comp_type = MSM_DISPLAY_COMPRESSION_DSC;
|
||||||
comp_info->comp_ratio = MSM_DISPLAY_COMPRESSION_RATIO_3_TO_1;
|
comp_info->comp_ratio = DP_COMPRESSION_RATIO_3_TO_1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2136,16 +2116,12 @@ static u32 _dp_panel_calc_be_in_lane(struct dp_panel *dp_panel)
|
|||||||
if (!dp_panel->mst_state)
|
if (!dp_panel->mst_state)
|
||||||
return be_in_lane;
|
return be_in_lane;
|
||||||
|
|
||||||
switch (pinfo->comp_info.comp_ratio) {
|
if (pinfo->comp_info.comp_ratio == DP_COMPRESSION_RATIO_2_TO_1)
|
||||||
case MSM_DISPLAY_COMPRESSION_RATIO_2_TO_1:
|
|
||||||
denominator = 16; /* 2 * bits-in-byte */
|
denominator = 16; /* 2 * bits-in-byte */
|
||||||
break;
|
else if (pinfo->comp_info.comp_ratio == DP_COMPRESSION_RATIO_3_TO_1)
|
||||||
case MSM_DISPLAY_COMPRESSION_RATIO_3_TO_1:
|
|
||||||
denominator = 24; /* 3 * bits-in-byte */
|
denominator = 24; /* 3 * bits-in-byte */
|
||||||
break;
|
else
|
||||||
default:
|
denominator = 8;
|
||||||
denominator = 8; /* 1 * bits-in-byte */
|
|
||||||
}
|
|
||||||
|
|
||||||
numerator = (pinfo->h_active + pinfo->h_back_porch +
|
numerator = (pinfo->h_active + pinfo->h_back_porch +
|
||||||
pinfo->h_front_porch + pinfo->h_sync_width) *
|
pinfo->h_front_porch + pinfo->h_sync_width) *
|
||||||
@@ -2205,8 +2181,8 @@ static void dp_panel_config_dsc(struct dp_panel *dp_panel, bool enable)
|
|||||||
dsc->dsc_en = true;
|
dsc->dsc_en = true;
|
||||||
dsc->dto_en = true;
|
dsc->dto_en = true;
|
||||||
|
|
||||||
_dp_panel_get_dto_m_n(comp_info->comp_ratio, pinfo->bpp,
|
dp_panel_get_dto_params(comp_info->comp_ratio, &dsc->dto_n,
|
||||||
&dsc->dto_n, &dsc->dto_d);
|
&dsc->dto_d, pinfo->bpp);
|
||||||
} else {
|
} else {
|
||||||
dsc->dsc_en = false;
|
dsc->dsc_en = false;
|
||||||
dsc->dto_en = false;
|
dsc->dto_en = false;
|
||||||
@@ -2957,9 +2933,11 @@ static void dp_panel_convert_to_dp_mode(struct dp_panel *dp_panel,
|
|||||||
dp_mode->timing.widebus_en = dp_panel->widebus_en;
|
dp_mode->timing.widebus_en = dp_panel->widebus_en;
|
||||||
dp_mode->timing.dsc_overhead_fp = 0;
|
dp_mode->timing.dsc_overhead_fp = 0;
|
||||||
|
|
||||||
if (dp_panel->dsc_en && dsc_cap) {
|
comp_info = &dp_mode->timing.comp_info;
|
||||||
comp_info = &dp_mode->timing.comp_info;
|
comp_info->comp_ratio = DP_COMPRESSION_RATIO_NONE;
|
||||||
|
comp_info->comp_type = MSM_DISPLAY_COMPRESSION_NONE;
|
||||||
|
|
||||||
|
if (dp_panel->dsc_en && dsc_cap) {
|
||||||
if (dp_panel_dsc_prepare_basic_params(comp_info,
|
if (dp_panel_dsc_prepare_basic_params(comp_info,
|
||||||
dp_mode, dp_panel)) {
|
dp_mode, dp_panel)) {
|
||||||
DP_DEBUG("prepare DSC basic params failed\n");
|
DP_DEBUG("prepare DSC basic params failed\n");
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DP_PANEL_H_
|
#ifndef _DP_PANEL_H_
|
||||||
|
@@ -135,7 +135,8 @@ static void drm_mode_to_intf_timing_params(
|
|||||||
* compression ratio
|
* compression ratio
|
||||||
*/
|
*/
|
||||||
if (phys_enc->hw_intf->cap->type == INTF_DP &&
|
if (phys_enc->hw_intf->cap->type == INTF_DP &&
|
||||||
(timing->wide_bus_en || vid_enc->base.comp_ratio)) {
|
(timing->wide_bus_en ||
|
||||||
|
(vid_enc->base.comp_ratio > 1))) {
|
||||||
timing->width = timing->width >> 1;
|
timing->width = timing->width >> 1;
|
||||||
timing->xres = timing->xres >> 1;
|
timing->xres = timing->xres >> 1;
|
||||||
timing->h_back_porch = timing->h_back_porch >> 1;
|
timing->h_back_porch = timing->h_back_porch >> 1;
|
||||||
@@ -143,7 +144,7 @@ static void drm_mode_to_intf_timing_params(
|
|||||||
timing->hsync_pulse_width = timing->hsync_pulse_width >> 1;
|
timing->hsync_pulse_width = timing->hsync_pulse_width >> 1;
|
||||||
|
|
||||||
if (vid_enc->base.comp_type == MSM_DISPLAY_COMPRESSION_DSC &&
|
if (vid_enc->base.comp_type == MSM_DISPLAY_COMPRESSION_DSC &&
|
||||||
vid_enc->base.comp_ratio) {
|
(vid_enc->base.comp_ratio > 1)) {
|
||||||
timing->compression_en = true;
|
timing->compression_en = true;
|
||||||
timing->extra_dto_cycles =
|
timing->extra_dto_cycles =
|
||||||
vid_enc->base.dsc_extra_pclk_cycle_cnt;
|
vid_enc->base.dsc_extra_pclk_cycle_cnt;
|
||||||
|
Reference in New Issue
Block a user