Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3213644imu; Sat, 24 Nov 2018 00:15:14 -0800 (PST) X-Google-Smtp-Source: AJdET5eWC0BSEZtBNXP3YqGeQbXDfjkjwSG8DZWhKd0618ElLC/Fuq5PCe5lmAkMG9R+QHdkjaJ6 X-Received: by 2002:a62:647:: with SMTP id 68-v6mr20074518pfg.42.1543047314409; Sat, 24 Nov 2018 00:15:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047314; cv=none; d=google.com; s=arc-20160816; b=etgCmCVveQVC3ZnTi9KB1QMHaktzezKV2+T9+MXVHefoCOx/WMzTQcVX3XvQ7gp1uo 6lsq+RYobj/GOqKX7Af1heimulYRadxmC8Ss/C+mbTWJ+OHuv0iG+gtyTaMZJ8B9QvYT zJVrKZCNsAzXRtD/dekkfP+DeIp5BAYZVuvjW/PxTm44mHz5Kbi3erZet6hSkbJDJX5m bpXvJkc6hTTAAP/12OunBMx94yzJxSTi/8m6IMt07ckCDa6wW7Eh0hK+qoWqw4eaRZ8P YCjUTgAegWeICoK29D7FPfZKZ4J1SKFNKiPvLZhoFgYDvT0UT2XfD/x+lqqu1799edDb V3+Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hMkYsNgRlrUsrW9ZtyJ+MilkzK405SzZz149tX3cDWw=; b=qGFi1cnRcJiUJe1BSNDq0PIXrukZinyps8ukFbtNawUXrhLRrLSkKrlNION8O1C7PB URVFVB8WjGM0SR9cXx0G4chdAItqG2Xi5khqPGGgGdE0zMnIukoMD7wNZlHRfAw3CWb8 euTfdVr3VIz34Gu8kANOQFkRET8PmM61kZ+zBw/452IOLk8MDq7RYWd7Kcn4cY6VeKuV uH5ixGFgUje45EU/OZia0PUCAgfnUpjuqxd2IgzoNJ2/x5awYOJosZ8VdaFRlDj5/pgP VbnH6TE66EejMhk5YgeVGJVygk9TiZf0TCoZTLsyI4bsnP7dXVff+4PcwkOz82y2BtUs NyWg== 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 t74si45527083pgc.150.2018.11.24.00.15.00; Sat, 24 Nov 2018 00:15:14 -0800 (PST) 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 S2502611AbeKWUKG (ORCPT + 99 others); Fri, 23 Nov 2018 15:10:06 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49140 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388038AbeKWUKG (ORCPT ); Fri, 23 Nov 2018 15:10:06 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id E525B207AB; Fri, 23 Nov 2018 10:26:37 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost.localdomain (aaubervilliers-681-1-94-205.w90-88.abo.wanadoo.fr [90.88.35.205]) by mail.bootlin.com (Postfix) with ESMTPSA id 95591207AB; Fri, 23 Nov 2018 10:26:27 +0100 (CET) From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Chen-Yu Tsai , Thomas Petazzoni , linux-sunxi@googlegroups.com, Daniel Vetter , Paul Kocialkowski Subject: [PATCH v2 01/43] drm/sun4i: Cleanup video/YUV source before enabling a layer Date: Fri, 23 Nov 2018 10:24:33 +0100 Message-Id: <20181123092515.2511-2-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> References: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> 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 This adds a dedicated function for cleaning the video and YUV source channel layer enable bits. This function is called first on layer atomic update to make sure that there are no leftover bits from previous plane configuration that were not cleaned until now. It fixes issues when alternating between video and YUV planes, where both bits would be set eventually, leading to broken plane display. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_backend.c | 9 +++++++++ drivers/gpu/drm/sun4i/sun4i_backend.h | 2 ++ drivers/gpu/drm/sun4i/sun4i_layer.c | 2 ++ 3 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index bf49c55b0f2c..67b4bb4f5365 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -395,6 +395,15 @@ int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, int layer, return 0; } +void sun4i_backend_cleanup_layer(struct sun4i_backend *backend, + int layer) +{ + regmap_update_bits(backend->engine.regs, + SUN4I_BACKEND_ATTCTL_REG0(layer), + SUN4I_BACKEND_ATTCTL_REG0_LAY_VDOEN | + SUN4I_BACKEND_ATTCTL_REG0_LAY_YUVEN, 0); +} + static bool sun4i_backend_plane_uses_scaler(struct drm_plane_state *state) { u16 src_h = state->src_h >> 16; diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.h b/drivers/gpu/drm/sun4i/sun4i_backend.h index e3d4c6035eb2..339dbff1cce4 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.h +++ b/drivers/gpu/drm/sun4i/sun4i_backend.h @@ -208,5 +208,7 @@ int sun4i_backend_update_layer_frontend(struct sun4i_backend *backend, int layer, uint32_t in_fmt); int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, int layer, struct drm_plane *plane); +void sun4i_backend_cleanup_layer(struct sun4i_backend *backend, + int layer); #endif /* _SUN4I_BACKEND_H_ */ diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index 78f77af8805a..e0e37c2f1721 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -92,6 +92,8 @@ static void sun4i_backend_layer_atomic_update(struct drm_plane *plane, struct sun4i_backend *backend = layer->backend; struct sun4i_frontend *frontend = backend->frontend; + sun4i_backend_cleanup_layer(backend, layer->id); + if (layer_state->uses_frontend) { sun4i_frontend_init(frontend); sun4i_frontend_update_coord(frontend, plane); -- 2.19.1