From patchwork Tue Jun 13 23:15:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9785051 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 226E060384 for ; Wed, 14 Jun 2017 00:41:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15BEB28573 for ; Wed, 14 Jun 2017 00:41:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AA2D28584; Wed, 14 Jun 2017 00:41:08 +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 C1AC928573 for ; Wed, 14 Jun 2017 00:41:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E01C6E3D6; Wed, 14 Jun 2017 00:41:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86B506E3C9 for ; Tue, 13 Jun 2017 23:38:51 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id x81so14865281lfb.3 for ; Tue, 13 Jun 2017 16:38:51 -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=rwim1+xsXwZ+bB54iRvbCgvAHOIHaUKVztqW3MFwQFg=; b=AMH+jQjy72Q5x3jXSkxAeP26ioQCzY0sBMCadTapC7yGN5RhMqB+DLSqLLItPqhlEm T9TXrXVWfUH4FZ4oUgIwLEwQEVvZKyY8HPSk6E0NUtuOJ0ZP1PjYR2faA+sN7beMhEhA XVcUKgie+i4xOhBp25M7hHFHOgdQEfCgDbtb2bfxx44hES4cxU5nAhvxCjsPbKRx2xuY +w185YN3KvziResnTdVF0CRXsZ59mtwX0hBNIoQhi0Uc4ThQ9pmp//XmQhPzO7BuAPQZ Ha0MJccmh56pd9AAFsXb2mKz/Sh7hfHY9CX/NtXKQeJvqA8/Wm3CW/bIiD+3gw8ZPlBk h2cA== 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=rwim1+xsXwZ+bB54iRvbCgvAHOIHaUKVztqW3MFwQFg=; b=shRgLKdsZ2KF/UG02Tvtw3g66cbPnAeHfOw9ofcrQHNx7FEzqf9MhdrmGiWLP+rkqF xEXUO2v8J2buLX8dizktwwC6M+vQmfDsqKaZGeas0qfeOz30hZhCf35NSLvecqXBb4r5 MgWAe8C3C853qQAhiCvoRrVydPvg7Pbh/XIXJBAsJaUhqHahlIwmX6XYzPyoLLwPL/1S UT8KYgbyN6JETQxNBft5sBjpho6NjaaAqNxGpphpMUk1++rLK5bbD141dAN6CygHfuGG HELFUEM6SMAIkETGUi3+IDOYbu4OJUSlQZuL9t3WnU4QsLZ3/cm+z/Yf5dPbErqZftcd uzHQ== X-Gm-Message-State: AKS2vOz9QBZqRjwItAsBA2jlmFXxUfRgzVxq8/q69tUjmhN5bqeXHNQw FEJLsSEXqzt2cg== X-Received: by 10.46.80.69 with SMTP id v5mr749921ljd.6.1497397129972; Tue, 13 Jun 2017 16:38:49 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-7.pppoe.spdop.ru. [109.252.91.7]) by smtp.gmail.com with ESMTPSA id f27sm3785725lfa.27.2017.06.13.16.38.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 16:38:49 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen , Erik Faye-Lund Subject: [PATCH v2 07/22] drm/tegra: dc: Apply clipping to the plane Date: Wed, 14 Jun 2017 02:15:46 +0300 Message-Id: <7adbe0c6e67115fa4fd201026533b7cb97fc44d2.1497394243.git.digetx@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Wed, 14 Jun 2017 00:41:00 +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);