From: Chris Wilson <chris@chris-wilson.co.uk> To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/2] drm/i915: Simplify return value from intel_get_load_detect_pipe Date: Wed, 20 Apr 2011 19:26:06 +0100 Message-ID: <1303323967-22541-1-git-send-email-chris@chris-wilson.co.uk> (raw) In-Reply-To: <yunwriolrpa.fsf@aiko.keithp.com> ... and so remove the confusion as to whether to use the returned crtc or intel_encoder->base.crtc with the subsequent load-detection. Even though they were the same, the two instances of load-detection code disagreed over which was the more correct. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/intel_crt.c | 17 +++++++---------- drivers/gpu/drm/i915/intel_display.c | 16 +++++++++------- drivers/gpu/drm/i915/intel_drv.h | 8 ++++---- drivers/gpu/drm/i915/intel_tv.c | 6 ++---- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index d03fc05..2eb60cd 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c @@ -305,13 +305,11 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) } static enum drm_connector_status -intel_crt_load_detect(struct drm_crtc *crtc, struct intel_crt *crt) +intel_crt_load_detect(struct intel_crt *crt) { - struct drm_encoder *encoder = &crt->base.base; - struct drm_device *dev = encoder->dev; + struct drm_device *dev = crt->base.base.dev; struct drm_i915_private *dev_priv = dev->dev_private; - struct intel_crtc *intel_crtc = to_intel_crtc(crtc); - uint32_t pipe = intel_crtc->pipe; + uint32_t pipe = to_intel_crtc(crt->base.base.crtc)->pipe; uint32_t save_bclrpat; uint32_t save_vtotal; uint32_t vtotal, vactive; @@ -454,15 +452,14 @@ intel_crt_detect(struct drm_connector *connector, bool force) /* for pre-945g platforms use load detect */ crtc = crt->base.base.crtc; if (crtc && crtc->enabled) { - status = intel_crt_load_detect(crtc, crt); + status = intel_crt_load_detect(crt); } else { - crtc = intel_get_load_detect_pipe(&crt->base, connector, - NULL, &dpms_mode); - if (crtc) { + if (intel_get_load_detect_pipe(&crt->base, connector, + NULL, &dpms_mode)) { if (intel_crt_detect_ddc(connector)) status = connector_status_connected; else - status = intel_crt_load_detect(crtc, crt); + status = intel_crt_load_detect(crt); intel_release_load_detect_pipe(&crt->base, connector, dpms_mode); } else diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e6df160..a0df09b 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -5539,10 +5539,10 @@ static struct drm_display_mode load_detect_mode = { 704, 832, 0, 480, 489, 491, 520, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC), }; -struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, - struct drm_connector *connector, - struct drm_display_mode *mode, - int *dpms_mode) +bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, + struct drm_connector *connector, + struct drm_display_mode *mode, + int *dpms_mode) { struct intel_crtc *intel_crtc; struct drm_crtc *possible_crtc; @@ -5575,7 +5575,7 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON); encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON); } - return crtc; + return true; } /* Find an unused one (if possible) */ @@ -5595,7 +5595,8 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, * If we didn't find an unused CRTC, don't use any. */ if (!crtc) { - return NULL; + DRM_DEBUG_KMS("no pipe available for load-detect\n"); + return false; } encoder->crtc = crtc; @@ -5619,10 +5620,11 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, encoder_funcs->mode_set(encoder, &crtc->mode, &crtc->mode); encoder_funcs->commit(encoder); } + /* let the connector get through one full cycle before testing */ intel_wait_for_vblank(dev, intel_crtc->pipe); - return crtc; + return true; } void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder, diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index aeb1b98..7ea4bab 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -298,10 +298,10 @@ static inline void intel_wait_for_crtc_vblank_safe(struct drm_crtc *crtc) msleep(50); } extern void intel_wait_for_pipe_off(struct drm_device *dev, int pipe); -extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, - struct drm_connector *connector, - struct drm_display_mode *mode, - int *dpms_mode); +extern bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, + struct drm_connector *connector, + struct drm_display_mode *mode, + int *dpms_mode); extern void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder, struct drm_connector *connector, int dpms_mode); diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 3047a66..1174f77 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c @@ -1370,12 +1370,10 @@ intel_tv_detect(struct drm_connector *connector, bool force) if (intel_tv->base.base.crtc && intel_tv->base.base.crtc->enabled) { type = intel_tv_detect_type(intel_tv, connector); } else if (force) { - struct drm_crtc *crtc; int dpms_mode; - crtc = intel_get_load_detect_pipe(&intel_tv->base, connector, - &mode, &dpms_mode); - if (crtc) { + if (intel_get_load_detect_pipe(&intel_tv->base, connector, + &mode, &dpms_mode)) { type = intel_tv_detect_type(intel_tv, connector); intel_release_load_detect_pipe(&intel_tv->base, connector, dpms_mode); -- 1.7.4.1
next prev parent reply index Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-04-20 9:22 Remove dead code " Chris Wilson 2011-04-20 9:22 ` [PATCH 1/6] drm/i915: Simplify return value " Chris Wilson 2011-04-20 18:10 ` Keith Packard 2011-04-20 18:26 ` Chris Wilson [this message] 2011-04-20 18:26 ` [PATCH 2/2] drm/i915: Propagate failure to set mode for load-detect pipe Chris Wilson 2011-04-20 9:22 ` [PATCH 2/6] drm/i915: Don't store temporary load-detect variables in the generic encoder Chris Wilson 2011-04-20 18:12 ` Keith Packard 2011-04-20 9:22 ` [PATCH 3/6] drm/i915: Remove unused supported_crtc from intel_load_detect_pipe Chris Wilson 2011-04-20 18:12 ` Keith Packard 2011-04-20 9:22 ` [PATCH 4/6] drm/i915: Pass the saved adjusted_mode when adding to the load-detect crtc Chris Wilson 2011-04-20 18:23 ` Keith Packard 2011-04-20 19:38 ` Chris Wilson 2011-04-20 21:00 ` Keith Packard 2011-04-20 9:22 ` [PATCH 5/6] drm/i915: Remove dead code from intel_get_load_detect_pipe() Chris Wilson 2011-04-20 18:26 ` Keith Packard 2011-04-20 9:22 ` [PATCH 6/6] drm/i915: Attach a fb to the load-detect pipe Chris Wilson 2011-04-20 18:43 ` Keith Packard 2011-04-20 18:55 ` Chris Wilson 2011-04-20 21:03 ` Keith Packard 2011-04-20 21:43 ` [PATCH] " Chris Wilson 2011-04-21 8:45 ` When in doubt, use a temporary fb Chris Wilson 2011-04-21 8:45 ` [PATCH 1/3] drm/i915: Remove dead code from intel_release_load_detect_pipe() Chris Wilson 2011-04-21 8:45 ` [PATCH 2/3] drm/i915: Attach a fb to the load-detect pipe Chris Wilson 2011-04-21 8:45 ` [PATCH 3/3] drm/i915: Move the tracking of dpms_mode down into crtc enable/disable Chris Wilson 2011-04-20 20:16 ` [PATCH] drm/i915: Attach a fb to the load-detect pipe Chris Wilson
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=1303323967-22541-1-git-send-email-chris@chris-wilson.co.uk \ --to=chris@chris-wilson.co.uk \ --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
Intel-GFX Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/intel-gfx/0 intel-gfx/git/0.git git clone --mirror https://lore.kernel.org/intel-gfx/1 intel-gfx/git/1.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 intel-gfx intel-gfx/ https://lore.kernel.org/intel-gfx \ intel-gfx@lists.freedesktop.org public-inbox-index intel-gfx Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.freedesktop.lists.intel-gfx AGPL code for this site: git clone https://public-inbox.org/public-inbox.git