Merge "disp: msm: update rm topology mapping tables"

This commit is contained in:
qctecmdr
2020-05-05 18:29:34 -07:00
committed by Gerrit - the friendly Code Review server
commit 154ee80381
8 muutettua tiedostoa jossa 156 lisäystä ja 64 poistoa

Näytä tiedosto

@@ -425,6 +425,7 @@ int dp_connector_get_mode_info(struct drm_connector *connector,
sizeof(mode_info->comp_info));
topology->num_enc = topology->num_lm;
topology->comp_type = mode_info->comp_info.comp_type;
}
return 0;

Näytä tiedosto

@@ -512,14 +512,14 @@ int dsi_conn_get_mode_info(struct drm_connector *connector,
memcpy(&mode_info->topology, &dsi_mode.priv_info->topology,
sizeof(struct msm_display_topology));
mode_info->comp_info.comp_type = MSM_DISPLAY_COMPRESSION_NONE;
if (dsi_mode.priv_info->dsc_enabled) {
mode_info->comp_info.comp_type = MSM_DISPLAY_COMPRESSION_DSC;
mode_info->topology.comp_type = MSM_DISPLAY_COMPRESSION_DSC;
memcpy(&mode_info->comp_info.dsc_info, &dsi_mode.priv_info->dsc,
sizeof(dsi_mode.priv_info->dsc));
} else if (dsi_mode.priv_info->vdc_enabled) {
mode_info->comp_info.comp_type = MSM_DISPLAY_COMPRESSION_VDC;
mode_info->topology.comp_type = MSM_DISPLAY_COMPRESSION_VDC;
memcpy(&mode_info->comp_info.vdc_info, &dsi_mode.priv_info->vdc,
sizeof(dsi_mode.priv_info->vdc));
}

Näytä tiedosto

@@ -645,11 +645,13 @@ struct msm_compression_info {
* @num_lm: number of layer mixers used
* @num_enc: number of compression encoder blocks used
* @num_intf: number of interfaces the panel is mounted on
* @comp_type: type of compression supported
*/
struct msm_display_topology {
u32 num_lm;
u32 num_enc;
u32 num_intf;
enum msm_display_compression_type comp_type;
};
/**

Näytä tiedosto

@@ -2303,8 +2303,8 @@ static int sde_connector_populate_mode_info(struct drm_connector *conn,
sde_kms_info_add_keyint(info, "bit_clk_rate",
mode_info.clk_rate);
topology_idx = (int)sde_rm_get_topology_name(
mode_info.topology);
topology_idx = (int)sde_rm_get_topology_name(&sde_kms->rm,
mode_info.topology);
if (topology_idx < SDE_RM_TOPOLOGY_MAX) {
sde_kms_info_add_keystr(info, "topology",
e_topology_name[topology_idx].name);

Näytä tiedosto

@@ -926,6 +926,52 @@ int sde_connector_helper_reset_custom_properties(
int sde_connector_state_get_mode_info(struct drm_connector_state *conn_state,
struct msm_mode_info *mode_info);
/**
* sde_connector_state_get_topology - get topology from given connector state
* conn_state: Pointer to the DRM connector state object
* topology: Pointer to store topology info of the display
*/
static inline int sde_connector_state_get_topology(
struct drm_connector_state *conn_state,
struct msm_display_topology *topology)
{
struct sde_connector_state *sde_conn_state = NULL;
if (!conn_state || !topology) {
SDE_ERROR("invalid arguments conn_state %d, topology %d\n",
!conn_state, !topology);
return -EINVAL;
}
sde_conn_state = to_sde_connector_state(conn_state);
memcpy(topology, &sde_conn_state->mode_info.topology,
sizeof(struct msm_display_topology));
return 0;
}
/**
* sde_connector_state_get_compression_info- get compression info of display
* from given connector state
* conn_state: Pointer to the DRM connector state object
* comp_info: Pointer to the compression info structure
*/
static inline int sde_connector_state_get_compression_info(
struct drm_connector_state *conn_state,
struct msm_compression_info *comp_info)
{
struct sde_connector_state *sde_conn_state = NULL;
if (!conn_state || !comp_info) {
SDE_ERROR("invalid arguments\n");
return -EINVAL;
}
sde_conn_state = to_sde_connector_state(conn_state);
memcpy(comp_info, &sde_conn_state->mode_info.comp_info,
sizeof(struct msm_compression_info));
return 0;
}
/**
* sde_connector_get_mode_info - retrieve mode info for given mode
* @connector: Pointer to drm connector structure

Näytä tiedosto

@@ -510,22 +510,22 @@ void sde_encoder_get_hw_resources(struct drm_encoder *drm_enc,
struct drm_connector_state *conn_state)
{
struct sde_encoder_virt *sde_enc = NULL;
struct msm_mode_info mode_info;
int i = 0;
int ret, i = 0;
if (!hw_res || !drm_enc || !conn_state) {
SDE_ERROR("invalid argument(s), drm_enc %d, res %d, state %d\n",
!drm_enc, !hw_res, !conn_state);
if (!hw_res || !drm_enc || !conn_state || !hw_res->comp_info) {
SDE_ERROR("rc %d, drm_enc %d, res %d, state %d, comp-info %d\n",
-EINVAL, !drm_enc, !hw_res, !conn_state,
hw_res ? !hw_res->comp_info : 0);
return;
}
sde_enc = to_sde_encoder_virt(drm_enc);
SDE_DEBUG_ENC(sde_enc, "\n");
/* Query resources used by phys encs, expected to be without overlap */
memset(hw_res, 0, sizeof(*hw_res));
hw_res->display_num_of_h_tiles = sde_enc->display_num_of_h_tiles;
hw_res->display_type = sde_enc->disp_info.display_type;
/* Query resources used by phys encs, expected to be without overlap */
for (i = 0; i < sde_enc->num_phys_encs; i++) {
struct sde_encoder_phys *phys = sde_enc->phys_encs[i];
@@ -538,10 +538,14 @@ void sde_encoder_get_hw_resources(struct drm_encoder *drm_enc,
* called from atomic_check phase. Use the below API to get mode
* information of the temporary conn_state passed
*/
sde_connector_state_get_mode_info(conn_state, &mode_info);
hw_res->topology = mode_info.topology;
hw_res->comp_info = &sde_enc->mode_info.comp_info;
hw_res->display_type = sde_enc->disp_info.display_type;
ret = sde_connector_state_get_topology(conn_state, &hw_res->topology);
if (ret)
SDE_ERROR("failed to get topology ret %d\n", ret);
ret = sde_connector_state_get_compression_info(conn_state,
hw_res->comp_info);
if (ret)
SDE_ERROR("failed to get compression info ret %d\n", ret);
}
void sde_encoder_destroy(struct drm_encoder *drm_enc)
@@ -873,7 +877,8 @@ static int _sde_encoder_atomic_check_reserve(struct drm_encoder *drm_enc,
if (crtc_state->active)
topology = &sde_conn_state->mode_info.topology;
ret = sde_rm_update_topology(conn_state, topology);
ret = sde_rm_update_topology(&sde_kms->rm,
conn_state, topology);
if (ret) {
SDE_ERROR_ENC(sde_enc,
"RM failed to update topology, rc: %d\n", ret);

Näytä tiedosto

@@ -31,40 +31,61 @@
#define RM_RQ_CWB(r) ((r)->top_ctrl & BIT(SDE_RM_TOPCTL_CWB))
#define RM_IS_TOPOLOGY_MATCH(t, r) ((t).num_lm == (r).num_lm && \
(t).num_comp_enc == (r).num_enc && \
(t).num_intf == (r).num_intf)
(t).num_intf == (r).num_intf && \
(t).comp_type == (r).comp_type)
/**
* toplogy information to be used when ctl path version does not
* support driving more than one interface per ctl_path
*/
static const struct sde_rm_topology_def g_top_table[] = {
{ SDE_RM_TOPOLOGY_NONE, 0, 0, 0, 0, false },
{ SDE_RM_TOPOLOGY_SINGLEPIPE, 1, 0, 1, 1, false },
{ SDE_RM_TOPOLOGY_SINGLEPIPE_DSC, 1, 1, 1, 1, false },
{ SDE_RM_TOPOLOGY_DUALPIPE, 2, 0, 2, 2, true },
{ SDE_RM_TOPOLOGY_DUALPIPE_DSC, 2, 2, 2, 2, true },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE, 2, 0, 1, 1, false },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC, 2, 1, 1, 1, false },
{ SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE, 2, 2, 1, 1, false },
{ SDE_RM_TOPOLOGY_PPSPLIT, 1, 0, 2, 1, true },
static const struct sde_rm_topology_def g_top_table[SDE_RM_TOPOLOGY_MAX] = {
{ SDE_RM_TOPOLOGY_NONE, 0, 0, 0, 0, false,
MSM_DISPLAY_COMPRESSION_NONE },
{ SDE_RM_TOPOLOGY_SINGLEPIPE, 1, 0, 1, 1, false,
MSM_DISPLAY_COMPRESSION_NONE },
{ SDE_RM_TOPOLOGY_SINGLEPIPE_DSC, 1, 1, 1, 1, false,
MSM_DISPLAY_COMPRESSION_DSC },
{ SDE_RM_TOPOLOGY_DUALPIPE, 2, 0, 2, 2, true,
MSM_DISPLAY_COMPRESSION_NONE },
{ SDE_RM_TOPOLOGY_DUALPIPE_DSC, 2, 2, 2, 2, true,
MSM_DISPLAY_COMPRESSION_DSC },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE, 2, 0, 1, 1, false,
MSM_DISPLAY_COMPRESSION_NONE },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC, 2, 1, 1, 1, false,
MSM_DISPLAY_COMPRESSION_DSC },
{ SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE, 2, 2, 1, 1, false,
MSM_DISPLAY_COMPRESSION_DSC },
{ SDE_RM_TOPOLOGY_PPSPLIT, 1, 0, 2, 1, true,
MSM_DISPLAY_COMPRESSION_NONE },
};
/**
* topology information to be used when the ctl path version
* is SDE_CTL_CFG_VERSION_1_0_0
*/
static const struct sde_rm_topology_def g_ctl_ver_1_top_table[] = {
{ SDE_RM_TOPOLOGY_NONE, 0, 0, 0, 0, false },
{ SDE_RM_TOPOLOGY_SINGLEPIPE, 1, 0, 1, 1, false },
{ SDE_RM_TOPOLOGY_SINGLEPIPE_DSC, 1, 1, 1, 1, false },
{ SDE_RM_TOPOLOGY_SINGLEPIPE_VDC, 1, 1, 1, 1, false },
{ SDE_RM_TOPOLOGY_DUALPIPE, 2, 0, 2, 1, true },
{ SDE_RM_TOPOLOGY_DUALPIPE_DSC, 2, 2, 2, 1, true },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE, 2, 0, 1, 1, false },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC, 2, 1, 1, 1, false },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_VDC, 2, 1, 1, 1, false },
{ SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE, 2, 2, 1, 1, false },
{ SDE_RM_TOPOLOGY_PPSPLIT, 1, 0, 2, 1, true },
static const struct sde_rm_topology_def g_top_table_v1[SDE_RM_TOPOLOGY_MAX] = {
{ SDE_RM_TOPOLOGY_NONE, 0, 0, 0, 0, false,
MSM_DISPLAY_COMPRESSION_NONE },
{ SDE_RM_TOPOLOGY_SINGLEPIPE, 1, 0, 1, 1, false,
MSM_DISPLAY_COMPRESSION_NONE },
{ SDE_RM_TOPOLOGY_SINGLEPIPE_DSC, 1, 1, 1, 1, false,
MSM_DISPLAY_COMPRESSION_DSC },
{ SDE_RM_TOPOLOGY_SINGLEPIPE_VDC, 1, 1, 1, 1, false,
MSM_DISPLAY_COMPRESSION_VDC },
{ SDE_RM_TOPOLOGY_DUALPIPE, 2, 0, 2, 1, true,
MSM_DISPLAY_COMPRESSION_NONE },
{ SDE_RM_TOPOLOGY_DUALPIPE_DSC, 2, 2, 2, 1, true,
MSM_DISPLAY_COMPRESSION_DSC },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE, 2, 0, 1, 1, false,
MSM_DISPLAY_COMPRESSION_NONE },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_DSC, 2, 1, 1, 1, false,
MSM_DISPLAY_COMPRESSION_DSC },
{ SDE_RM_TOPOLOGY_DUALPIPE_3DMERGE_VDC, 2, 1, 1, 1, false,
MSM_DISPLAY_COMPRESSION_VDC },
{ SDE_RM_TOPOLOGY_DUALPIPE_DSCMERGE, 2, 2, 1, 1, false,
MSM_DISPLAY_COMPRESSION_DSC },
{ SDE_RM_TOPOLOGY_PPSPLIT, 1, 0, 2, 1, true,
MSM_DISPLAY_COMPRESSION_NONE },
};
@@ -308,14 +329,15 @@ void sde_rm_init_hw_iter(
iter->type = type;
}
enum sde_rm_topology_name sde_rm_get_topology_name(
struct msm_display_topology topology)
enum sde_rm_topology_name sde_rm_get_topology_name(struct sde_rm *rm,
struct msm_display_topology topology)
{
int i;
for (i = 0; i < SDE_RM_TOPOLOGY_MAX; i++)
if (RM_IS_TOPOLOGY_MATCH(g_top_table[i], topology))
return g_top_table[i].top_name;
if (RM_IS_TOPOLOGY_MATCH(rm->topology_tbl[i],
topology))
return rm->topology_tbl[i].top_name;
return SDE_RM_TOPOLOGY_NONE;
}
@@ -714,7 +736,7 @@ int sde_rm_init(struct sde_rm *rm,
rm->dev = dev;
if (IS_SDE_CTL_REV_100(cat->ctl_rev))
rm->topology_tbl = g_ctl_ver_1_top_table;
rm->topology_tbl = g_top_table_v1;
else
rm->topology_tbl = g_top_table;
@@ -1273,21 +1295,28 @@ static bool _sde_rm_check_vdc(struct sde_rm *rm,
static int _sde_rm_reserve_dsc(
struct sde_rm *rm,
struct sde_rm_rsvp *rsvp,
struct msm_display_dsc_info *dsc_info,
const struct sde_rm_topology_def *top,
struct sde_rm_requirements *reqs,
u8 *_dsc_ids)
{
struct sde_rm_hw_iter iter_i, iter_j;
struct sde_rm_hw_blk *dsc[MAX_BLOCKS];
u32 reserve_mask = 0;
int alloc_count = 0;
int num_dsc_enc = top->num_comp_enc;
int num_dsc_enc;
struct msm_display_dsc_info *dsc_info;
int i;
if ((!top->num_comp_enc) || !dsc_info) {
if (reqs->hw_res.comp_info->comp_type != MSM_DISPLAY_COMPRESSION_DSC) {
SDE_DEBUG("compression blk dsc not required\n");
return 0;
}
num_dsc_enc = reqs->topology->num_comp_enc;
dsc_info = &reqs->hw_res.comp_info->dsc_info;
if ((!num_dsc_enc) || !dsc_info) {
SDE_DEBUG("invalid topoplogy params: %d, %d\n",
top->num_comp_enc,
!(dsc_info == NULL));
num_dsc_enc, !(dsc_info == NULL));
return 0;
}
@@ -1309,7 +1338,7 @@ static int _sde_rm_reserve_dsc(
continue;
/* if this hw block does not support required feature */
if ((dsc_info->config.native_422 ||
if (!_dsc_ids && (dsc_info->config.native_422 ||
dsc_info->config.native_420) && !has_422_420_support)
continue;
@@ -1680,9 +1709,7 @@ static int _sde_rm_make_dsc_rsvp(struct sde_rm *rm, struct sde_rm_rsvp *rsvp,
i, splash_display->dsc_ids[i]);
}
return _sde_rm_reserve_dsc(rm, rsvp,
&reqs->hw_res.comp_info->dsc_info,
reqs->topology, hw_ids);
return _sde_rm_reserve_dsc(rm, rsvp, reqs, hw_ids);
}
@@ -1907,8 +1934,6 @@ static int _sde_rm_populate_requirements(
const struct drm_display_mode *mode = &crtc_state->mode;
int i;
memset(reqs, 0, sizeof(*reqs));
reqs->top_ctrl = sde_connector_get_property(conn_state,
CONNECTOR_PROP_TOPOLOGY_CONTROL);
sde_encoder_get_hw_resources(enc, &reqs->hw_res, conn_state);
@@ -2032,7 +2057,8 @@ static struct drm_connector *_sde_rm_get_connector(
return conn;
}
int sde_rm_update_topology(struct drm_connector_state *conn_state,
int sde_rm_update_topology(struct sde_rm *rm,
struct drm_connector_state *conn_state,
struct msm_display_topology *topology)
{
int i, ret = 0;
@@ -2045,8 +2071,8 @@ int sde_rm_update_topology(struct drm_connector_state *conn_state,
if (topology) {
top = *topology;
for (i = 0; i < SDE_RM_TOPOLOGY_MAX; i++)
if (RM_IS_TOPOLOGY_MATCH(g_top_table[i], top)) {
top_name = g_top_table[i].top_name;
if (RM_IS_TOPOLOGY_MATCH(rm->topology_tbl[i], top)) {
top_name = rm->topology_tbl[i].top_name;
break;
}
}
@@ -2207,9 +2233,10 @@ int sde_rm_reserve(
bool test_only)
{
struct sde_rm_rsvp *rsvp_cur, *rsvp_nxt;
struct sde_rm_requirements reqs;
struct sde_rm_requirements reqs = {0,};
struct msm_drm_private *priv;
struct sde_kms *sde_kms;
struct msm_compression_info *comp_info;
int ret;
if (!rm || !enc || !crtc_state || !conn_state) {
@@ -2233,6 +2260,10 @@ int sde_rm_reserve(
!drm_atomic_crtc_needs_modeset(crtc_state))
return 0;
comp_info = kzalloc(sizeof(*comp_info), GFP_KERNEL);
if (!comp_info)
return -ENOMEM;
SDE_DEBUG("reserving hw for conn %d enc %d crtc %d test_only %d\n",
conn_state->connector->base.id, enc->base.id,
crtc_state->crtc->base.id, test_only);
@@ -2265,6 +2296,7 @@ int sde_rm_reserve(
if (!test_only && rsvp_nxt)
goto commit_rsvp;
reqs.hw_res.comp_info = comp_info;
ret = _sde_rm_populate_requirements(rm, enc, crtc_state,
conn_state, &reqs);
if (ret) {
@@ -2332,6 +2364,7 @@ commit_rsvp:
ret = _sde_rm_commit_rsvp(rm, rsvp_nxt, conn_state);
end:
kfree(comp_info);
_sde_rm_print_rsvps(rm, SDE_RM_STAGE_FINAL);
mutex_unlock(&rm->rm_lock);

Näytä tiedosto

@@ -88,6 +88,7 @@ enum sde_rm_qsync_modes {
* @num_intf: number of interface used
* @num_ctl: number of control path used
* @needs_split_display: If set split display is enabled
* @comp_type: type of compression supported
*/
struct sde_rm_topology_def {
enum sde_rm_topology_name top_name;
@@ -95,7 +96,8 @@ struct sde_rm_topology_def {
int num_comp_enc;
int num_intf;
int num_ctl;
int needs_split_display;
bool needs_split_display;
enum msm_display_compression_type comp_type;
};
/**
@@ -156,11 +158,12 @@ struct sde_rm_hw_request {
/**
* sde_rm_get_topology_name - get the name of the given topology config
* @rm: SDE resource manager handle
* @topology: msm_display_topology topology config
* @Return: name of the given topology
*/
enum sde_rm_topology_name sde_rm_get_topology_name(
struct msm_display_topology topology);
enum sde_rm_topology_name sde_rm_get_topology_name(struct sde_rm *rm,
struct msm_display_topology topology);
/**
@@ -273,11 +276,13 @@ int sde_rm_cont_splash_res_init(struct msm_drm_private *priv,
/**
* sde_rm_update_topology - sets topology property of the connector
* @rm: SDE resource manager handle
* @conn_state: drm state of the connector
* @topology: topology selected for the display
* @return: 0 on success or error
*/
int sde_rm_update_topology(struct drm_connector_state *conn_state,
int sde_rm_update_topology(struct sde_rm *rm,
struct drm_connector_state *conn_state,
struct msm_display_topology *topology);
/**