Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9122686pxu; Mon, 28 Dec 2020 07:11:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlopbi0nR8GvKaUPh1AWdh1W/z5kp81JOky7uO8AXY3z63BJ9owMHBfLnp6fkdKeDdC31Z X-Received: by 2002:a17:906:710b:: with SMTP id x11mr43871247ejj.433.1609168262930; Mon, 28 Dec 2020 07:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168262; cv=none; d=google.com; s=arc-20160816; b=pVs2WeTT0Hu2ZBiQ+leLMEFMs1kxBuoG7e6O+dYsizlCkfTua8wV80+t3V2L0Up9Ii bVD3r+2kWc0/qhQMd7m5jCd4BdAK6DwiLJiJlHd6EtByunPHK+fYZbsKRbXSgyTUY9Pn KQ8x32E6/5KWaW41Y/xDnEkG3MDIo3BStMDGxj7hx5mkut3OKFlyZgoHwkNhwQIe9MBC pfRy/ZU9UwLJnyqMeMe8LHkK1ZPm4maqs/i5Kxw9XcJcKyMZs//1NqodQV6SSyjid8/u zxgKqwMiu9epH4Q3xd7s0kohxQpXTz0KK8IYlzZDpWXKMGHXH4RvyzUws6/PTQIguqLl L95w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CLGGqCaDe7ngNxA9AibgMlEp/C5LVDTG5hQtgk+Huog=; b=UkmaVP2P5DsxYgWtyc5gZ8QBBfoS2/Ogei7AuJONkXh86DGhjWctS3xy8momEuGUEv u5aVY6O7pQSvxQYGtYZyb9PPDmHfPkjsSlM4vs9fo8pfWufsinAx032qCwFH1bYMUjIc 4YL51UuXJkGOj+UOKR2PeLLpuxEnyXZTG9gFtfyCOZu6A/M0byUUjfvJBYsxNZGC+Thh PRZdTAsOO8mbcn578ixJK2WtRHJpD50wW4ESTykMsIFWJZHdV1/IIqf38N9gWvCYlg81 T8IfyAWSdj2aJf/09i7R/+lb4jt/AAz2qM5+8JzbnXUXjrcrbbPCc5EmgcD9IrrdDyrM jYmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JqsPCqlA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o7si20318369edq.20.2020.12.28.07.10.38; Mon, 28 Dec 2020 07:11:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JqsPCqlA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439571AbgL1PGn (ORCPT + 99 others); Mon, 28 Dec 2020 10:06:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:44322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438906AbgL1OJ5 (ORCPT ); Mon, 28 Dec 2020 09:09:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CF71A207A9; Mon, 28 Dec 2020 14:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164556; bh=yrUpkunsziuQQgjws7/th4KevViFFmMo2wWwfKC5NfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JqsPCqlAt+NSCDuHwI7r/d9ZTVM38rHddmfMBkHnPnr9HpAj+KpW2rICKdhS/zE+P fTozQXyiJRDr3MoGCgtMfVRFLAkAK43MRSF5VQCKfEpG7TNqt0sO2fCDVn6EeVUYc9 ic74wWsV69tTTn4hmztuhhV4j2tvKZ0EBV23rQOQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurentiu Palcu , Lucas Stach , Sasha Levin Subject: [PATCH 5.10 209/717] drm/imx/dcss: fix rotations for Vivante tiled formats Date: Mon, 28 Dec 2020 13:43:27 +0100 Message-Id: <20201228125030.994986948@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laurentiu Palcu [ Upstream commit 59cb403f38099506ddbe05fd09126f3f0890860b ] DCSS supports 90/180/270 degree rotations for Vivante tiled and super-tiled formats. Unfortunately, with the current code, they didn't work properly. This simple patch makes the rotations work by fixing the way the scaler is set up for 90/270 degree rotations. In this particular case, the source width and height need to be swapped since DPR is sending the buffer to scaler already rotated. Also, make sure to allow full rotations for DRM_FORMAT_MOD_VIVANTE_SUPER_TILED. Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ") Signed-off-by: Laurentiu Palcu Reviewed-by: Lucas Stach Signed-off-by: Lucas Stach Link: https://patchwork.freedesktop.org/patch/msgid/20201105140127.25249-2-laurentiu.palcu@oss.nxp.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/imx/dcss/dcss-plane.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/dcss/dcss-plane.c b/drivers/gpu/drm/imx/dcss/dcss-plane.c index 961d671f171b4..f54087ac44d35 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-plane.c +++ b/drivers/gpu/drm/imx/dcss/dcss-plane.c @@ -111,7 +111,8 @@ static bool dcss_plane_can_rotate(const struct drm_format_info *format, supported_rotation = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_MASK; else if (!format->is_yuv && - modifier == DRM_FORMAT_MOD_VIVANTE_TILED) + (modifier == DRM_FORMAT_MOD_VIVANTE_TILED || + modifier == DRM_FORMAT_MOD_VIVANTE_SUPER_TILED)) supported_rotation = DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK; else if (format->is_yuv && linear_format && @@ -273,6 +274,7 @@ static void dcss_plane_atomic_update(struct drm_plane *plane, u32 src_w, src_h, dst_w, dst_h; struct drm_rect src, dst; bool enable = true; + bool is_rotation_90_or_270; if (!fb || !state->crtc || !state->visible) return; @@ -311,8 +313,13 @@ static void dcss_plane_atomic_update(struct drm_plane *plane, dcss_plane_atomic_set_base(dcss_plane); + is_rotation_90_or_270 = state->rotation & (DRM_MODE_ROTATE_90 | + DRM_MODE_ROTATE_270); + dcss_scaler_setup(dcss->scaler, dcss_plane->ch_num, - state->fb->format, src_w, src_h, + state->fb->format, + is_rotation_90_or_270 ? src_h : src_w, + is_rotation_90_or_270 ? src_w : src_h, dst_w, dst_h, drm_mode_vrefresh(&crtc_state->mode)); -- 2.27.0