Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3266777ybp; Sun, 6 Oct 2019 08:14:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBg87+odAQ96hRFY7N0Z9wXJEJcvUfAPkeVzyf6UFTQw8HKk9NvpmkkON0vAGwxOznUgvu X-Received: by 2002:aa7:d789:: with SMTP id s9mr24949829edq.62.1570374872706; Sun, 06 Oct 2019 08:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570374872; cv=none; d=google.com; s=arc-20160816; b=P4CDYgQVaSHuXkzlwSTJU1+8PrJ3/uc78V4bLEjSrnw3iomqzLyu+C60weXbH5c5Yh J26ypsM8kHf5ukWv+WNWw6Pz7qQAtemKmmDBqjBG3Bs1lMgPy/UIExJKRSjRs9gCKOKe Lb/QsnQ4/Gt024HcO9rV4W3vom0gW2vKMF+Ddk54G8skjyNs6+IJVnGzNnu4SnfWykZm owIAvm4/TCVNYpN/2blkPC0r7d/4Rqic/5ew7HtISaL9y3hMF45ay0reEXzA+iHStREq jFSt7wtErHWRnuu1sYWmberAubWoJwZMTGEuoQCsScEDFdaQF69W/3s+5wGKdcHXAgo1 fPjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id; bh=rNyuzF+ZbJKXZKxbyZfqdjFngOENfqZgnfCmbpgOZ+o=; b=ilq5ArEuCEQxJEXScaukemoG+1VggAg0zXy3vZEkN3jVJMiYdG9r+P/hVp0gwf8cbQ TahGkrC8EK4DEGriytWK2FJYfdYwk9iwb3iCWQkVdpXxALQonotlgx8S8b5NKYLRzpOL +WSa0YI0YZ0D50MB85rHJQXHupjuSgCR+H03Pd4KADPr9Dpo8HKl9oljsnsTh9PwdaFm Vn71YsQZZ7A0JNy2Ve2vTohdJHFeGBJexzFIMGTXZjhqbuDub591izOb2IhqWabNRJRx hNXF/Qh+lJ2upGjDHFg95/vV2x4PSE6rTEG7ryoA26e7zn6jw5PNw9h9RRs65M9kPq6K 2v9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si5696943ejd.277.2019.10.06.08.14.08; Sun, 06 Oct 2019 08:14:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbfJFPNh (ORCPT + 99 others); Sun, 6 Oct 2019 11:13:37 -0400 Received: from hermes.aosc.io ([199.195.250.187]:45744 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726599AbfJFPNh (ORCPT ); Sun, 6 Oct 2019 11:13:37 -0400 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id 5115582914; Sun, 6 Oct 2019 15:13:30 +0000 (UTC) Message-ID: <14da3ae768c439e387f6609553bd465e945d4a33.camel@aosc.io> Subject: Re: [linux-sunxi] [PATCH 3/3] Revert "drm/sun4i: dsi: Rework a bit the hblk calculation" From: Icenowy Zheng To: Jagan Teki Cc: Maxime Ripard , Chen-Yu Tsai , David Airlie , Daniel Vetter , dri-devel , linux-arm-kernel , linux-kernel , linux-sunxi Date: Sun, 06 Oct 2019 23:12:43 +0800 In-Reply-To: <58dc94b6371ab2f5b11b13ab707d73ab3fc4cc64.camel@aosc.io> References: <20191001080253.6135-1-icenowy@aosc.io> <20191001080253.6135-4-icenowy@aosc.io> <58dc94b6371ab2f5b11b13ab707d73ab3fc4cc64.camel@aosc.io> Organization: Anthon Open-Source Community Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2019-10-06日的 22:44 +0800,Icenowy Zheng写道: > 在 2019-10-03四的 09:53 +0530,Jagan Teki写道: > > Hi Wens, > > > > On Tue, Oct 1, 2019 at 1:34 PM Icenowy Zheng > > wrote: > > > This reverts commit 62e7511a4f4dcf07f753893d3424decd9466c98b. > > > > > > This commit, although claimed as a refactor, in fact changed the > > > formula. > > > > > > By expanding the original formula, we can find that the const 10 > > > is > > > not > > > substracted, instead it's added to the value (because 10 is > > > negative > > > when calculating hsa, and hsa itself is negative when calculating > > > hblk). > > > This breaks the similar pattern to other formulas, so restoring > > > the > > > original formula is more proper. > > > > > > Signed-off-by: Icenowy Zheng > > > --- > > > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 9 ++------- > > > 1 file changed, 2 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > > index 2d3e822a7739..cb5fd19c0d0d 100644 > > > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > > @@ -577,14 +577,9 @@ static void sun6i_dsi_setup_timings(struct > > > sun6i_dsi *dsi, > > > (mode->hsync_start - mode->hdisplay) * > > > Bpp - HFP_PACKET_OVERHEAD); > > > > > > /* > > > - * The blanking is set using a sync event (4 > > > bytes) > > > - * and a blanking packet (4 bytes + payload + 2 > > > - * bytes). Its minimal size is therefore 10 > > > bytes. > > > + * hblk seems to be the line + porches length. > > > */ > > > -#define HBLK_PACKET_OVERHEAD 10 > > > - hblk = max((unsigned int)HBLK_PACKET_OVERHEAD, > > > - (mode->htotal - (mode->hsync_end - > > > mode- > > > > hsync_start)) * Bpp - > > > - HBLK_PACKET_OVERHEAD); > > > + hblk = mode->htotal * Bpp - hsa; > > > > The original formula is correct according to BSP [1] and work with > > my > > panels which I have tested before. May be the horizontal timings on > > panels you have leads to negative value. > > Do you tested the same timing with BSP kernel? > > It's quite difficult to get a negative value here, because the value > is > quite big (includes mode->hdisplay * Bpp). By re-checking with the BSP source code, I found that the constant in the HFP formula is indeed wrong -- it should be 16, not 6. > > Strangely, only change the formula here back makes the timing > translated from FEX file works (tested on PineTab and PinePhone > production ver). The translation rule is from [1]. > > So I still insist on the patch because it's needed by experiment. > > [1] http://linux-sunxi.org/LCD > > > [1] > > https://github.com/ayufan-pine64/linux-pine64/blob/my-hacks-1.2-with-drm/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L919