[Openpvrsgx-devgroup] [PATCH] drm: pvrsgx: Force enable limited runtime PM support for ddk 1.17
H. Nikolaus Schaller
hns at goldelico.com
Mon Dec 14 09:54:26 CET 2020
Hi Tony,
thanks!
I have added it to the tree (but not yet pushed to the repo - will do with 5.11-rc1 rebase).
BR,
Nikolaus
> Am 13.12.2020 um 08:48 schrieb Tony Lindgren <tony at atomide.com>:
>
> We want to have the sgx clock disabled when the screen blanks for power
> management. For ddk-1.17, the option for SUPPORT_ACTIVE_POWER_MANAGEMENT
> has been disabled as it was probably enabling more PM than just gating the
> clock when blanking the screen for the userspace blobs.
>
> To gate the sgx clock on screen blank, we need to enable the option for
> SUPPORT_ACTIVE_POWER_MANAGEMENT for the kernel driver, but not advertise
> it for the userspace blobs. Otherwise we get:
>
> PVR_K: Extra options present in KM: (0x8000). Please check sgx_options.h
>
> We also need SYS_USING_INTERRUPTS as otherwise sgx won't get idled if we
> have SUPPORT_ACTIVE_POWER_MANAGEMENT enabled.
>
> This seems to work just fine for PM as tested on droid4 with sway running
> after some experimental wlroots patches. Then hopefully eventually we can
> just have the option enabled for SUPPORT_ACTIVE_POWER_MANAGEMENT for all
> the SoCs and blobs.
>
> Cc: David Shah <dave at ds0.me>
> Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75 at gmail.com>
> Cc: Jonathan Bakker <xc-racer2 at live.ca>
> Cc: Merlijn Wajer <merlijn at wizzup.org>
> Cc: Sebastian Reichel <sre at kernel.org>
> Cc: ruleh <ruleh at gmx.de>
> Cc: Carl Philipp Klemm <philipp at uvos.xyz>
> Signed-off-by: Tony Lindgren <tony at atomide.com>
> ---
> .../drm/pvrsgx/1.17.4948957/eurasia_km/Makefile | 6 +++---
> .../eurasia_km/include4/sgx_options.h | 9 +--------
> .../services4/system/omap/sysutils_linux.c | 15 ++-------------
> 3 files changed, 6 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/Makefile b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/Makefile
> --- a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/Makefile
> +++ b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/Makefile
> @@ -127,7 +127,9 @@ ccflags-y += \
> -DSYS_CUSTOM_POWERLOCK_WRAP \
> -DPVR_NO_FULL_CACHE_OPS \
> -DSGX_CLK_CORE_DIV5 \
> - -DSUPPORT_SGX_NEW_STATUS_VALS
> + -DSUPPORT_SGX_NEW_STATUS_VALS \
> + -DSYS_USING_INTERRUPTS \
> + -DSUPPORT_ACTIVE_POWER_MANAGEMENT
>
> # new for ddk 1.14 tree
> ccflags-y += \
> @@ -216,7 +218,6 @@ ccflags-y += -DSGX_FEATURE_MP_CORE_COUNT=2
> ccflags-y += -DSGX_FEATURE_SYSTEM_CACHE # assumed by client libs
> ccflags-n += -DSYS_OMAP_HAS_DVFS_FRAMEWORK # sgxfreq extension
> # may be broken...
> -#ccflags-y += -DSUPPORT_ACTIVE_POWER_MANAGEMENT
> ccflags-y += -DAMVERSION=5
> # PVR_OMAPLFB_DRM_FB := 0
> endif
> @@ -236,7 +237,6 @@ ccflags-y += -DMODULE # this disables some code in AcquireGPTimer in sysutils_li
> ccflags-y += -DSUPPORT_DMABUF
>
> # these must not be set or we can't compile successfully for omap
> -ccflags-n += -DSYS_USING_INTERRUPTS # should probably be enabled but leads to paging errors, asynchronous external abort
> ccflags-n += -DSUPPORT_DRI_DRM_EXT
> ccflags-n += -DSUPPORT_DRI_DRM_PLUGIN
> ccflags-n += -DPVR_DISPLAY_CONTROLLER_DRM_IOCTL
> diff --git a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/include4/sgx_options.h b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/include4/sgx_options.h
> --- a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/include4/sgx_options.h
> +++ b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/include4/sgx_options.h
> @@ -148,14 +148,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> #define OPTIONS_BIT14 0x0
> #endif /* SGX_SUPPORT_HWPROFILING */
>
> -
> -
> -#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT) || defined (INTERNAL_TEST)
> -#define SUPPORT_ACTIVE_POWER_MANAGEMENT_SET_OFFSET OPTIONS_BIT15
> -#define OPTIONS_BIT15 (0x1U << 15)
> -#else
> -#define OPTIONS_BIT15 0x0
> -#endif /* SUPPORT_ACTIVE_POWER_MANAGEMENT */
> +#define OPTIONS_BIT15 0x0 /* HACK: missing userspace flag */
>
> #if defined(SUPPORT_DISPLAYCONTROLLER_TILING) || defined (INTERNAL_TEST)
> #define SUPPORT_DISPLAYCONTROLLER_TILING_SET_OFFSET OPTIONS_BIT16
> diff --git a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.c b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.c
> --- a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.c
> +++ b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.c
> @@ -260,13 +260,8 @@ IMG_VOID DisableSGXClocks(SYS_DATA *psSysData)
> SysDisableSGXInterrupts(psSysData);
>
> #if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI)
> - {
> - int res = pm_runtime_put_sync(&gpsPVRLDMDev->dev);
> - if (res < 0)
> - {
> - PVR_DPF((PVR_DBG_ERROR, "DisableSGXClocks: pm_runtime_put_sync failed (%d)", -res));
> - }
> - }
> + pm_runtime_mark_last_busy(&gpsPVRLDMDev->dev);
> + pm_runtime_put_autosuspend(&gpsPVRLDMDev->dev);
> #if defined(SYS_OMAP_HAS_DVFS_FRAMEWORK)
> sgxfreq_notif_sgx_clk_off();
> #endif /* defined(SYS_OMAP_HAS_DVFS_FRAMEWORK) */
> @@ -640,17 +635,11 @@ IMG_VOID DisableSystemClocks(SYS_DATA *psSysData)
>
> PVRSRV_ERROR SysPMRuntimeRegister(void)
> {
> -#if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI)
> - pm_runtime_enable(&gpsPVRLDMDev->dev);
> -#endif
> return PVRSRV_OK;
> }
>
> PVRSRV_ERROR SysPMRuntimeUnregister(void)
> {
> -#if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI)
> - pm_runtime_disable(&gpsPVRLDMDev->dev);
> -#endif
> return PVRSRV_OK;
> }
>
> --
> 2.29.2
More information about the openpvrsgx-devgroup
mailing list