From patchwork Wed Jun 14 23:18:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9787759 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 2897D602CB for ; Thu, 15 Jun 2017 00:59:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E964284DC for ; Thu, 15 Jun 2017 00:59:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 135DB284ED; Thu, 15 Jun 2017 00:59:57 +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 C052C284DC for ; Thu, 15 Jun 2017 00:59:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9303C6E65B; Thu, 15 Jun 2017 00:57:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBAEE6E632 for ; Wed, 14 Jun 2017 23:19:03 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id v20so1609735lfa.2 for ; Wed, 14 Jun 2017 16:19:03 -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:in-reply-to:references :in-reply-to:references; bh=Zmdv8xjPMMg6++aASkSfGdNUGqPGJGTlDnC8BmV7rzA=; b=cVhHbXl2irppp21u/ml93lo0mUevPXNa8B7red5P2NxCqb3P8aRbw/oiWh5xYY0ASE XExqhHUgfZk/O8hrOkFm8b3L+8ioBAupdCKvAriW+AvWDF5yCTW3ZZg+GxcHmu/x7Awk 0tPOPlMczlB0YWFMp5jJ6tMB5xU/bumN3828D60SbG7y/1Q3Fh2RSUeV/RDBVs3r++E6 QIrJgjtb5e0y1O3yCyLxS98pX2Xg1EfTmMnEA8FJy97ASvgUmGh6hqiVQoIfoWsdFiMZ oA6jRuP/NXd89bu1UWaiMQzBaLUClcBI3H2MQULe4U7xD43DN3u922yuv/xigUfiZb4X oIlQ== 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:in-reply-to:references; bh=Zmdv8xjPMMg6++aASkSfGdNUGqPGJGTlDnC8BmV7rzA=; b=WA+wJC/kMqV3NJRTy6vkset4C1mDm5bYcvPNUT3G7HcJz+NRqM6oF6QM2Vssr5nxF1 DHKiQZS4oyj+N/sNOq8qH6u/udMB9z3Owr/AP1dh2I6k0aRLXdd7NYsxsM6sLdZdquz4 0vut1tK63Qba3oU8Zm0iQ5cYa+XzkWiGQ6lIR5Wr93W9Knt+Qle7duRdy0FozscitvPR WoJ2G4Ud71XxDQYzgZllLUeL2ZgUQ5tANwpCwXuxqwiExsjJuls2Gf9kEQ4BlTT7FHqH EJmEgOjlRjXz5zXBNg0F00oqEoKmOKp8QkxsgRdtQnIVTqEPfsQZeN/SeuW1Gt6GXTjH 7TlA== X-Gm-Message-State: AKS2vOwXg2UaSmM6d+n1Au15z0HCy0StBbHlhHVNZIyr7SlBRSykuf0D 9KaS3PEqugyzqw== X-Received: by 10.46.19.10 with SMTP id 10mr603238ljt.5.1497482342400; Wed, 14 Jun 2017 16:19:02 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-7.pppoe.spdop.ru. [109.252.91.7]) by smtp.gmail.com with ESMTPSA id i24sm290165ljb.63.2017.06.14.16.19.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 16:19:01 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen , Erik Faye-Lund Subject: [PATCH v3 07/20] drm/tegra: dc: Apply clipping to the plane Date: Thu, 15 Jun 2017 02:18:30 +0300 Message-Id: <1306db6555e16d0bed85d731d79c05a29fda3bda.1497480757.git.digetx@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Thu, 15 Jun 2017 00:57:20 +0000 Cc: linux-tegra@vger.kernel.org, DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Tegra20 an overlay plane should be clipped, otherwise its output is distorted once plane crosses display boundary. Signed-off-by: Dmitry Osipenko Reviewed-by: Erik Faye-Lund --- drivers/gpu/drm/tegra/dc.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 98ee6abb056c..a7a7cce1afd0 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -486,12 +486,25 @@ static int tegra_plane_state_add(struct tegra_plane *plane, { struct drm_crtc_state *crtc_state; struct tegra_dc_state *tegra; + struct drm_rect clip; + int err; /* Propagate errors from allocation or locking failures. */ crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc); if (IS_ERR(crtc_state)) return PTR_ERR(crtc_state); + clip.x1 = 0; + clip.y1 = 0; + clip.x2 = crtc_state->mode.hdisplay; + clip.y2 = crtc_state->mode.vdisplay; + + /* Check plane state for visibility and calculate clipping bounds */ + err = drm_plane_helper_check_state(state, &clip, 0, INT_MAX, + true, true); + if (err < 0) + return err; + tegra = to_dc_state(crtc_state); tegra->planes |= WIN_A_ACT_REQ << plane->index; @@ -561,14 +574,14 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, return; memset(&window, 0, sizeof(window)); - window.src.x = plane->state->src_x >> 16; - window.src.y = plane->state->src_y >> 16; - window.src.w = plane->state->src_w >> 16; - window.src.h = plane->state->src_h >> 16; - window.dst.x = plane->state->crtc_x; - window.dst.y = plane->state->crtc_y; - window.dst.w = plane->state->crtc_w; - window.dst.h = plane->state->crtc_h; + window.src.x = plane->state->src.x1 >> 16; + window.src.y = plane->state->src.y1 >> 16; + window.src.w = drm_rect_width(&plane->state->src) >> 16; + window.src.h = drm_rect_height(&plane->state->src) >> 16; + window.dst.x = plane->state->dst.x1; + window.dst.y = plane->state->dst.y1; + window.dst.w = drm_rect_width(&plane->state->dst); + window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; window.bottom_up = tegra_fb_is_bottom_up(fb);