Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp944525pxb; Wed, 1 Sep 2021 13:21:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMIYEKLYgx149js0a/FGrKaTOg3llDm87wNuYd0dEGGR6ucPCv+oACafx7Cfk2dm8wc/t4 X-Received: by 2002:a92:cda4:: with SMTP id g4mr949321ild.236.1630527668863; Wed, 01 Sep 2021 13:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630527668; cv=none; d=google.com; s=arc-20160816; b=UhC9eUp1e1j3Ljp4v5Hon2EanCJEbM/ybn3CdT8Fmlsa+eC4xLRAnMzJBRVEx9MtZm xUwTwQqakVf63b7u0ggnDlVZugZdGljAs6yh7vQytHW4W2GSWQ0v8bI+2wj9Cxt2/QAO 9FN4ofsHIP5/ZS1rsD10vcY+p0vxneDkv3OOcNOnYGdNaKmHCugyEoo++orbzJgnsvTP M7vu5NRo1aqKhY1NJDuQ5J8AAtpxyBjNY32I41VYJy+hqatZfMFyD9AuU3hQbu7YYUXp fFtrujWnSLisOAmzmd++fnz3gAUoi5wEasAnaGRaeMhCRFaeU1UDIcxyejRiY3ThAiFj brzg== 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=2jcfUYpHoEl7JKJs+yS3w+IvgHH4p6pPJVkDNxk1v/0=; b=yk0Pfyl+3Km4KPlNqjM95qq+HLgtMzMmYgmoF/BYzIf7eopCPAPeME8i/KOhhBn3qL DDyKM78+tx+LayyDPwNtwAe6OUeQli1vuOI8b35Jn6h+FHJdD0jKV5mYnFFiBlh7hA+t imK69s7vh03wm27pJ2K9G/CdmI3hCEgXE9V3imNX05cnTXi7o66UQGbe+nme/sl3sVbv /YE+p3iPKscTLYwAhZXiwLwOJGmpNS7kx315+QJPlyuakWjpZFRGglpShEwub/OQzwDz Xx8yL8jfst5b21cSjsAI0HRPc0R+eQlcRthtT166GUG03pueRVwgUSemfMRvBHFyKxkc /dEw== 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 u13si462142jak.109.2021.09.01.13.20.57; Wed, 01 Sep 2021 13:21:08 -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 S1344618AbhIAR4I (ORCPT + 99 others); Wed, 1 Sep 2021 13:56:08 -0400 Received: from rosenzweig.io ([138.197.143.207]:45200 "EHLO rosenzweig.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344606AbhIAR4H (ORCPT ); Wed, 1 Sep 2021 13:56:07 -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-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 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-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; -- 2.30.2