drm/rcar-du: Convert drm_atomic_helper_suspend/resume()
Subsystems (3)
PATCH 1/1 drm/rcar-du: Convert drm_atomic_helper_suspend/resume()
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().
--- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2 -19
@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state; -drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); -return PTR_ERR (state); - } - - rcdu->suspend_state = state; - -return 0 ; +return drm_mode_config_helper_suspend (rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - -return 0 ; +return drm_mode_config_helper_resume (rcdu->ddev); }#endif
Signature · 1 line
1.9.1
Quoted 2 lines · Souptick Joarder
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().
Hi Souptick,
Thanks for your patch.
Quoted 12 lines
Signed-off-by Souptick Joarder <[email protected]>Signed-off-by Ajit Negi <[email protected]>--- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-0@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev)
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev) · line 367
Quoted 10 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-7{struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state; -drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false);
I don't think we can use drm_mode_config_helper_(suspend/resume) API here as this file uses CMA functions. And from git grep it seems that there are very few drivers using it at the moment, so not sure if introducing new API functions similar to drm_mode_config will make sense or not.
Thanks.
Quoted 24 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2
-13-drm_kms_helper_poll_enable (rcdu->ddev); - return PTR_ERR(state); - } - - rcdu->suspend_state = state; - -return 0 ; + return drm_mode_config_helper_suspend(rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - -return 0 ; +return drm_mode_config_helper_resume (rcdu->ddev); }#endif --
Quoted 2 lines
1.9.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 24 lines · Vaishali Thakkar
Quoted 2 lines · Souptick Joarder
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().Hi Souptick,
Thanks for your patch.
Quoted 16 lines
Signed-off-by Souptick Joarder <[email protected]>Signed-off-by Ajit Negi <[email protected]>--- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-1@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state;
Quoted 10 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev) · line 367
Quoted 6 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-6-drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false);I don't think we can use
drm_mode_config_helper_(suspend/resume)API here as this file uses CMA functions.
drm_fbdev_cma_set_suspend_unlocked() is wrapper function which invokes drm_fb_helper_set_suspend_unlocked().
Where the new API drm_mode_config_helper_suspend/resume() directly invokes drm_fb_helper_set_suspend_unlocked(). So it is safe to replace exiting code with API drm_mode_config_helper_suspend/resume().
Quoted 4 lines
And from git grep it seems that
there are very few drivers using it at the moment, so not sure if introducing new API functions similar todrm_mode_configwill make sense or not.
https://www.kernel.org/doc/html/latest/gpu/todo.html
It was picked up from TODO list after discussing with Daniel.
Quoted 28 lines
Thanks.
Quoted 26 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2
-13-drm_kms_helper_poll_enable (rcdu->ddev); - return PTR_ERR(state); - } - - rcdu->suspend_state = state; - -return 0 ; + return drm_mode_config_helper_suspend(rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - -return 0 ; +return drm_mode_config_helper_resume (rcdu->ddev); }#endif --1.9.1
Hi Souptick,
Thank you for the patch.
Quoted 38 lines · On Saturday, 28 July 2018 21:50:58 EEST Souptick Joarder wrote:
Quoted 27 lines · Vaishali Thakkar
Quoted 2 lines · Souptick Joarder
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().Hi Souptick,
Thanks for your patch.
Quoted 19 lines
Signed-off-by Souptick Joarder <[email protected]>Signed-off-by Ajit Negi <[email protected]>---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/rcar-du/rcar_du_drv.cindex 02aee6c..288220f 100644drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-1@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state;Quoted 9 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev) · line 367
Quoted 6 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-6-drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false);I don't think we can use
drm_mode_config_helper_(suspend/resume)API here as this file uses CMA functions.
Quoted 6 lines
drm_fbdev_cma_set_suspend_unlocked()is wrapper function which invokesdrm_fb_helper_set_suspend_unlocked().Where the new API drm_mode_config_helper_suspend/resume() directly invokes
drm_fb_helper_set_suspend_unlocked(). So it is safe to replace exiting code with API drm_mode_config_helper_suspend/resume().
I agree that they're functionally equivalent for now, but what if drm_fbdev_cma_set_suspend_unlocked() gets extended later ? This change risks introducing a breakage that could could unnoticed at that point. At the very least you should add a comment in drm_fbdev_cma_set_suspend_unlocked() to explain that any extension of the function should also address all drivers using drm_mode_config_helper_suspend() and drm_mode_config_helper_resume().
Quoted 4 lines
Quoted 3 lines
And from git grep it seems that there are very few drivers using it at the moment, so not sure if introducing new API functions similar to
drm_mode_configwill make sense or not.
Quoted 12 lines
https://www.kernel.org/doc/html/latest/gpu/todo.html
It was picked up from TODO list after discussing with Daniel.
Quoted 7 lines
Thanks.
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-5-drm_kms_helper_poll_enable (rcdu->ddev); -return PTR_ERR (state); - } - - rcdu->suspend_state = state;
Additionally, I think you can remove the suspend_state field from the rcdu structure.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2
-6- return 0; + return drm_mode_config_helper_suspend(rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - -return 0 ; +return drm_mode_config_helper_resume (rcdu->ddev); }#endif
Signature · 10 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 46 lines · Laurent Pinchart
Hi Souptick,
Thank you for the patch.
Quoted 41 lines · On Saturday, 28 July 2018 21:50:58 EEST Souptick Joarder wrote:
Quoted 27 lines · Vaishali Thakkar
Quoted 2 lines · Souptick Joarder
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().Hi Souptick,
Thanks for your patch.
Quoted 19 lines
Signed-off-by Souptick Joarder <[email protected]>Signed-off-by Ajit Negi <[email protected]>---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/rcar-du/rcar_du_drv.cindex 02aee6c..288220f 100644drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-1@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state;Quoted 9 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev) · line 367
Quoted 6 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-6-drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false);I don't think we can use
drm_mode_config_helper_(suspend/resume)API here as this file uses CMA functions.
drm_fbdev_cma_set_suspend_unlocked()is wrapper function which invokesdrm_fb_helper_set_suspend_unlocked().
Quoted 8 lines
Quoted 3 lines
Where the new API drm_mode_config_helper_suspend/resume() directly invokes
drm_fb_helper_set_suspend_unlocked(). So it is safe to replace exiting code with API drm_mode_config_helper_suspend/resume().I agree that they're functionally equivalent for now, but what if
drm_fbdev_cma_set_suspend_unlocked()gets extended later ? This change risks introducing a breakage that could could unnoticed at that point.
No, any extention of drm_fbdev_cma_set_suspend_unlocked() will not have any impact on driver because with this patch we will be retaining the original suspend/resume logic of the rcar-du driver and further this driver is not going to use drm_fbdev_cma_set_suspend_unlocked().
Quoted 4 lines
At the very
least you should add a comment indrm_fbdev_cma_set_suspend_unlocked()to explain that any extension of the function should also address all drivers usingdrm_mode_config_helper_suspend()anddrm_mode_config_helper_resume().
The consumers of drm_fbdev_cma_set_suspend_unlocked() are - drivers/gpu/drm/arm/hdlcd_drv.c drivers/gpu/drm/drm_fb_cma_helper.c
and both will be converted to use API drm_mode_config_helper_suspend/resume(). As there will be no more consumer of drm_fbdev_cma_set_suspend_unlocked() , we can remove this wrapper API forever :)
Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
And from git grep it seems that there are very few drivers using it at the moment, so not sure if introducing new API functions similar to
drm_mode_configwill make sense or not.https://www.kernel.org/doc/html/latest/gpu/todo.html
It was picked up from TODO list after discussing with Daniel.
Quoted 2 lines
Thanks.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev) · line 372
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-5-drm_kms_helper_poll_enable (rcdu->ddev); -return PTR_ERR (state); - } - - rcdu->suspend_state = state;Additionally, I think you can remove the
suspend_statefield from the rcdu structure.
Sure, I will remove it in v2.
Quoted 25 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +1
-1-return 0 ; +return drm_mode_config_helper_suspend (rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev);Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev) · line 370
Quoted 8 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +1
-5-drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - - return 0; + return drm_mode_config_helper_resume(rcdu->ddev); }#endif --
Regards,Laurent Pinchart
Hi Souptick,
Quoted 49 lines · On Monday, 30 July 2018 16:58:09 EEST Souptick Joarder wrote:
Quoted 48 lines · Laurent Pinchart
Quoted 46 lines · On Saturday, 28 July 2018 21:50:58 EEST Souptick Joarder wrote:
Quoted 27 lines · Vaishali Thakkar
Quoted 2 lines · Souptick Joarder
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().Hi Souptick,
Thanks for your patch.
Quoted 19 lines
Signed-off-by Souptick Joarder <[email protected]>Signed-off-by Ajit Negi <[email protected]>---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/rcar-du/rcar_du_drv.cindex 02aee6c..288220f 100644drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-1@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state;Quoted 10 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev)
Quoted 7 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-6-drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false);I don't think we can use
drm_mode_config_helper_(suspend/resume)API here as this file uses CMA functions.
drm_fbdev_cma_set_suspend_unlocked()is wrapper function which invokesdrm_fb_helper_set_suspend_unlocked().Where the new API drm_mode_config_helper_suspend/resume() directly invokes
drm_fb_helper_set_suspend_unlocked(). So it is safe to replace exiting code with API drm_mode_config_helper_suspend/resume().
Quoted 8 lines
Quoted 3 lines
I agree that they're functionally equivalent for now, but what if
drm_fbdev_cma_set_suspend_unlocked()gets extended later ? This change risks introducing a breakage that could could unnoticed at that point.No, any extention of
drm_fbdev_cma_set_suspend_unlocked()will not have any impact on driver because with this patch we will be retaining the original suspend/resume logic of the rcar-du driver and further this driver is not going to usedrm_fbdev_cma_set_suspend_unlocked().
My point is that if the fb cma helpers gets later extended with a feature that need special handling and suspend/resume time, with the drm_fbdev_cma_set_suspend_unlocked() function properly updated to take that feature into account, driver using those helpers but converted to drm_atomic_helper_suspend/resume() will break.
Quoted 6 lines
Quoted 5 lines
At the very
least you should add a comment indrm_fbdev_cma_set_suspend_unlocked()to explain that any extension of the function should also address all drivers usingdrm_mode_config_helper_suspend()anddrm_mode_config_helper_resume().
Quoted 8 lines
The consumers of
drm_fbdev_cma_set_suspend_unlocked()are -drivers/gpu/drm/arm/hdlcd_drv.cdrivers/gpu/drm/drm_fb_cma_helper.cand both will be converted to use API drm_mode_config_helper_suspend/resume(). As there will be no more consumer of
drm_fbdev_cma_set_suspend_unlocked(), we can remove this wrapper API forever :)
OK, if you remove the function completely then anyone wanting to extend the fbdev cma helpers in the way described above will notice that something will need to be done, so it's fine. Please thus make sure that you go all the way to removing that function.
Quoted 36 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
And from git grep it seems that there are very few drivers using it at the moment, so not sure if introducing new API functions similar to
drm_mode_configwill make sense or not.https://www.kernel.org/doc/html/latest/gpu/todo.html
It was picked up from TODO list after discussing with Daniel.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev) · line 372
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-5-drm_kms_helper_poll_enable (rcdu->ddev); -return PTR_ERR (state); - } - - rcdu->suspend_state = state;Additionally, I think you can remove the
suspend_statefield from the rcdu structure.Sure, I will remove it in v2.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2
-6- return 0; + return drm_mode_config_helper_suspend(rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - -return 0 ; +return drm_mode_config_helper_resume (rcdu->ddev); }#endif
Signature · 10 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 82 lines · Laurent Pinchart
Hi Souptick,
Quoted 49 lines · On Monday, 30 July 2018 16:58:09 EEST Souptick Joarder wrote:
Quoted 48 lines · Laurent Pinchart
Quoted 46 lines · On Saturday, 28 July 2018 21:50:58 EEST Souptick Joarder wrote:
Quoted 27 lines · Vaishali Thakkar
Quoted 2 lines · Souptick Joarder
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().Hi Souptick,
Thanks for your patch.
Quoted 19 lines
Signed-off-by Souptick Joarder <[email protected]>Signed-off-by Ajit Negi <[email protected]>---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/rcar-du/rcar_du_drv.cindex 02aee6c..288220f 100644drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-1@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state;Quoted 10 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct drm_device *dev)
Quoted 7 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-6-drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false);I don't think we can use
drm_mode_config_helper_(suspend/resume)API here as this file uses CMA functions.
drm_fbdev_cma_set_suspend_unlocked()is wrapper function which invokesdrm_fb_helper_set_suspend_unlocked().Where the new API drm_mode_config_helper_suspend/resume() directly invokes
drm_fb_helper_set_suspend_unlocked(). So it is safe to replace exiting code with API drm_mode_config_helper_suspend/resume().Quoted 8 lines
Quoted 3 lines
I agree that they're functionally equivalent for now, but what if
drm_fbdev_cma_set_suspend_unlocked()gets extended later ? This change risks introducing a breakage that could could unnoticed at that point.No, any extention of
drm_fbdev_cma_set_suspend_unlocked()will not have any impact on driver because with this patch we will be retaining the original suspend/resume logic of the rcar-du driver and further this driver is not going to usedrm_fbdev_cma_set_suspend_unlocked().My point is that if the fb cma helpers gets later extended with a feature that need special handling and suspend/resume time, with the
drm_fbdev_cma_set_suspend_unlocked()function properly updated to take that feature into account, driver using those helpers but converted to drm_atomic_helper_suspend/resume() will break.Quoted 6 lines
Quoted 5 lines
At the very
least you should add a comment indrm_fbdev_cma_set_suspend_unlocked()to explain that any extension of the function should also address all drivers usingdrm_mode_config_helper_suspend()anddrm_mode_config_helper_resume().Quoted 8 lines
The consumers of
drm_fbdev_cma_set_suspend_unlocked()are -drivers/gpu/drm/arm/hdlcd_drv.cdrivers/gpu/drm/drm_fb_cma_helper.cand both will be converted to use API drm_mode_config_helper_suspend/resume(). As there will be no more consumer of
drm_fbdev_cma_set_suspend_unlocked(), we can remove this wrapper API forever :)
Quoted 5 lines
OK, if you remove the function completely then anyone wanting to extend the fbdev cma helpers in the way described above will notice that something will need to be done, so it's fine. Please thus make sure that you go all the way to removing that function.
Sure, once both the drivers are converted to use drm_mode_config_helper_suspend/resume() and goes into linus's tree, then we can remove it.
But will wait for some more feedback before concluding on this.
Dave/ Daniel, Would you like to add any feedback ?
Quoted 44 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 3 lines
And from git grep it seems that there are very few drivers using it at the moment, so not sure if introducing new API functions similar to
drm_mode_configwill make sense or not.https://www.kernel.org/doc/html/latest/gpu/todo.html
It was picked up from TODO list after discussing with Daniel.
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-5-drm_kms_helper_poll_enable (rcdu->ddev); -return PTR_ERR (state); - } - - rcdu->suspend_state = state;Quoted 21 lines
Quoted 2 lines
Additionally, I think you can remove the
suspend_statefield from the rcdu structure.Sure, I will remove it in v2.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2
-6- return 0; + return drm_mode_config_helper_suspend(rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - -return 0 ; +return drm_mode_config_helper_resume (rcdu->ddev); }#endif --
Regards,Laurent Pinchart
Hi Souptick,
Quoted 83 lines · On Monday, 30 July 2018 18:13:13 EEST Souptick Joarder wrote:
Quoted 82 lines · Laurent Pinchart
Quoted 51 lines · On Monday, 30 July 2018 16:58:09 EEST Souptick Joarder wrote:
Quoted 50 lines · Laurent Pinchart
Quoted 48 lines · On Saturday, 28 July 2018 21:50:58 EEST Souptick Joarder wrote:
Quoted 30 lines · Vaishali Thakkar
Quoted 2 lines · Souptick Joarder
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().Hi Souptick,
Thanks for your patch.
Quoted 22 lines
Signed-off-by Souptick Joarder <[email protected]>Signed-off-by Ajit Negi <[email protected]>---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/rcar-du/rcar_du_drv.cindex 02aee6c..288220f 100644drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-1@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state;Quoted 10 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct · line 365
Quoted 7 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-6-drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false);I don't think we can use
drm_mode_config_helper_(suspend/resume)API here as this file uses CMA functions.
drm_fbdev_cma_set_suspend_unlocked()is wrapper function which invokesdrm_fb_helper_set_suspend_unlocked().Where the new API drm_mode_config_helper_suspend/resume() directly invokes
drm_fb_helper_set_suspend_unlocked(). So it is safe to replace exiting code with API drm_mode_config_helper_suspend/resume().Quoted 8 lines
Quoted 3 lines
I agree that they're functionally equivalent for now, but what if
drm_fbdev_cma_set_suspend_unlocked()gets extended later ? This change risks introducing a breakage that could could unnoticed at that point.No, any extention of
drm_fbdev_cma_set_suspend_unlocked()will not have any impact on driver because with this patch we will be retaining the original suspend/resume logic of the rcar-du driver and further this driver is not going to usedrm_fbdev_cma_set_suspend_unlocked().My point is that if the fb cma helpers gets later extended with a feature that need special handling and suspend/resume time, with the
drm_fbdev_cma_set_suspend_unlocked()function properly updated to take that feature into account, driver using those helpers but converted to drm_atomic_helper_suspend/resume() will break.Quoted 14 lines
Quoted 5 lines
At the very
least you should add a comment indrm_fbdev_cma_set_suspend_unlocked()to explain that any extension of the function should also address all drivers usingdrm_mode_config_helper_suspend()anddrm_mode_config_helper_resume().The consumers of
drm_fbdev_cma_set_suspend_unlocked()are -drivers/gpu/drm/arm/hdlcd_drv.cdrivers/gpu/drm/drm_fb_cma_helper.cand both will be converted to use API drm_mode_config_helper_suspend/resume(). As there will be no more consumer of
drm_fbdev_cma_set_suspend_unlocked(), we can remove this wrapper API forever :)
Quoted 8 lines
Quoted 4 lines
OK, if you remove the function completely then anyone wanting to extend the fbdev cma helpers in the way described above will notice that something will need to be done, so it's fine. Please thus make sure that you go all the way to removing that function.
Sure, once both the drivers are converted to use drm_mode_config_helper_suspend/resume() and goes into linus's tree, then we can remove it.
Could we get the two driver changes and the function removal merged all together ?
Quoted 39 lines
But will wait for some more feedback before concluding on this.
Dave/ Daniel, Would you like to add any feedback ?
Quoted 35 lines
Quoted 35 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
And from git grep it seems that there are very few drivers using it at the moment, so not sure if introducing new API functions similar to
drm_mode_configwill make sense or not.https://www.kernel.org/doc/html/latest/gpu/todo.html
It was picked up from TODO list after discussing with Daniel.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct · line 377
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-5-drm_kms_helper_poll_enable (rcdu->ddev); -return PTR_ERR (state); - } - - rcdu->suspend_state = state;Additionally, I think you can remove the
suspend_statefield from the rcdu structure.Sure, I will remove it in v2.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2
-6- return 0; + return drm_mode_config_helper_suspend(rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - -return 0 ; +return drm_mode_config_helper_resume (rcdu->ddev); }#endif
Signature · 10 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 91 lines · Laurent Pinchart
Hi Souptick,
Quoted 88 lines · On Monday, 30 July 2018 18:13:13 EEST Souptick Joarder wrote:
Quoted 86 lines · Laurent Pinchart
Quoted 51 lines · On Monday, 30 July 2018 16:58:09 EEST Souptick Joarder wrote:
Quoted 50 lines · Laurent Pinchart
Quoted 48 lines · On Saturday, 28 July 2018 21:50:58 EEST Souptick Joarder wrote:
Quoted 30 lines · Vaishali Thakkar
Quoted 2 lines · Souptick Joarder
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().Hi Souptick,
Thanks for your patch.
Quoted 22 lines
Signed-off-by Souptick Joarder <[email protected]>Signed-off-by Ajit Negi <[email protected]>---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/rcar-du/rcar_du_drv.cindex 02aee6c..288220f 100644drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-1@@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state;Quoted 10 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct · line 365
Quoted 7 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-6-drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false);I don't think we can use
drm_mode_config_helper_(suspend/resume)API here as this file uses CMA functions.
drm_fbdev_cma_set_suspend_unlocked()is wrapper function which invokesdrm_fb_helper_set_suspend_unlocked().Where the new API drm_mode_config_helper_suspend/resume() directly invokes
drm_fb_helper_set_suspend_unlocked(). So it is safe to replace exiting code with API drm_mode_config_helper_suspend/resume().Quoted 8 lines
Quoted 3 lines
I agree that they're functionally equivalent for now, but what if
drm_fbdev_cma_set_suspend_unlocked()gets extended later ? This change risks introducing a breakage that could could unnoticed at that point.No, any extention of
drm_fbdev_cma_set_suspend_unlocked()will not have any impact on driver because with this patch we will be retaining the original suspend/resume logic of the rcar-du driver and further this driver is not going to usedrm_fbdev_cma_set_suspend_unlocked().My point is that if the fb cma helpers gets later extended with a feature that need special handling and suspend/resume time, with the
drm_fbdev_cma_set_suspend_unlocked()function properly updated to take that feature into account, driver using those helpers but converted to drm_atomic_helper_suspend/resume() will break.Quoted 6 lines
Quoted 5 lines
At the very
least you should add a comment indrm_fbdev_cma_set_suspend_unlocked()to explain that any extension of the function should also address all drivers usingdrm_mode_config_helper_suspend()anddrm_mode_config_helper_resume().Quoted 8 lines
The consumers of
drm_fbdev_cma_set_suspend_unlocked()are -drivers/gpu/drm/arm/hdlcd_drv.cdrivers/gpu/drm/drm_fb_cma_helper.cand both will be converted to use API drm_mode_config_helper_suspend/resume(). As there will be no more consumer of
drm_fbdev_cma_set_suspend_unlocked(), we can remove this wrapper API forever :)OK, if you remove the function completely then anyone wanting to extend the fbdev cma helpers in the way described above will notice that something will need to be done, so it's fine. Please thus make sure that you go all the way to removing that function.
Quoted 6 lines
Quoted 3 lines
Sure, once both the drivers are converted to use drm_mode_config_helper_suspend/resume() and goes into linus's tree, then we can remove it.
Could we get the two driver changes and the function removal merged all together ?
Sure, I will send it.
Quoted 48 lines
Quoted 40 lines
But will wait for some more feedback before concluding on this.
Dave/ Daniel, Would you like to add any feedback ?
Quoted 35 lines
Quoted 35 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
And from git grep it seems that there are very few drivers using it at the moment, so not sure if introducing new API functions similar to
drm_mode_configwill make sense or not.https://www.kernel.org/doc/html/latest/gpu/todo.html
It was picked up from TODO list after discussing with Daniel.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c static void rcar_du_lastclose(struct · line 377
Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-5-drm_kms_helper_poll_enable (rcdu->ddev); -return PTR_ERR (state); - } - - rcdu->suspend_state = state;Additionally, I think you can remove the
suspend_statefield from the rcdu structure.Sure, I will remove it in v2.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +2
-6- return 0; + return drm_mode_config_helper_suspend(rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); - -return 0 ; +return drm_mode_config_helper_resume (rcdu->ddev); }#endif --
Regards,Laurent Pinchart