All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm: Preserve the list head in drm_mode_copy
@ 2013-05-31 12:17 ville.syrjala
  2013-05-31 12:17 ` [PATCH 2/3] drm: Add probed modes in probe order ville.syrjala
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: ville.syrjala @ 2013-05-31 12:17 UTC (permalink / raw)
  To: dri-devel

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Preserve the destination mode's list head in drm_mode_copy. Just
in case someone decides that it's a good idea to overwrite a mode which
happens to be on some list,

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_modes.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index a371ff8..ba86316 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -787,16 +787,17 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo);
  * LOCKING:
  * None.
  *
- * Copy an existing mode into another mode, preserving the object id
- * of the destination mode.
+ * Copy an existing mode into another mode, preserving the object id and
+ * list head of the destination mode.
  */
 void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src)
 {
 	int id = dst->base.id;
+	struct list_head head = dst->head;
 
 	*dst = *src;
 	dst->base.id = id;
-	INIT_LIST_HEAD(&dst->head);
+	dst->head = head;
 }
 EXPORT_SYMBOL(drm_mode_copy);
 
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] drm: Add probed modes in probe order
  2013-05-31 12:17 [PATCH 1/3] drm: Preserve the list head in drm_mode_copy ville.syrjala
@ 2013-05-31 12:17 ` ville.syrjala
  2013-06-11  7:15   ` Daniel Vetter
  2013-05-31 12:17 ` [PATCH 3/3] drm: Sort connector modes based on vrefresh ville.syrjala
  2013-05-31 13:00 ` [PATCH 1/3] drm: Preserve the list head in drm_mode_copy Alex Deucher
  2 siblings, 1 reply; 7+ messages in thread
From: ville.syrjala @ 2013-05-31 12:17 UTC (permalink / raw)
  To: dri-devel

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Keeping the modes in the same order as we probe them makes it a bit
easier to track what's happening.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e7e9242..f072ac6 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -657,7 +657,7 @@ EXPORT_SYMBOL(drm_crtc_cleanup);
 void drm_mode_probed_add(struct drm_connector *connector,
 			 struct drm_display_mode *mode)
 {
-	list_add(&mode->head, &connector->probed_modes);
+	list_add_tail(&mode->head, &connector->probed_modes);
 }
 EXPORT_SYMBOL(drm_mode_probed_add);
 
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] drm: Sort connector modes based on vrefresh
  2013-05-31 12:17 [PATCH 1/3] drm: Preserve the list head in drm_mode_copy ville.syrjala
  2013-05-31 12:17 ` [PATCH 2/3] drm: Add probed modes in probe order ville.syrjala
@ 2013-05-31 12:17 ` ville.syrjala
  2013-05-31 13:00 ` [PATCH 1/3] drm: Preserve the list head in drm_mode_copy Alex Deucher
  2 siblings, 0 replies; 7+ messages in thread
From: ville.syrjala @ 2013-05-31 12:17 UTC (permalink / raw)
  To: dri-devel

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Keeping the modes sorted by vrefresh before the pixel clock makes the
mode list somehow more pleasing to the eye.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
This is quite a subjective thing, so if no one else wants it, I'm fine
with dropping it. More of an RFC really...

 drivers/gpu/drm/drm_crtc_helper.c | 5 +++--
 drivers/gpu/drm/drm_modes.c       | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index ed1334e..f554516 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -189,13 +189,14 @@ prune:
 	if (list_empty(&connector->modes))
 		return 0;
 
+	list_for_each_entry(mode, &connector->modes, head)
+		mode->vrefresh = drm_mode_vrefresh(mode);
+
 	drm_mode_sort(&connector->modes);
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
 			drm_get_connector_name(connector));
 	list_for_each_entry(mode, &connector->modes, head) {
-		mode->vrefresh = drm_mode_vrefresh(mode);
-
 		drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 		drm_mode_debug_printmodeline(mode);
 	}
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index ba86316..4370fd4 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1018,6 +1018,11 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head
 	diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay;
 	if (diff)
 		return diff;
+
+	diff = b->vrefresh - a->vrefresh;
+	if (diff)
+		return diff;
+
 	diff = b->clock - a->clock;
 	return diff;
 }
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] drm: Preserve the list head in drm_mode_copy
  2013-05-31 12:17 [PATCH 1/3] drm: Preserve the list head in drm_mode_copy ville.syrjala
  2013-05-31 12:17 ` [PATCH 2/3] drm: Add probed modes in probe order ville.syrjala
  2013-05-31 12:17 ` [PATCH 3/3] drm: Sort connector modes based on vrefresh ville.syrjala
@ 2013-05-31 13:00 ` Alex Deucher
  2 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2013-05-31 13:00 UTC (permalink / raw)
  To: ville.syrjala; +Cc: dri-devel

On Fri, May 31, 2013 at 8:17 AM,  <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Preserve the destination mode's list head in drm_mode_copy. Just
> in case someone decides that it's a good idea to overwrite a mode which
> happens to be on some list,
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

For the series:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/drm_modes.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index a371ff8..ba86316 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -787,16 +787,17 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo);
>   * LOCKING:
>   * None.
>   *
> - * Copy an existing mode into another mode, preserving the object id
> - * of the destination mode.
> + * Copy an existing mode into another mode, preserving the object id and
> + * list head of the destination mode.
>   */
>  void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src)
>  {
>         int id = dst->base.id;
> +       struct list_head head = dst->head;
>
>         *dst = *src;
>         dst->base.id = id;
> -       INIT_LIST_HEAD(&dst->head);
> +       dst->head = head;
>  }
>  EXPORT_SYMBOL(drm_mode_copy);
>
> --
> 1.8.1.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] drm: Add probed modes in probe order
  2013-05-31 12:17 ` [PATCH 2/3] drm: Add probed modes in probe order ville.syrjala
@ 2013-06-11  7:15   ` Daniel Vetter
  2013-06-11  7:48     ` Chris Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2013-06-11  7:15 UTC (permalink / raw)
  To: Syrjala, Ville, Chris Wilson, Dave Airlie; +Cc: dri-devel

On Fri, May 31, 2013 at 2:17 PM,  <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Keeping the modes in the same order as we probe them makes it a bit
> easier to track what's happening.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I've just added a regression fixer to my -fixes queue which depends
upon the old behaviour ... I'll make a note to fix this once stuff is
merged together again. For reference the patch this will break in
-fixes is:

commit c3456fb3e4712d0448592af3c5d644c9472cd3c1
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Jun 10 09:47:58 2013 +0200

    drm/i915: prefer VBT modes for SVDO-LVDS over EDID

Cheers, Daniel

> ---
>  drivers/gpu/drm/drm_crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index e7e9242..f072ac6 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -657,7 +657,7 @@ EXPORT_SYMBOL(drm_crtc_cleanup);
>  void drm_mode_probed_add(struct drm_connector *connector,
>                          struct drm_display_mode *mode)
>  {
> -       list_add(&mode->head, &connector->probed_modes);
> +       list_add_tail(&mode->head, &connector->probed_modes);
>  }
>  EXPORT_SYMBOL(drm_mode_probed_add);
>
> --
> 1.8.1.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel



--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] drm: Add probed modes in probe order
  2013-06-11  7:15   ` Daniel Vetter
@ 2013-06-11  7:48     ` Chris Wilson
  2013-06-11  8:34       ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2013-06-11  7:48 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Dave Airlie, dri-devel

On Tue, Jun 11, 2013 at 09:15:29AM +0200, Daniel Vetter wrote:
> On Fri, May 31, 2013 at 2:17 PM,  <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Keeping the modes in the same order as we probe them makes it a bit
> > easier to track what's happening.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> I've just added a regression fixer to my -fixes queue which depends
> upon the old behaviour ... I'll make a note to fix this once stuff is
> merged together again. For reference the patch this will break in
> -fixes is:
> 
> commit c3456fb3e4712d0448592af3c5d644c9472cd3c1
> Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> Date:   Mon Jun 10 09:47:58 2013 +0200
> 
>     drm/i915: prefer VBT modes for SVDO-LVDS over EDID

That is not the only place to have a subtle dependence upon the ordering
of modes in the list.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] drm: Add probed modes in probe order
  2013-06-11  7:48     ` Chris Wilson
@ 2013-06-11  8:34       ` Daniel Vetter
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2013-06-11  8:34 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, Syrjala, Ville, Dave Airlie, dri-devel

On Tue, Jun 11, 2013 at 08:48:48AM +0100, Chris Wilson wrote:
> On Tue, Jun 11, 2013 at 09:15:29AM +0200, Daniel Vetter wrote:
> > On Fri, May 31, 2013 at 2:17 PM,  <ville.syrjala@linux.intel.com> wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > >
> > > Keeping the modes in the same order as we probe them makes it a bit
> > > easier to track what's happening.
> > >
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > I've just added a regression fixer to my -fixes queue which depends
> > upon the old behaviour ... I'll make a note to fix this once stuff is
> > merged together again. For reference the patch this will break in
> > -fixes is:
> > 
> > commit c3456fb3e4712d0448592af3c5d644c9472cd3c1
> > Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Date:   Mon Jun 10 09:47:58 2013 +0200
> > 
> >     drm/i915: prefer VBT modes for SVDO-LVDS over EDID
> 
> That is not the only place to have a subtle dependence upon the ordering
> of modes in the list.

I've now included latest drm-next into drm-intel-nightly. I guess we'll
find out soon ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-11  8:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-31 12:17 [PATCH 1/3] drm: Preserve the list head in drm_mode_copy ville.syrjala
2013-05-31 12:17 ` [PATCH 2/3] drm: Add probed modes in probe order ville.syrjala
2013-06-11  7:15   ` Daniel Vetter
2013-06-11  7:48     ` Chris Wilson
2013-06-11  8:34       ` Daniel Vetter
2013-05-31 12:17 ` [PATCH 3/3] drm: Sort connector modes based on vrefresh ville.syrjala
2013-05-31 13:00 ` [PATCH 1/3] drm: Preserve the list head in drm_mode_copy Alex Deucher

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.