From patchwork Tue May 23 00:14:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9741661 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 5B61760210 for ; Tue, 23 May 2017 01:02:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EE4C286EC for ; Tue, 23 May 2017 01:02:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41DF128779; Tue, 23 May 2017 01:02:32 +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 CDA25286EC for ; Tue, 23 May 2017 01:02:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2AA8A6E314; Tue, 23 May 2017 01:00:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 220A889DA3 for ; Tue, 23 May 2017 00:15:25 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id 99so6669542lfu.2 for ; Mon, 22 May 2017 17:15:25 -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=Zf8vqC9AXAq7wvbxNokKCghqxmXkuAJxSgN5KOhBHSA=; b=PNILBf0RrFLKZz9tFzDEz7tBF1m674QKWcZdIlSCouonIKXSMSU1gosUrnfZCf/b/R xx0VYpMKg/NVosUhlFQqRoOZoJcCxlQJ7p2Dlm2HYKdsmGT5WyXtsU2fAvjyQF9jFnnT LN2kFkVRKPrYVXDQnBazQ6S6Nd9uc4a57EJLmfPyRREXIcuyI7O+e6xchm2q8sf4MUpJ I2F/hU5VSpsFfTOo1uWnl3pyBXolDuGPZcwym1FPWcIuKyw5walAnsjPauOv7SwMVmPl LMOUZyMKu+yP96mfgTP6//PpOfbLiEk9cGjKakPBJWDLgeBhF9Ib3mUDUPWBHOgjEd83 twfA== 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=Zf8vqC9AXAq7wvbxNokKCghqxmXkuAJxSgN5KOhBHSA=; b=EjCVj0YQmPZhO2uLqunQ9rk7v4KM/FbUjuvyPF9t01L7OTf7CVbDZdlqyYJBbcWABJ w1WmjokPX0dHeIle8DzBl5Di+m2sicHDl7e2e29WUoWJxVkNUpaJDMc66qOf+xXRPMdP uRbHUMBiYe7Brd7XhPcclL+w/so5nWwrcesdi77+nSTMnrxpTTBLnX04QpDFjckSyDW9 //nhXgo7Dr5nptHTBAkwfakgA4pfTLfonm0S2pWm1bROXhrSpHYTU42fTWVm3j5+gY0/ mMA2Tm8VeqKUjpgdV3WX8fhyJOCKCjfExWpdiGpzc++95GTAsBfpCBo0uAsjtko8jN0k 2PxQ== X-Gm-Message-State: AODbwcDJQdzgXKyoWdGg42OXBPmIlTLkd7bwRt3Jmcve7qhbeJ+wD84D QXxRUTfO06fwvg== X-Received: by 10.25.201.18 with SMTP id z18mr6724921lff.66.1495498523598; Mon, 22 May 2017 17:15:23 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-175.pppoe.spdop.ru. [109.252.91.175]) by smtp.gmail.com with ESMTPSA id v30sm3440904ljd.9.2017.05.22.17.15.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 17:15:23 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen Subject: [PATCH 09/22] drm/tegra: dc: Apply clipping to the plane Date: Tue, 23 May 2017 03:14:24 +0300 Message-Id: <197b5a9d91895692edd6b562fb3d22dede0014e5.1495498184.git.digetx@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Tue, 23 May 2017 00:59:38 +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 --- 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 5c9b93981af2..2e01a2dfc5cd 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -485,12 +485,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; @@ -560,14 +573,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);