From patchwork Fri Mar 2 00:32:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schake X-Patchwork-Id: 10252987 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 ED12760291 for ; Fri, 2 Mar 2018 00:35:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDF4328740 for ; Fri, 2 Mar 2018 00:35:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D20772874C; Fri, 2 Mar 2018 00:35:44 +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 CE2C228740 for ; Fri, 2 Mar 2018 00:35:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D59A76ECA8; Fri, 2 Mar 2018 00:35:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 30DEA6ECA8 for ; Fri, 2 Mar 2018 00:35:40 +0000 (UTC) Received: by mail-wr0-x244.google.com with SMTP id k9so8401669wre.9 for ; Thu, 01 Mar 2018 16:35:40 -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; bh=SZSVCYJYLhLU/HnmBSKfPRAGP0e1uqLlX2rNszr3XuA=; b=VF/mdlCNjPt0joq/SvxoKPkoKip4EeWP/8SoI+jMifSHEyCjoxicHTDEmW2OU3D0I6 DYS6QsJtUQsTA7QuX0Hi+P8wr7YKxwYTL2jiKPq3tB+/tQ9YFAGnYHuQMBXHzjV1PfTp Eu1VihrfVsjnYouEUpsaltwKD+ikijcFToKsRT2JnlpEDOZ/5xXJ1sLF7lF/9Dm8Haff +Kmj1FFlsWn52ysHW5H/pLzUtDBbUornE/ZBvp/jm+goFGvCQP3UGfdpeig3ai9uk91+ z1qKO3TJXALXzd4xqLeIjeSQsQzCcG0a4rx9itdWGycNurD+zs0y7PkGpzKQDDNAJ2cY j0SQ== 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=SZSVCYJYLhLU/HnmBSKfPRAGP0e1uqLlX2rNszr3XuA=; b=Boxw52XIrKq8MTPhf4quKZ1DK+XW1C04GdRWaTcOZXQF/2XdGEgVJvaipi/xi/YPmn Vdir7o+Lj4X+mp/WOqCcVcLaF6hzHr/QwVuOXU3tLBrGh00som8j9B3LbgwgkFEeYKpf VAvpnymEnp4KgP7a17TIlnXJROWuBcXwBwOCqyUeR6Y017LrnEpQ931wm4jQsfnQGcua Y/FEBJIUalI0bfncR6nR74ct7qf8eAKUu3OaAc9ZynJB2vFhX3y+TBMQiMNs4LxbaUbH 7fcRvEv6kK6h94ihzPVSbvZ8+GwFmwGl57DcsaMbJUUTdex4VkE5wXu5CYMd47YQ1ENF brVw== X-Gm-Message-State: APf1xPDMGn+cmtNOfSLzCPwEZVmHXWTxiwx7ERIeSeL7qnjqPLFJP10k poxfnRaBzWkgfozbUH5yhJk6Nb2D X-Google-Smtp-Source: AG47ELt/qtwfKf3xC3Z9TTOuy/uyQaYZON94Mq8K8ZVxl+f0Izy6ZVq7LhbG1uyzoEbHFVkSCyaRMQ== X-Received: by 10.223.163.157 with SMTP id l29mr3233775wrb.239.1519950938616; Thu, 01 Mar 2018 16:35:38 -0800 (PST) Received: from localhost.localdomain (x4e311309.dyn.telefonica.de. [78.49.19.9]) by smtp.gmail.com with ESMTPSA id s21sm4382132wra.45.2018.03.01.16.35.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 16:35:37 -0800 (PST) From: Stefan Schake To: eric@anholt.net Subject: [PATCH] drm/vc4: Ignore alpha on primary plane Date: Fri, 2 Mar 2018 01:32:40 +0100 Message-Id: <1519950760-68447-1-git-send-email-stschake@gmail.com> X-Mailer: git-send-email 2.7.4 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 We allow alpha formats on the primary plane but a partially transparent framebuffer will cause a corrupted display. With this change black pixels are output instead, in line with the behavior for other DRM drivers. Signed-off-by: Stefan Schake --- Test program is available at https://github.com/stschake/vc4-alpha-test drivers/gpu/drm/vc4/vc4_plane.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 61ad955..8c829fa 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -521,6 +521,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane, u32 ctl0_offset = vc4_state->dlist_count; const struct hvs_format *format = vc4_get_hvs_format(fb->format->format); int num_planes = drm_format_num_planes(format->drm); + bool primary_plane = state->crtc->primary == plane; u32 scl0, scl1, pitch0; u32 lbm_size, tiling; unsigned long irqflags; @@ -620,8 +621,12 @@ static int vc4_plane_mode_set(struct drm_plane *plane, /* Position Word 2: Source Image Size, Alpha Mode */ vc4_state->pos2_offset = vc4_state->dlist_count; + /* We do not enable the HVS background color fill so the primary plane + * must be opaque to avoid display artifacts. Achieve this by always + * using fixed alpha (initialized to 0xff above) on the primary plane. + */ vc4_dlist_write(vc4_state, - VC4_SET_FIELD(fb->format->has_alpha ? + VC4_SET_FIELD(fb->format->has_alpha && !primary_plane ? SCALER_POS2_ALPHA_MODE_PIPELINE : SCALER_POS2_ALPHA_MODE_FIXED, SCALER_POS2_ALPHA_MODE) |