drm/bridge/synopsys: dsi: use adjusted_mode in mode_set
Subsystems (4)
PATCH 1/1 drm/bridge/synopsys: dsi: use adjusted_mode in mode_set
The "adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).
---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6 -6
@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init (dsi);dw_mipi_dsi_dphy_timing_config (dsi);
@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ dw_mipi_dsi_set_mode (dsi,0 );
Signature · 1 line
2.15.1
Quoted 9 lines · Philippe Cornu
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"
These two appear to be the same for my cases, but at least nothing breaks:
Hi Brian,
And a big thanks for your Tested-by
Quoted 7 lines · Brian Norris
Quoted 6 lines · Philippe Cornu
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).
Quoted 6 lines
Quoted 3 lines
Signed-off-by Philippe Cornu <[email protected]>---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"These two appear to be the same for my cases, but at least nothing breaks:
In drivers/gpu/drm/rockchip/rockchip_drm_vop.c function vop_crtc_mode_fixup(), the adjusted_mode->clock (ie. vop px clk output = dw dsi px clk input) is updated according to rockchip hw pll/dividers...
So you "may" have a different value in adjusted_mode->clock compare to mode->clock. Maybe there is no difference for the panel you are using because its px clock matches perfectly with rockchip hw pll/dividers... or has been set to match with ;-)
I did a similar patch (see [1]) and it works "fine" on stm, the only difference with the rockchip vop is that clk_round_rate() returns odd values on stm so I used set/get_rate instead.
So now, both rockchip & stm crtc have an "adjusted_mode->clock" so it makes sense to use it in dw dsi :)
Philippe :-)
[1] https://patchwork.freedesktop.org/patch/200720/
"[PATCH] drm/stm: ltdc: use crtc_mode_fixup to update adjusted_mode clock"
Quoted 2 lines
Tested-by Brian Norris <[email protected]>
Quoted 27 lines · Philippe CORNU
Hi Brian,
And a big thanks for your Tested-byQuoted 7 lines · Brian Norris
Quoted 6 lines · Philippe Cornu
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Quoted 6 lines
Quoted 3 lines
Signed-off-by Philippe Cornu <[email protected]>---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"These two appear to be the same for my cases, but at least nothing breaks:
In
drivers/gpu/drm/rockchip/rockchip_drm_vop.cfunctionvop_crtc_mode_fixup(), theadjusted_mode->clock(ie. vop px clk output = dw dsi px clk input) is updated according to rockchip hw pll/dividers...So you "may" have a different value in
adjusted_mode->clockcompare tomode->clock. Maybe there is no difference for the panel you are using because its px clock matches perfectly with rockchip hw pll/dividers... or has been set to match with ;-)
Quoted 6 lines
I did a similar patch (see [1]) and it works "fine" on stm, the only difference with the rockchip vop is that
clk_round_rate()returns odd values on stm so I used set/get_rate instead.So now, both rockchip & stm crtc have an "
adjusted_mode->clock" so it makes sense to use it in dw dsi :)
Could you get the patch [1] queued on drm-misc-next? I can queue this patch after it.
Thanks,
Archit
Quoted 16 lines
Philippe :-)
[1] https://patchwork.freedesktop.org/patch/200720/
"[PATCH] drm/stm: ltdc: usecrtc_mode_fixupto updateadjusted_modeclock"Quoted 2 lines
Tested-by Brian Norris <[email protected]>_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Laurent Pinchart
reviewerHi Philippe,
(CC'ing Daniel Vetter)
Thank you for the patch.
Quoted 7 lines · On Thursday, 25 January 2018 17:55:04 EET Philippe Cornu wrote:
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>
The adjusted mode is documented as
/**
* @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. It is purely driver
* implementation defined what exactly this adjusted mode means. Usually
* it is used to store the hardware display timings used between the
* CRTC and encoder blocks.
*/
This is easy to handle when the CRTC and encoder are controlled by the same driver, as the field is "implementation defined" by a single driver . However, when using bridges, there are two drivers involved, and they must both agree to meaningfully use the adjusted mode. I can't see how to do so without standardizing the meaning of the adjusted mode field.
Daniel, what's your opinion on this ?
Quoted 49 lines
---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.cindexed8af32f8e52..b926b62e9e33100644drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +5
-5@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init (dsi);drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-1dw_mipi_dsi_dphy_timing_config (dsi);@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(structdrm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi ); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */
dw_mipi_dsi_set_mode(dsi, 0);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Laurent,
And many thanks for your comments :)
Quoted 28 lines · Laurent Pinchart
Hi Philippe,
(CC'ing Daniel Vetter)
Thank you for the patch.
Quoted 7 lines · On Thursday, 25 January 2018 17:55:04 EET Philippe Cornu wrote:
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>The adjusted mode is documented as
/**
* @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. It is purely driver
* implementation defined what exactly this adjusted mode means. Usually
* it is used to store the hardware display timings used between the
* CRTC and encoder blocks.
*/
Quoted 5 lines
This is easy to handle when the CRTC and encoder are controlled by the same driver, as the field is "implementation defined" by a single driver . However, when using bridges, there are two drivers involved, and they must both agree to meaningfully use the adjusted mode. I can't see how to do so without standardizing the meaning of the adjusted mode field.
This is exactly the reason why my first implementation used the dsi bridge "optional pixel clock" instead of the adjusted_mode (see [1])
But after digging more into the drm source code, I think using adjusted_mode instead of the pixel clock here brings more advantages because:
* adjusted_mode is an argument of bridge mode_set() probably for being used in any manner, maybe like this :)
* if the bridge "user" (crtc or a master bridge drivers) does not need to modify its adjusted_mode then mode & adjusted_mode mode_set() arguments will have the same values so "no consequence" for the bridge.
* if the bridge "user" (crtc or master bridge drivers) needs to adjust any value of the mode then this adjustment is available for the bridge.
* rockchip crtc updates a part of the mode (the clock), stm is doing the same (see [2]) but any future "user" of the dw_mipi_dsi bridge can adjust something else (blankings...) and the dw_mipi_dsi bridge will be then aware of...
But maybe it is a wrong usage of the "adjusted_mode offer"...
Many thanks,
Philippe :-)
[1] https://patchwork.freedesktop.org/patch/200240/
[2] https://patchwork.freedesktop.org/patch/200720/
Quoted 53 lines
Daniel, what's your opinion on this ?
Quoted 49 lines
---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.cindexed8af32f8e52..b926b62e9e33100644drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +5
-5@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init (dsi);dw_mipi_dsi_dphy_timing_config(dsi);drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-1@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(structdrm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi ); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ dw_mipi_dsi_set_mode(dsi, 0);
Laurent Pinchart
reviewerHi Philippe,
Quoted 33 lines · On Monday, 29 January 2018 12:17:37 EET Philippe CORNU wrote:
Quoted 23 lines · Laurent Pinchart
Quoted 7 lines · On Thursday, 25 January 2018 17:55:04 EET Philippe Cornu wrote:
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>The adjusted mode is documented as
/**
* @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. It is purely driver
* implementation defined what exactly this adjusted mode means. Usually
* it is used to store the hardware display timings used between the
* CRTC and encoder blocks.
*/Quoted 5 lines
This is easy to handle when the CRTC and encoder are controlled by the same driver, as the field is "implementation defined" by a single driver . However, when using bridges, there are two drivers involved, and they must both agree to meaningfully use the adjusted mode. I can't see how to do so without standardizing the meaning of the adjusted mode field.
This is exactly the reason why my first implementation used the dsi bridge "optional pixel clock" instead of the
adjusted_mode(see [1])
Quoted 10 lines
But after digging more into the drm source code, I think using
adjusted_modeinstead of the pixel clock here brings more advantages because:
*adjusted_modeis an argument of bridgemode_set()probably for being used in any manner, maybe like this :)
* if the bridge "user" (crtc or a master bridge drivers) does not need to modify itsadjusted_modethen mode &adjusted_modemode_set()arguments will have the same values so "no consequence" for the bridge.
* if the bridge "user" (crtc or master bridge drivers) needs to adjust any value of the mode then this adjustment is available for the bridge.
Remember that there can be multiple chained bridges, and a single adjusted mode field.
Quoted 6 lines
* rockchip crtc updates a part of the mode (the clock), stm is doing the same (see [2]) but any future "user" of the
dw_mipi_dsibridge can adjust something else (blankings...) and thedw_mipi_dsibridge will be then aware of...But maybe it is a wrong usage of the "
adjusted_modeoffer"...
I don't disagree that there's a need for using adjusted values, but I believe we need to create a clear API to do so. Using the adjust_mode field as-is when it's clearly documented as being implementation-defined is asking for trouble.
Quoted 58 lines
Many thanks,
Philippe :-)
[1] https://patchwork.freedesktop.org/patch/200240/
[2] https://patchwork.freedesktop.org/patch/200720/Quoted 53 lines
Daniel, what's your opinion on this ?
Quoted 51 lines
---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.cindexed8af32f8e52..b926b62e9e33100644drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +5
-5@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init(dsi); dw_mipi_dsi_dphy_timing_config(dsi);drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-1@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(structdrm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi ); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ dw_mipi_dsi_set_mode(dsi, 0);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Laurent & Daniel :-)
Quoted 55 lines · Laurent Pinchart
Hi Philippe,
Quoted 33 lines · On Monday, 29 January 2018 12:17:37 EET Philippe CORNU wrote:
Quoted 23 lines · Laurent Pinchart
Quoted 7 lines · On Thursday, 25 January 2018 17:55:04 EET Philippe Cornu wrote:
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>The adjusted mode is documented as
/**
* @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. It is purely driver
* implementation defined what exactly this adjusted mode means. Usually
* it is used to store the hardware display timings used between the
* CRTC and encoder blocks.
*/Quoted 5 lines
This is easy to handle when the CRTC and encoder are controlled by the same driver, as the field is "implementation defined" by a single driver . However, when using bridges, there are two drivers involved, and they must both agree to meaningfully use the adjusted mode. I can't see how to do so without standardizing the meaning of the adjusted mode field.
This is exactly the reason why my first implementation used the dsi bridge "optional pixel clock" instead of the
adjusted_mode(see [1])Quoted 10 lines
But after digging more into the drm source code, I think using
adjusted_modeinstead of the pixel clock here brings more advantages because:
*adjusted_modeis an argument of bridgemode_set()probably for being used in any manner, maybe like this :)
* if the bridge "user" (crtc or a master bridge drivers) does not need to modify itsadjusted_modethen mode &adjusted_modemode_set()arguments will have the same values so "no consequence" for the bridge.
* if the bridge "user" (crtc or master bridge drivers) needs to adjust any value of the mode then this adjustment is available for the bridge.Remember that there can be multiple chained bridges, and a single adjusted mode field.
Quoted 5 lines
* rockchip crtc updates a part of the mode (the clock), stm is doing the same (see [2]) but any future "user" of the
dw_mipi_dsibridge can adjust something else (blankings...) and thedw_mipi_dsibridge will be then aware of...
Quoted 6 lines
Quoted 1 line
But maybe it is a wrong usage of the "
adjusted_modeoffer"...I don't disagree that there's a need for using adjusted values, but I believe we need to create a clear API to do so. Using the
adjust_modefield as-is when it's clearly documented as being implementation-defined is asking for trouble.
Laurent, do you think we can use "adjusted mode" here in this small patch as the actual 2 "users" of this bridge (rockchip & stm) use both "adjusted mode" in their crtc?
Quoted 7 lines
Quoted 7 lines
Many thanks,
Philippe :-)
[1] https://patchwork.freedesktop.org/patch/200240/
[2] https://patchwork.freedesktop.org/patch/200720/Quoted 2 lines
Daniel, what's your opinion on this ?
Daniel, any opinion on the adjusted_mode usage?
Many thanks to both of you,
Philippe :-)
Quoted 52 lines
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.cindexed8af32f8e52..b926b62e9e33100644drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +5
-5@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init(dsi); dw_mipi_dsi_dphy_timing_config(dsi);drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-1@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(structdrm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi ); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ dw_mipi_dsi_set_mode(dsi, 0);
Laurent Pinchart
reviewerHi Philippe,
Quoted 58 lines · On Saturday, 3 February 2018 00:41:26 EET Philippe CORNU wrote:
Quoted 57 lines · Laurent Pinchart
Quoted 35 lines · On Monday, 29 January 2018 12:17:37 EET Philippe CORNU wrote:
Quoted 24 lines · Laurent Pinchart
Quoted 7 lines · On Thursday, 25 January 2018 17:55:04 EET Philippe Cornu wrote:
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>The adjusted mode is documented as
/**
* @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. It is purely driver
* implementation defined what exactly this adjusted mode means. Usually
* it is used to store the hardware display timings used between the
* CRTC and encoder blocks.
*/Quoted 6 lines
This is easy to handle when the CRTC and encoder are controlled by the same driver, as the field is "implementation defined" by a single driver. However, when using bridges, there are two drivers involved, and they must both agree to meaningfully use the adjusted mode. I can't see how to do so without standardizing the meaning of the adjusted mode field.
This is exactly the reason why my first implementation used the dsi bridge "optional pixel clock" instead of the
adjusted_mode(see [1])Quoted 10 lines
But after digging more into the drm source code, I think using
adjusted_modeinstead of the pixel clock here brings more advantages because:
*adjusted_modeis an argument of bridgemode_set()probably for being used in any manner, maybe like this :)
* if the bridge "user" (crtc or a master bridge drivers) does not need to modify itsadjusted_modethen mode &adjusted_modemode_set()arguments will have the same values so "no consequence" for the bridge.
* if the bridge "user" (crtc or master bridge drivers) needs to adjust any value of the mode then this adjustment is available for the bridge.Remember that there can be multiple chained bridges, and a single adjusted mode field.
Quoted 6 lines
* rockchip crtc updates a part of the mode (the clock), stm is doing the same (see [2]) but any future "user" of the
dw_mipi_dsibridge can adjust something else (blankings...) and thedw_mipi_dsibridge will be then aware of...But maybe it is a wrong usage of the "
adjusted_modeoffer"...
Quoted 8 lines
Quoted 4 lines
I don't disagree that there's a need for using adjusted values, but I believe we need to create a clear API to do so. Using the
adjust_modefield as-is when it's clearly documented as being implementation-defined is asking for trouble.Laurent, do you think we can use "adjusted mode" here in this small patch as the actual 2 "users" of this bridge (rockchip & stm) use both "adjusted mode" in their crtc?
The Synopsys DSI driver might only be used by two display controller drivers today, it is nonetheless a standard bridge driver that should not make any assumption of a particular use of the adjusted_mode in particular display controller drivers. To use the adjusted_mode value in bridge drivers we need to standardize its usage, otherwise we'll end up with incompatibilities between bridge drivers and display controller drivers.
Quoted 59 lines
Quoted 4 lines
Quoted 4 lines
[1] https://patchwork.freedesktop.org/patch/200240/
[2] https://patchwork.freedesktop.org/patch/200720/Quoted 1 line
Daniel, what's your opinion on this ?
Daniel, any opinion on the
adjusted_modeusage?Quoted 52 lines
Quoted 52 lines
Quoted 52 lines
Quoted 52 lines
---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c| 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.cindexed8af32f8e52..b926b62e9e33100644drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +5
-5@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init(dsi); dw_mipi_dsi_dphy_timing_config(dsi);drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-1@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(structdrm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi ); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ dw_mipi_dsi_set_mode(dsi, 0);
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
reviewerHi Philippe,
Quoted 73 lines · On Thursday, 8 February 2018 15:15:40 EEST Laurent Pinchart wrote:
Quoted 63 lines · On Saturday, 3 February 2018 00:41:26 EET Philippe CORNU wrote:
Quoted 62 lines · Laurent Pinchart
Quoted 39 lines · On Monday, 29 January 2018 12:17:37 EET Philippe CORNU wrote:
Quoted 26 lines · Laurent Pinchart
Quoted 7 lines · On Thursday, 25 January 2018 17:55:04 EET Philippe Cornu wrote:
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>The adjusted mode is documented as
/**
* @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. It is purely driver
* implementation defined what exactly this adjusted mode means. Usually
* it is used to store the hardware display timings used between the
* CRTC and encoder blocks.
*/Quoted 8 lines
This is easy to handle when the CRTC and encoder are controlled by the same driver, as the field is "implementation defined" by a single driver. However, when using bridges, there are two drivers involved, and
they must both agree to meaningfully use the adjusted mode. I can't see
how to do so without standardizing the meaning of the adjusted mode field.This is exactly the reason why my first implementation used the dsi bridge "optional pixel clock" instead of the
adjusted_mode(see [1])Quoted 10 lines
But after digging more into the drm source code, I think using
adjusted_modeinstead of the pixel clock here brings more advantages because:
*adjusted_modeis an argument of bridgemode_set()probably for being used in any manner, maybe like this :)
* if the bridge "user" (crtc or a master bridge drivers) does not need to modify itsadjusted_modethen mode &adjusted_modemode_set()arguments will have the same values so "no consequence" for the bridge.
* if the bridge "user" (crtc or master bridge drivers) needs to adjust any value of the mode then this adjustment is available for the bridge.Remember that there can be multiple chained bridges, and a single adjusted mode field.
Quoted 7 lines
* rockchip crtc updates a part of the mode (the clock), stm is doing the
same (see [2]) but any future "user" of thedw_mipi_dsibridge can adjust something else (blankings...) and thedw_mipi_dsibridge will be then aware of...But maybe it is a wrong usage of the "
adjusted_modeoffer"...Quoted 8 lines
Quoted 4 lines
I don't disagree that there's a need for using adjusted values, but I believe we need to create a clear API to do so. Using the
adjust_modefield as-is when it's clearly documented as being implementation-defined is asking for trouble.Laurent, do you think we can use "adjusted mode" here in this small patch as the actual 2 "users" of this bridge (rockchip & stm) use both "adjusted mode" in their crtc?
Quoted 6 lines
The Synopsys DSI driver might only be used by two display controller drivers today, it is nonetheless a standard bridge driver that should not make any assumption of a particular use of the
adjusted_modein particular display controller drivers. To use theadjusted_modevalue in bridge drivers we need to standardize its usage, otherwise we'll end up with incompatibilities between bridge drivers and display controller drivers.
Now that the documentation has been clarified I have no objection against this patch anymore.
Quoted 67 lines
Quoted 67 lines
Quoted 4 lines
Quoted 4 lines
[1] https://patchwork.freedesktop.org/patch/200240/
[2] https://patchwork.freedesktop.org/patch/200720/Quoted 1 line
Daniel, what's your opinion on this ?
Daniel, any opinion on the
adjusted_modeusage?Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c| 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.cindexed8af32f8e52..b926b62e9e33100644drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6
-6@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init (dsi);dw_mipi_dsi_dphy_timing_config (dsi);@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(structdrm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi ); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ dw_mipi_dsi_set_mode(dsi, 0);
Signature · 10 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Philippe,
I've tried your patch on both 4.17-rc1 & drm-misc-next and it works fine. So,
BR
Yannick Fertr?
Quoted 154 lines · Laurent Pinchart
Hi Philippe,
Quoted 73 lines · On Thursday, 8 February 2018 15:15:40 EEST Laurent Pinchart wrote:
Quoted 63 lines · On Saturday, 3 February 2018 00:41:26 EET Philippe CORNU wrote:
Quoted 62 lines · Laurent Pinchart
Quoted 39 lines · On Monday, 29 January 2018 12:17:37 EET Philippe CORNU wrote:
Quoted 26 lines · Laurent Pinchart
Quoted 7 lines · On Thursday, 25 January 2018 17:55:04 EET Philippe Cornu wrote:
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>The adjusted mode is documented as
/**
* @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. It is purely driver
* implementation defined what exactly this adjusted mode means. Usually
* it is used to store the hardware display timings used between the
* CRTC and encoder blocks.
*/Quoted 8 lines
This is easy to handle when the CRTC and encoder are controlled by the same driver, as the field is "implementation defined" by a single driver. However, when using bridges, there are two drivers involved, and
they must both agree to meaningfully use the adjusted mode. I can't see
how to do so without standardizing the meaning of the adjusted mode field.This is exactly the reason why my first implementation used the dsi bridge "optional pixel clock" instead of the
adjusted_mode(see [1])Quoted 10 lines
But after digging more into the drm source code, I think using
adjusted_modeinstead of the pixel clock here brings more advantages because:
*adjusted_modeis an argument of bridgemode_set()probably for being used in any manner, maybe like this :)
* if the bridge "user" (crtc or a master bridge drivers) does not need to modify itsadjusted_modethen mode &adjusted_modemode_set()arguments will have the same values so "no consequence" for the bridge.
* if the bridge "user" (crtc or master bridge drivers) needs to adjust any value of the mode then this adjustment is available for the bridge.Remember that there can be multiple chained bridges, and a single adjusted mode field.
Quoted 7 lines
* rockchip crtc updates a part of the mode (the clock), stm is doing the
same (see [2]) but any future "user" of thedw_mipi_dsibridge can adjust something else (blankings...) and thedw_mipi_dsibridge will be then aware of...But maybe it is a wrong usage of the "
adjusted_modeoffer"...Quoted 8 lines
Quoted 4 lines
I don't disagree that there's a need for using adjusted values, but I believe we need to create a clear API to do so. Using the
adjust_modefield as-is when it's clearly documented as being implementation-defined is asking for trouble.Laurent, do you think we can use "adjusted mode" here in this small patch as the actual 2 "users" of this bridge (rockchip & stm) use both "adjusted mode" in their crtc?
Quoted 6 lines
The Synopsys DSI driver might only be used by two display controller drivers today, it is nonetheless a standard bridge driver that should not make any assumption of a particular use of the
adjusted_modein particular display controller drivers. To use theadjusted_modevalue in bridge drivers we need to standardize its usage, otherwise we'll end up with incompatibilities between bridge drivers and display controller drivers.Now that the documentation has been clarified I have no objection against this patch anymore.
Quoted 67 lines
Quoted 67 lines
Quoted 4 lines
Quoted 4 lines
[1] https://patchwork.freedesktop.org/patch/200240/
[2] https://patchwork.freedesktop.org/patch/200720/Quoted 1 line
Daniel, what's your opinion on this ?
Daniel, any opinion on the
adjusted_modeusage?Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c| 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.cindexed8af32f8e52..b926b62e9e33100644drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6
-6@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init (dsi);dw_mipi_dsi_dphy_timing_config (dsi);@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(structdrm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi ); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ dw_mipi_dsi_set_mode(dsi, 0);
Andrzej Hajda
AppliedQuoted 9 lines · Philippe Cornu
The "
adjusted_mode" clock value (ie the real pixel clock) is more accurate than "mode" clock value (ie the panel/bridge requested clock value). It offers a better preciseness for timing computations and allows to reduce the extra dsi bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant).Signed-off-by Philippe Cornu <[email protected]>---
Note: This patch replaces "drm/bridge/synopsys: dsi: add optional pixel clock"
Queued to drm-misc-next.
--
Regards
Andrzej
Quoted 43 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6
-6@@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,clk_prepare_enable (dsi->pclk); - ret = phy_ops->get_lane_mbps (priv_data, mode, dsi->mode_flags, + ret = phy_ops->get_lane_mbps (priv_data, adjusted_mode, dsi->mode_flags, dsi->lanes, dsi->format, &dsi->lane_mbps);if (ret)DRM_DEBUG_DRIVER ("Phy get_lane_mbps() failed\n" );pm_runtime_get_sync (dsi->dev);dw_mipi_dsi_init (dsi); -dw_mipi_dsi_dpi_config (dsi, mode); +dw_mipi_dsi_dpi_config (dsi, adjusted_mode);dw_mipi_dsi_packet_handler_config (dsi);dw_mipi_dsi_video_mode_config (dsi); -dw_mipi_dsi_video_packet_config (dsi, mode); +dw_mipi_dsi_video_packet_config (dsi, adjusted_mode);dw_mipi_dsi_command_mode_config (dsi); -dw_mipi_dsi_line_timer_config (dsi, mode); -dw_mipi_dsi_vertical_timing_config (dsi, mode); +dw_mipi_dsi_line_timer_config (dsi, adjusted_mode); +dw_mipi_dsi_vertical_timing_config (dsi, adjusted_mode);dw_mipi_dsi_dphy_init (dsi);dw_mipi_dsi_dphy_timing_config (dsi);@@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,dw_mipi_dsi_dphy_enable (dsi); -dw_mipi_dsi_wait_for_two_frames (mode); +dw_mipi_dsi_wait_for_two_frames (adjusted_mode);/* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ dw_mipi_dsi_set_mode (dsi,0 );