From patchwork Mon May 20 09:03:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 420 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 29AA43F36B for ; Mon, 20 May 2019 11:07:31 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id s19sf8794135plp.6 for ; Mon, 20 May 2019 02:07:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1558343250; cv=pass; d=google.com; s=arc-20160816; b=wE3sqADdXLqrVm8aVCN6a1P61JrYc5lT1HyQy//gjzS7WbsZPXoMJeLIkW6fsg+YyD 1LoYJgiVS3hAWXmI4eB6BjbkF/uOWvHvfG6Wkvq0GIDqsRn+RBkpwSD8KBbx6xg9kGyO uE7uFJTHE13fqnxQm4iahx1GcOvdQ9paHxyT8+L6QFPAgwgy4xMAI3SGmQ7++MinO/wA 8YysIyRN0Br9z72dyuNVriAY2jqb+jrSzXSiejBKTqB2ANhvM1gpKabRpMukOz1Kmq29 ClztH67TQrHYkMvZpz0thD+FMui5RMU2wvNvPOqb6+kRgHWax2b6Hu7ZXrTZMbWWxozs KvaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=BAd2LjBuJIkqJT2jMtg5t8mF07sRV3ncKBKOXKbqH/s=; b=feDhURdaEFhavYFJTyp5qR5hcj8PcI3zQLcSGBlxanX7DhTjZvbekjG8EEhymXrJNl g+jKIDzfwiONDaEzB388noh/ByZ6GsRCMPvemwXIonqvZ9vsW5u/u1hZO3UTU4uH9bqF eqPl8ij0+LZ1jIVuMyv6IFmY7ReBlXB7TAFErC2XQNUlTT81W/PNjn8yY1UCKSaSpjzy jnAIZGiUnXQljQf1ra6ORTrS/QzPbhJRhJ1cwcTLL+xCFUvXjjTx6vF4yOomdzSUezWp roJn2F6Kq+3q/X+zUl2xLzF4+QCiYuIVGmaYlfjkc9YbEzYm7Gr050Xf1ShfKvRjKHSo roNQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KGiXud+0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=BAd2LjBuJIkqJT2jMtg5t8mF07sRV3ncKBKOXKbqH/s=; b=Vp/aXAPBkonAUPmKL2Z4Yo9KF8Q4SmZvPJoa9OOcFOdwzEASiqyCD71brQzzZcGCOd 6IFr+03FWtv1Sb2JxT6saOD5+nfrG+W1qgyRQpEQQB64DGp2l6tEXlfv7Uhx/KD8HVBD MJG/yoJo6vYX+OpGPBZiykPA+FCBo8swQ6onA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=BAd2LjBuJIkqJT2jMtg5t8mF07sRV3ncKBKOXKbqH/s=; b=Tal/t7briiyossy03mR0u+Ob0IIyQMkkWdBlM57XeUMamuz4w/sdWXeNkjyPNF8LEM ISqjmZ77jgGLhAtko54LEey+zbq/qByqKrxJnfRX/0VFvSPQtS+b2KhKu/m5MtJjIvDb xxH2oyQn37kzjkGQ85tFvEaNvoMQliNwH9ZN9MG32z/AvQYMtFmbaFKpnaKluY+sehzv irFVXvYBk3WN21Cwj8AGxohpb3artkClb6CBNTqHhpTIpUHc+AFunUvmGPwgC65G9R1k rQbLlaaCN+Hty9CrZBFzsBHPP80PeAshYSVU5KyHBv5mT1YoCDU08jeNJUZ1RXp+xzLh zZRw== X-Gm-Message-State: APjAAAUiNTZbIl+cHkxkWJaIiBrstP4C37r3G8/736ZtdwtGJoGW9cTT 3GLVksqu72YIOtlDuWHMc0M97n44 X-Google-Smtp-Source: APXvYqzyvwo4s6ZmW/l80/J4u3cCMLMig4H/GiunymWoNBssO/i/r/9neN07u+MfMv7y9TCupIP7xg== X-Received: by 2002:a62:3605:: with SMTP id d5mr58159141pfa.28.1558343249914; Mon, 20 May 2019 02:07:29 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:505:: with SMTP id 5ls4349201plf.5.gmail; Mon, 20 May 2019 02:07:29 -0700 (PDT) X-Received: by 2002:a17:902:2869:: with SMTP id e96mr51179377plb.150.1558343249548; Mon, 20 May 2019 02:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558343249; cv=none; d=google.com; s=arc-20160816; b=d1etBRiP6FdGjQ7ww7UAQeGGdcvHhjV5l4ih/2L/zp3XhVd0NZG6iV+fGWbll0iJJH O0D0D4bOl9vzzY4qxXsiSvpCoYq0BHm5d81Mmk1w+QrGq4+2XYtN5fJGfa/HSdaDxB4W oTx7f3FO90k5gdz5yXHWOtxE42quwQe92U5Rp+2jOjCLem3zrhr5HwFsb26WqM5if5ab 2vgP0/r335ALbqqKS9cftT31yvxqDfnr8BO/s2KDVPPvsGSO4Rnpixj+rmld9wey3HN5 SdkdEcR+16evdBpGgzKB2GV5blEPjN+vGZa+y/df+V8mEu6rSuxp4JC/KJj2tW8BOkVu TWiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=kYczVIziVgtoXaMdiCSJdvyko6PsZTz3vls3yir8pOc=; b=B2dYBGlaDFE3G8GdzeHMebRCvtP4kKtZBaF4XvXbUwotKBHhrvtFWLssMO5GcHBkjk QwroJp6mj0qHwLb0TGQwJfvtbiP6Gbeg6ZsAjL/3YnAhbhUFXlruFmTy+aYD44JTeipc G/kQ6L1vVnx9ZBXS0D54zsoZQwZ7dAapOl8GAIE7uApFIon9oVtZF7RTSe5zY02at9rN Y1zLXV4pGhYtW815wtdvz6I7waTrRlIsnji53woQVcfEaYqvjlv6p3Apr+78nFZ/5Z46 9WNL3kOKSy9HiFRn3CrWm4059LxpbF/0KkJqzdLJIPHuN6857gq3XTZlI+PYgjFQqUx/ 7WMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KGiXud+0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 78sor17159511pgb.30.2019.05.20.02.07.29 for (Google Transport Security); Mon, 20 May 2019 02:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a65:6449:: with SMTP id s9mr72257102pgv.90.1558343249223; Mon, 20 May 2019 02:07:29 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:28 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: bshah@mykolab.com, Vasily Khoruzhick , powerpan@qq.com, michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v10 03/11] drm/sun4i: dsi: Fix video start delay computation Date: Mon, 20 May 2019 14:33:10 +0530 Message-Id: <20190520090318.27570-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=KGiXud+0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The current code is computing vertical video start delay as delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; On which the second parameter mode->vsync_end - mode->vdisplay = front porch + sync timings according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h With adding additional sync timings, the desired video start delay value as 510 for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as: WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0 [CRTC:46:crtc-0] vblank wait timed out Modules linked in: CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00029-g09e5b0ed0a58 #18 Hardware name: Allwinner sun8i Family Workqueue: events deferred_probe_work_func [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x84/0x98) [] (dump_stack) from [] (__warn+0xfc/0x114) [] (__warn) from [] (warn_slowpath_fmt+0x44/0x68) [] (warn_slowpath_fmt) from [] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0) [] (drm_atomic_helper_wait_for_vblanks.part.1) from [] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c) [] (drm_atomic_helper_commit_tail_rpm) from [] (commit_tail+0x40/0x6c) [] (commit_tail) from [] (drm_atomic_helper_commit+0xbc/0x128) [] (drm_atomic_helper_commit) from [] (restore_fbdev_mode_atomic+0x1cc/0x1dc) [] (restore_fbdev_mode_atomic) from [] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0) [] (drm_fb_helper_restore_fbdev_mode_unlocked) from [] (drm_fb_helper_set_par+0x30/0x54) [] (drm_fb_helper_set_par) from [] (fbcon_init+0x560/0x5ac) [] (fbcon_init) from [] (visual_init+0xbc/0x104) [] (visual_init) from [] (do_bind_con_driver+0x1b0/0x390) [] (do_bind_con_driver) from [] (do_take_over_console+0x13c/0x1c4) [] (do_take_over_console) from [] (do_fbcon_takeover+0x74/0xcc) [] (do_fbcon_takeover) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__blocking_notifier_call_chain+0x48/0x60) [] (__blocking_notifier_call_chain) from [] (blocking_notifier_call_chain+0x18/0x20) [] (blocking_notifier_call_chain) from [] (register_framebuffer+0x1e0/0x2f8) [] (register_framebuffer) from [] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c) [] (__drm_fb_helper_initial_config_and_unlock) from [] (drm_fbdev_client_hotplug+0xe8/0x1b8) [] (drm_fbdev_client_hotplug) from [] (drm_fbdev_generic_setup+0x88/0x118) [] (drm_fbdev_generic_setup) from [] (sun4i_drv_bind+0x128/0x160) [] (sun4i_drv_bind) from [] (try_to_bring_up_master+0x164/0x1a0) [] (try_to_bring_up_master) from [] (__component_add+0x94/0x140) [] (__component_add) from [] (sun6i_dsi_probe+0x144/0x234) [] (sun6i_dsi_probe) from [] (platform_drv_probe+0x48/0x9c) [] (platform_drv_probe) from [] (really_probe+0x1dc/0x2c8) [] (really_probe) from [] (driver_probe_device+0x60/0x160) [] (driver_probe_device) from [] (bus_for_each_drv+0x74/0xb8) [] (bus_for_each_drv) from [] (__device_attach+0xd0/0x13c) [] (__device_attach) from [] (bus_probe_device+0x84/0x8c) [] (bus_probe_device) from [] (deferred_probe_work_func+0x64/0x90) [] (deferred_probe_work_func) from [] (process_one_work+0x204/0x420) [] (process_one_work) from [] (worker_thread+0x274/0x5a0) [] (worker_thread) from [] (kthread+0x11c/0x14c) [] (kthread) from [] (ret_from_fork+0x14/0x2c) Exception stack(0xde539fb0 to 0xde539ff8) 9fa0: 00000000 00000000 00000000 00000000 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace 495200a78b24980e ]--- random: fast init done [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out But the expected video start delay value is 513 which states that the second parameter on the computation is "front porch" value (no sync timings included). This is clearly confirmed from the legacy [1] and new [2] bsp codes that the second parameter on the video start delay is "front porch" Here is the detailed evidence for calculating front porch as per bsp code. vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp => (panel->lcd_vt) - panel->lcd_y - panel->lcd_vbp => (tt->ver_front_porch + lcdp->panel_info.lcd_vbp + lcdp->panel_info.lcd_y) - panel->lcd_y - panel->lcd_vbp => tt->ver_front_porch Which is mode->vsync_start - mode->vdisplay according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h This patch fix this by updating the video start delay to use front porch value. [2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2051 [1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L803 Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index b3ca85410b2c..47d571d97600 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -375,7 +375,7 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, * working in all supported panels as of now. */ u8 start = 1; - u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; + u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay) + start; if (delay > mode->vtotal) delay = delay % mode->vtotal;