From patchwork Wed May 10 22:54:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jessica Zhang X-Patchwork-Id: 13237357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5938FC77B7C for ; Wed, 10 May 2023 22:55:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5716810E505; Wed, 10 May 2023 22:55:07 +0000 (UTC) Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id DEFC610E505; Wed, 10 May 2023 22:55:05 +0000 (UTC) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34AMWw6R021189; Wed, 10 May 2023 22:55:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : date : subject : mime-version : content-type : content-transfer-encoding : message-id : references : in-reply-to : to : cc; s=qcppdkim1; bh=02WDuKrryAsnhGgxZTNSN0H2+AQg1hejxGqvJ0WHbsY=; b=L004q1f7VkVDYDkQcNmi7pL/nU2Z0krzeSdEhlRMGhfR8yv9RMfKHQHqnStV5/FkUPUp tWiAJknpb3O0AD6y2K0koucejstm173zQnAzWR/qzCbYKqRgmBrXGat61ya6KCmBNHI8 IDhJofST1qPPZu1//OyDQgR2taQ1dxSt4keIYLX/8dkaEa0J7CYKPckcp0u1AdluZRat 9zQrpHPNiuhbrmYGH1xBrwMNeA6ND/USgSKXXFg19F/ixnbbMLFeyBKFK7ymSvkAXwbA BAT0U4xYI73anUL6sVHyp7tPIeEjNGTZtumkNPGr74bhEmdxyVF4/jrCEho3hFwhqQfA Aw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qgm5m00vq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 May 2023 22:55:03 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34AMt2jC014093 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 May 2023 22:55:02 GMT Received: from jesszhan-linux.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 10 May 2023 15:55:02 -0700 From: Jessica Zhang Date: Wed, 10 May 2023 15:54:41 -0700 Subject: [PATCH v9 1/8] drm/display/dsc: Add flatness and initial scale value calculations MIME-Version: 1.0 Message-ID: <20230329-rfc-msm-dsc-helper-v9-1-87daeaec2c0a@quicinc.com> References: <20230329-rfc-msm-dsc-helper-v9-0-87daeaec2c0a@quicinc.com> In-Reply-To: <20230329-rfc-msm-dsc-helper-v9-0-87daeaec2c0a@quicinc.com> To: X-Mailer: b4 0.13-dev-bfdf5 X-Developer-Signature: v=1; a=ed25519-sha256; t=1683759301; l=1328; i=quic_jesszhan@quicinc.com; s=20230329; h=from:subject:message-id; bh=SiPrETtPeQsw6TkRmH6Rnw3iLND9rf5XbK6DmOHqp6g=; b=YhlW1/NTC5+0jZHUGwNlUFY46tEPareqNgteJd2qTMQyyKQ5+NmbZq8mkeD8dK7pHcu4tqFkC uR3gTCI9KpRA0erlq83KPB4B+Q3SvtC5ZXjdWMHMgSVy7JKhvXdiAAi X-Developer-Key: i=quic_jesszhan@quicinc.com; a=ed25519; pk=gAUCgHZ6wTJOzQa3U0GfeCDH7iZLlqIEPo4rrjfDpWE= X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 5Z8VsVKg37H8WYg2Tr4FLUyBguGV70aG X-Proofpoint-ORIG-GUID: 5Z8VsVKg37H8WYg2Tr4FLUyBguGV70aG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-10_04,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305100190 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, Abhinav Kumar , dri-devel@lists.freedesktop.org, Kuogee Hsieh , Konrad Dybcio , Jessica Zhang , Dmitry Baryshkov , Marijn Suijten , Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add helpers to calculate det_thresh_flatness and initial_scale_value as these calculations are defined within the DSC spec. Signed-off-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov Reviewed-by: Marijn Suijten Signed-off-by: Jessica Zhang --- include/drm/display/drm_dsc_helper.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/drm/display/drm_dsc_helper.h b/include/drm/display/drm_dsc_helper.h index 0bb0c3afd740..422135a33d65 100644 --- a/include/drm/display/drm_dsc_helper.h +++ b/include/drm/display/drm_dsc_helper.h @@ -25,5 +25,16 @@ void drm_dsc_set_rc_buf_thresh(struct drm_dsc_config *vdsc_cfg); int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params_kind kind); int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg); +static inline void drm_dsc_set_initial_scale_value(struct drm_dsc_config *dsc) +{ + dsc->initial_scale_value = 8 * dsc->rc_model_size / + (dsc->rc_model_size - dsc->initial_offset); +} + +static inline int drm_dsc_calculate_flatness_det_thresh(struct drm_dsc_config *dsc) +{ + return 2 << (dsc->bits_per_component - 8); +} + #endif /* _DRM_DSC_HELPER_H_ */