From e2726c7b1a81bedd516fabb0bba2acf28c696c02 Mon Sep 17 00:00:00 2001 From: Abhijit Kulkarni Date: Mon, 27 May 2019 18:05:38 -0700 Subject: [PATCH] disp: msm: sde: allocate dsc block based on capability Certain DSC hw blocks only support 444 mode, while others support both 444 and 422 modes. This change adds support in resource manager to check the hw resource requirement with the capability of the block and then reserve the correct hw resource. Change-Id: If85beb2f2f25e9eb7f8a8321c94b57878d048369 Signed-off-by: Abhijit Kulkarni --- msm/sde/sde_encoder.c | 1 + msm/sde/sde_encoder.h | 2 ++ msm/sde/sde_rm.c | 38 +++++++++++++++++++++++++++++++++----- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/msm/sde/sde_encoder.c b/msm/sde/sde_encoder.c index 78b2d5cee0..f41c180ef3 100644 --- a/msm/sde/sde_encoder.c +++ b/msm/sde/sde_encoder.c @@ -480,6 +480,7 @@ void sde_encoder_get_hw_resources(struct drm_encoder *drm_enc, */ 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; } diff --git a/msm/sde/sde_encoder.h b/msm/sde/sde_encoder.h index e01a9f9acb..599ef3a133 100644 --- a/msm/sde/sde_encoder.h +++ b/msm/sde/sde_encoder.h @@ -58,6 +58,7 @@ * interface * @display_type: Type of the display * @topology: Topology of the display + * @comp_info: Compression parameters information */ struct sde_encoder_hw_resources { enum sde_intf_mode intfs[INTF_MAX]; @@ -66,6 +67,7 @@ struct sde_encoder_hw_resources { u32 display_num_of_h_tiles; enum sde_connector_display display_type; struct msm_display_topology topology; + struct msm_compression_info *comp_info; }; /** diff --git a/msm/sde/sde_rm.c b/msm/sde/sde_rm.c index c08f723b9b..ebe0180c5d 100644 --- a/msm/sde/sde_rm.c +++ b/msm/sde/sde_rm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ #define pr_fmt(fmt) "[drm:%s] " fmt, __func__ @@ -1236,6 +1236,7 @@ static bool _sde_rm_check_dsc(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, u8 *_dsc_ids) { @@ -1245,20 +1246,40 @@ static int _sde_rm_reserve_dsc( int num_dsc_enc = top->num_comp_enc; int i; - if (!top->num_comp_enc) + if ((!top->num_comp_enc) || !dsc_info) { + SDE_DEBUG("invalid topoplogy params: %d, %d\n", + top->num_comp_enc, + !(dsc_info == NULL)); return 0; + } sde_rm_init_hw_iter(&iter_i, 0, SDE_HW_BLK_DSC); /* Find a first DSC */ while (alloc_count != num_dsc_enc && _sde_rm_get_hw_locked(rm, &iter_i)) { + const struct sde_hw_dsc *hw_dsc = to_sde_hw_dsc( + iter_i.blk->hw); + unsigned long features = hw_dsc->caps->features; + bool has_422_420_support = + BIT(SDE_DSC_NATIVE_422_EN) & features; + + SDE_DEBUG("blk id = %d, is_422_420_req:%d ,is_supported:%d\n", + iter_i.blk->id, + (dsc_info->config.native_422 || + dsc_info->config.native_420), + has_422_420_support); memset(&dsc, 0, sizeof(dsc)); alloc_count = 0; if (_dsc_ids && (iter_i.blk->id != _dsc_ids[alloc_count])) continue; + /* if this hw block does not support required feature */ + if ((dsc_info->config.native_422 || + dsc_info->config.native_420) && !has_422_420_support) + continue; + if (!_sde_rm_check_dsc(rm, rsvp, iter_i.blk, NULL)) continue; @@ -1540,20 +1561,27 @@ static int _sde_rm_make_dsc_rsvp(struct sde_rm *rm, struct sde_rm_rsvp *rsvp, struct sde_rm_requirements *reqs, struct sde_splash_display *splash_display) { - int ret, i; + int i; u8 *hw_ids = NULL; /* Check if splash data provided dsc_ids */ if (splash_display) { hw_ids = splash_display->dsc_ids; + if (splash_display->dsc_cnt) + reqs->hw_res.comp_info->comp_type = + MSM_DISPLAY_COMPRESSION_DSC; for (i = 0; i < splash_display->dsc_cnt; i++) SDE_DEBUG("splash_data.dsc_ids[%d] = %d\n", i, splash_display->dsc_ids[i]); } - ret = _sde_rm_reserve_dsc(rm, rsvp, reqs->topology, hw_ids); + if ( reqs->hw_res.comp_info->comp_type == + MSM_DISPLAY_COMPRESSION_DSC) + return _sde_rm_reserve_dsc(rm, rsvp, + &reqs->hw_res.comp_info->dsc_info, + reqs->topology, hw_ids); - return ret; + return 0; } static int _sde_rm_make_next_rsvp(struct sde_rm *rm, struct drm_encoder *enc,