From patchwork Wed Feb 19 20:35:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 11392389 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BD77138D for ; Wed, 19 Feb 2020 20:35:59 +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 8440B208C4 for ; Wed, 19 Feb 2020 20:35:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8440B208C4 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 B4DC26EC9E; Wed, 19 Feb 2020 20:35:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id E94336EC9C; Wed, 19 Feb 2020 20:35:50 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2020 12:35:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,461,1574150400"; d="scan'208";a="229914690" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by fmsmga008.fm.intel.com with SMTP; 19 Feb 2020 12:35:47 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 19 Feb 2020 22:35:47 +0200 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH 01/12] drm: Nuke mode->hsync Date: Wed, 19 Feb 2020 22:35:33 +0200 Message-Id: <20200219203544.31013-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200219203544.31013-1-ville.syrjala@linux.intel.com> References: <20200219203544.31013-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä 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älä Reviewed-by: Emil Velikov --- 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. Calculates 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 <= 0) return 0; - calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */ - calc_val += 500; /* round to 1000Hz */ - calc_val /= 1000; /* truncate to 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_display_mode *mode, mode->clock = pipe_config->hw.adjusted_mode.crtc_clock; - mode->hsync = drm_mode_hsync(mode); mode->vrefresh = drm_mode_vrefresh(mode); drm_mode_set_name(mode); } diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index 99134d4f35eb..7dab7f172431 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h @@ -390,16 +390,6 @@ struct drm_display_mode { */ int vrefresh; - /** - * @hsync: - * - * Horizontal refresh rate, for debug output in human readable form. Not - * used in a functional way. - * - * This value is in kHz. - */ - int hsync; - /** * @picture_aspect_ratio: *