From patchwork Wed Apr 18 17:31:52 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: 10348731 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 BC4606031B for ; Wed, 18 Apr 2018 17:32:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABF6728796 for ; Wed, 18 Apr 2018 17:32:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A064A287A2; Wed, 18 Apr 2018 17:32:04 +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 568F72879A for ; Wed, 18 Apr 2018 17:32:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E8E3F6E0BC; Wed, 18 Apr 2018 17:32:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io0-x242.google.com (mail-io0-x242.google.com [IPv6:2607:f8b0:4001:c06::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64CA06E0BC for ; Wed, 18 Apr 2018 17:32:00 +0000 (UTC) Received: by mail-io0-x242.google.com with SMTP id t123-v6so3377932iof.7 for ; Wed, 18 Apr 2018 10:32:00 -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=HU9nTuCYlkGH7CtryTKC28Fu7naPSSoahSugrmzlFNU=; b=DzLs94cQzwAcXYD9vjLZKKZ6wO/Clk2OuPetVvJMAk5cxA7XMMA8MeqQOU2vKjIABt +tRkYIZ7oF1nkLTc9Y2efJ+HWyTewDt6clC09LwKqJKNly9+xN1SxQlhKob0k4I9rUHQ kweKS5FJGYjNralxr+wXiNevF2h1p8fNC4jTCVTWFfu3wsKrKfK68JOkTFo0ipTvZVA4 9pdY7XvtYVY3/v3n7m3rgN98ZbL5Ospw9Izo7VerNMO/el9Ac+RjlfZox97/jSC6TUxy qbl2DcxXNRQ24pCWoRuElwPiggqlWTwNW8vIiJ+Q8g2Xeif3yXcwuMCLrRQhInHVsD0B NiBg== 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=HU9nTuCYlkGH7CtryTKC28Fu7naPSSoahSugrmzlFNU=; b=Gbcm5NVuG02c9TcvQptcr5DU6s6zpVkylaXvb9tx6mRm4TqI54/GHqUBjfa2ZEpTz2 /GNHUaDeKYH7QZVmjvsoppvOk8vnh+NBg/ljlof2qUCPNXANg9RDRFEEokYROdYu8Sfi +xiKPJ4r5IT32qCx9GMFAymWvcUdjJsKaUByjFj2ghztFxgm6rVM2uVZ9RXCWevQhls4 zZxl9DHDW84k7b7cKdKKg7IueqxG3KjhA7ctRmfwB6nHRlT3k+gmS+kfixDZ4+FT5S22 33eHaEKu8a1pNcHlA/3T/VvICIA0sUdSYGHJBbjbe3+k+lFPg+TCcAzErFDfVxBvB+Yg ZWBA== X-Gm-Message-State: ALQs6tADvogpRnhXVacBp7BA+lIwnfRXEdik1RURYw2XzyPAzwsNnmSf hwn+ZaDYWOMeUbldOpNrlDe3QPPW X-Google-Smtp-Source: AIpwx4+Nt74QAQyf/U5wtMZ6Z/EvTKjfPhafoAFoCoxe8NKYAKocIw7mdR+hEPQFf1xiBAwsOG2Lxw== X-Received: by 2002:a6b:aa52:: with SMTP id t79-v6mr3179352ioe.161.1524072719158; Wed, 18 Apr 2018 10:31:59 -0700 (PDT) Received: from hawkmoon.pdx.corp.google.com ([2620:15c:f:10:f576:f887:7d74:2d5f]) by smtp.gmail.com with ESMTPSA id g16-v6sm5270646ita.0.2018.04.18.10.31.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Apr 2018 10:31:57 -0700 (PDT) From: "Kristian H. Kristensen" X-Google-Original-From: "Kristian H. Kristensen" To: dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm/rockchip: Disable blending for win0 Date: Wed, 18 Apr 2018 10:31:52 -0700 Message-Id: <20180418173152.93246-1-hoegsberg@chromium.org> X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog 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 Blending win0 with the background color doesn't seem to work correctly. We only get the background color, no matter the contents of the win0 framebuffer. However, blending pre-multiplied color with the default opaque black default background color is a no-op, so we can just disable blending to get the correct result. Signed-off-by: Kristian H. Kristensen Cc: Sandy Huang Cc: Sean Paul Reviewed-by: Sean Paul --- v2: Drop CHROMIUM: prefix, rebase on Linus' master drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 53d4afe15278..753a7548da84 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -76,6 +76,9 @@ #define VOP_WIN_GET_YRGBADDR(vop, win) \ vop_readl(vop, win->base + win->phy->yrgb_mst.offset) +#define VOP_WIN_TO_INDEX(vop_win) \ + ((vop_win) - (vop_win)->vop->win) + #define to_vop(x) container_of(x, struct vop, crtc) #define to_vop_win(x) container_of(x, struct vop_win, base) @@ -708,6 +711,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, dma_addr_t dma_addr; uint32_t val; bool rb_swap; + int win_index = VOP_WIN_TO_INDEX(vop_win); int format; /* @@ -777,7 +781,14 @@ static void vop_plane_atomic_update(struct drm_plane *plane, rb_swap = has_rb_swapped(fb->format->format); VOP_WIN_SET(vop, win, rb_swap, rb_swap); - if (fb->format->has_alpha) { + /* + * Blending win0 with the background color doesn't seem to work + * correctly. We only get the background color, no matter the contents + * of the win0 framebuffer. However, blending pre-multiplied color + * with the default opaque black default background color is a no-op, + * so we can just disable blending to get the correct result. + */ + if (fb->format->has_alpha && win_index > 0) { VOP_WIN_SET(vop, win, dst_alpha_ctl, DST_FACTOR_M0(ALPHA_SRC_INVERSE)); val = SRC_ALPHA_EN(1) | SRC_COLOR_M0(ALPHA_SRC_PRE_MUL) |