Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1246948rwi; Wed, 26 Oct 2022 12:41:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+LNjYzyTNcaJl/3rFxab5EwKGI/Rb58tc92dB/gdMRrcyhbYSz2pbf6WKUHoB9ucqYLHz X-Received: by 2002:a17:907:2cf7:b0:78d:c7fc:29ff with SMTP id hz23-20020a1709072cf700b0078dc7fc29ffmr39897450ejc.748.1666813280611; Wed, 26 Oct 2022 12:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666813280; cv=none; d=google.com; s=arc-20160816; b=XSEl+e5ZRZXaNoqNb7W9CS/t6dO+NqcP84YDBQhaCpNjiRIpyClhI9TWmQLNX1+jQz c6/WY/1tzQrjaoKvXgQBH1JxAaqrs8Pg50/IWXi36MIiea5huQh6O7GFjRa7D2FXE1jA 9MgpBgaEsHtaNlLIQYGgug1kdoH1wlV8+Q8MEv3VNB8Zz6Kn+xRltti07m8D0FSOsYyv a7pjln3cE/EJSgJqZmArKIuxhx7LNNihld+sw+vir1yQNydK3yaAQf3Ym4X8eGw72zEu al2SXtOV1+A7Ul7BPOj56scqNLFLhOGAd5wEl+ZjStOa7v9l0XxwKLb7xGxUD7Ie5NHr LqrQ== 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=dCirdEgfXSMb76xNUtSdsz4ImxDbA2A1khx9nMAwM44=; b=IoKGIvpuT2NdIYkMtFhh8Zp+2maU3ufmgNx/ADoYck8rTH7GxXl4I8JfU4rCJXhiGf YWUJQ+9Dsl8zNc4+1ZU4Dsrr2gpxVhr/a4vW+SnHBDfnQ7viNUf/ozT+HZfrqUE/PwSX 2jCclcEKk++4bvl9YGTVUWkqyO1RTaSFtGei8saKRfxWln+ljunz4HA17MlEMVT0i6Pe rxvhndcUDGHcX+gIzPRE/idwdAQVL6NYL6f3XjtR8FiVe1MlSIn9XaKtsbJKeCYAf0+V 2KHkIMgLEueNFyoUDQKurVFUrM4RaGhhpRW9onJ6+/efKzZyyPO0HR/gB5ECPPC9Gd4S kTqg== 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 d31-20020a056402401f00b00461f44d7bfcsi6064922eda.573.2022.10.26.12.40.55; Wed, 26 Oct 2022 12:41:20 -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 S234349AbiJZS2u (ORCPT + 99 others); Wed, 26 Oct 2022 14:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234377AbiJZS2i (ORCPT ); Wed, 26 Oct 2022 14:28:38 -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 4D0ABDD896 for ; Wed, 26 Oct 2022 11:28:36 -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 882063F33A; Wed, 26 Oct 2022 20:28:33 +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 00/10] drm/msm: Fix math issues in MSM DSC implementation Date: Wed, 26 Oct 2022 20:28:14 +0200 Message-Id: <20221026182824.876933-1-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 v3: - Swap patch 7 and 8 to make sure msm_host is available inside dsi_populate_dsc_params(); - Reword patch 6 (Migrate to drm_dsc_compute_rc_parameters()) to more clearly explain why the FIXME wasn't solved initially, but why it can (and should!) be resolved now. v3: https://lore.kernel.org/linux-arm-msm/20221009184824.457416-1-marijn.suijten@somainline.org/T/#u 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: Account for DSC's bits_per_pixel having 4 fractional bits drm/msm/dsi: Disallow 8 BPC DSC configuration for alternative BPC values 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.1