Skip to contentSkip to conversation

drm: clarify adjusted_mode for a bridge connected to a crtc

PATCH In review Philippe Cornu 3 participants 8 messages Feb 26, 2018 – Apr 9, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: clarify adjusted_mode for a bridge connected to a crtc

This patch clarifies the adjusted_mode documentation for a bridge directly connected to a crtc.

---
This patch is linked to the discussion https://lkml.org/lkml/2018/1/25/367

 include/drm/drm_bridge.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +2 -1
index 3270fec46979..b5f3c070467c 100644
@@ -177,7 +177,8 @@ struct drm_bridge_funcs {
 	 * pipeline has been called already. If the bridge is the first element
 	 * then this would be &drm_encoder_helper_funcs.mode_set. The display
 	 * pipe (i.e.  clocks and timing signals) is off when this function is
-	 * called.
+	 * called. If the bridge is connected to the crtc, the adjusted_mode
+	 * parameter is the one defined in &drm_crtc_state.adjusted_mode.
 	 */
 	void (*mode_set)(struct drm_bridge *bridge,
 			 struct drm_display_mode *mode,
Signature · 6 lines
2.15.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Philippe Cornu

This patch clarifies the adjusted_mode documentation for a bridge directly connected to a crtc.

---
This patch is linked to the discussion https://lkml.org/lkml/2018/1/25/367

Aside, and kinda why I noticed this patch to begin with: You have drm-misc commit rights, but you seem to not use that. And with 18 patches in the 4.17 cycle you're the top contributor who's not pushing his own patches.

What's the hold-up? Tools don't work, or something else? I really think regular contributors should just push their own stuff themselves (after appropriate review ofc).
-Daniel

Quoted 25 lines
 include/drm/drm_bridge.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +2 -1
index 3270fec46979..b5f3c070467c 100644
@@ -177,7 +177,8 @@ struct drm_bridge_funcs {
 	 * pipeline has been called already. If the bridge is the first element
 	 * then this would be &drm_encoder_helper_funcs.mode_set. The display
 	 * pipe (i.e.  clocks and timing signals) is off when this function is
-	 * called.
+	 * called. If the bridge is connected to the crtc, the adjusted_mode
+	 * parameter is the one defined in &drm_crtc_state.adjusted_mode.
 	 */
 	void (*mode_set)(struct drm_bridge *bridge,
 			 struct drm_display_mode *mode,
Signature · 6 lines
2.15.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#2 lore raw

Hi Daniel,

Quoted 9 lines · Daniel Vetter
Quoted 6 lines · Philippe Cornu

This patch clarifies the adjusted_mode documentation for a bridge directly connected to a crtc.

---
This patch is linked to the discussion https://lkml.org/lkml/2018/1/25/367

Many thanks for the review.

Quoted 10 lines

Aside, and kinda why I noticed this patch to begin with: You have drm-misc commit rights, but you seem to not use that. And with 18 patches in the 4.17 cycle you're the top contributor who's not pushing his own patches.

What's the hold-up? Tools don't work, or something else? I really think regular contributors should just push their own stuff themselves (after appropriate review ofc).
-Daniel

I still consider myself a drm “beginner”, my first patch in drm was last summer so less than 1 year ago.
However, thank you for your encouraging return, I will immediately study the matter (dim...) and prepare myself.

Thank you,
Philippe :-)

Quoted 21 lines
Quoted 21 lines
  include/drm/drm_bridge.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +2 -1
index 3270fec46979..b5f3c070467c 100644
@@ -177,7 +177,8 @@ struct drm_bridge_funcs {
  	 * pipeline has been called already. If the bridge is the first element
  	 * then this would be &drm_encoder_helper_funcs.mode_set. The display
  	 * pipe (i.e.  clocks and timing signals) is off when this function is
-	 * called.
+	 * called. If the bridge is connected to the crtc, the adjusted_mode
+	 * parameter is the one defined in &drm_crtc_state.adjusted_mode.
  	 */
  	void (*mode_set)(struct drm_bridge *bridge,
  			 struct drm_display_mode *mode,
Signature · 1 line
2.15.1
Quoted 5 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 20 lines · Philippe CORNU

Hi Daniel,

Quoted 9 lines · Daniel Vetter
Quoted 6 lines · Philippe Cornu

This patch clarifies the adjusted_mode documentation for a bridge directly connected to a crtc.

---
This patch is linked to the discussion https://lkml.org/lkml/2018/1/25/367

Many thanks for the review.

Quoted 5 lines

Aside, and kinda why I noticed this patch to begin with: You have drm-misc commit rights, but you seem to not use that. And with 18 patches in the 4.17 cycle you're the top contributor who's not pushing his own patches.

Quoted 8 lines
Quoted 5 lines

What's the hold-up? Tools don't work, or something else? I really think regular contributors should just push their own stuff themselves (after appropriate review ofc).
-Daniel

I still consider myself a drm “beginner”, my first patch in drm was last summer so less than 1 year ago.

You're doing great patches, and at least for drm-misc you're the top contributor who doesn't push stuff himself. You're definitely ready to do so!

Quoted 2 lines

However, thank you for your encouraging return, I will immediately study the matter (dim...) and prepare myself.

Yes please. And for any questions please ask on #dri-devel on freenode, we're all happy to help out.
-Daniel

Quoted 34 lines

Thank you,
Philippe :-)

Quoted 21 lines
Quoted 21 lines
  include/drm/drm_bridge.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +2 -2
index 3270fec46979..b5f3c070467c 100644
@@ -177,7 +177,8 @@ struct drm_bridge_funcs {
      * pipeline has been called already. If the bridge is the first element
      * then this would be &drm_encoder_helper_funcs.mode_set. The display
      * pipe (i.e.  clocks and timing signals) is off when this function is
-     * called.
+     * called. If the bridge is connected to the crtc, the adjusted_mode
+     * parameter is the one defined in &drm_crtc_state.adjusted_mode.
      */
     void (*mode_set)(struct drm_bridge *bridge,
                      struct drm_display_mode *mode,
--

2.15.1

Quoted 5 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 34 lines · Daniel Vetter
Quoted 20 lines · Philippe CORNU

Hi Daniel,

Quoted 9 lines · Daniel Vetter
Quoted 6 lines · Philippe Cornu

This patch clarifies the adjusted_mode documentation for a bridge directly connected to a crtc.

---
This patch is linked to the discussion https://lkml.org/lkml/2018/1/25/367

Many thanks for the review.

Quoted 5 lines

Aside, and kinda why I noticed this patch to begin with: You have drm-misc commit rights, but you seem to not use that. And with 18 patches in the 4.17 cycle you're the top contributor who's not pushing his own patches.

Quoted 8 lines
Quoted 5 lines

What's the hold-up? Tools don't work, or something else? I really think regular contributors should just push their own stuff themselves (after appropriate review ofc).
-Daniel

I still consider myself a drm “beginner”, my first patch in drm was last summer so less than 1 year ago.

You're doing great patches, and at least for drm-misc you're the top contributor who doesn't push stuff himself. You're definitely ready to do so!

Quoted 6 lines
Quoted 2 lines

However, thank you for your encouraging return, I will immediately study the matter (dim...) and prepare myself.

Yes please. And for any questions please ask on #dri-devel on freenode, we're all happy to help out.
-Daniel

Hi Daniel & Benjamin,

I managed to push a first patch on drm-misc-next :-)

No particular difficulties with dim installation, main encountered issues are "corporate proxies" & ubuntu package updates...

So this email is mostly to thank you Benjamin for your good advice and support when using dim.

Big thanks,
Philippe :-)

Quoted 31 lines
Quoted 31 lines

Thank you,
Philippe :-)

Quoted 26 lines
Quoted 25 lines
   include/drm/drm_bridge.h | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +2 -2
index 3270fec46979..b5f3c070467c 100644
@@ -177,7 +177,8 @@ struct drm_bridge_funcs {
       * pipeline has been called already. If the bridge is the first element
       * then this would be &drm_encoder_helper_funcs.mode_set. The display
       * pipe (i.e.  clocks and timing signals) is off when this function is
-     * called.
+     * called. If the bridge is connected to the crtc, the adjusted_mode
+     * parameter is the one defined in &drm_crtc_state.adjusted_mode.
       */
      void (*mode_set)(struct drm_bridge *bridge,
                       struct drm_display_mode *mode,
--

2.15.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Quoted 7 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
In reply to Philippe Cornu

Hi Philippe,

Thank you for the patch.

Quoted 15 lines · On Monday, 26 February 2018 14:16:04 EEST Philippe Cornu wrote:

This patch clarifies the adjusted_mode documentation for a bridge directly connected to a crtc.

---
This patch is linked to the discussion https://lkml.org/lkml/2018/1/25/367

 include/drm/drm_bridge.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +0 -0
index 3270fec46979..b5f3c070467c 100644

include/drm/drm_bridge.h struct drm_bridge_funcs { · line 181

Quoted 6 lines
include/drm/drm_bridge.h +2 -1
@@ -177,7 +177,8 @@ struct drm_bridge_funcs {
 	 * pipeline has been called already. If the bridge is the first element
 	 * then this would be &drm_encoder_helper_funcs.mode_set. The display
 	 * pipe (i.e.  clocks and timing signals) is off when this function is
-	 * called.
+	 * called. If the bridge is connected to the crtc, the adjusted_mode
+	 * parameter is the one defined in &drm_crtc_state.adjusted_mode.

Unless I'm mistaken this will always be the mode stored in &drm_crtc_state.adjusted_mode (at least for atomic drivers), regardless of whether the bridge is the first in the chain (connected to the CRTC) or not. What is important to document is that we have a single adjusted_mode for the whole chain of bridges, and that it corresponds to the mode output by the CRTC for the first bridge. Bridges further in the chain can look at that mode, although there will probably be nothing of interest to them there.

How about the following text ?

/**
* @mode_set:
*
* This callback should set the given mode on the bridge. It is called
* after the @mode_set callback for the preceding element in the display
* pipeline has been called already. If the bridge is the first element
* then this would be &drm_encoder_helper_funcs.mode_set. The display
* pipe (i.e. clocks and timing signals) is off when this function is
* called.
*
* The adjusted_mode parameter corresponds to the mode output by the CRTC
* for the first bridge in the chain. It can be different from the mode
* parameter that contains the desired mode for the connector at the end
* of the bridges chain, for instance when the first bridge in the chain
* performs scaling. The adjusted mode is mostly useful for the first
* bridge in the chain and is likely irrelevant for the other bridges. *
* For atomic drivers the adjusted_mode is the mode stored in
* &drm_crtc_state.adjusted_mode.
*
* NOTE:
*
* If a need arises to store and access modes adjusted for other locations
* than the connection between the CRTC and the first bridge, the DRM
* framework will have to be extended with DRM bridge states. */

Then I think we should also update the documentation of drm_crtc_state.adjusted_mode accordingly:

/*
* @adjusted_mode:
*
* Internal display timings which can be used by the driver to handle
* differences between the mode requested by userspace in @mode and what
* is actually programmed into the hardware.
*
* For drivers using drm_bridge, this store the hardware display timings
* used between the CRTC and the first bridge. For other drivers, the
* meaning of the adjusted_mode field is purely driver implementation
* defined information, and will usually be used to store the hardware
* display timings used between the CRTC and encoder blocks. */

Signature · 10 lines
Regards,

Laurent Pinchart



_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

Hi Laurent,

Quoted 67 lines · Laurent Pinchart

Hi Philippe,

Thank you for the patch.

Quoted 15 lines · On Monday, 26 February 2018 14:16:04 EEST Philippe Cornu wrote:

This patch clarifies the adjusted_mode documentation for a bridge directly connected to a crtc.

---
This patch is linked to the discussion https://lkml.org/lkml/2018/1/25/367

  include/drm/drm_bridge.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +0 -0
index 3270fec46979..b5f3c070467c 100644

include/drm/drm_bridge.h struct drm_bridge_funcs { · line 181

Quoted 6 lines
include/drm/drm_bridge.h +2 -1
@@ -177,7 +177,8 @@ struct drm_bridge_funcs {
  	 * pipeline has been called already. If the bridge is the first element
  	 * then this would be &drm_encoder_helper_funcs.mode_set. The display
  	 * pipe (i.e.  clocks and timing signals) is off when this function is
-	 * called.
+	 * called. If the bridge is connected to the crtc, the adjusted_mode
+	 * parameter is the one defined in &drm_crtc_state.adjusted_mode.

Unless I'm mistaken this will always be the mode stored in &drm_crtc_state.adjusted_mode (at least for atomic drivers), regardless of whether the bridge is the first in the chain (connected to the CRTC) or not. What is important to document is that we have a single adjusted_mode for the whole chain of bridges, and that it corresponds to the mode output by the CRTC for the first bridge. Bridges further in the chain can look at that mode, although there will probably be nothing of interest to them there.

How about the following text ?

/**
* @mode_set:
*
* This callback should set the given mode on the bridge. It is called
* after the @mode_set callback for the preceding element in the display
* pipeline has been called already. If the bridge is the first element
* then this would be &drm_encoder_helper_funcs.mode_set. The display
* pipe (i.e. clocks and timing signals) is off when this function is
* called.
*
* The adjusted_mode parameter corresponds to the mode output by the CRTC
* for the first bridge in the chain. It can be different from the mode
* parameter that contains the desired mode for the connector at the end
* of the bridges chain, for instance when the first bridge in the chain
* performs scaling. The adjusted mode is mostly useful for the first
* bridge in the chain and is likely irrelevant for the other bridges. *
* For atomic drivers the adjusted_mode is the mode stored in
* &drm_crtc_state.adjusted_mode.
*
* NOTE:
*
* If a need arises to store and access modes adjusted for other locations
* than the connection between the CRTC and the first bridge, the DRM
* framework will have to be extended with DRM bridge states. */

Then I think we should also update the documentation of drm_crtc_state.adjusted_mode accordingly:

Quoted 14 lines

/*
* @adjusted_mode:
*
* Internal display timings which can be used by the driver to handle
* differences between the mode requested by userspace in @mode and what
* is actually programmed into the hardware.
*
* For drivers using drm_bridge, this store the hardware display timings
* used between the CRTC and the first bridge. For other drivers, the
* meaning of the adjusted_mode field is purely driver implementation
* defined information, and will usually be used to store the hardware
* display timings used between the CRTC and encoder blocks. */

Your proposal is very clear and understandable. I will make a new patch version based on it.
Big thanks
Philippe :-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
Quoted 85 lines · Philippe CORNU

Hi Laurent,

Quoted 67 lines · Laurent Pinchart

Hi Philippe,

Thank you for the patch.

Quoted 15 lines · On Monday, 26 February 2018 14:16:04 EEST Philippe Cornu wrote:

This patch clarifies the adjusted_mode documentation for a bridge directly connected to a crtc.

---
This patch is linked to the discussion https://lkml.org/lkml/2018/1/25/367

  include/drm/drm_bridge.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +0 -0
index 3270fec46979..b5f3c070467c 100644

include/drm/drm_bridge.h struct drm_bridge_funcs { · line 181

Quoted 6 lines
include/drm/drm_bridge.h +2 -1
@@ -177,7 +177,8 @@ struct drm_bridge_funcs {
  	 * pipeline has been called already. If the bridge is the first element
  	 * then this would be &drm_encoder_helper_funcs.mode_set. The display
  	 * pipe (i.e.  clocks and timing signals) is off when this function is
-	 * called.
+	 * called. If the bridge is connected to the crtc, the adjusted_mode
+	 * parameter is the one defined in &drm_crtc_state.adjusted_mode.

Unless I'm mistaken this will always be the mode stored in &drm_crtc_state.adjusted_mode (at least for atomic drivers), regardless of whether the bridge is the first in the chain (connected to the CRTC) or not. What is important to document is that we have a single adjusted_mode for the whole chain of bridges, and that it corresponds to the mode output by the CRTC for the first bridge. Bridges further in the chain can look at that mode, although there will probably be nothing of interest to them there.

How about the following text ?

/**
* @mode_set:
*
* This callback should set the given mode on the bridge. It is called
* after the @mode_set callback for the preceding element in the display
* pipeline has been called already. If the bridge is the first element
* then this would be &drm_encoder_helper_funcs.mode_set. The display
* pipe (i.e. clocks and timing signals) is off when this function is
* called.
*
* The adjusted_mode parameter corresponds to the mode output by the CRTC
* for the first bridge in the chain. It can be different from the mode
* parameter that contains the desired mode for the connector at the end
* of the bridges chain, for instance when the first bridge in the chain
* performs scaling. The adjusted mode is mostly useful for the first
* bridge in the chain and is likely irrelevant for the other bridges. *
* For atomic drivers the adjusted_mode is the mode stored in
* &drm_crtc_state.adjusted_mode.
*
* NOTE:
*
* If a need arises to store and access modes adjusted for other locations
* than the connection between the CRTC and the first bridge, the DRM
* framework will have to be extended with DRM bridge states. */

Then I think we should also update the documentation of drm_crtc_state.adjusted_mode accordingly:

Quoted 14 lines

/*
* @adjusted_mode:
*
* Internal display timings which can be used by the driver to handle
* differences between the mode requested by userspace in @mode and what
* is actually programmed into the hardware.
*
* For drivers using drm_bridge, this store the hardware display timings
* used between the CRTC and the first bridge. For other drivers, the
* meaning of the adjusted_mode field is purely driver implementation
* defined information, and will usually be used to store the hardware
* display timings used between the CRTC and encoder blocks. */

Quoted 2 lines

Your proposal is very clear and understandable. I will make a new patch version based on it.

Just to avoid confusion: Needs to be a fully new patch on top of latest drm-misc-next, since no rebasing in a group maintained tree. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel