drm/amdgpu/atpx: track whether if this is a hybrid graphics platform
Subsystems (2)
PATCH 1/6 drm/amdgpu/atpx: track whether if this is a hybrid graphics platform
hybrid graphics in this case refers to systems which use the new platform d3 cold ACPI methods as opposed to ATPX for dGPU power control.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -2394,10 +2394,12 @@ bool amdgpu_device_is_px(struct drm_device *dev);void amdgpu_register_atpx_handler (void );void amdgpu_unregister_atpx_handler (void );bool amdgpu_has_atpx_dgpu_power_cntl (void ); +bool amdgpu_is_atpx_hybrid (void );#else static inline void amdgpu_register_atpx_handler (void ) {}static inline void amdgpu_unregister_atpx_handler (void ) {}static inline bool amdgpu_has_atpx_dgpu_power_cntl (void ) {return false; } +static inline bool amdgpu_is_atpx_hybrid (void ) {return false; }#endif /*
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +8 -1
@@ -28,6 +28,7 @@ struct amdgpu_atpx_functions {struct amdgpu_atpx {acpi_handle handle;struct amdgpu_atpx_functions functions; +bool is_hybrid; }; static struct amdgpu_atpx_priv {
@@ -68,6 +69,10 @@ bool amdgpu_has_atpx_dgpu_power_cntl(void) {return amdgpu_atpx_priv.atpx.functions.power_cntl; } +bool amdgpu_is_atpx_hybrid (void ) { +return amdgpu_atpx_priv.atpx.is_hybrid; +} +/** * amdgpu_atpx_call - call an ATPX method *
@@ -192,9 +197,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED)) atpx->functions.power_cntl = true; + atpx->is_hybrid = false;if (valid_bits &ATPX_MS_HYBRID_GFX_SUPPORTED ) { -printk ("Hybrid Graphics, ATPX dGPU power cntl disabled\n" ); +printk ("ATPX Hybrid Graphics\n" ); atpx->functions.power_cntl = false; + atpx->is_hybrid = true; }return 0 ;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/6 drm/amdgpu/atpx: hybrid platforms use d3cold
The platform d3 cold is used to power down the dGPU.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
@@ -417,7 +417,9 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)pci_save_state (pdev);pci_disable_device (pdev);pci_ignore_hotplug (pdev); -if (amdgpu_has_atpx_dgpu_power_cntl ()) +if (amdgpu_is_atpx_hybrid ()) +pci_set_power_state (pdev, PCI_D3cold); +else if (amdgpu_has_atpx_dgpu_power_cntl ())pci_set_power_state (pdev, PCI_D3cold);else pci_set_power_state (pdev, PCI_D3hot);
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/6 drm/amdgpu: drop explicit pci D3/D0 setting for ATPX power control
In reply to Alex DeucherThe ATPX power control method does this for you.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -4
@@ -419,9 +419,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)pci_ignore_hotplug (pdev);if (amdgpu_is_atpx_hybrid ())pci_set_power_state (pdev, PCI_D3cold); -else if (amdgpu_has_atpx_dgpu_power_cntl ()) -pci_set_power_state (pdev, PCI_D3cold); -else +else if (!amdgpu_has_atpx_dgpu_power_cntl ())pci_set_power_state (pdev, PCI_D3hot); drm_dev->switch_power_state =DRM_SWITCH_POWER_DYNAMIC_OFF ;
@@ -439,7 +437,9 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) drm_dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ; -pci_set_power_state (pdev,PCI_D0 ); +if (amdgpu_is_atpx_hybrid () || + !amdgpu_has_atpx_dgpu_power_cntl ()) +pci_set_power_state (pdev,PCI_D0 );pci_restore_state (pdev); ret =pci_enable_device (pdev);if (ret)
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/6] drm/amdgpu: drop explicit pci D3/D0 setting for ATPX power control
Quoted 12 lines · Alex Deucher
The ATPX power control method does this for you.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_runtime_suspend(struct device *dev) · line 422
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-3@@ -419,9 +419,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)pci_ignore_hotplug (pdev);if (amdgpu_is_atpx_hybrid ())pci_set_power_state (pdev, PCI_D3cold); -else if (amdgpu_has_atpx_dgpu_power_cntl ()) -pci_set_power_state (pdev, PCI_D3cold); -else +else if (!amdgpu_has_atpx_dgpu_power_cntl ())
You're removing code that you added yesterday:
https://lists.freedesktop.org/archives/dri-devel/2016-June/109245.html
Why are you doing this?
Lukas
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3
-1pci_set_power_state (pdev, PCI_D3hot); drm_dev->switch_power_state =DRM_SWITCH_POWER_DYNAMIC_OFF ;@@ -439,7 +437,9 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) drm_dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ; -pci_set_power_state (pdev,PCI_D0 ); +if (amdgpu_is_atpx_hybrid () || + !amdgpu_has_atpx_dgpu_power_cntl ()) +pci_set_power_state (pdev,PCI_D0 );pci_restore_state (pdev); ret =pci_enable_device (pdev);if (ret)Signature · 6 lines
2.5.5 _______________________________________________ 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
Re: [PATCH 3/6] drm/amdgpu: drop explicit pci D3/D0 setting for ATPX power control
Quoted 24 lines · Lukas Wunner
Quoted 12 lines · Alex Deucher
The ATPX power control method does this for you.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_runtime_suspend(struct device *dev) · line 422
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-3@@ -419,9 +419,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)pci_ignore_hotplug (pdev);if (amdgpu_is_atpx_hybrid ())pci_set_power_state (pdev, PCI_D3cold); -else if (amdgpu_has_atpx_dgpu_power_cntl ()) -pci_set_power_state (pdev, PCI_D3cold); -else +else if (!amdgpu_has_atpx_dgpu_power_cntl ())You're removing code that you added yesterday:
https://lists.freedesktop.org/archives/dri-devel/2016-June/109245.html
Quoted 1 line
Why are you doing this?
To avoid changing behavior in intermediate steps to avoid breaking multiple platforms in one patch. The original behavior before this patch set was set d3cold unconditionally. The previous change set d3hot for systems without ATPX power control, and finally this patch removes setting d3cold for systems with ATPX power control.
Alex
Quoted 20 lines
Lukas
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3
-2pci_set_power_state (pdev, PCI_D3hot); drm_dev->switch_power_state =DRM_SWITCH_POWER_DYNAMIC_OFF ;@@ -439,7 +437,9 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) drm_dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ; -pci_set_power_state (pdev,PCI_D0 ); +if (amdgpu_is_atpx_hybrid () || + !amdgpu_has_atpx_dgpu_power_cntl ()) +pci_set_power_state (pdev,PCI_D0 );pci_restore_state (pdev); ret =pci_enable_device (pdev);if (ret) --2.5.5
Quoted 4 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
Re: [PATCH 3/6] drm/amdgpu: drop explicit pci D3/D0 setting for ATPX power control
Quoted 25 lines · Alex Deucher
Quoted 24 lines · Lukas Wunner
Quoted 12 lines · Alex Deucher
The ATPX power control method does this for you.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pmops_runtime_suspend(struct device *dev) · line 422
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-3@@ -419,9 +419,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)pci_ignore_hotplug (pdev);if (amdgpu_is_atpx_hybrid ())pci_set_power_state (pdev, PCI_D3cold); -else if (amdgpu_has_atpx_dgpu_power_cntl ()) -pci_set_power_state (pdev, PCI_D3cold); -else +else if (!amdgpu_has_atpx_dgpu_power_cntl ())You're removing code that you added yesterday:
https://lists.freedesktop.org/archives/dri-devel/2016-June/109245.html
Quoted 7 lines
Quoted 1 line
Why are you doing this?
To avoid changing behavior in intermediate steps to avoid breaking multiple platforms in one patch. The original behavior before this patch set was set d3cold unconditionally. The previous change set d3hot for systems without ATPX power control, and finally this patch removes setting d3cold for systems with ATPX power control.
Thank you for the explanation, I was trying to make sense of this but kept scratching my head. It would be good to have the explanation in the commit message(s), they're fairly terse. (In this patch it's just a one-liner.)
Best regards,
Lukas
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3
-2pci_set_power_state (pdev, PCI_D3hot); drm_dev->switch_power_state =DRM_SWITCH_POWER_DYNAMIC_OFF ;@@ -439,7 +437,9 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) drm_dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ; -pci_set_power_state (pdev,PCI_D0 ); +if (amdgpu_is_atpx_hybrid () || + !amdgpu_has_atpx_dgpu_power_cntl ()) +pci_set_power_state (pdev,PCI_D0 );pci_restore_state (pdev); ret =pci_enable_device (pdev);if (ret) --2.5.5
Quoted 4 lines
Quoted 4 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
PATCH 4/6 drm/radeon/atpx: track whether if this is a hybrid graphics platform
In reply to Alex Deucherhybrid graphics in this case refers to systems which use the new platform d3 cold ACPI methods as opposed to ATPX for dGPU power control.
--- drivers/gpu/drm/radeon/radeon_atpx_handler.c | 9 ++++++++- drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_atpx_handler.c +8 -1
@@ -28,6 +28,7 @@ struct radeon_atpx_functions {struct radeon_atpx {acpi_handle handle;struct radeon_atpx_functions functions; +bool is_hybrid; }; static struct radeon_atpx_priv {
@@ -67,6 +68,10 @@ bool radeon_has_atpx_dgpu_power_cntl(void) {return radeon_atpx_priv.atpx.functions.power_cntl; } +bool radeon_is_atpx_hybrid (void ) { +return radeon_atpx_priv.atpx.is_hybrid; +} +/** * radeon_atpx_call - call an ATPX method *
@@ -190,9 +195,11 @@ static int radeon_atpx_validate(struct radeon_atpx *atpx) ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED)) atpx->functions.power_cntl = true; + atpx->is_hybrid = false;if (valid_bits &ATPX_MS_HYBRID_GFX_SUPPORTED ) { -printk ("Hybrid Graphics, ATPX dGPU power cntl disabled\n" ); +printk ("ATPX Hybrid Graphics\n" ); atpx->functions.power_cntl = false; + atpx->is_hybrid = true; }return 0 ;
drivers/gpu/drm/radeon/radeon_drv.c +2 -0
@@ -166,10 +166,12 @@ void radeon_debugfs_cleanup(struct drm_minor *minor);void radeon_register_atpx_handler (void );void radeon_unregister_atpx_handler (void );bool radeon_has_atpx_dgpu_power_cntl (void ); +bool radeon_is_atpx_hybrid (void );#else static inline void radeon_register_atpx_handler (void ) {}static inline void radeon_unregister_atpx_handler (void ) {}static inline bool radeon_has_atpx_dgpu_power_cntl (void ) {return false; } +static inline bool radeon_is_atpx_hybrid (void ) {return false; }#endif int radeon_no_wb;
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/6 drm/radeon/atpx: hybrid platforms use d3cold
In reply to Alex DeucherThe platform d3 cold is used to power down the dGPU.
--- drivers/gpu/drm/radeon/radeon_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_drv.c +3 -1
@@ -417,7 +417,9 @@ static int radeon_pmops_runtime_suspend(struct device *dev)pci_save_state (pdev);pci_disable_device (pdev);pci_ignore_hotplug (pdev); -if (radeon_has_atpx_dgpu_power_cntl ()) +if (radeon_is_atpx_hybrid ()) +pci_set_power_state (pdev, PCI_D3cold); +else if (radeon_has_atpx_dgpu_power_cntl ())pci_set_power_state (pdev, PCI_D3cold);else pci_set_power_state (pdev, PCI_D3hot);
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/6 drm/radeon: drop explicit pci D3/D0 setting for ATPX power control
In reply to Alex DeucherThe ATPX power control method does this for you.
--- drivers/gpu/drm/radeon/radeon_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +4 -4
@@ -419,9 +419,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev)pci_ignore_hotplug (pdev);if (radeon_is_atpx_hybrid ())pci_set_power_state (pdev, PCI_D3cold); -else if (radeon_has_atpx_dgpu_power_cntl ()) -pci_set_power_state (pdev, PCI_D3cold); -else +else if (!radeon_has_atpx_dgpu_power_cntl ())pci_set_power_state (pdev, PCI_D3hot); drm_dev->switch_power_state =DRM_SWITCH_POWER_DYNAMIC_OFF ;
@@ -439,7 +437,9 @@ static int radeon_pmops_runtime_resume(struct device *dev) drm_dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ; -pci_set_power_state (pdev,PCI_D0 ); +if (radeon_is_atpx_hybrid () || + !radeon_has_atpx_dgpu_power_cntl ()) +pci_set_power_state (pdev,PCI_D0 );pci_restore_state (pdev); ret =pci_enable_device (pdev);if (ret)
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 02.06.2016 um 15:33 schrieb Alex Deucher:
Quoted 5 lines
hybrid graphics in this case refers to systems which use the new platform d3 cold ACPI methods as opposed to ATPX for dGPU power control.
Signed-off-by Alex Deucher <[email protected]>
I'm wondering if I should get deeper into this?
Regards,
Christian.
Quoted 48 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +2
-0@@ -2394,10 +2394,12 @@ bool amdgpu_device_is_px(struct drm_device *dev);void amdgpu_register_atpx_handler (void );void amdgpu_unregister_atpx_handler (void );bool amdgpu_has_atpx_dgpu_power_cntl (void ); +bool amdgpu_is_atpx_hybrid (void );#else static inline void amdgpu_register_atpx_handler (void ) {}static inline void amdgpu_unregister_atpx_handler (void ) {}static inline bool amdgpu_has_atpx_dgpu_power_cntl (void ) {return false; } +static inline bool amdgpu_is_atpx_hybrid (void ) {return false; }#endif /* drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +5
-0@@ -28,6 +28,7 @@ struct amdgpu_atpx_functions {struct amdgpu_atpx {acpi_handle handle;struct amdgpu_atpx_functions functions; +bool is_hybrid; }; static struct amdgpu_atpx_priv {@@ -68,6 +69,10 @@ bool amdgpu_has_atpx_dgpu_power_cntl(void) {return amdgpu_atpx_priv.atpx.functions.power_cntl; } +bool amdgpu_is_atpx_hybrid (void ) { +return amdgpu_atpx_priv.atpx.is_hybrid; +} +/** * amdgpu_atpx_call - call an ATPX method * @@ -192,9 +197,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED)) atpx->functions.power_cntl = true;
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) · line 207
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +3
-1+ atpx->is_hybrid = false;if (valid_bits &ATPX_MS_HYBRID_GFX_SUPPORTED ) { -printk ("Hybrid Graphics, ATPX dGPU power cntl disabled\n" ); +printk ("ATPX Hybrid Graphics\n" ); atpx->functions.power_cntl = false; + atpx->is_hybrid = true; }return 0 ;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel