From patchwork Fri Mar 9 00:53:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schake X-Patchwork-Id: 10269483 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 AB5026016D for ; Fri, 9 Mar 2018 00:55:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C9EF29C2A for ; Fri, 9 Mar 2018 00:55:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 913F229C2C; Fri, 9 Mar 2018 00:55:15 +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 333AF29C2A for ; Fri, 9 Mar 2018 00:55:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 004AA6E2CE; Fri, 9 Mar 2018 00:55:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 241046E2CE for ; Fri, 9 Mar 2018 00:55:12 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id 139so1071750wmn.2 for ; Thu, 08 Mar 2018 16:55:12 -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=DFZ9//lwtmGx+r46N38mgvDDBw37ZT0/vGPdSNLNjy4=; b=tkaHsnUT8yGTjupODVulEL7PZE03H38nffA4YJpTk+zWynI9vEnlzru7+Uc8RI6Zkg KWUMjx2gqp0BIRA5CftaYKnyLL1ViUqf1Nuq1SRAR3TGVDX4GUWaJBU+UWQfdx65wIze Bymfo/nP06nR7v6+eNjZZyLRE3i5z38ROsVgnFhYRlrvu1ZXC9MS+u/+z9KCUJBs8Olz qrsseJU58rkMWn6CTuJSG/UmmEpzZoVfD42VKQZojkT2DHWlZrQjNOaxo6uSBz+xCyzn LbRHiTcvY6ZH2Ijq66Fku8XT4sHr8yMmXNlvEoN+84Yk8D8Y35s7iulmMsSjR0RVCt7F 4coA== 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=DFZ9//lwtmGx+r46N38mgvDDBw37ZT0/vGPdSNLNjy4=; b=Q3EdKBw8tO266EajD/94Joi7FLh+mYBzfhn8cn/ztquPkezi0GqmPVGvhsW1mLQDXi D5K6Ep57b8bjUtEb2IbM01hIYzUDJuBRozme6XTkNJ3YLF79tDScncsg1occtkcYenE8 zWeSMjj7wpAtyC5ypJcs7uCA40pXn0txY6t54ZwScYztvQAsmCkwwudutVNI1j16BCZk mMCFtUc7y7whSD3V30nj6np4qqE7PMBhfp9PsrNIJt9th8tZUvjrS9loeKJ1if2dVlUV p/tpP11epXh1T9NVry4GxNahtgrINGO89KAnejaRw8rcDVZqB1SemuE+KH3YuRzrcaP7 Il4A== X-Gm-Message-State: AElRT7Ec0UEiHwK5QTp1anOiY6cnvA3Q9FB0pj5g00PoIRXkdwfPRLph KqMQj84uTtjETTre07HptS0= X-Google-Smtp-Source: AG47ELtFKOcZL4vVYilAcGtxhza5bPj0V+FYAX2yLDkKt8n0BO2rHEC1bPJhcy2BMrHlIoY7XyYr7w== X-Received: by 10.28.139.19 with SMTP id n19mr548387wmd.40.1520556910721; Thu, 08 Mar 2018 16:55:10 -0800 (PST) Received: from localhost.localdomain (x4e31ef02.dyn.telefonica.de. [78.49.239.2]) by smtp.gmail.com with ESMTPSA id s78sm45884815wrc.93.2018.03.08.16.55.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Mar 2018 16:55:09 -0800 (PST) From: Stefan Schake To: eric@anholt.net Subject: [PATCH v2 4/4] drm/vc4: Enable background color fill when necessary Date: Fri, 9 Mar 2018 01:53:37 +0100 Message-Id: <1520556817-97297-5-git-send-email-stschake@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520556817-97297-1-git-send-email-stschake@gmail.com> References: <1520556817-97297-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. Changes from v1: - Use needs_bg_fill from plane state Signed-off-by: Stefan Schake --- drivers/gpu/drm/vc4/vc4_crtc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index ce1e3b9..bf46674 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -643,9 +643,12 @@ 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; + struct vc4_plane_state *vc4_plane_state; 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 +659,20 @@ 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. + */ + vc4_plane_state = to_vc4_plane_state(plane->state); + enable_bg_fill = vc4_plane_state->needs_bg_fill; + } + dlist_next += vc4_plane_write_dlist(plane, dlist_next); } @@ -664,6 +681,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