From patchwork Sun Apr 20 10:52:48 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: 4021021 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 477CE9F319 for ; Sun, 20 Apr 2014 10:50:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4083B2022D for ; Sun, 20 Apr 2014 10:50:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 25BFE201F2 for ; Sun, 20 Apr 2014 10:49:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BF206E185; Sun, 20 Apr 2014 03:49:58 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B5256E185 for ; Sun, 20 Apr 2014 03:49:56 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 20 Apr 2014 03:49:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,891,1389772800"; d="scan'208";a="421235266" Received: from akashgoe-desktop.iind.intel.com ([10.223.82.34]) by azsmga001.ch.intel.com with ESMTP; 20 Apr 2014 03:49:53 -0700 From: akash.goel@intel.com To: intel-gfx@lists.freedesktop.org Date: Sun, 20 Apr 2014 16:22:48 +0530 Message-Id: <1397991168-25045-1-git-send-email-akash.goel@intel.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1397990658-24812-1-git-send-email-akash.goel@intel.com> References: <1397990658-24812-1-git-send-email-akash.goel@intel.com> Cc: Akash Goel Subject: [Intel-gfx] [PATCH 4/4] drm/i915: Changed the return type from 'void', so as to return an error 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.8 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 the 'border' property is being set, if the configuation is not valid. This addresses the review comment from Ville, given on the previous patch. Signed-off-by: Akash Goel --- drivers/gpu/drm/i915/intel_display.c | 5 +++-- drivers/gpu/drm/i915/intel_dp.c | 15 +++++++++------ drivers/gpu/drm/i915/intel_drv.h | 6 +++--- drivers/gpu/drm/i915/intel_lvds.c | 11 ++++++----- drivers/gpu/drm/i915/intel_panel.c | 28 ++++++++++++++++------------ 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 8ff99bf..d7303be 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -10018,9 +10018,10 @@ static int intel_set_mode(struct drm_crtc *crtc, return ret; } -void intel_crtc_restore_mode(struct drm_crtc *crtc) +int intel_crtc_restore_mode(struct drm_crtc *crtc) { - intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->primary->fb); + return intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, + crtc->primary->fb); } #undef for_each_intel_crtc_masked diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index b50b170..ad108e2 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -778,12 +778,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 f00d075..bed4941 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -704,7 +704,7 @@ void intel_mark_busy(struct drm_device *dev); void intel_mark_fb_busy(struct drm_i915_gem_object *obj, struct intel_ring_buffer *ring); void intel_mark_idle(struct drm_device *dev); -void intel_crtc_restore_mode(struct drm_crtc *crtc); +int intel_crtc_restore_mode(struct drm_crtc *crtc); void intel_crtc_update_dpms(struct drm_crtc *crtc); void intel_encoder_destroy(struct drm_encoder *encoder); void intel_connector_dpms(struct drm_connector *, int mode); @@ -888,10 +888,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(struct intel_connector *connector, u32 level, diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 1b1541d..e0ef79d 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -307,12 +307,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 3dbb774..748c98c 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -57,7 +57,7 @@ intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode, drm_mode_set_crtcinfo(adjusted_mode, 0); } -void +bool intel_pch_manual_panel_fitting(struct intel_crtc *intel_crtc, struct intel_crtc_config *pipe_config) { @@ -89,7 +89,7 @@ intel_pch_manual_panel_fitting(struct intel_crtc *intel_crtc, if ((dst_width == 0) || (dst_height == 0)) { DRM_ERROR("Invalid border size input\n"); - return; + return false; } pf_horizontal_ratio = panel_fitter_scaling(src_width, dst_width); @@ -97,10 +97,10 @@ intel_pch_manual_panel_fitting(struct intel_crtc *intel_crtc, if (pf_horizontal_ratio > MAX_DOWNSCALE_RATIO) { DRM_ERROR("width is too small\n"); - return; + return false; } else if (pf_vertical_ratio > MAX_DOWNSCALE_RATIO) { DRM_ERROR("height is too small\n"); - return; + return false; } x = intel_crtc->border[PANEL_BORDER_LEFT]; @@ -109,10 +109,11 @@ intel_pch_manual_panel_fitting(struct intel_crtc *intel_crtc, pipe_config->pch_pfit.pos = (x << 16) | y; pipe_config->pch_pfit.size = (dst_width << 16) | dst_height; pipe_config->pch_pfit.enabled = pipe_config->pch_pfit.size != 0; + return true; } /* 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) @@ -180,13 +181,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 @@ -353,7 +355,7 @@ static void i9xx_scale_aspect(struct intel_crtc_config *pipe_config, } } -void intel_gmch_manual_panel_fitting(struct intel_crtc *intel_crtc, +bool intel_gmch_manual_panel_fitting(struct intel_crtc *intel_crtc, struct intel_crtc_config *pipe_config) { struct drm_device *dev = intel_crtc->base.dev; @@ -385,7 +387,7 @@ void intel_gmch_manual_panel_fitting(struct intel_crtc *intel_crtc, if ((dst_width == 0) || (dst_height == 0)) { DRM_ERROR("Invalid border size input\n"); - return; + return false; } pf_horizontal_ratio = panel_fitter_scaling(src_width, dst_width); @@ -393,10 +395,10 @@ void intel_gmch_manual_panel_fitting(struct intel_crtc *intel_crtc, if (pf_horizontal_ratio > MAX_DOWNSCALE_RATIO) { DRM_ERROR("width is too small\n"); - return; + return false; } else if (pf_vertical_ratio > MAX_DOWNSCALE_RATIO) { DRM_ERROR("height is too small\n"); - return; + return false; } if (dst_width != tot_width) @@ -430,9 +432,10 @@ void intel_gmch_manual_panel_fitting(struct intel_crtc *intel_crtc, pipe_config->gmch_pfit.control = pfit_control; pipe_config->gmch_pfit.lvds_border_bits = border; + return true; } -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) { @@ -490,7 +493,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 */ @@ -512,6 +515,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; } static u32 intel_panel_compute_brightness(struct intel_connector *connector,