Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3852421rwb; Sun, 9 Oct 2022 12:19:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tibSg81mnB3Vq0vLj35J5EEPBAZnLeS1bGvd/NWBIx0pKQzEup/QCuztH2jNBf0WC9/J5 X-Received: by 2002:a17:90a:d14d:b0:205:e77d:dc91 with SMTP id t13-20020a17090ad14d00b00205e77ddc91mr27267746pjw.20.1665343163235; Sun, 09 Oct 2022 12:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665343163; cv=none; d=google.com; s=arc-20160816; b=eKX93cnyedQczKijgTpXuzcwwt2DPG+fdi7NS9CW4U/4+EWUIsqJGg8fV31UAhf3NJ u/uCzWJCoVLSFuHGKYq5lAFfS6McEJak4kah7XJwkcnB97mtk5lVj81HG/JLKLvDdJ5u tbsaZc/adEnSohn1T15wHDQQW1FJjdZANJVDt9vtSLp6Bf93tCJaGgN21stJ0lHw4xbr BjuH9VHfaMo115eGRjXXop8X7iUwtf/CedwsdoODCTJ/xMv/LP2I+4+iTKHsSu2n1ZBp f1xfoQMImVsx9ejd8guuT7sFMlGwhyhqcXHz+Y+qYaHVBDPsBam/aeA1PVbdEP+bGQhf YKwA== 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 :message-id:date:subject:cc:to:from; bh=r6EUk+I6lIxpQnHHwD6Nwsn47yWDNXUkBeTUyl1PvRo=; b=ywdT+asAlOS0xhlkgx+1qBIW3AlMRnVY40l7Ma7Wc2mzZD+mfFnlAyWtcnMXhzipeG +mg54Xq/Rvh5TGsWIH+xhw9kIbM/gtlIyWV03hBdGmDJucuHpAvtt2+Ik4Z/4IAf/gVe 2BUj653zOe0e5Y3AUAofBYgqyNbl/dcBfp1Zbr+eCvjKrQspn3O6XeaYFuBdlEz0JIBi PPfMbWUyzSWt5/A1STmeUk03GVuySN41lwhAHtIHcz3P5CPCix6/K7FqonOo0n6PJzWc 5iduwlKvY1d6A0eMIph/8RTUaCeBO8M7dquVpmFtnKJK1B404HZ7JNb0B0HOcZZJICVj zAIw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a170902b40a00b00180d51f70cfsi5913676plr.107.2022.10.09.12.19.10; Sun, 09 Oct 2022 12:19:23 -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 S230293AbiJISsl (ORCPT + 99 others); Sun, 9 Oct 2022 14:48:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230310AbiJISsi (ORCPT ); Sun, 9 Oct 2022 14:48:38 -0400 Received: from relay03.th.seeweb.it (relay03.th.seeweb.it [5.144.164.164]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B074B29377 for ; Sun, 9 Oct 2022 11:48: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-r1.th.seeweb.it (Postfix) with ESMTPSA id 775AD1F939; Sun, 9 Oct 2022 20:48:34 +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 v3 00/10] drm/msm: Fix math issues in MSM DSC implementation Date: Sun, 9 Oct 2022 20:48:14 +0200 Message-Id: <20221009184824.457416-1-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Various removals of complex yet unnecessary math, fixing all uses of drm_dsc_config::bits_per_pixel to deal with the fact that this field includes four fractional bits, and finally making sure that range_bpg_offset contains values 6-bits wide to prevent overflows in drm_dsc_pps_payload_pack(). Altogether this series is responsible for solving _all_ Display Stream Compression issues and artifacts on the Sony Tama (sdm845) Akatsuki smartphone (2880x1440p). Changes since v2: - Generalize mux_word_size setting depending on bits_per_component; - Migrate DSI's DSC calculations to drm_dsc_compute_rc_parameters(), implicitly addressing existing math issues; - Disallow any bits_per_component other than 8, until hardcoded values are updated and tested to support such cases. v2: https://lore.kernel.org/linux-arm-msm/20221005181657.784375-1-marijn.suijten@somainline.org/T/#u Changes since v1: - Propagate r-b's, except (obviously) in patches that were (heavily) modified; - Remove accidental debug code in dsi_cmd_dma_add; - Move Range BPG Offset masking out of DCS PPS packing, back into the DSI driver when it is assigned to drm_dsc_config (this series is now strictly focusing on drm/msm again); - Replace modulo-check resulting in conditional increment with DIV_ROUND_UP; - Remove repeated calculation of slice_chunk_size; - Use u16 instead of int when handling bits_per_pixel; - Use DRM_DEV_ERROR instead of pr_err in DSI code; - Also remove redundant target_bpp_x16 variable. v1: https://lore.kernel.org/linux-arm-msm/20221001190807.358691-1-marijn.suijten@somainline.org/T/#u Marijn Suijten (10): drm/msm/dsi: Remove useless math in DSC calculations drm/msm/dsi: Remove repeated calculation of slice_per_intf drm/msm/dsi: Use DIV_ROUND_UP instead of conditional increment on modulo drm/msm/dsi: Reuse earlier computed dsc->slice_chunk_size drm/msm/dsi: Appropriately set dsc->mux_word_size based on bpc drm/msm/dsi: Migrate to drm_dsc_compute_rc_parameters() drm/msm/dsi: Disallow 8 BPC DSC configuration for alternative BPC values drm/msm/dsi: Account for DSC's bits_per_pixel having 4 fractional bits drm/msm/dpu1: Account for DSC's bits_per_pixel having 4 fractional bits drm/msm/dsi: Prevent signed BPG offsets from bleeding into adjacent bits drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 11 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 121 ++++++--------------- 2 files changed, 37 insertions(+), 95 deletions(-) -- 2.38.0