Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp944524pxb; Wed, 1 Sep 2021 13:21:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMi+iHli2dm0pS1j/RE0h0UtHva+A15HiGkV07cGjpBO928GvPF9gFpgRZIy0cKCjg4GvJ X-Received: by 2002:a05:6e02:1bac:: with SMTP id n12mr906528ili.151.1630527668762; 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=NQJx5m2g3foG2sSnoxWuNyk1/f8Z86SNvWav3bfEzoivTAGPS2fo7h26jsvicF3Nj3 cMNRe5IPDUtklssLjNn/Keb4QSbrT/SFfUtvQPtblUUO8eyX7hxL9iBC5l5q9zVBgBRq Wa+EmOJ3+JbYKZSJZzj/wmFrXcuHWGZFjr7MJBtD85AGDs7UgGJb5z9ZLdTejHBYVH8q /NpJMqVHtGllEx3lFnKvfVH0lpB79mkQdUZWe85xEZiG0alZR7wrnydnMBz1uy4za84X 6/23Mp5APKj+dDUe33ZG7nO3KOLP3s8geRqZ4+zshW2gMn0e+zh5nfYTATlAEhRL0FXd yTOQ== 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=kvLN02YRPxxyNMS+I+p0k2y2VkzUPZ/rDNlPQFmqMsE=; b=qP2zL+M1ht2OspbYY/Pd8nb3jNi52wYpgAI0Sl7hLK5dgkTfs7KuelLpvdq47G7mXW S6PSrR8LRTka2BmeFa0LNr7RUFOZ9UwAmGv/3WGYaKQfHlfJD2JP6UExBzuz866P18q7 gqd/1VJUNcTRboTrZh3c3FGYxt02YNj+KsJyw07slYTIwDwWmUP0kVguExTWvZgR2v8z Jog3P8I3vzgCvU3avFntcT+8KZFhmvvrDDJOGhgdaJzL4q76FG9ScK8zuFcSqbVgc30R FFJlE2/ObQtbxrRh6chmBMvVadkAbFaTMsDULdlXz0q0Qo9z94Hx3sbUD9bC+v3NXF1X LZSA== 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 n45si361393jac.76.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 S1344607AbhIARzy (ORCPT + 99 others); Wed, 1 Sep 2021 13:55:54 -0400 Received: from rosenzweig.io ([138.197.143.207]:45154 "EHLO rosenzweig.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236754AbhIARzx (ORCPT ); Wed, 1 Sep 2021 13:55:53 -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-amlogic@lists.infradead.org Subject: [PATCH 2/5] drm/meson: Use common drm_fixed_16_16 helper Date: Wed, 1 Sep 2021 13:54:28 -0400 Message-Id: <20210901175431.14060-2-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-amlogic@lists.infradead.org --- drivers/gpu/drm/meson/meson_overlay.c | 7 +++---- drivers/gpu/drm/meson/meson_plane.c | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c index dfef8afcc245..d8fc6bbb332f 100644 --- a/drivers/gpu/drm/meson/meson_overlay.c +++ b/drivers/gpu/drm/meson/meson_overlay.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "meson_overlay.h" #include "meson_registers.h" @@ -162,8 +163,6 @@ struct meson_overlay { }; #define to_meson_overlay(x) container_of(x, struct meson_overlay, base) -#define FRAC_16_16(mult, div) (((mult) << 16) / (div)) - static int meson_overlay_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state) { @@ -181,8 +180,8 @@ static int meson_overlay_atomic_check(struct drm_plane *plane, return drm_atomic_helper_check_plane_state(new_plane_state, crtc_state, - FRAC_16_16(1, 5), - FRAC_16_16(5, 1), + drm_fixed_16_16(1, 5), + drm_fixed_16_16(5, 1), true, true); } diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c index 8640a8a8a469..4fae9ebbf178 100644 --- a/drivers/gpu/drm/meson/meson_plane.c +++ b/drivers/gpu/drm/meson/meson_plane.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "meson_plane.h" #include "meson_registers.h" @@ -68,8 +69,6 @@ struct meson_plane { }; #define to_meson_plane(x) container_of(x, struct meson_plane, base) -#define FRAC_16_16(mult, div) (((mult) << 16) / (div)) - static int meson_plane_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state) { @@ -92,7 +91,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane, */ return drm_atomic_helper_check_plane_state(new_plane_state, crtc_state, - FRAC_16_16(1, 5), + drm_fixed_16_16(1, 5), DRM_PLANE_HELPER_NO_SCALING, false, true); } -- 2.30.2