From patchwork Wed Oct 26 18:28:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marijn Suijten X-Patchwork-Id: 11348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424084wru; Wed, 26 Oct 2022 11:29:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OvjMMtajcOHFJQVcy5FN8XQ4fG3yPEZNBFHpy/J/ZNhrVRz1K+yQMuXk2x+NWBJvpEl5v X-Received: by 2002:a17:902:e74a:b0:186:a094:1d3 with SMTP id p10-20020a170902e74a00b00186a09401d3mr18389983plf.153.1666808974545; Wed, 26 Oct 2022 11:29:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666808974; cv=none; d=google.com; s=arc-20160816; b=pKZ9VwMCb2z//A9I+b31A6pTQHbgK+M7bUSnSRUb7qfFbX8XveI9X3cdSmoIxE18U4 vWEtjhCape75rQGl7vmxJBMs1JynxGLp5iFodGqvJcWRwufjMy2HnTb+ZU+VBUa29aqS o//4NKEghWA+Ha41cAPJXzGrjlwpdIk2QwTHYZOr2q8FKmw6tuO9f5r0LCQr8ShYpzIY VKPzBOYqAOeSzg9VdxYPD3G2wAKro4ms44wPILl+3Izl+hFoXjFaO+qajNbi99/n7I7e LdwFM176usFl44sfwaT/yaTMLpbHBOX2IJ19oG4zqzefH/Sdi5uChbfRdJ5wxW5rghH4 T/gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ii5Qn5rKLg1TR/azioN9tnrutw+ZjJnDhbUCg6URwJ4=; b=HE+Rbiuyr/jBc2uYQGXdiI6XMHCKTmjIvWxdzq3EOv6UuJRxfBYDwgFEEULw01t05Q GAsem54m80eJQKK2iNmJJVq2S7ROIyKK/wKv7lAXD74NMEu3qBy6D4PlbCsNW1ZujS/Z 3AbTfGduI2YyTTG9wX45fvVCnD4KxL5IDJfYG9t4SE7EO1XiIoFkKZZik+VmPxrAzn6/ 6TtS/ktepsKjKaEWmIlj2TXj3CxD52Z6NAF2mM20xlryhNEYKIv7igjtSXOFTpw5spj7 pUGAL8MEx5VYnDP92DeE+UqEHUtT02h+F2sPrdGiV2IEgtZVWqIbWBB3pGIqzlHgJNW7 R7+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w3-20020a1709027b8300b00186abc34277si7068440pll.263.2022.10.26.11.29.19; Wed, 26 Oct 2022 11:29:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234000AbiJZS2z (ORCPT + 99 others); Wed, 26 Oct 2022 14:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234401AbiJZS2i (ORCPT ); Wed, 26 Oct 2022 14:28:38 -0400 Received: from relay06.th.seeweb.it (relay06.th.seeweb.it [IPv6:2001:4b7a:2000:18::167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 475FEDEF3C for ; Wed, 26 Oct 2022 11:28:37 -0700 (PDT) Received: from localhost.localdomain (94-209-172-39.cable.dynamic.v4.ziggo.nl [94.209.172.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id 3A52E3F412; Wed, 26 Oct 2022 20:28:35 +0200 (CEST) From: Marijn Suijten To: phone-devel@vger.kernel.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Vinod Koul Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Marijn Suijten , Sean Paul , David Airlie , Daniel Vetter , Douglas Anderson , Vladimir Lypak , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 01/10] drm/msm/dsi: Remove useless math in DSC calculations Date: Wed, 26 Oct 2022 20:28:15 +0200 Message-Id: <20221026182824.876933-2-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221026182824.876933-1-marijn.suijten@somainline.org> References: <20221026182824.876933-1-marijn.suijten@somainline.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747775887409722273?= X-GMAIL-MSGID: =?utf-8?q?1747775887409722273?= Multiplying a value by 2 and adding 1 to it always results in a value that is uneven, and that 1 gets truncated immediately when performing integer division by 2 again. There is no "rounding" possible here. After that target_bpp_x16 is used to store a multiplication of bits_per_pixel by 16 which is only ever read to immediately be divided by 16 again, and is elided in much the same way. Fixes: b9080324d6ca ("drm/msm/dsi: add support for dsc data") Reviewed-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov Signed-off-by: Marijn Suijten --- drivers/gpu/drm/msm/dsi/dsi_host.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index e82eef031ed4..d645fcbb0683 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1784,7 +1784,6 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) int hrd_delay; int pre_num_extra_mux_bits, num_extra_mux_bits; int slice_bits; - int target_bpp_x16; int data; int final_value, final_scale; int i; @@ -1864,14 +1863,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) data = 2048 * (dsc->rc_model_size - dsc->initial_offset + num_extra_mux_bits); dsc->slice_bpg_offset = DIV_ROUND_UP(data, groups_total); - /* bpp * 16 + 0.5 */ - data = dsc->bits_per_pixel * 16; - data *= 2; - data++; - data /= 2; - target_bpp_x16 = data; - - data = (dsc->initial_xmit_delay * target_bpp_x16) / 16; + data = dsc->initial_xmit_delay * dsc->bits_per_pixel; final_value = dsc->rc_model_size - data + num_extra_mux_bits; dsc->final_offset = final_value; From patchwork Wed Oct 26 18:28:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marijn Suijten X-Patchwork-Id: 11349 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424111wru; Wed, 26 Oct 2022 11:29:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72MfjBIzmht8zvcxDFzc1fniPP1Esnt3F4I4q18NlsVXIeB5dNiOhBOT9DyHj3fp8yhUTU X-Received: by 2002:a17:90a:f198:b0:212:c3cf:b8f4 with SMTP id bv24-20020a17090af19800b00212c3cfb8f4mr5729832pjb.49.1666808979370; Wed, 26 Oct 2022 11:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666808979; cv=none; d=google.com; s=arc-20160816; b=fQsI3WEUTyoXT6lfs34QG0+TI9hFfJXUiaFZ30eto2K8P2dEIairkRIrnPYHtxbUTR fDGHMOe5awzB2glsN/szRwDB7bXfz5OeTboZFVNUwOmMXvX1bO7Pjg25UZl3wgRUOdbN SBIzbsER63OnvLrGjd0nNaEyv3yCcst3VWNYWugCIOfotqTd9kYA6FngzjS5dvjoHwc0 mod8qTQgssZ9r3EfV39eMQQpmdJ5LAunU+BeEv4R1Ug4xHhaJs7heY2T/QjgY+Mxvcbo hIkj/4OEtZcOF7lZwVTyJkFE5sZGcukdU5aCMSHMousUwNjIG9sobIRQH1/oJ0Y4QarF TjaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lw8esrT/Y8Gnj43tNjhSPd7K1elBlz//HcDeZTGIkeA=; b=uEr5UbbvfM8RzqbN759LurUlD7oCnr83at1f3rJqmmqY2QfJRDSl8Bg/e3EQ7QPI13 x+uGCKO3ZFqwYlSpL9qODTNpuj3OMXRVm7zhAIApiZhjf7fccwIBou8fxN4CVmrf/rhs nO5cAsH4Uv+dS0JmfQ9QtG5BP3KXg67o82nIlCJewGNU+6J7WOpSnMEbnGReZ5d0xiCg LpzhU9rhg4hNgfYfq5j6TPod8nItgYWNc1NcC3ii+mt9BzB7cpXfIdNq2R6La0+I+QCw Izqq/DNSObd80YaWu8w2rubzmeG7IkYK95fiTzA2qVPXFLLjOyDfrk/+/ZrYsIWRxg+M 0oPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a63770c000000b0044c3e11a7b4si8380647pgc.42.2022.10.26.11.29.25; Wed, 26 Oct 2022 11:29:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234420AbiJZS27 (ORCPT + 99 others); Wed, 26 Oct 2022 14:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234380AbiJZS2k (ORCPT ); Wed, 26 Oct 2022 14:28:40 -0400 Received: from relay06.th.seeweb.it (relay06.th.seeweb.it [5.144.164.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C4EEE1941; Wed, 26 Oct 2022 11:28:39 -0700 (PDT) Received: from localhost.localdomain (94-209-172-39.cable.dynamic.v4.ziggo.nl [94.209.172.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id E696B3F66A; Wed, 26 Oct 2022 20:28:36 +0200 (CEST) From: Marijn Suijten To: phone-devel@vger.kernel.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Vinod Koul Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Marijn Suijten , Sean Paul , David Airlie , Daniel Vetter , Douglas Anderson , Vladimir Lypak , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Marek Vasut Subject: [PATCH v4 02/10] drm/msm/dsi: Remove repeated calculation of slice_per_intf Date: Wed, 26 Oct 2022 20:28:16 +0200 Message-Id: <20221026182824.876933-3-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221026182824.876933-1-marijn.suijten@somainline.org> References: <20221026182824.876933-1-marijn.suijten@somainline.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747775892312466643?= X-GMAIL-MSGID: =?utf-8?q?1747775892312466643?= slice_per_intf is already computed for intf_width, which holds the same value as hdisplay. Fixes: 08802f515c3c ("drm/msm/dsi: Add support for DSC configuration") Reviewed-by: Bjorn Andersson Reviewed-by: Konrad Dybcio Reviewed-by: Abhinav Kumar Reviewed-by: Vinod Koul Reviewed-by: Dmitry Baryshkov Signed-off-by: Marijn Suijten --- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index d645fcbb0683..80dd9370a258 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -842,7 +842,7 @@ static void dsi_ctrl_config(struct msm_dsi_host *msm_host, bool enable, static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mode, u32 hdisplay) { struct drm_dsc_config *dsc = msm_host->dsc; - u32 reg, intf_width, reg_ctrl, reg_ctrl2; + u32 reg, reg_ctrl, reg_ctrl2; u32 slice_per_intf, total_bytes_per_intf; u32 pkt_per_line; u32 bytes_in_slice; @@ -851,8 +851,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod /* first calculate dsc parameters and then program * compress mode registers */ - intf_width = hdisplay; - slice_per_intf = DIV_ROUND_UP(intf_width, dsc->slice_width); + slice_per_intf = DIV_ROUND_UP(hdisplay, dsc->slice_width); /* If slice_per_pkt is greater than slice_per_intf * then default to 1. This can happen during partial @@ -861,7 +860,6 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod if (slice_per_intf > dsc->slice_count) dsc->slice_count = 1; - slice_per_intf = DIV_ROUND_UP(hdisplay, dsc->slice_width); bytes_in_slice = DIV_ROUND_UP(dsc->slice_width * dsc->bits_per_pixel, 8); dsc->slice_chunk_size = bytes_in_slice; From patchwork Wed Oct 26 18:28:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marijn Suijten X-Patchwork-Id: 11352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424252wru; Wed, 26 Oct 2022 11:30:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ib1uLNiiqfsuunK3Vfv3OmB8UPHNdhra5XM7kVIqv3xPtHJVEel6T5yIBzW+VqAXrzToY X-Received: by 2002:a05:6402:1e8d:b0:454:79a9:201f with SMTP id f13-20020a0564021e8d00b0045479a9201fmr42896543edf.176.1666809001163; Wed, 26 Oct 2022 11:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666809001; cv=none; d=google.com; s=arc-20160816; b=vLHeHiryysjBv1XEzFAQJSDROAGReW1pulJdtnPAlenSkxLUXr2UoMJeYtYsVHQQ4n 42wEKg4LekmblQU5T0jybf2uBGk75OD4H/mq82ohSo1pvYR0r2/s6DA2m+itl8ZciQ/n NiXPffLi6duhcVpoELLAN/hjU9Q+Rh/W6b2aVL/UWoQzUEJgHfo2rXoNExUHrBoPOMaN U83z9duSxhKEjPmi6tY6icdTZHI11xEOvWmyUl+NMUbfRCGJCfI0XhZcEgHkwczQlYUG AT75+HJ0n84K1yJsm8Rnp1N77+tOp8MQmO5040kpbtdIa2uIKas+1dHxE7oP4DUz7G+5 YNBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OSXR7NhTCeoQ6FtZ60ipxlRRoyJtzpZIxhnI7E0tW+4=; b=lJiArLznXDSOWmewaU7OgXlDpdU15El09zHLKs4Uu5eiEoTIeI9y9/lwomQVjBA6ND ptw53O2w+OrkOXNbaDwwGR2DqJPoGXqnetXevreXkRuXUxU1e9GpkUlmT5233ABCXycI MvZN6GtlaVa+POPc5JUTs/goZshdx545YZ10kRK635JzBhWiVzipTNXQBRYWmcAVu/QF rLA+Y8qPdkhKIvIhgLdJ/htXXhyuEVMVv90SGRQ7N3UfbJtF1PAoI9wMnOhHzmwsCO5h DQlvOGxV8m7GMZ6KqEy4Ws9z1w7EJ3MwqGsO37U3JRxwQ7an7b3ckYizZhWEZGjuwo23 xpYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv11-20020a17090760cb00b007824b85978asi4243846ejc.81.2022.10.26.11.29.37; Wed, 26 Oct 2022 11:30:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234347AbiJZS3F (ORCPT + 99 others); Wed, 26 Oct 2022 14:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbiJZS2m (ORCPT ); Wed, 26 Oct 2022 14:28:42 -0400 Received: from relay08.th.seeweb.it (relay08.th.seeweb.it [5.144.164.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95F3282850 for ; Wed, 26 Oct 2022 11:28:41 -0700 (PDT) Received: from localhost.localdomain (94-209-172-39.cable.dynamic.v4.ziggo.nl [94.209.172.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id A6FE93F682; Wed, 26 Oct 2022 20:28:38 +0200 (CEST) From: Marijn Suijten To: phone-devel@vger.kernel.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Vinod Koul Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Marijn Suijten , Sean Paul , David Airlie , Daniel Vetter , Douglas Anderson , Vladimir Lypak , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 03/10] drm/msm/dsi: Use DIV_ROUND_UP instead of conditional increment on modulo Date: Wed, 26 Oct 2022 20:28:17 +0200 Message-Id: <20221026182824.876933-4-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221026182824.876933-1-marijn.suijten@somainline.org> References: <20221026182824.876933-1-marijn.suijten@somainline.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747775915288204386?= X-GMAIL-MSGID: =?utf-8?q?1747775915288204386?= This exact same math is used to compute bytes_in_slice above in dsi_update_dsc_timing(), also used to fill slice_chunk_size. Fixes: b9080324d6ca ("drm/msm/dsi: add support for dsc data") Reviewed-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov Signed-off-by: Marijn Suijten --- drivers/gpu/drm/msm/dsi/dsi_host.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 80dd9370a258..d9b3e336896f 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1829,9 +1829,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) * params are calculated */ groups_per_line = DIV_ROUND_UP(dsc->slice_width, 3); - dsc->slice_chunk_size = dsc->slice_width * dsc->bits_per_pixel / 8; - if ((dsc->slice_width * dsc->bits_per_pixel) % 8) - dsc->slice_chunk_size++; + dsc->slice_chunk_size = DIV_ROUND_UP(dsc->slice_width * dsc->bits_per_pixel, 8); /* rbs-min */ min_rate_buffer_size = dsc->rc_model_size - dsc->initial_offset + From patchwork Wed Oct 26 18:28:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marijn Suijten X-Patchwork-Id: 11350 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424148wru; Wed, 26 Oct 2022 11:29:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cv/nfg89JCqiJUHMnLEULMndj4C7O792bbbbXMhsRKBIIdL+alPGNcpkwNyWd4biIZS6o X-Received: by 2002:a65:5a0b:0:b0:46b:158e:ad7c with SMTP id y11-20020a655a0b000000b0046b158ead7cmr39300761pgs.272.1666808985239; Wed, 26 Oct 2022 11:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666808985; cv=none; d=google.com; s=arc-20160816; b=GFgEt9u1BAk4KuuiiZrWJsk153G78hT8TiGEGLTaR5qnBsHBcscNf2QGoAs7LfszgR UWpCpwiNF9RYigB2v2uUIFJW1iczdiPuk3Kj/oxReXUJ7+mXLkKZtPwWfmx06FN6+HIL cMIQdY7Pop1Aj7/hN/6e5428hxY14hE6yay857lF8biG2oCjD/DoA965MoefvM/zzSvD 58yp7/LXhzt6hS9PWuUuHzjKGfiXEjGn9apfO9F+1XYthFylk8VB5jO1JyPNaLRVZfBb Q8+ATgjwB6EqZsEQFZEOxXy8zua5kaHo3lMbFWB0jlowR11ZHVCQw6ic1ocINREk9fGo NrXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DNQZ3UAMh++Ab+y+QQaELMhjVEKRbKfKi8jQwoOLAdE=; b=FFUiWKAWviuHGezSX/7nExYrJGd7BUKYNONW9yWjLAh3RtYzXCJ0lEggNwSydmSbQE jopidkJpWGOwakN9F7Cb9rIUjZLRrrFe2OrSxlfAnPxKLNxBZtXdtc7axn9Xg3blz6rL FPp8nLq67oVw9FDOe6liY8m/z6+mvinZna4c1jIm3R1NMfg+IkPE3XuPa62B3WBn2a4U /p/MhBaySnR81o1oHaGVeDGlafsaeLfB/OiGGAOMbwoAYfAkXut7MbhnSsy3iGNzpLMY 3Vu6ODBtuucwFu0l3NFxL3oh4ZaBGnAIHZ4ZDApLhE3Gu3RAMmzrkeiYhovUwJpZNFkz Apkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a170902e0d300b0016c474690cfsi6176716pla.318.2022.10.26.11.29.32; Wed, 26 Oct 2022 11:29:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234442AbiJZS3C (ORCPT + 99 others); Wed, 26 Oct 2022 14:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234310AbiJZS2n (ORCPT ); Wed, 26 Oct 2022 14:28:43 -0400 Received: from m-r2.th.seeweb.it (m-r2.th.seeweb.it [5.144.164.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FAF6D8EC7 for ; Wed, 26 Oct 2022 11:28:42 -0700 (PDT) Received: from localhost.localdomain (94-209-172-39.cable.dynamic.v4.ziggo.nl [94.209.172.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id 5B5F53F6A7; Wed, 26 Oct 2022 20:28:40 +0200 (CEST) From: Marijn Suijten To: phone-devel@vger.kernel.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Vinod Koul Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Marijn Suijten , Sean Paul , David Airlie , Daniel Vetter , Douglas Anderson , Vladimir Lypak , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Marek Vasut Subject: [PATCH v4 04/10] drm/msm/dsi: Reuse earlier computed dsc->slice_chunk_size Date: Wed, 26 Oct 2022 20:28:18 +0200 Message-Id: <20221026182824.876933-5-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221026182824.876933-1-marijn.suijten@somainline.org> References: <20221026182824.876933-1-marijn.suijten@somainline.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747775898363485853?= X-GMAIL-MSGID: =?utf-8?q?1747775898363485853?= dsi_populate_dsc_params() is called prior to dsi_update_dsc_timing() and already computes a value for slice_chunk_size, whose value doesn't need to be recomputed and re-set here. Fixes: 08802f515c3c ("drm/msm/dsi: Add support for DSC configuration") Reviewed-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov Signed-off-by: Marijn Suijten --- drivers/gpu/drm/msm/dsi/dsi_host.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index d9b3e336896f..70b93e4b62a7 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -845,7 +845,6 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod u32 reg, reg_ctrl, reg_ctrl2; u32 slice_per_intf, total_bytes_per_intf; u32 pkt_per_line; - u32 bytes_in_slice; u32 eol_byte_num; /* first calculate dsc parameters and then program @@ -860,11 +859,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod if (slice_per_intf > dsc->slice_count) dsc->slice_count = 1; - bytes_in_slice = DIV_ROUND_UP(dsc->slice_width * dsc->bits_per_pixel, 8); - - dsc->slice_chunk_size = bytes_in_slice; - - total_bytes_per_intf = bytes_in_slice * slice_per_intf; + total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf; eol_byte_num = total_bytes_per_intf % 3; pkt_per_line = slice_per_intf / dsc->slice_count; @@ -890,7 +885,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod reg_ctrl |= reg; reg_ctrl2 &= ~DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH__MASK; - reg_ctrl2 |= DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH(bytes_in_slice); + reg_ctrl2 |= DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH(dsc->slice_chunk_size); dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, reg_ctrl); dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2, reg_ctrl2); From patchwork Wed Oct 26 18:28:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marijn Suijten X-Patchwork-Id: 11351 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424232wru; Wed, 26 Oct 2022 11:29:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xC698otfFltMw+Uix9zQKosHBLRmTwl/zuhUIp/cn3LXCixchB8KYQXvEZd87UD8Cf3TQ X-Received: by 2002:a17:903:1250:b0:185:40c6:3c2c with SMTP id u16-20020a170903125000b0018540c63c2cmr45421586plh.64.1666808997631; Wed, 26 Oct 2022 11:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666808997; cv=none; d=google.com; s=arc-20160816; b=lnyT6+uCtgSLEdL2tqGnegICEjN3XFWi/L7hDZ+PW0u6C8S91uobCIqPfz1K/ts2Hw gXpX1CFbXOWG912SNSNh03/u3TRvLczMQxALrVXHcPtR0EdJo0rI84QCjllaJ6q0c+Ux ve7gadAvPE4Isf8F/Hwp8kyA+tP/RgbaH8/afAq/d5cLzK/GFsV/O4FXi/K6U9CuazsZ g0ZTmUJJRvRGsl3SK65YHLyfeYFAS7PBzjW4Uso/Knpy0xlwH05O9Wl1ipFapooq6RPB qWDrTM9wTvabrVxYB4fJFm++wD2+Dfb27gVVs2KYt4oKac8/yFEYfmQmamPRTQU68855 MPgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=CgbS+v8NVxdpt1hQbliojnOsP92qCM1XpM85JCgDMGg=; b=pvx4FWPfH5bfedheJn4Ooj1ram2zZuJyQ0SBBEvhSlIjl/IsKURKoJP+QfKpQIuBW5 Zj60P2HY7K25Ienz2GEqGBRRbUfSseqTkKs1C0wfAYZXbcB3kYY9WgqAC955uPbEZUqv Ez3qlm+OrXnxjb79dZgKmd17e+HZfkffNPdG+Iuv19YKHyvMlRGa/zUyKsfdX4C4B/pz lxjHXeQyrRUh/PhPqy768VNgrOkwUSenp8yZHX5t9nJIVKy0tF3JTC+y/HekWjbGsYic FKdwRqxxmrxSfh3nsW/A4eEVTs6mUPdyC0pPLqGLjmpk5s0089PiBUbTM3QFEdWi4lbr v6/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a656897000000b0045b1d6c87cfsi8105212pgt.432.2022.10.26.11.29.44; Wed, 26 Oct 2022 11:29:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234468AbiJZS3M (ORCPT + 99 others); Wed, 26 Oct 2022 14:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234342AbiJZS2p (ORCPT ); Wed, 26 Oct 2022 14:28:45 -0400 Received: from relay05.th.seeweb.it (relay05.th.seeweb.it [IPv6:2001:4b7a:2000:18::166]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 243A8D25A7 for ; Wed, 26 Oct 2022 11:28:44 -0700 (PDT) Received: from localhost.localdomain (94-209-172-39.cable.dynamic.v4.ziggo.nl [94.209.172.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id 12ABB3F757; Wed, 26 Oct 2022 20:28:42 +0200 (CEST) From: Marijn Suijten To: phone-devel@vger.kernel.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Vinod Koul Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Marijn Suijten , Sean Paul , David Airlie , Daniel Vetter , Douglas Anderson , Vladimir Lypak , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Marek Vasut Subject: [PATCH v4 05/10] drm/msm/dsi: Appropriately set dsc->mux_word_size based on bpc Date: Wed, 26 Oct 2022 20:28:19 +0200 Message-Id: <20221026182824.876933-6-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221026182824.876933-1-marijn.suijten@somainline.org> References: <20221026182824.876933-1-marijn.suijten@somainline.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747775911756560300?= X-GMAIL-MSGID: =?utf-8?q?1747775911756560300?= This field is currently unread but will come into effect when duplicated code below is migrated to call drm_dsc_compute_rc_parameters(), which uses the bpc-dependent value of the local variable mux_words_size in much the same way. The hardcoded constant seems to be a remnant from the `/* bpc 8 */` comment right above, indicating that this group of field assignments is applicable to bpc = 8 exclusively and should probably bail out on different bpc values, until constants for other bpc values are added (or the current ones are confirmed to be correct across multiple bpc's). Fixes: b9080324d6ca ("drm/msm/dsi: add support for dsc data") Reviewed-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov Signed-off-by: Marijn Suijten --- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 70b93e4b62a7..a1c387e9b7f4 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1808,6 +1808,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) if (dsc->bits_per_component == 12) mux_words_size = 64; + dsc->mux_word_size = mux_words_size; dsc->initial_xmit_delay = 512; dsc->initial_scale_value = 32; dsc->first_line_bpg_offset = 12; @@ -1818,7 +1819,6 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) dsc->flatness_max_qp = 12; dsc->rc_quant_incr_limit0 = 11; dsc->rc_quant_incr_limit1 = 11; - dsc->mux_word_size = DSC_MUX_WORD_SIZE_8_10_BPC; /* FIXME: need to call drm_dsc_compute_rc_parameters() so that rest of * params are calculated From patchwork Wed Oct 26 18:28:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marijn Suijten X-Patchwork-Id: 11354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424398wru; Wed, 26 Oct 2022 11:30:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4NETpcGogLYEyMkbptTPaO7EQofTsXJ/HwH7eQ+1gE9bCeUtya5mVeaWdY4+8Xf8ZPTFBy X-Received: by 2002:a17:906:9752:b0:78d:d2e1:d745 with SMTP id o18-20020a170906975200b0078dd2e1d745mr38217900ejy.452.1666809019081; Wed, 26 Oct 2022 11:30:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666809019; cv=none; d=google.com; s=arc-20160816; b=rGLvaufeA/DexcfdwZgWhXiPoe903jiJEFSXCNnsqTiNq5ko9eu0so2MKRG0Z6OMF+ gHQX7xjZ9MyRwj6KWBXG5etqvq1ro9Ct1qdhIeOHYa68pClHimwYSrxa8hpGIMe8I+sZ hN/355/HmcDxhz/2bjm3bjlFQkF0kUKz9DvUeWriQyGdalX+UFI04dfI2xobZQDSUCTn 6fxdMtyHjZilZVoeDx+/S6QYM32uqkDWfZn2x12S/bdui85+ScbeVZUYKLTim5yUtmtL t6ZFSsiB3FCZ0s08A3mc06kNFBhfo96XGzlTs+OedJFHGDMxaqRIiX0gCQfLxPkBvqJL DCRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=yhpMvCITRjfHOwru91QcDNkwAwzzcgffxaj581tFPJ8=; b=Oz0m6OxFfFqsp8BRRwti/7oHzAHZauz3wCqR7aRy5guYoqCqbFNHKeNPl2WpL7HE7B VYGOliQqO9Oyjtch7egmE22VdS2CEJA0qyAHjnde9L+2exWjcVoaZCdc1bvggMlXddc5 SPxBcCh5j2pyF07J1QoStBQtGkeQUaQMwAeGvj2cJTt/ezcoD7hswloc6aF9Sdsgtuxd O/NQhEqeTAP18wQ7Yi1gRJqNtoZtMDobt4E8h8TsKI+2gol9QkVxCSxDzEwD70Q6WDbM kAhwcAYMqGr+ZrdwmiXFCJ+gEL4u2KsbbUY7d7J0R8F49Jw8UqD0+mdGTw4jdUhz4A/u V82Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h4-20020a170906854400b007330c08fe49si5562405ejy.206.2022.10.26.11.29.55; Wed, 26 Oct 2022 11:30:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234494AbiJZS3S (ORCPT + 99 others); Wed, 26 Oct 2022 14:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233539AbiJZS2r (ORCPT ); Wed, 26 Oct 2022 14:28:47 -0400 Received: from relay07.th.seeweb.it (relay07.th.seeweb.it [IPv6:2001:4b7a:2000:18::168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5676DAC6D; Wed, 26 Oct 2022 11:28:45 -0700 (PDT) Received: from localhost.localdomain (94-209-172-39.cable.dynamic.v4.ziggo.nl [94.209.172.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id C2E2D3F6D3; Wed, 26 Oct 2022 20:28:43 +0200 (CEST) From: Marijn Suijten To: phone-devel@vger.kernel.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Vinod Koul Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Marijn Suijten , Sean Paul , David Airlie , Daniel Vetter , Douglas Anderson , Vladimir Lypak , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 06/10] drm/msm/dsi: Migrate to drm_dsc_compute_rc_parameters() Date: Wed, 26 Oct 2022 20:28:20 +0200 Message-Id: <20221026182824.876933-7-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221026182824.876933-1-marijn.suijten@somainline.org> References: <20221026182824.876933-1-marijn.suijten@somainline.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747775934159409070?= X-GMAIL-MSGID: =?utf-8?q?1747775934159409070?= As per the FIXME this code is entirely duplicate with what is already provided inside drm_dsc_compute_rc_parameters(), supposedly because that function was yielding "incorrect" results while in reality the panel driver(s?) used for testing were providing incorrect parameters. For example, this code from downstream assumed dsc->bits_per_pixel to contain an integer value, whereas the upstream drm_dsc_config struct stores it with 4 fractional bits. drm_dsc_compute_rc_parameters() already accounts for this feat while the panel driver used for testing [1] wasn't, hence making drm_dsc_compute_rc_parameters() seem like it was returning an incorrect result. Other users of dsc->bits_per_pixel inside dsi_populate_dsc_params() also treat it in the same erroneous way, and will be addressed in a separate patch. In the end, using drm_dsc_compute_rc_parameters() spares both a lot of duplicate code and erratic behaviour. [1]: https://git.linaro.org/people/vinod.koul/kernel.git/commit/?h=topic/pixel3_5.18-rc1&id=1d7d98ad564f1ec69e7525e07418918d90f247a1 Fixes: b9080324d6ca ("drm/msm/dsi: add support for dsc data") Reviewed-by: Abhinav Kumar Signed-off-by: Marijn Suijten Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi_host.c | 64 +++--------------------------- 1 file changed, 6 insertions(+), 58 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index a1c387e9b7f4..0d130bded38d 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -21,6 +21,7 @@ #include