drm/msm: crank down gpu when inactive
Shut down the clks when the gpu has nothing to do. A short inactivity timer is used to provide a low pass filter for power transitions. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
@@ -72,6 +72,10 @@ struct msm_gpu {
|
||||
|
||||
uint32_t submitted_fence;
|
||||
|
||||
/* is gpu powered/active? */
|
||||
int active_cnt;
|
||||
bool inactive;
|
||||
|
||||
/* worker for handling active-list retiring: */
|
||||
struct work_struct retire_work;
|
||||
|
||||
@@ -91,7 +95,12 @@ struct msm_gpu {
|
||||
uint32_t bsc;
|
||||
#endif
|
||||
|
||||
/* Hang Detction: */
|
||||
/* Hang and Inactivity Detection:
|
||||
*/
|
||||
#define DRM_MSM_INACTIVE_PERIOD 66 /* in ms (roughly four frames) */
|
||||
#define DRM_MSM_INACTIVE_JIFFIES msecs_to_jiffies(DRM_MSM_INACTIVE_PERIOD)
|
||||
struct timer_list inactive_timer;
|
||||
struct work_struct inactive_work;
|
||||
#define DRM_MSM_HANGCHECK_PERIOD 500 /* in ms */
|
||||
#define DRM_MSM_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_MSM_HANGCHECK_PERIOD)
|
||||
struct timer_list hangcheck_timer;
|
||||
@@ -99,6 +108,11 @@ struct msm_gpu {
|
||||
struct work_struct recover_work;
|
||||
};
|
||||
|
||||
static inline bool msm_gpu_active(struct msm_gpu *gpu)
|
||||
{
|
||||
return gpu->submitted_fence > gpu->funcs->last_fence(gpu);
|
||||
}
|
||||
|
||||
static inline void gpu_write(struct msm_gpu *gpu, u32 reg, u32 data)
|
||||
{
|
||||
msm_writel(data, gpu->mmio + (reg << 2));
|
||||
|
Reference in New Issue
Block a user