From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33F99C433E7 for ; Tue, 13 Oct 2020 10:54:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C636420E65 for ; Tue, 13 Oct 2020 10:54:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NCxMoMNZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387900AbgJMKyV (ORCPT ); Tue, 13 Oct 2020 06:54:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730163AbgJMKyT (ORCPT ); Tue, 13 Oct 2020 06:54:19 -0400 Received: from mail-vk1-xa42.google.com (mail-vk1-xa42.google.com [IPv6:2607:f8b0:4864:20::a42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F32E1C0613D0 for ; Tue, 13 Oct 2020 03:54:17 -0700 (PDT) Received: by mail-vk1-xa42.google.com with SMTP id y10so2558108vkl.5 for ; Tue, 13 Oct 2020 03:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ynUyUlf8ZBc/wosstkfDmHSkC80iEcSV9kvyuaRkng4=; b=NCxMoMNZHtR/f6uBXfzdJQk8jzrc8dbrfZvgIF6hyvcC214r0LB+m+NNlUMfQGJLdP /zg9yuYcYn5wAPieHv5PsxM9+sloG71VPrC41niSEVM377SaFTB3shYj8zCNTNyIbua6 iOWtDADZ+xIDrzoOMJULESyfqCSmB0DeWUMpM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ynUyUlf8ZBc/wosstkfDmHSkC80iEcSV9kvyuaRkng4=; b=DAc4ccBBHB5Fb8zGnNh9I0MLvT7ni25jgAcIXUHg5nOblIgBYGo3uQV+LCrUvNT6GN rWhiPJl8zsRMYsBK0xx3IdOe1gQgxezP8YwarwyDiG55cU/kF/6TqHVrM42YKYQU+CEd nkLRY8xQg+niA1kQ6BYj9zX5HszmGwH59v1Rm00ANxxuSexGtrBxH9ldO3DgD2s0fFFi j8LrWzEf8CUiz2Frn12O++wLfCQnd4SLmg5TazE74Qn0JD6XP+6b+UOVb9IpTu7hEead BHPhHgqNmncpPhdU0HIrM4sGQAnvAZModpaKgWrDSCm9+fKfeqkkdMgezdnFle6Vq7Rb L6rw== X-Gm-Message-State: AOAM532ESZy0y/a+gs2LIs9z5rWxb4mD3GTDZXpVXccOeI5sWeHgPr2m XsWK9k9qu65vS19nqO6GkHNF5FY9diQk2L/3yzLPiQ== X-Google-Smtp-Source: ABdhPJysPQ5eomCeyfTMzrgpCupOQSNSpjtTrgtpcQZw7r3iRalZSOO25Xe+CvFq/MXGQdp/beZjzKxff66coldxr7U= X-Received: by 2002:a1f:2450:: with SMTP id k77mr15393251vkk.13.1602586457062; Tue, 13 Oct 2020 03:54:17 -0700 (PDT) MIME-Version: 1.0 References: <20201013100625.13056-1-jitao.shi@mediatek.com> <20201013100625.13056-2-jitao.shi@mediatek.com> In-Reply-To: <20201013100625.13056-2-jitao.shi@mediatek.com> From: Nicolas Boichat Date: Tue, 13 Oct 2020 18:54:05 +0800 Message-ID: Subject: Re: [PATCH v5 1/1] drm/mediatek: dsi: fix scrolling of panel with small hfp or hbp To: Jitao Shi Cc: Rob Herring , Mark Rutland , Matthias Brugger , Daniel Vetter , David Airlie , dri-devel , lkml , Devicetree List , srv_heupstream , huijuan.xie@mediatek.com, stonea168@163.com, cawa cheng , "moderated list:ARM/Mediatek SoC support" , Yingjoe Chen , Eddie Huang , linux-arm Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Tue, Oct 13, 2020 at 6:06 PM Jitao Shi wrote: > > Replace horizontal_backporch_byte with vm->hback_porch * bpp to aovid > flowing judgement negative number. > > if ((vm->hfront_porch * dsi_tmp_buf_bpp + horizontal_backporch_byte) > > data_phy_cycles * dsi->lanes + delta) > > Signed-off-by: Jitao Shi > --- > drivers/gpu/drm/mediatek/mtk_dsi.c | 65 +++++++++++++++----------------------- > 1 file changed, 25 insertions(+), 40 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index 80b7a082e874..ddddf69ebeaf 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -445,6 +445,7 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi) > u32 horizontal_backporch_byte; > u32 horizontal_frontporch_byte; > u32 dsi_tmp_buf_bpp, data_phy_cycles; > + u32 delta; > struct mtk_phy_timing *timing = &dsi->phy_timing; > > struct videomode *vm = &dsi->vm; > @@ -466,50 +467,34 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi) > horizontal_sync_active_byte = (vm->hsync_len * dsi_tmp_buf_bpp - 10); > > if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) > - horizontal_backporch_byte = vm->hback_porch * dsi_tmp_buf_bpp; > + horizontal_backporch_byte = > + (vm->hback_porch * dsi_tmp_buf_bpp - 10); These parentheses are not required, but it might be a little clearer to write: (vm->hback_porch * dsi_tmp_buf_bpp) - 10; > else > - horizontal_backporch_byte = (vm->hback_porch + vm->hsync_len) * > - dsi_tmp_buf_bpp; > + horizontal_backporch_byte = ((vm->hback_porch + vm->hsync_len) * > + dsi_tmp_buf_bpp - 10); ditto: ((vm->hback_porch + vm->hsync_len) * dsi_tmp_buf_bpp) - 10; But then, _maybe_ it's clearer to drop this hunk and just add this below the if/else: horizontal_backporch_byte -= 10; > > data_phy_cycles = timing->lpx + timing->da_hs_prepare + > - timing->da_hs_zero + timing->da_hs_exit; > - > - if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) { > - if ((vm->hfront_porch + vm->hback_porch) * dsi_tmp_buf_bpp > > - data_phy_cycles * dsi->lanes + 18) { > - horizontal_frontporch_byte = > - vm->hfront_porch * dsi_tmp_buf_bpp - > - (data_phy_cycles * dsi->lanes + 18) * > - vm->hfront_porch / > - (vm->hfront_porch + vm->hback_porch); > - > - horizontal_backporch_byte = > - horizontal_backporch_byte - > - (data_phy_cycles * dsi->lanes + 18) * > - vm->hback_porch / > - (vm->hfront_porch + vm->hback_porch); > - } else { > - DRM_WARN("HFP less than d-phy, FPS will under 60Hz\n"); > - horizontal_frontporch_byte = vm->hfront_porch * > - dsi_tmp_buf_bpp; > - } > + timing->da_hs_zero + timing->da_hs_exit + 3; (for reference, apart from this `+ 3`, there is no functional change in this hunk: this just moves delta outside of the if/else block, which is a good idea for readability) > + > + delta = (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) ? 18 : 12; > + > + if ((vm->hfront_porch * dsi_tmp_buf_bpp + horizontal_backporch_byte) > > + data_phy_cycles * dsi->lanes + delta) { > + horizontal_frontporch_byte = > + vm->hfront_porch * dsi_tmp_buf_bpp - > + (data_phy_cycles * dsi->lanes + delta) * > + vm->hfront_porch / > + (vm->hfront_porch + vm->hback_porch); > + > + horizontal_backporch_byte = > + horizontal_backporch_byte - > + (data_phy_cycles * dsi->lanes + delta) * > + vm->hback_porch / > + (vm->hfront_porch + vm->hback_porch); > } else { > - if ((vm->hfront_porch + vm->hback_porch) * dsi_tmp_buf_bpp > > - data_phy_cycles * dsi->lanes + 12) { > - horizontal_frontporch_byte = > - vm->hfront_porch * dsi_tmp_buf_bpp - > - (data_phy_cycles * dsi->lanes + 12) * > - vm->hfront_porch / > - (vm->hfront_porch + vm->hback_porch); > - horizontal_backporch_byte = horizontal_backporch_byte - > - (data_phy_cycles * dsi->lanes + 12) * > - vm->hback_porch / > - (vm->hfront_porch + vm->hback_porch); > - } else { > - DRM_WARN("HFP less than d-phy, FPS will under 60Hz\n"); > - horizontal_frontporch_byte = vm->hfront_porch * > - dsi_tmp_buf_bpp; > - } > + DRM_WARN("HFP + HBP less than d-phy, FPS will under 60Hz\n"); > + horizontal_frontporch_byte = vm->hfront_porch * > + dsi_tmp_buf_bpp; > } > > writel(horizontal_sync_active_byte, dsi->regs + DSI_HSA_WC); > -- > 2.12.5 > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel