Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp836040pxb; Wed, 1 Sep 2021 10:56:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFr97cgIiymipUhZYSlNel8bdWxNq5pRLwYLc+OfRHkG7x2UCDUaAhoxW8LfeJvBYc2CXc X-Received: by 2002:a05:6602:1845:: with SMTP id d5mr652741ioi.23.1630519002358; Wed, 01 Sep 2021 10:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630519002; cv=none; d=google.com; s=arc-20160816; b=H1VLLvMkAZ4zI7RxMLHB1Tt7ChUiNO7ieSUwEqXgxr3ornyVIuInNrudxEw6RqlTXV P9mwUsExreSE5194MhS0P96ZfIwGTq8GIgCXLBWFAQZpk22PSQIOHsw35Ivxya1pH2Qn SYf5fB8m+vCWhC1Qc1vEK1L66V26SghZ/t36QCPdxTWDMw+ha8wAx8iEEDB1yZ6w1XjF ULKd65NZkQ/QAms/SNkM7NhvSMUQd3V3I80HyzyoawYIYU7Qho6EJyimyBuUFSBCgdVF 0bZGweh3UmdUu0WtK3qn23VUaZNRmkwz7fFwR55Dvx8iXFssKwwmmsOYSLjcImdswgQQ 2wDQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=U8AvrUih8rV0sBbybGgfojVo8y24bbSme/7Ecph1H0Q=; b=n6ojTa2/dm21jjWzGdzDes9LUaonUGMzuRV2jAzPvmzqxDJ2NY/FdfT/L61rSGQx6Z 1jfbhDuASFb9vq3z9ju/I5YlCl3KTrtpUGGkRIgY/dzDssJWBXAt/8CPPPgr+50/syTT lXSrf9EWtivHc2bbV0aIe+SvGgDeHbHdYVtyD6GQRRxRmN6ALN6JKudPuYSCJzIU/6E4 GngQPgHj6mbIbBkdAhTDkTeoCYQjqmghKtO8hc8NC35EdtA8jgFGJByOMjjE9hmC1JdK bB1IJpS1oHUpX7j51b4aCZoxKWXdvG7tcxSd7ev3xUZXGHdq9rHQ3WUsecRUpKSM7q++ npVQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h5si106079jaa.119.2021.09.01.10.56.30; Wed, 01 Sep 2021 10:56:42 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344769AbhIAR4R (ORCPT + 99 others); Wed, 1 Sep 2021 13:56:17 -0400 Received: from rosenzweig.io ([138.197.143.207]:45246 "EHLO rosenzweig.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344753AbhIAR4R (ORCPT ); Wed, 1 Sep 2021 13:56:17 -0400 From: Alyssa Rosenzweig To: dri-devel@lists.freedesktop.org Cc: Neil Armstrong , David Airlie , Daniel Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Rob Clark , Sean Paul , Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Abhinav Kumar , Dmitry Baryshkov , Lee Jones , Stephen Boyd , Kalyan Thota , Laurent Pinchart , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alyssa Rosenzweig , linux-rockchip@lists.infradead.org Subject: [PATCH 4/5] drm/rockchip: Use common drm_fixed_16_16 helper Date: Wed, 1 Sep 2021 13:54:30 -0400 Message-Id: <20210901175431.14060-4-alyssa@rosenzweig.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210901175431.14060-1-alyssa@rosenzweig.io> References: <20210901175431.14060-1-alyssa@rosenzweig.io> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace our open-coded FRAC_16_16 with the common drm_fixed_16_16 helper to reduce code duplication between drivers. Signed-off-by: Alyssa Rosenzweig Cc: linux-rockchip@lists.infradead.org --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 9 +++++---- drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index ba9e14da41b4..9428fcba400f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef CONFIG_DRM_ANALOGIX_DP #include @@ -789,9 +790,9 @@ static int vop_plane_atomic_check(struct drm_plane *plane, struct vop_win *vop_win = to_vop_win(plane); const struct vop_win_data *win = vop_win->data; int ret; - int min_scale = win->phy->scl ? FRAC_16_16(1, 8) : + int min_scale = win->phy->scl ? drm_fixed_16_16(1, 8) : DRM_PLANE_HELPER_NO_SCALING; - int max_scale = win->phy->scl ? FRAC_16_16(8, 1) : + int max_scale = win->phy->scl ? drm_fixed_16_16(8, 1) : DRM_PLANE_HELPER_NO_SCALING; if (!crtc || WARN_ON(!fb)) @@ -1037,9 +1038,9 @@ static int vop_plane_atomic_async_check(struct drm_plane *plane, plane); struct vop_win *vop_win = to_vop_win(plane); const struct vop_win_data *win = vop_win->data; - int min_scale = win->phy->scl ? FRAC_16_16(1, 8) : + int min_scale = win->phy->scl ? drm_fixed_16_16(1, 8) : DRM_PLANE_HELPER_NO_SCALING; - int max_scale = win->phy->scl ? FRAC_16_16(8, 1) : + int max_scale = win->phy->scl ? drm_fixed_16_16(8, 1) : DRM_PLANE_HELPER_NO_SCALING; struct drm_crtc_state *crtc_state; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h index 857d97cdc67c..cada12e653cc 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h @@ -335,7 +335,6 @@ enum vop_pol { DEN_NEGATIVE = 2 }; -#define FRAC_16_16(mult, div) (((mult) << 16) / (div)) #define SCL_FT_DEFAULT_FIXPOINT_SHIFT 12 #define SCL_MAX_VSKIPLINES 4 #define MIN_SCL_FT_AFTER_VSKIP 1 -- 2.30.2