From patchwork Tue Mar 6 01:48:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schake X-Patchwork-Id: 10260503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CB1EB60134 for ; Tue, 6 Mar 2018 01:49:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD7C628D62 for ; Tue, 6 Mar 2018 01:49:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0D1928D65; Tue, 6 Mar 2018 01:49:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6637028D62 for ; Tue, 6 Mar 2018 01:49:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 840D16E517; Tue, 6 Mar 2018 01:49:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id B09986E514 for ; Tue, 6 Mar 2018 01:49:10 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id 188so19144261wme.1 for ; Mon, 05 Mar 2018 17:49:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W2l42CCC6Iy6xIGfOtp4TNCxTozHGb2vWNmxn+d6XTA=; b=W0taMll16quHrr3s18UVGV/Kg9LF21csHeEFObVgwGAd1MpVvzK+DTYj2g8L9BpppR tEmAUsaQYbwMimuEaCsf9Uyu5D/y/xBsyEkAK2Q9Mb7KJEO+X2HwA99jUFXzaScAxi9V 1dRy54kk9jQ19t4IDpvZSUcYPgxgM2YYAGYDtpYhHyX4ZL1C9d0ezvnDlRbA++W7hYdP eRn4kXfO094DvnPGZkQ+534QtlxaWk8bpmUIjTxMbiiUBLTJfaeFOZq97fY8pXgcnI9R FkeIR+oXTXmi46jMgDkzP/14zIFh+/U5ppWZS0NVIPJDxYgsAx+FiY6e5dgI6cp9qBnL 91nA== 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; bh=W2l42CCC6Iy6xIGfOtp4TNCxTozHGb2vWNmxn+d6XTA=; b=UZ+7150U6AQ3QKZQzuAfO9ny5wXI6NNztaDkwagN8Cke3FQ/dkWZecikiatnjGJMMY aucc1HiKvfjjFn2e8HsFHX/79EOm/taxUR5wyavh87fF1AeC2n//d7V8mdtRPQ/J/RGR hsBPHbOjkXxJ0hyoGGDTdVap33D5/uClz4LW6esliNYTapP/klkunTK1CByYebXKz4Jr wFbZscIkw1uL5zDJWNgg8Bw2uhz5Q9f2Tz9a1FEUfI1bHzdY0PF22JTNNyN4c3o4ntE9 mBERgai6sscP/WyVOTQiLVYKI6erpyu7b26eeQwbgYDFRK5IH9XsyPi2fIRc8Bjh+cif c6LQ== X-Gm-Message-State: AElRT7FPAqhOTyxaHsd8XUK6TPQqIhki587TYN3AIQSoTGlMxPL8xu28 FIyY3c9pYuuRd+qoE7lhye0= X-Google-Smtp-Source: AG47ELvrxGHxJQ6ahCyu5oUxET0HC8TaTM6CNBqeVY+Ux8n7zznFKiwB4cpsNiRUKFj+BrpV1muDXQ== X-Received: by 10.28.97.7 with SMTP id v7mr9187590wmb.154.1520300949013; Mon, 05 Mar 2018 17:49:09 -0800 (PST) Received: from localhost.localdomain (x4db58e23.dyn.telefonica.de. [77.181.142.35]) by smtp.gmail.com with ESMTPSA id b185sm8048974wmb.24.2018.03.05.17.49.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 17:49:07 -0800 (PST) From: Stefan Schake To: eric@anholt.net Subject: [PATCH 3/3] drm/vc4: Enable background color fill when necessary Date: Tue, 6 Mar 2018 02:48:39 +0100 Message-Id: <1520300919-103427-4-git-send-email-stschake@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520300919-103427-1-git-send-email-stschake@gmail.com> References: <1520300919-103427-1-git-send-email-stschake@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-rpi-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Stefan Schake MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Using the hint from the plane state, we turn on the background color to avoid display corruption from planes blending with the background. Signed-off-by: Stefan Schake --- drivers/gpu/drm/vc4/vc4_crtc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index ce1e3b9..728845f 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -643,9 +643,11 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, { struct drm_device *dev = crtc->dev; struct vc4_dev *vc4 = to_vc4_dev(dev); + struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); struct drm_plane *plane; bool debug_dump_regs = false; + bool enable_bg_fill = false; u32 __iomem *dlist_start = vc4->hvs->dlist + vc4_state->mm.start; u32 __iomem *dlist_next = dlist_start; @@ -656,6 +658,18 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, /* Copy all the active planes' dlist contents to the hardware dlist. */ drm_atomic_crtc_for_each_plane(plane, crtc) { + /* Is this the first active plane? */ + if (dlist_next == dlist_start) + /* We need to enable background fill when a plane + * could be alpha blending from the background, i.e. + * where no other plane is underneath. It suffices to + * consider the first active plane here since we set + * needs_bg_fill such that either the first plane + * already needs it or all planes on top blend from + * the first or a lower plane. + */ + enable_bg_fill = to_vc4_plane(plane)->needs_bg_fill; + dlist_next += vc4_plane_write_dlist(plane, dlist_next); } @@ -664,6 +678,14 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm.size); + if (enable_bg_fill) + /* This sets a black background color fill, as is the case + * with other DRM drivers. + */ + HVS_WRITE(SCALER_DISPBKGNDX(vc4_crtc->channel), + HVS_READ(SCALER_DISPBKGNDX(vc4_crtc->channel)) | + SCALER_DISPBKGND_FILL); + /* Only update DISPLIST if the CRTC was already running and is not * being disabled. * vc4_crtc_enable() takes care of updating the dlist just after