Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1155670ybt; Tue, 7 Jul 2020 08:59:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRPNcSNc8InTtukW/ZNjqhcAdM157eAoZXDW6e/fPVIyMtcgUWhs/ok+WoBfttku3wZ5OR X-Received: by 2002:a05:6402:202a:: with SMTP id ay10mr64382098edb.0.1594137576841; Tue, 07 Jul 2020 08:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594137576; cv=none; d=google.com; s=arc-20160816; b=h+R/aiNOxtak7OJ6MBG24pgf3t83cfQDP0NfOXwXwpBeo3nwitCHCUEyKV1Bx/jvzi RGwrU3k7Nzj8qRIGoNYQqFfc/MnXnQQYQPolWp9ukyw9HXUTVjGz0/pM9U1x/x4DRcrv RTykCG6S3BNrEbeExB4tCri1y6C7unxoBNQNK4WTYTk5YN4JvA5xgtiXRZHeahA11opj zMHCTiJzFNlsPKMoD5n2vMkW7Xk1clkExgsSDpvRMCFvJ3GlbRBgGJ9u6ZWRSnlMCTmZ uXysNm/H8Qx6Wio7Flm/9K45V2EY8U9wx5B/+o/tbcXOiIIlxaswE+c36S9+zOxnEP6i 8O2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=hGGzB42iFy6ghF2u4QUqQFvdM4Y3ZVYyPzuZ+b6j5U8=; b=FjZApY9PoIBKr6rtgApdvGYwEDFvPxdG+aC6vzmxLhkgrTgsywOOR/eD37RYbZkhOz /QpDL+Ddta6UH00FyJ8nsv2YYPjRRDIz31ZvL0g/6+YCaE12lDovXc73/h256bqOJB7U ZNzDEmoGC39IQLsBLxEeDyZl4vQQhYzVM1n1I1T2R9PJAiUUh5uUJJS8X6JElAaFOtJa DPuCnbaiUMonO06qJUuHyPV7e68tc+y5IlGgmXu9YoR997VPAUi+koVidwBWe80PMDWL x8N9gawJE3xxZPPx49c6SeM0HGVK0zyWO0X/5MugmgYZu4fQ+JQlhjXNeARF6WmtX5+a g5UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flowbird.group header.s=google header.b=SQauLQ9k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flowbird.group Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz17si14252338ejc.222.2020.07.07.08.59.12; Tue, 07 Jul 2020 08:59:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@flowbird.group header.s=google header.b=SQauLQ9k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flowbird.group Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728201AbgGGP6v (ORCPT + 99 others); Tue, 7 Jul 2020 11:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727079AbgGGP6v (ORCPT ); Tue, 7 Jul 2020 11:58:51 -0400 Received: from mail-ed1-x561.google.com (mail-ed1-x561.google.com [IPv6:2a00:1450:4864:20::561]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6B63C061755 for ; Tue, 7 Jul 2020 08:58:50 -0700 (PDT) Received: by mail-ed1-x561.google.com with SMTP id e22so38867463edq.8 for ; Tue, 07 Jul 2020 08:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flowbird.group; s=google; h=from:to:cc:subject:date:message-id; bh=hGGzB42iFy6ghF2u4QUqQFvdM4Y3ZVYyPzuZ+b6j5U8=; b=SQauLQ9kLevGI1sjapbckHVSOl/rItba2jDiiEVbyk6vgD+ekaU79GMgdlUfeg7csN k3FdKEQUQbUTZHGuSDJ6Hc1TCopRcYom+7PnjG012s215/7xWz96ysJjtfamTV2vBUIk GTH3Tt9sXgLdclGWvy/420eUO0eSeRH3Lj7hEo1jcNtzrhX3DFCuZgX20Lw6tJLifJ/y 5lFyyEB9m8vy15HwlJmM9Fmxyw8y1jMDeQMUWteqGLSYd3fPNmPoVdfmM28eLKdieewY Un2WtQzZYAELNz1E0JK3TaPSXrIkbgrzYXuv2CcIW/dhpW5JgfdO4BL74R7Q2uxoCwXE XZdg== 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; bh=hGGzB42iFy6ghF2u4QUqQFvdM4Y3ZVYyPzuZ+b6j5U8=; b=o3zWK3fA4C9K/rF0tsX94pdWPl9GkejDuklcwqHQWmueXxgN2wHJB/om2OPjxOKiLg H2GVIKI6QcXO1kSVr8cX4mwItmWHwSxfaC7EwYoy7AEuf8l7v4IC056hZ7Q/L/xBMk7K F0bpGz1pwlwevU9xBnnL+uJMvG1V596t6QLOzrDSti76oj6955wuJhmGbiQ/aVVoZfra RJe1qHr+zmr9DCNb0AOq7vovMiw40cea1AnzMpv0rg/S74b+wi6/KFS7f8lIGKujgiqO ZTTHTdEdNcr42SjusrsHXaPlhSScz0vtASPmJkF0PDnKc9GUr2Jt8nd0oJXzTJIx4Bv+ /rBg== X-Gm-Message-State: AOAM532QTkTWcitoi+ZTOnwgNuiSLYt4K2Gxc0XIYYxqQ/hsGHYd75Oq rD7bzV45CeiXEYS62VDIi+esZY1cyooMcpybdmrrku/AfROB X-Received: by 2002:a50:acc5:: with SMTP id x63mr39384755edc.99.1594137528113; Tue, 07 Jul 2020 08:58:48 -0700 (PDT) Received: from mta1.parkeon.com ([185.149.63.251]) by smtp-relay.gmail.com with ESMTPS id dn20sm5596ejc.142.2020.07.07.08.58.48 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 07 Jul 2020 08:58:48 -0700 (PDT) X-Relaying-Domain: flowbird.group Received: from [172.16.14.70] (port=54136 helo=PC12445-BES.dynamic.besancon.parkeon.com) by mta1.parkeon.com with esmtp (Exim 4.71) (envelope-from ) id 1jspzb-00069x-Mi; Tue, 07 Jul 2020 17:58:47 +0200 From: Martin Fuzzey To: Philipp Zabel Cc: Shawn Guo , Sascha Hauer , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm: imx: Fix occasional screen corruption on modeset. Date: Tue, 7 Jul 2020 17:56:59 +0200 Message-Id: <1594137527-15201-1-git-send-email-martin.fuzzey@flowbird.group> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When performing a modeset the atomic core calls ipu_crtc_atomic_disable() which switches off the DC and DI. When we immediately restart as in the modeset case this sometimes leads to corruption at the bottom of the screen looking like a mirror image of the top. The exact reason isn't understood but it seems timing related. This was observed on i.MX6DL on a system that does 2 mode transitions on boot (fbcon->android boot animation->android homescreen) then no more during normal operation resulting in corruption about once every 10 boots that lasted for variable durations from a few seconds to several hours. Dumping the buffers confirmed that they were correct in memory, just the display was wrong. For tests the problem was reproduced systematically by forcing a full modeset every 10 frames even if when not required. Leaving the DC and DI on if the CRTC is staying on fixes this. Signed-off-by: Martin Fuzzey --- drivers/gpu/drm/imx/ipuv3-crtc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index 63c0284..9137b64 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c @@ -84,8 +84,15 @@ static void ipu_crtc_atomic_disable(struct drm_crtc *crtc, struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc); struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent); - ipu_dc_disable_channel(ipu_crtc->dc); - ipu_di_disable(ipu_crtc->di); + /* + * If we are just doing a modeset don't disable dc/di as that + * sometimes leads to corruption at the bottom of the screen + */ + if (!crtc->state->active) { + ipu_dc_disable_channel(ipu_crtc->dc); + ipu_di_disable(ipu_crtc->di); + } + /* * Planes must be disabled before DC clock is removed, as otherwise the * attached IDMACs will be left in undefined state, possibly hanging -- 1.9.1