From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: akash.goel@intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/4] drm/i915: Changed the return type from 'void', so as to return an error
Date: Tue, 29 Apr 2014 16:33:40 +0300 [thread overview]
Message-ID: <20140429133339.GE18465@intel.com> (raw)
In-Reply-To: <1397991168-25045-1-git-send-email-akash.goel@intel.com>
On Sun, Apr 20, 2014 at 04:22:48PM +0530, akash.goel@intel.com wrote:
> From: Akash Goel <akash.goel@intel.com>
>
> 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 <akash.goel@intel.com>
Please reorder the patches so that this patch comes before you add the
manual panel fitting stuff. Otherwise it's hard to evaluate the error
paths in the new code.
> ---
> 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,
> --
> 1.9.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2014-04-29 13:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailto:1394542461-22198-3-git-send-email-akash.goel@intel.com>
2014-03-26 3:49 ` [PATCH v3 2/3] drm/i915: New drm crtc property for varying the Pipe Src size akash.goel
2014-04-20 10:44 ` [PATCH v4 2/4] " akash.goel
2014-04-20 10:52 ` [PATCH 4/4] drm/i915: Changed the return type from 'void', so as to return an error akash.goel
2014-04-29 13:33 ` Ville Syrjälä [this message]
2014-05-04 9:24 ` Akash Goel
2014-04-29 14:06 ` [PATCH v4 2/4] drm/i915: New drm crtc property for varying the Pipe Src size Ville Syrjälä
2014-04-29 14:38 ` Daniel Vetter
2014-05-04 10:21 ` Akash Goel
2014-06-01 6:49 ` Akash Goel
2014-06-17 13:58 ` Ville Syrjälä
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140429133339.GE18465@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=akash.goel@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.