Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3903618rwb; Sun, 9 Oct 2022 13:25:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40FLzcdV4HOJMZxGQLDcT29SNjmTo8YCJbMmF7Yu9t+PcXxA6lK/8LSIO8s0ncrRDg4N+A X-Received: by 2002:a17:90b:1811:b0:20c:41be:16a9 with SMTP id lw17-20020a17090b181100b0020c41be16a9mr11740076pjb.160.1665347101068; Sun, 09 Oct 2022 13:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665347101; cv=none; d=google.com; s=arc-20160816; b=QQHt4kkD4D077y1LgS8txxxy2jJ8BIyb27rOue+HcRATuGtyPH236ZQQvJ9nBjKw7p T+zh1vKx4/4fN0HWqED92hg2edwWOmMRFZhrbDZo8a/6XCacMCfD7tHp58Q3GlaR6ffd FQS7mwPVVYxqys/P3+gPVwbl3wOutzSCVwrLBMJSQu2VqCFejgkR6nuaCwBt3xqqIegq 0YXOxpy4rbwxY/q02WC6YpqXWa11k8E4ipCal43G1sTnNAmSkDBDIPnwF+Ahv9DxIhB1 mst054wBeKVxFdxwBfL22Sclu64hNuxeBWrLRop4hOeH+dJvpdVG7bmtYHVGzVNRJiTr gCyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=eLmKWVTMUSHqEP9DIVkRM+ZnS7XRFcavZfbEdhp8mMc=; b=KxKn+K72B97FC08ThYRCPaR5PPOPqfg2K5nadLMGNCthhvvLOfXEnmidejmGOeLQEx 1pWd0RUkr1yFTEh0me5a1QkxqVgDnIybfUBHfVAwuB8fEYb1vru0Da1a4CgI+iYa62WF IBbEF/L4/P+7FLAAnC41mVWaErkpPR+lYdpUC6nvg+qp/hG7aaMyMhkqwOrh8zgXUcWJ fiBIWVcU/8MDppovJyDc28RWGB0NnOhh3dlwYUJTCFwyonTjAkQdV8h6a03IxYTx5jIt GiFjjFf09BFv7TVdcvwxQ2fKd/yUPovEbSwg4+Bk/gK6vSmnAo4yvjK/unlhCMELK2Hv W4Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D3znIKzX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my4-20020a17090b4c8400b00200b6023910si18473900pjb.2.2022.10.09.13.24.49; Sun, 09 Oct 2022 13:25: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; dkim=pass header.i=@linaro.org header.s=google header.b=D3znIKzX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbiJITOX (ORCPT + 99 others); Sun, 9 Oct 2022 15:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229979AbiJITOT (ORCPT ); Sun, 9 Oct 2022 15:14:19 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF30C13F59 for ; Sun, 9 Oct 2022 12:14:18 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id r22so9827729ljn.10 for ; Sun, 09 Oct 2022 12:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=eLmKWVTMUSHqEP9DIVkRM+ZnS7XRFcavZfbEdhp8mMc=; b=D3znIKzXKwQaxB7Ox3lpizhW7NS6r19zfvTiJftlw02OF9QCPjt9kbEIllwQSDwAZm bbQd6AGAx4o2TTHo7hE884uCEcGqpp6G4Ny7jvmIBpXYmT2rwz0rUyxYHHYb6xXZLDHc E/DV8n9stU9dLyYaAgvDlJFsbnUibYlnZ3lQiZYIXY6gD7JTWs4L3E2890nEcjUZGl/p uegdz2Z11CjMAJ7dwVkfNE9BlNRrCClWYLW6o+2UaccXyf4zJIrbSLQt8/GNaAY2oQap k8xV2eGWsUXni6SEBMXVz/OEX8Xxc0HYD+ZcLhdkj1uBQdTp3VrXeNoO6jBsfp9PWNDD kUfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eLmKWVTMUSHqEP9DIVkRM+ZnS7XRFcavZfbEdhp8mMc=; b=vWwUvmx2RE+uK+sbfCgC0fNoh0TmEznzLl+9H8fAFJnRfxK5sIQ2y4lb0J/jVfPjgO nUaSs2cXmI1PVUYfNBwLgVG1toOnFeu2hkm8z3hM87HqzIcp9KbNvIE7t31cFtqqWTSV LobtCTf0YM0gVyByGrtTgEQJfqIhtZdR7KoSID2HvqtcqM3tQeSlbK36+Z97and7Z0r3 TgjQ4PaOvsWgP2zwSiFONiEVTa/mggazIMqCCxQUV5lj9q7P4OKLLL90YNv+j57kN7qW IAfWpbyjha/hRfW5+ALaQZJHj9JA1g+awO5+02NRgfQ8/brBLnAGarL8P9yVD0XTRuts a0Zg== X-Gm-Message-State: ACrzQf2CqQsTmoQriMICJ9nJepHBYf15FKXxTqRhNlYPeE9nGQA1UEda k9CFVLCdIwcCjxNX+FKQeG0xgw== X-Received: by 2002:a2e:a54b:0:b0:26c:72ed:b758 with SMTP id e11-20020a2ea54b000000b0026c72edb758mr5535281ljn.245.1665342857092; Sun, 09 Oct 2022 12:14:17 -0700 (PDT) Received: from [192.168.1.211] ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id d14-20020a056512368e00b004946c3cf53fsm1117170lfs.59.2022.10.09.12.14.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Oct 2022 12:14:16 -0700 (PDT) Message-ID: <408bf6a2-47fe-3eaf-7235-578d33a576c9@linaro.org> Date: Sun, 9 Oct 2022 22:14:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v3 10/10] drm/msm/dsi: Prevent signed BPG offsets from bleeding into adjacent bits Content-Language: en-GB To: Marijn Suijten , phone-devel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Rob Clark , Abhinav Kumar , Sean Paul , David Airlie , Daniel Vetter , Vinod Koul , Douglas Anderson , Vladimir Lypak , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20221009184824.457416-1-marijn.suijten@somainline.org> <20221009185316.462522-3-marijn.suijten@somainline.org> From: Dmitry Baryshkov In-Reply-To: <20221009185316.462522-3-marijn.suijten@somainline.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, 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 On 09/10/2022 21:53, Marijn Suijten wrote: > The bpg_offset array contains negative BPG offsets which fill the full 8 > bits of a char thanks to two's complement: this however results in those > bits bleeding into the next field when the value is packed into DSC PPS > by the drm_dsc_helper function, which only expects range_bpg_offset to > contain 6-bit wide values. As a consequence random slices appear > corrupted on-screen (tested on a Sony Tama Akatsuki device with sdm845). > > Use AND operators to limit these two's complement values to 6 bits, > similar to the AMD and i915 drivers. > > Fixes: b9080324d6ca ("drm/msm/dsi: add support for dsc data") > Signed-off-by: Marijn Suijten Reviewed-by: Dmitry Baryshkov Side note: the DSC params tables are more or less common between amd, i916 and msm drivers. It might be worth moving them to the DSC helpers from the individual drivers. This would mean such masks handling can go into the helper too. -- With best wishes Dmitry