From patchwork Fri Sep 29 10:05:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9977415 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 47D7060329 for ; Fri, 29 Sep 2017 10:05:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 427192967C for ; Fri, 29 Sep 2017 10:05:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3794129809; Fri, 29 Sep 2017 10:05:57 +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=-6.9 required=2.0 tests=BAYES_00,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 D5EE42967C for ; Fri, 29 Sep 2017 10:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751805AbdI2KFz (ORCPT ); Fri, 29 Sep 2017 06:05:55 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:42655 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbdI2KFw (ORCPT ); Fri, 29 Sep 2017 06:05:52 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170929100550euoutp02cf80698d01f71c3180d57c74bb473c14~ozRF8Ynpe0286302863euoutp02k; Fri, 29 Sep 2017 10:05:50 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170929100549eucas1p287b5c6728550aef00309ff184508db11~ozRFQk2rX1409714097eucas1p2-; Fri, 29 Sep 2017 10:05:49 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 7B.32.12576.DFA1EC95; Fri, 29 Sep 2017 11:05:49 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170929100548eucas1p26c83f7cf1e82d4cd052e19d4d06cdbfa~ozREoKIEI3082430824eucas1p2R; Fri, 29 Sep 2017 10:05:48 +0000 (GMT) X-AuditID: cbfec7ef-f79ee6d000003120-aa-59ce1afdc151 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A7.27.18832.CFA1EC95; Fri, 29 Sep 2017 11:05:48 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OX100L2HDDLSN30@eusync4.samsung.com>; Fri, 29 Sep 2017 11:05:48 +0100 (BST) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Tobias Jakobi , Daniel Drake Subject: [PATCH v2 07/11] drm/exynos: add mode_fixup callback to exynos_drm_crtc_ops Date: Fri, 29 Sep 2017 12:05:38 +0200 Message-id: <20170929100542.12849-8-a.hajda@samsung.com> X-Mailer: git-send-email 2.14.1 In-reply-to: <20170929100542.12849-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7djP87p/pc5FGiz7KGpxa905VouNM9az Wjya/5jZ4srX92wWk+5PYLGYcX4fk8XaI3fZLdpWf2B14PBY9D3L4373cSaPf8fYPfq2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IMHESA1LAKqEos3n2cCsXkFLCTeH5vBBrFNXuLcg9tgMzkFLCUWT/4CViME VLNo4XrWCYy8CxgZVjGKpJYW56bnFhvqFSfmFpfmpesl5+duYgQG1rZjPzfvYLy0MfgQowAH oxIP7w25s5FCrIllxZW5hxglOJiVRHifcJ6LFOJNSaysSi3Kjy8qzUktPsQozcGiJM7bu2d1 pJBAemJJanZqakFqEUyWiYNTqoFxos6XH/vstlU59nR8vBr58ozblQOVAhcfP1RtSvjsJ/F8 h8Bjv6+nVmfsVygIDw/gUs259/jFzZnT2Bx2xBd/u9vQ+PueyKfKuBaxxL+VIroKFurrhWdX vO+ZITnZ8fRt7RSvKUpRcRxnFNqVTzyTbfRPqlvs4T3tcNMfzVlMAs0tOoe9pkgosRRnJBpq MRcVJwIAk1bpbigCAAA= X-CMS-MailID: 20170929100548eucas1p26c83f7cf1e82d4cd052e19d4d06cdbfa X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-CMS-RootMailID: 20170929100548eucas1p26c83f7cf1e82d4cd052e19d4d06cdbfa X-RootMTR: 20170929100548eucas1p26c83f7cf1e82d4cd052e19d4d06cdbfa References: <20170929100542.12849-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 crtc::mode_fixup callback is required by crtcs which internally use a different mode than requested by user - case of Exynos Mixer. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 15 +++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 6ce0821590df..dc01342e759a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -95,8 +95,23 @@ static enum drm_mode_status exynos_crtc_mode_valid(struct drm_crtc *crtc, return MODE_OK; } +static bool exynos_crtc_mode_fixup(struct drm_crtc *crtc, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); + + if (exynos_crtc->ops->mode_fixup) + return exynos_crtc->ops->mode_fixup(exynos_crtc, mode, + adjusted_mode); + + return true; +} + + static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .mode_valid = exynos_crtc_mode_valid, + .mode_fixup = exynos_crtc_mode_fixup, .atomic_check = exynos_crtc_atomic_check, .atomic_begin = exynos_crtc_atomic_begin, .atomic_flush = exynos_crtc_atomic_flush, diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index cf131c2aa23e..e8bcc7223016 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -136,6 +136,9 @@ struct exynos_drm_crtc_ops { u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc); enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc, const struct drm_display_mode *mode); + bool (*mode_fixup)(struct exynos_drm_crtc *crtc, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode); int (*atomic_check)(struct exynos_drm_crtc *crtc, struct drm_crtc_state *state); void (*atomic_begin)(struct exynos_drm_crtc *crtc);