From patchwork Tue Feb 21 02:41:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yao mark X-Patchwork-Id: 9583813 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 32185600C1 for ; Tue, 21 Feb 2017 02:43:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10D0E2891A for ; Tue, 21 Feb 2017 02:43:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 040912891D; Tue, 21 Feb 2017 02:43:31 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B28602891A for ; Tue, 21 Feb 2017 02:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=y/w0VMBHvUUz4OTgFT9xW7GgRqlIs5YEiqZBmyC8weU=; b=NB1 WXAnORXUL4IduMfbqUH+kG+7F6m2JAai0rsRrm6GcLK1LUDo/ZvDwv4YPmQIfQ+WWF1WdM0CCgdIB bGPAQjBFvjFcrpJFy6tfeGs3jLxkHPWWC0qDi3t+q3iIjFdV6DtYmRE0ev84eSIFCAa0QUOnf668U vpEkSyf8/XpQFArtcUKqs5ZgZ+waYJS00HZUh5wTqLoMQuMkuyiDxfuGCys9iFaTPcJVQmSDfGBzN sXrkJi3Z2QsX4KQZjae70BcS3CZdaAgAn3CujJCSUlEV4kmGt7T0WFRYenw89plbg5t6Z1eiRmQsb YKqH44f4okRz40mkC1M7BrRJIhQwBsA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cg0QL-0002Xf-Sp; Tue, 21 Feb 2017 02:43:29 +0000 Received: from regular1.263xmail.com ([211.150.99.134]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cg0PD-0001xm-MC; Tue, 21 Feb 2017 02:42:23 +0000 Received: from mark.yao?rock-chips.com (unknown [192.168.167.97]) by regular1.263xmail.com (Postfix) with ESMTP id 0CED1811F; Tue, 21 Feb 2017 10:41:51 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 5A8B93CF; Tue, 21 Feb 2017 10:41:44 +0800 (CST) X-RL-SENDER: mark.yao@rock-chips.com X-FST-TO: airlied@linux.ie X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: mark.yao@rock-chips.com X-UNIQUE-TAG: <222c7585df6675e08c4a3ff6f154390f> X-ATTACHMENT-NUM: 0 X-SENDER: yzq@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 27577XUDVXB; Tue, 21 Feb 2017 10:41:45 +0800 (CST) From: Mark Yao To: David Airlie , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drm/rockchip: vop: verify display mode with vop max_output Date: Tue, 21 Feb 2017 10:41:24 +0800 Message-Id: <1487644885-22492-1-git-send-email-mark.yao@rock-chips.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170220_184220_203738_A5862BEC X-CRM114-Status: UNSURE ( 8.53 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Yao MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 ++++++ drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 7 +++++++ drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 13 +++++++++++++ 3 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 8dab2af..7ec5d7f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -867,6 +867,12 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, struct drm_display_mode *adjusted_mode) { struct vop *vop = to_vop(crtc); + const struct vop_data *vop_data = vop->data; + + if (mode->hdisplay > vop_data->max_output.width) + return false; + if (mode->vdisplay > vop_data->max_output.height) + return false; adjusted_mode->clock = clk_round_rate(vop->dclk, mode->clock * 1000) / 1000; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h index 5a4faa85..de5a714 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h @@ -135,6 +135,11 @@ struct vop_win_data { enum drm_plane_type type; }; +struct vop_rect { + int width; + int height; +}; + struct vop_data { const struct vop_reg_data *init_table; unsigned int table_size; @@ -142,6 +147,8 @@ struct vop_data { const struct vop_intr *intr; const struct vop_win_data *win; unsigned int win_size; + struct vop_rect max_input; + struct vop_rect max_output; }; /* interrupt define */ diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c index 91fbc7b..f4ffb677 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c @@ -132,6 +132,8 @@ }; static const struct vop_data rk3036_vop = { + .max_input = {1920, 1080}, + .max_output = {1920, 1080}, .init_table = rk3036_vop_init_reg_table, .table_size = ARRAY_SIZE(rk3036_vop_init_reg_table), .ctrl = &rk3036_ctrl_data, @@ -273,6 +275,13 @@ }; static const struct vop_data rk3288_vop = { + .max_input = {4096, 8192}, + /* + * TODO: rk3288 have two vop, big one support 3840x2160, + * little one only support 2560x1600. + * Now force use 3840x2160. + */ + .max_output = {3840, 2160}, .init_table = rk3288_init_reg_table, .table_size = ARRAY_SIZE(rk3288_init_reg_table), .intr = &rk3288_vop_intr, @@ -341,6 +350,8 @@ }; static const struct vop_data rk3399_vop_big = { + .max_input = {4096, 8192}, + .max_output = {4096, 2160}, .init_table = rk3399_init_reg_table, .table_size = ARRAY_SIZE(rk3399_init_reg_table), .intr = &rk3399_vop_intr, @@ -360,6 +371,8 @@ }; static const struct vop_data rk3399_vop_lit = { + .max_input = {4096, 8192}, + .max_output = {2560, 1600}, .init_table = rk3399_init_reg_table, .table_size = ARRAY_SIZE(rk3399_init_reg_table), .intr = &rk3399_vop_intr,