From patchwork Thu Aug 14 09:24:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: akash.goel@intel.com X-Patchwork-Id: 4723221 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A6B169F375 for ; Thu, 14 Aug 2014 09:20:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9802200FF for ; Thu, 14 Aug 2014 09:20:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AFB12201DD for ; Thu, 14 Aug 2014 09:20:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 192536E642; Thu, 14 Aug 2014 02:20:04 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 2EF046E642 for ; Thu, 14 Aug 2014 02:20:03 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 14 Aug 2014 02:12:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="372277493" Received: from akashgoe-desktop.iind.intel.com ([10.223.82.144]) by FMSMGA003.fm.intel.com with ESMTP; 14 Aug 2014 02:16:37 -0700 From: akash.goel@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 14 Aug 2014 14:54:22 +0530 Message-Id: <1408008267-11443-2-git-send-email-akash.goel@intel.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1408008267-11443-1-git-send-email-akash.goel@intel.com> References: <1408008267-11443-1-git-send-email-akash.goel@intel.com> Cc: shobhit.kumar@intel.com, Akash Goel Subject: [Intel-gfx] [PATCH 1/6] drm/i915: Added a return type for panel fitter config functions X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Akash Goel This patch changes the return type of panel fitter configuration functions from 'void', so that an error could be returned back to User space, either during the modeset time or when some property is being set, if the configuation is not valid. Signed-off-by: Akash Goel Signed-off-by: Pallavi G --- drivers/gpu/drm/i915/intel_dp.c | 15 +++++++++------ drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/i915/intel_lvds.c | 11 ++++++----- drivers/gpu/drm/i915/intel_panel.c | 10 ++++++---- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index e5ada4f..3273b77 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -859,12 +859,15 @@ intel_dp_compute_config(struct intel_encoder *encoder, if (is_edp(intel_dp) && intel_connector->panel.fixed_mode) { intel_fixed_panel_mode(intel_connector->panel.fixed_mode, adjusted_mode); - if (!HAS_PCH_SPLIT(dev)) - intel_gmch_panel_fitting(intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); - else - intel_pch_panel_fitting(intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); + if (!HAS_PCH_SPLIT(dev)) { + if (!intel_gmch_panel_fitting(intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) + return false; + } else { + if (!intel_pch_panel_fitting(intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) + return false; + } } if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 3abc915..d1b5ded 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1016,10 +1016,10 @@ int intel_panel_init(struct intel_panel *panel, void intel_panel_fini(struct intel_panel *panel); void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode, struct drm_display_mode *adjusted_mode); -void intel_pch_panel_fitting(struct intel_crtc *crtc, +bool intel_pch_panel_fitting(struct intel_crtc *crtc, struct intel_crtc_config *pipe_config, int fitting_mode); -void intel_gmch_panel_fitting(struct intel_crtc *crtc, +bool intel_gmch_panel_fitting(struct intel_crtc *crtc, struct intel_crtc_config *pipe_config, int fitting_mode); void intel_panel_set_backlight_acpi(struct intel_connector *connector, diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 1987491..2a53768 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -317,12 +317,13 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder, if (HAS_PCH_SPLIT(dev)) { pipe_config->has_pch_encoder = true; - intel_pch_panel_fitting(intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); + if (!intel_pch_panel_fitting(intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) + return false; } else { - intel_gmch_panel_fitting(intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); - + if (!intel_gmch_panel_fitting(intel_crtc, pipe_config, + intel_connector->panel.fitting_mode)) + return false; } /* diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 59b028f..15f2979 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -96,7 +96,7 @@ intel_find_panel_downclock(struct drm_device *dev, } /* adjusted_mode has been preset to be the panel's fixed mode */ -void +bool intel_pch_panel_fitting(struct intel_crtc *intel_crtc, struct intel_crtc_config *pipe_config, int fitting_mode) @@ -158,13 +158,14 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc, default: WARN(1, "bad panel fit mode: %d\n", fitting_mode); - return; + return false; } done: pipe_config->pch_pfit.pos = (x << 16) | y; pipe_config->pch_pfit.size = (width << 16) | height; pipe_config->pch_pfit.enabled = pipe_config->pch_pfit.size != 0; + return true; } static void @@ -300,7 +301,7 @@ static void i9xx_scale_aspect(struct intel_crtc_config *pipe_config, } } -void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, +bool intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, struct intel_crtc_config *pipe_config, int fitting_mode) { @@ -352,7 +353,7 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, break; default: WARN(1, "bad panel fit mode: %d\n", fitting_mode); - return; + return false; } /* 965+ wants fuzzy fitting */ @@ -374,6 +375,7 @@ out: pipe_config->gmch_pfit.control = pfit_control; pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios; pipe_config->gmch_pfit.lvds_border_bits = border; + return true; } enum drm_connector_status