From patchwork Wed Sep 1 17:54:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alyssa Rosenzweig X-Patchwork-Id: 12470035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1597FC4320A for ; Wed, 1 Sep 2021 17:57:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D68DC61059 for ; Wed, 1 Sep 2021 17:57:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D68DC61059 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rosenzweig.io Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mlUmuM4vb7N8MB5xaWps5vogN2NjgJ9z7zAgoMGkEGM=; b=qyhgH1dwf8qOXy ttzygAiLxm8NXQbAGms4tRfdd+1TOyKFL/EiTy79FrWPYzj/Mo8TjnpA4lYCkt3o1y3QNCLG15Pf+ XmkvRtExLgnxIybVBRrgQHEARjC02Vy22D1SZG+t8zVhoV1CXZg8cXoLV6nJ/mdpQUJFVNIZ5SKYv KlJZWTnR9WXzX6lcASdohYhrs2JxD0jnnoXuMvgJEgfuD7NAoBGIdQbxzpqmBrLiMowAzlfJRN4cH BcPHdWgYWgcXZgFam3lIqMCeSocN63+/6IX36u+zhwwb/2RIQdaIKI/pU/9Ir3sfQjC/PHXvA9a1D yXS76QsXF9+tnkutVpYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLUSI-006sVh-9I; Wed, 01 Sep 2021 17:55:22 +0000 Received: from rosenzweig.io ([138.197.143.207]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLUS6-006sTD-E1 for linux-arm-kernel@lists.infradead.org; Wed, 01 Sep 2021 17:55:11 +0000 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_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Abhinav Kumar , Dmitry Baryshkov , Lee Jones , Stephen Boyd , Kalyan Thota , Laurent Pinchart , =?utf-8?b?VmlsbGUg?= =?utf-8?b?U3lyasOkbMOk?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alyssa Rosenzweig , linux-arm-msm@vger.kernel.org Subject: [PATCH 3/5] drm/msm: Use common drm_fixed_16_16 helper Date: Wed, 1 Sep 2021 13:54:29 -0400 Message-Id: <20210901175431.14060-3-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210901_105510_574193_4A86841C X-CRM114-Status: GOOD ( 11.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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-arm-msm@vger.kernel.org --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 8 ++++---- drivers/gpu/drm/msm/msm_drv.h | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index c989621209aa..fc9a9f544110 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -964,7 +964,7 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, crtc_state = drm_atomic_get_new_crtc_state(state, new_plane_state->crtc); - min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxupscale); + min_scale = drm_fixed_16_16(1, pdpu->pipe_sblk->maxupscale); ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state, min_scale, pdpu->pipe_sblk->maxdwnscale << 16, diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c index c6b69afcbac8..079b0662ee3c 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -199,8 +199,8 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state, return -ERANGE; } - min_scale = FRAC_16_16(1, 8); - max_scale = FRAC_16_16(8, 1); + min_scale = drm_fixed_16_16(1, 8); + max_scale = drm_fixed_16_16(8, 1); ret = drm_atomic_helper_check_plane_state(state, crtc_state, min_scale, max_scale, @@ -381,8 +381,8 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane, plane->state->fb != new_plane_state->fb) return -EINVAL; - min_scale = FRAC_16_16(1, 8); - max_scale = FRAC_16_16(8, 1); + min_scale = drm_fixed_16_16(1, 8); + max_scale = drm_fixed_16_16(8, 1); ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state, min_scale, max_scale, diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 8b005d1ac899..b5aa94024a42 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -32,6 +32,7 @@ #include #include #include +#include struct msm_kms; struct msm_gpu; @@ -51,8 +52,6 @@ struct msm_disp_state; #define MAX_BRIDGES 8 #define MAX_CONNECTORS 8 -#define FRAC_16_16(mult, div) (((mult) << 16) / (div)) - struct msm_file_private { rwlock_t queuelock; struct list_head submitqueues;