From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 6CA65C35656 for ; Fri, 21 Feb 2020 16:04:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 47C00222C4 for ; Fri, 21 Feb 2020 16:04:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47C00222C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B491E6F4B9; Fri, 21 Feb 2020 16:04:37 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id B524F6F4BC; Fri, 21 Feb 2020 16:04:36 +0000 (UTC) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2020 08:04:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,468,1574150400"; d="scan'208";a="270030725" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by fmsmga002.fm.intel.com with SMTP; 21 Feb 2020 08:04:26 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 21 Feb 2020 18:04:25 +0200 Date: Fri, 21 Feb 2020 18:04:25 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Emil Velikov Subject: Re: [Intel-gfx] [PATCH 01/12] drm: Nuke mode->hsync Message-ID: <20200221160425.GR13686@intel.com> References: <20200219203544.31013-1-ville.syrjala@linux.intel.com> <20200219203544.31013-2-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Hint: comment User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel Graphics Development , ML dri-devel Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, Feb 20, 2020 at 10:55:18AM +0000, Emil Velikov wrote: > On Wed, 19 Feb 2020 at 20:35, Ville Syrjala > wrote: > > > > From: Ville Syrj=E4l=E4 > > > > Let's just calculate the hsync rate on demand. No point in wasting > > space storing it and risking the cached value getting out of sync > > with reality. > > > > Signed-off-by: Ville Syrj=E4l=E4 > > --- > > drivers/gpu/drm/drm_modes.c | 14 ++------------ > > drivers/gpu/drm/i915/display/intel_display.c | 1 - > > include/drm/drm_modes.h | 10 ---------- > > 3 files changed, 2 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c > > index d4d64518e11b..fe7e872a6239 100644 > > --- a/drivers/gpu/drm/drm_modes.c > > +++ b/drivers/gpu/drm/drm_modes.c > > @@ -752,24 +752,14 @@ EXPORT_SYMBOL(drm_mode_set_name); > > * @mode: mode > > * > > * Returns: > > - * @modes's hsync rate in kHz, rounded to the nearest integer. Calcula= tes the > > - * value first if it is not yet set. > > + * @modes's hsync rate in kHz, rounded to the nearest integer > > */ > > int drm_mode_hsync(const struct drm_display_mode *mode) > > { > > - unsigned int calc_val; > > - > > - if (mode->hsync) > > - return mode->hsync; > > - > > if (mode->htotal <=3D 0) > > return 0; > > > > - calc_val =3D (mode->clock * 1000) / mode->htotal; /* hsync in H= z */ > > - calc_val +=3D 500; /* round to 1= 000Hz */ > > - calc_val /=3D 1000; /* truncate t= o kHz */ > > - > > - return calc_val; > > + return DIV_ROUND_CLOSEST(mode->clock, mode->htotal); > > } > > EXPORT_SYMBOL(drm_mode_hsync); > > > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu= /drm/i915/display/intel_display.c > > index ee7d54ccd3e6..fab914819489 100644 > > --- a/drivers/gpu/drm/i915/display/intel_display.c > > +++ b/drivers/gpu/drm/i915/display/intel_display.c > > @@ -8867,7 +8867,6 @@ void intel_mode_from_pipe_config(struct drm_displ= ay_mode *mode, > > > > mode->clock =3D pipe_config->hw.adjusted_mode.crtc_clock; > > > > - mode->hsync =3D drm_mode_hsync(mode); > = > With this gone, we could make drm_mode_hsync() internal and move it to > drm_foo_internal.h. > Making it obvious that drivers, should be copy/pasting it. Hmm. Looks like drm_edid.c is the only user left actually. Should probably just move it there and make it static. > = > Regardless, the patch is: > Reviewed-by: Emil Velikov > = > -Emil -- = Ville Syrj=E4l=E4 Intel _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel