All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: ville.syrjala@linux.intel.com
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Dave Airlie" <airlied@redhat.com>,
	dri-devel@lists.freedesktop.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH 5/7] drm: Only merge mode type bits between new probed modes
Date: Fri, 4 Dec 2015 09:29:10 +0100	[thread overview]
Message-ID: <20151204082910.GB10243@phenom.ffwll.local> (raw)
In-Reply-To: <1449177255-9515-6-git-send-email-ville.syrjala@linux.intel.com>

On Thu, Dec 03, 2015 at 11:14:13PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently most drivers request that any mode appearing on both the
> old mode list and the new probed_modes list get their type bits ORed
> together if the modes are deemed to otherwise match each other.
> 
> I don't know why anyone would want to merge in the mode type bits
> from any mode left over from a previous probe. For instance, you
> could never get rid of ther preferred bit if a matching non-preferred
> mode is returned by the new probe. So let's not merge anything from
> the stale old modes, and just replace them outright with matching new
> modes.
> 
> If multiple matching modes are produced by the same probe, merging
> the type bits between them would seem like a sensible thing to do.
> For a bit of extra finesse if two modes are considered equal we can
> pick the actual timings from the one marked as preferrred. And if
> multiple preferred modes are produced by the same probe somehow, we
> can just favor the first one added to the probed_modes list.
> 
> You may be asking yourself why we both with the merging at all if
s/both/bother/

> nothing from the old list survives in practice. The only asnwer I have

s/asnwer/answer/

> is "debug output". That is we want to print out a list of pruned modes,
> which is why we still want to look for duplicates with the old modes.

Yup, it's all an elaborate scheme to fill up dmesg ;-)

> There was a previous attempt to get rid of the mode type merging
> entirely, but it caused some kind of regression on Daniels's G33
> machine. Apparently the hardware has since rotted away, so we don't
> have to worry about it anymore. The relevant commits are:
> commit 3fbd6439e463 ("drm: copy mode type in drm_mode_connector_list_update()")
> commit abce1ec9b08a ("Revert "drm: copy mode type in drm_mode_connector_list_update()"")

Slight correction: It's only the sdvo transcoder that rotted, and when I
reported this regression whatever tiny change this causes seems to have
been enough to kill the machine. A few months later it died always. So
really unlucky conincidence that my hw was exactly between dead and alive
when Dave pushed this originally.

> It was then decided in
> commit b87577b7c768 ("drm: try harder to avoid regression when merging mode bits")
> that just qxl virtio are excluded from the merging, while everyone
> else does it. That is not changed, although now even qxl and virtio
> will be subject to the previously mentioned logic to choose which
> actual timings are picked for the new mode.
> 
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Adam Jackson <ajax@redhat.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

With the commit message corrected:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_modes.c | 34 +++++++++++++++++++++++++++-------
>  1 file changed, 27 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 2b94a5c661b0..8c803e3af1da 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1197,13 +1197,33 @@ void drm_mode_connector_list_update(struct drm_connector *connector,
>  				continue;
>  
>  			found_it = true;
> -			/* if equal delete the probed mode */
> -			mode->status = pmode->status;
> -			/* Merge type bits together */
> -			if (merge_type_bits)
> -				mode->type |= pmode->type;
> -			else
> -				mode->type = pmode->type;
> +
> +			/*
> +			 * If the old matching mode is stale (ie. left over
> +			 * from a previous probe) just replace it outright.
> +			 * Otherwise just merge the type bits between all
> +			 * equal probed modes.
> +			 *
> +			 * If two probed modes are considered equal, pick the
> +			 * actual timings from the one that's marked as
> +			 * preferred (in case the match isn't 100%). If
> +			 * multiple or zero preferred modes are present, favor
> +			 * the mode added to the probed_modes list first.
> +			 */
> +			if (mode->status == MODE_STALE) {
> +				drm_mode_copy(mode, pmode);
> +			} else if ((mode->type & DRM_MODE_TYPE_PREFERRED) == 0 &&
> +				   (pmode->type & DRM_MODE_TYPE_PREFERRED) != 0) {
> +				if (merge_type_bits)
> +					pmode->type |= mode->type;
> +				drm_mode_copy(mode, pmode);
> +			} else {
> +				if (merge_type_bits)
> +					mode->type |= pmode->type;
> +				else
> +					mode->type = pmode->type;
> +			}
> +
>  			list_del(&pmode->head);
>  			drm_mode_destroy(connector->dev, pmode);
>  			break;
> -- 
> 2.4.10
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-12-04  8:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 21:14 [PATCH 0/7] drm: Fix mode pruning ville.syrjala
2015-12-03 21:14 ` [PATCH 1/7] drm: Don't overwrite UNVERFIED mode status to OK ville.syrjala
2015-12-04  8:17   ` Daniel Vetter
2015-12-04  8:17     ` Daniel Vetter
2015-12-04 12:23     ` Ville Syrjälä
2015-12-04 12:23       ` Ville Syrjälä
2015-12-10 21:07     ` Ville Syrjälä
2015-12-10 21:07       ` Ville Syrjälä
2015-12-03 21:14 ` [PATCH 2/7] drm: Rename MODE_UNVERIFIED to MODE_STALE ville.syrjala
2015-12-04  8:18   ` Daniel Vetter
2015-12-10 20:39   ` [PATCH v2 " ville.syrjala
2015-12-03 21:14 ` [PATCH 3/7] drm: Reindent enum drm_mode_status ville.syrjala
2015-12-04  8:18   ` Daniel Vetter
2015-12-04  9:15     ` Ville Syrjälä
2015-12-03 21:14 ` [PATCH 4/7] drm: Flatten drm_mode_connector_list_update() a bit ville.syrjala
2015-12-04  8:19   ` Daniel Vetter
2015-12-03 21:14 ` [PATCH 5/7] drm: Only merge mode type bits between new probed modes ville.syrjala
2015-12-04  8:29   ` Daniel Vetter [this message]
2015-12-04 13:13   ` [PATCH v2 " ville.syrjala
2015-12-03 21:14 ` [PATCH 6/7] drm: Drop drm_helper_probe_single_connector_modes_nomerge() ville.syrjala
2015-12-04  8:30   ` Daniel Vetter
2015-12-03 21:14 ` [PATCH 7/7] drm/sti: Drop bogus drm_mode_sort() call ville.syrjala
2015-12-04  8:31   ` Daniel Vetter
2015-12-11  8:34 ` [PATCH 0/7] drm: Fix mode pruning Daniel Vetter

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=20151204082910.GB10243@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=ville.syrjala@linux.intel.com \
    /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.