From patchwork Mon Apr 16 19:01:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kristian_H=C3=B8gsberg?= X-Patchwork-Id: 10343713 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 2141360216 for ; Mon, 16 Apr 2018 19:01:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 147A5288CE for ; Mon, 16 Apr 2018 19:01:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 077D9288CF; Mon, 16 Apr 2018 19:01: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=-5.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 77B57288C9 for ; Mon, 16 Apr 2018 19:01:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D904C89F89; Mon, 16 Apr 2018 19:01:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb0-x242.google.com (mail-yb0-x242.google.com [IPv6:2607:f8b0:4002:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 847BC89F89 for ; Mon, 16 Apr 2018 19:01:12 +0000 (UTC) Received: by mail-yb0-x242.google.com with SMTP id q74-v6so912465ybg.6 for ; Mon, 16 Apr 2018 12:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=fbXrV0GrE83rV6fB9XFdEYSnUTRIMYbqoJyFLWnyBV4=; b=nU2S0t9NoDIZ8U65VTQCZswUo9fFzumBDWHHn3NJ0ZClMUNVX1raSN27BpRohIVhT7 17PErXS19ODa4JgOYvR6QKBELY1XeVZuis3oet/7AFDBqJB2a9tjUxGdFaChhlJfGSUn TwAI2rnYUJkQxZK5x7+KAiIaueomcoCkCbo4ReWCYKaTErbUNfrDyf4op1LTPjQe/OEo LA19Hi/7Lo3rhuoz9XwtvozrYzqJ6B/nEozv15pRdtnp8xV6KVWK1005ijs1SpEeExpG JqgZheoCUqxvgkz3CQsl2YxpfPmM3jktWWmYzdwd+OQb2UZ8dKt5NuvZoQIj5APU6X9y EEFQ== 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=fbXrV0GrE83rV6fB9XFdEYSnUTRIMYbqoJyFLWnyBV4=; b=Ia5vBZ10mLgfK2NVN4ECJ2496oH3UTzEd5c5zr9bfm8WwkHp8L9guVEjttYbywDmma zJKKiJPa63/ffmGLXOwetl7owe/6I54lflsyq3SOl7Awi9CT6JrIcfS/WAXF2PXPuMQr VanNMiE4SvX5yN9LJySTMZCHzrzSghWC3yY9/UXsJVn9eOBozJqZxy0rIDV77NJ/AZvI Ij2dlIjUyNPG6DqB2BQykrfDdrK9iSiLQKdFlmouRRRI0FpLlx1H7qwl8WxJDZ19vboy T8ir7cSs0PjGAxcyDdD5PhGCA3ACBSuHsqgiv2QggQvShoP2suSZpmPsL2SdRPvPmmjy tZlA== X-Gm-Message-State: ALQs6tCRpIarXin55TFR3c04xVbzxoThHLUJSma50uWJ/s5EU7Du5B3x FAYtEj1IlIkT2phNELm8tQDQ/LgH X-Google-Smtp-Source: AIpwx48a48t1o9B6iAtZrEQZr81fV+oMKeYlOQWLpp4riqa2UX/RSpOcFGF5zgrjTYZnuptyZIVrNQ== X-Received: by 2002:a25:a3c5:: with SMTP id e63-v6mr8368039ybi.430.1523905270303; Mon, 16 Apr 2018 12:01:10 -0700 (PDT) Received: from hawkmoon.pdx.corp.google.com ([2620:15c:f:10:f576:f887:7d74:2d5f]) by smtp.gmail.com with ESMTPSA id l124sm3526109ywd.105.2018.04.16.12.01.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Apr 2018 12:01:08 -0700 (PDT) From: "Kristian H. Kristensen" X-Google-Original-From: "Kristian H. Kristensen" To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/rockchip: Filter out alpha formats for primary plane Date: Mon, 16 Apr 2018 12:01:03 -0700 Message-Id: <20180416190103.83171-1-hoegsberg@chromium.org> X-Mailer: git-send-email 2.13.5 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: "Kristian H. Kristensen" MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Rockchip doesn't support per-pixel alpha blending for the lowest window in the stack. While the hw supports restacking the windows, we don't expose that in KMS, so just filter out alpha formats for the primary plane. Change-Id: I7828d5bf0f0b5c6dd23f9e52aa01a5a683131d2f Signed-off-by: Kristian H. Kristensen --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index fae37b1cd691..2efe78600fd0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1547,6 +1547,28 @@ static irqreturn_t vop_isr(int irq, void *data) return ret; } +static uint32_t formats_for_win(const struct vop_win_phy *phy, uint32_t win, + uint32_t *formats, uint32_t max_formats) +{ + uint32_t i, j; + + BUG_ON(max_formats < phy->nformats); + + j = 0; + for (i = 0; i < phy->nformats; i++) { + /* + * win0 doesn't support per-pixel alpha, so don't add any RGBA + * formats for that plane. + */ + if (win == 0 && is_alpha_support(phy->data_formats[i])) + continue; + + formats[j++] = phy->data_formats[i]; + } + + return j; +} + static int vop_create_crtc(struct vop *vop) { const struct vop_data *vop_data = vop->data; @@ -1568,15 +1590,17 @@ static int vop_create_crtc(struct vop *vop) for (i = 0; i < vop_data->win_size; i++) { struct vop_win *vop_win = &vop->win[i]; const struct vop_win_data *win_data = vop_win->data; + uint32_t nformats, formats[16]; if (win_data->type != DRM_PLANE_TYPE_PRIMARY && win_data->type != DRM_PLANE_TYPE_CURSOR) continue; + nformats = formats_for_win(win_data->phy, i, + formats, ARRAY_SIZE(formats)); ret = drm_universal_plane_init(vop->drm_dev, &vop_win->base, 0, &vop_plane_funcs, - win_data->phy->data_formats, - win_data->phy->nformats, + formats, nformats, win_data->phy->format_modifiers, win_data->type, NULL); if (ret) {