From patchwork Mon Mar 25 07:13:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10868051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0C7818E8 for ; Mon, 25 Mar 2019 07:14:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA84C2924E for ; Mon, 25 Mar 2019 07:14:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEED62925A; Mon, 25 Mar 2019 07:14:05 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC65E2924E for ; Mon, 25 Mar 2019 07:14:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729821AbfCYHOE (ORCPT ); Mon, 25 Mar 2019 03:14:04 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59689 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729803AbfCYHOD (ORCPT ); Mon, 25 Mar 2019 03:14:03 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190325071401euoutp02721c10cfef1723d3aa245afa0f9c2545~PIj0DU47k0730507305euoutp02K; Mon, 25 Mar 2019 07:14:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190325071401euoutp02721c10cfef1723d3aa245afa0f9c2545~PIj0DU47k0730507305euoutp02K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553498041; bh=etuAz+B4tjFxongWFMq4xgwecflkYEh95FK1Mb0jXrY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=D7KP/UuD0vxtl6vxv3KgUPEk0UGosLfM1W0BcXD5UuoWP/SeGHpTI0OWBnoJghdwV XwyNW+xv4msasgN/jI3UGLBmVe3VOZEq1yh091c9fKF2naVZxxwweRgleHAvaIwASW mw9dyONxyHfDo+xpnjt5vTTstJAOnackc6UgG1H0= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190325071401eucas1p2065adae262005307e74f498cb5ad93ec~PIjzrQ0rm3045430454eucas1p26; Mon, 25 Mar 2019 07:14:01 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 1C.4E.04325.9BF789C5; Mon, 25 Mar 2019 07:14:01 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190325071400eucas1p1a6740040c56d51b0a3658ec01c1bb9f6~PIjy7JQOA3105731057eucas1p1w; Mon, 25 Mar 2019 07:14:00 +0000 (GMT) X-AuditID: cbfec7f5-b75ff700000010e5-a0-5c987fb9d0ac Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 21.29.04140.8BF789C5; Mon, 25 Mar 2019 07:14:00 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.51.74]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0POW003QHUR43P00@eusync3.samsung.com>; Mon, 25 Mar 2019 07:14:00 +0000 (GMT) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v3 RESEND 18/24] drm/exynos: add GSCALER plane capability Date: Mon, 25 Mar 2019 08:13:43 +0100 Message-id: <20190325071349.22600-19-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190325071349.22600-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKIsWRmVeSWpSXmKPExsWy7djPc7o762fEGDQ+4bK4te4cq8XGGetZ La58fc9mMen+BBaL8+c3sFvMOL+PyWLtkbvsDuwem1Z1snnc7z7O5NG3ZRWjx+dNcgEsUVw2 Kak5mWWpRfp2CVwZ8y9fZCpYJVTR1f2YuYFxK38XIweHhICJxI7Dcl2MXBxCAisYJRpnz2SC cD4zSmxec44NpuhkqzlEfBmjxMr9Sxm7GDmBnP+MEos+5IPYbAKaEn8332QDsUUElCVW7Wtn B2lgFvjNKDF9+TZ2kISwgKfEhVfbWUFsFgFViX8t58HivAKWEj8WdoLFJQTkJVZvOMAMYnMC xf+fvsQMEW9kk/j2WADCdpG4cLyRBcKWkbg8uRvKrpe4v6KFGWSxhEAHo8TWDTuhmq0lDh+/ CLaAWYBPYtK26cwQn/FKdLQJQZR4SPx9e4YJ4rEeRokrd3MnMEosYGRYxSieWlqcm55abJyX Wq5XnJhbXJqXrpecn7uJERhZp/8d/7qDcd+fpEOMAhyMSjy8L3ZOjxFiTSwrrsw9xCjBwawk wvtEdEaMEG9KYmVValF+fFFpTmrxIUZpDhYlcd5qhgfRQgLpiSWp2ampBalFMFkmDk6pBsYQ m5Myz5arf7vpc1fqxwbf8+sY5h9KW68mry6oc+fIwieXRItfssmo8gQHRrdzhkpflPNI7ntl PaXsmZKEMKtnQ9WJx+nRohtnivrYV88I9LJym/TEfW81p73Zlsh8ptBPMYbyO+RfPgp3Fy/3 /bwyRaPRxIxddZrO3BUCrmeN7CI11hfzKbEUZyQaajEXFScCAIyXGYqoAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkluLIzCtJLcpLzFFi42I5/e/4Vd0d9TNiDC48VbO4te4cq8XGGetZ La58fc9mMen+BBaL8+c3sFvMOL+PyWLtkbvsDuwem1Z1snnc7z7O5NG3ZRWjx+dNcgEsUVw2 Kak5mWWpRfp2CVwZ8y9fZCpYJVTR1f2YuYFxK38XIweHhICJxMlW8y5GTg4hgSWMEjMv6nYx cgHZjUwSX1csYQdJsAloSvzdfJMNxBYRUJZYta+dHaSIWeA3o8TnGV+ZQRLCAp4SF15tZwWx WQRUJf61nAdr5hWwlPixsBMsLiEgL7F6wwGwek6g+P/Tl5ghNltI7F3WyD6BkWcBI8MqRpHU 0uLc9NxiI73ixNzi0rx0veT83E2MwIDZduznlh2MXe+CDzEKcDAq8fA67JkeI8SaWFZcmXuI UYKDWUmE94nojBgh3pTEyqrUovz4otKc1OJDjNIcLErivOcNKqOEBNITS1KzU1MLUotgskwc nFINjDfllqnO//ryF4Oz2N/qpftENNqfS5jVr77P17938YG9CcqZ0xp77Xo2PboRrpaY9VZo ZUemmtEySXWdxSdnhG3hEn51x0yg3XlPoGaUiPwF9W2/2jp8WNq371m8e/6ZhoPGvWulOnff fTzD7UQb07TDBVItk+emPX3odVD7860GIaf+5au/HlJiKc5INNRiLipOBAAoWtGyFAIAAA== X-CMS-MailID: 20190325071400eucas1p1a6740040c56d51b0a3658ec01c1bb9f6 CMS-TYPE: 201P X-CMS-RootMailID: 20190325071400eucas1p1a6740040c56d51b0a3658ec01c1bb9f6 References: <20190325071349.22600-1-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This bit will indicate the plane is provided by GSCALER. Tests shows that GSCALER does not like to convert from/to too small buffers. Since exact constraints are not provided by documentation rough estimate of 64 pixel has been applied. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 5d06e796dc80..7bdbac639b2b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -75,6 +75,7 @@ to_exynos_plane_state(struct drm_plane_state *state) #define EXYNOS_DRM_PLANE_CAP_TILE (1 << 3) #define EXYNOS_DRM_PLANE_CAP_PIX_BLEND (1 << 4) #define EXYNOS_DRM_PLANE_CAP_WIN_BLEND (1 << 5) +#define EXYNOS_DRM_PLANE_CAP_GSCALER (1 << 6) struct exynos_drm_plane; struct exynos_drm_plane_ops { diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 5f8f56b69369..89168157e1e2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -198,6 +198,11 @@ exynos_drm_plane_check_format(struct exynos_drm_plane_state *state) return 0; } +static bool is_in_range(int val, int min, int max) +{ + return (val >= min) && (val < max); +} + static int exynos_drm_plane_check_size(struct exynos_drm_plane_state *state) { @@ -205,7 +210,7 @@ exynos_drm_plane_check_size(struct exynos_drm_plane_state *state) bool width_ok = false, height_ok = false; if (plane->capabilities & EXYNOS_DRM_PLANE_CAP_SCALE) - return 0; + width_ok = height_ok = true; if (state->src.w == state->crtc.w) width_ok = true; @@ -221,6 +226,13 @@ exynos_drm_plane_check_size(struct exynos_drm_plane_state *state) state->v_ratio == (1 << 15)) height_ok = true; + if (plane->capabilities & EXYNOS_DRM_PLANE_CAP_GSCALER) { + width_ok = is_in_range(state->src.w, 64, 4800) && + is_in_range(state->crtc.w, 64, 4800); + height_ok = is_in_range(state->src.h, 64, 3344) && + is_in_range(state->crtc.h, 64, 3344); + } + if (width_ok && height_ok) return 0;