Commit 7a007a12 authored by Bruce Wang's avatar Bruce Wang Committed by Rob Clark

drm/msm/dpu: Remove suspend state tracking from crtc

Since drm core's modeset locks serialize atomic commits, we don't need to
track whether or not we're in a suspended state from inside the crtc for
dpu_crtc_enable/disable. This patch removes the suspend logic from the crtc and
removes the relevant tracing from dpu_trace. Since we removed all calls
to dpu_kms_is_suspend_state, we can remove that function and the
suspend_state field of dpu_kms as well.

v2: added patch to patchset
v3: reworded commit body and moved deletion of dpu_kms_is_suspend_state and
suspend_state to this patch
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarBruce Wang <bzwang@chromium.org>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 3750e78c
...@@ -815,35 +815,6 @@ static void _dpu_crtc_vblank_enable_no_lock( ...@@ -815,35 +815,6 @@ static void _dpu_crtc_vblank_enable_no_lock(
} }
} }
/**
* _dpu_crtc_set_suspend - notify crtc of suspend enable/disable
* @crtc: Pointer to drm crtc object
* @enable: true to enable suspend, false to indicate resume
*/
static void _dpu_crtc_set_suspend(struct drm_crtc *crtc, bool enable)
{
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
DRM_DEBUG_KMS("crtc%d suspend = %d\n", crtc->base.id, enable);
mutex_lock(&dpu_crtc->crtc_lock);
/*
* If the vblank is enabled, release a power reference on suspend
* and take it back during resume (if it is still enabled).
*/
trace_dpu_crtc_set_suspend(DRMID(&dpu_crtc->base), enable, dpu_crtc);
if (dpu_crtc->suspend == enable)
DPU_DEBUG("crtc%d suspend already set to %d, ignoring update\n",
crtc->base.id, enable);
else if (dpu_crtc->enabled && dpu_crtc->vblank_requested) {
_dpu_crtc_vblank_enable_no_lock(dpu_crtc, !enable);
}
dpu_crtc->suspend = enable;
mutex_unlock(&dpu_crtc->crtc_lock);
}
/** /**
* dpu_crtc_duplicate_state - state duplicate hook * dpu_crtc_duplicate_state - state duplicate hook
* @crtc: Pointer to drm crtc structure * @crtc: Pointer to drm crtc structure
...@@ -951,9 +922,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) ...@@ -951,9 +922,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
DRM_DEBUG_KMS("crtc%d\n", crtc->base.id); DRM_DEBUG_KMS("crtc%d\n", crtc->base.id);
if (dpu_kms_is_suspend_state(crtc->dev))
_dpu_crtc_set_suspend(crtc, true);
/* Disable/save vblank irq handling */ /* Disable/save vblank irq handling */
drm_crtc_vblank_off(crtc); drm_crtc_vblank_off(crtc);
...@@ -966,8 +934,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) ...@@ -966,8 +934,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
atomic_read(&dpu_crtc->frame_pending)); atomic_read(&dpu_crtc->frame_pending));
trace_dpu_crtc_disable(DRMID(crtc), false, dpu_crtc); trace_dpu_crtc_disable(DRMID(crtc), false, dpu_crtc);
if (dpu_crtc->enabled && !dpu_crtc->suspend && if (dpu_crtc->enabled && dpu_crtc->vblank_requested) {
dpu_crtc->vblank_requested) {
_dpu_crtc_vblank_enable_no_lock(dpu_crtc, false); _dpu_crtc_vblank_enable_no_lock(dpu_crtc, false);
} }
dpu_crtc->enabled = false; dpu_crtc->enabled = false;
...@@ -1033,8 +1000,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, ...@@ -1033,8 +1000,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
mutex_lock(&dpu_crtc->crtc_lock); mutex_lock(&dpu_crtc->crtc_lock);
trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc); trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
if (!dpu_crtc->enabled && !dpu_crtc->suspend && if (!dpu_crtc->enabled && dpu_crtc->vblank_requested) {
dpu_crtc->vblank_requested) {
_dpu_crtc_vblank_enable_no_lock(dpu_crtc, true); _dpu_crtc_vblank_enable_no_lock(dpu_crtc, true);
} }
dpu_crtc->enabled = true; dpu_crtc->enabled = true;
...@@ -1289,17 +1255,11 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, ...@@ -1289,17 +1255,11 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
int dpu_crtc_vblank(struct drm_crtc *crtc, bool en) int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
{ {
struct dpu_crtc *dpu_crtc; struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
if (!crtc) {
DPU_ERROR("invalid crtc\n");
return -EINVAL;
}
dpu_crtc = to_dpu_crtc(crtc);
mutex_lock(&dpu_crtc->crtc_lock); mutex_lock(&dpu_crtc->crtc_lock);
trace_dpu_crtc_vblank(DRMID(&dpu_crtc->base), en, dpu_crtc); trace_dpu_crtc_vblank(DRMID(&dpu_crtc->base), en, dpu_crtc);
if (dpu_crtc->enabled && !dpu_crtc->suspend) { if (dpu_crtc->enabled) {
_dpu_crtc_vblank_enable_no_lock(dpu_crtc, en); _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en);
} }
dpu_crtc->vblank_requested = en; dpu_crtc->vblank_requested = en;
......
...@@ -133,7 +133,6 @@ struct dpu_crtc_frame_event { ...@@ -133,7 +133,6 @@ struct dpu_crtc_frame_event {
* @play_count : frame count between crtc enable and disable * @play_count : frame count between crtc enable and disable
* @vblank_cb_time : ktime at vblank count reset * @vblank_cb_time : ktime at vblank count reset
* @vblank_requested : whether the user has requested vblank events * @vblank_requested : whether the user has requested vblank events
* @suspend : whether or not a suspend operation is in progress
* @enabled : whether the DPU CRTC is currently enabled. updated in the * @enabled : whether the DPU CRTC is currently enabled. updated in the
* commit-thread, not state-swap time which is earlier, so * commit-thread, not state-swap time which is earlier, so
* safe to make decisions on during VBLANK on/off work * safe to make decisions on during VBLANK on/off work
...@@ -169,7 +168,6 @@ struct dpu_crtc { ...@@ -169,7 +168,6 @@ struct dpu_crtc {
u64 play_count; u64 play_count;
ktime_t vblank_cb_time; ktime_t vblank_cb_time;
bool vblank_requested; bool vblank_requested;
bool suspend;
bool enabled; bool enabled;
struct list_head feature_list; struct list_head feature_list;
......
...@@ -135,9 +135,6 @@ struct dpu_kms { ...@@ -135,9 +135,6 @@ struct dpu_kms {
struct dpu_core_perf perf; struct dpu_core_perf perf;
/* saved atomic state during system suspend */
struct drm_atomic_state *suspend_state;
struct dpu_rm rm; struct dpu_rm rm;
bool rm_init; bool rm_init;
...@@ -162,19 +159,6 @@ struct vsync_info { ...@@ -162,19 +159,6 @@ struct vsync_info {
#define ddev_to_msm_kms(D) ((D) && (D)->dev_private ? \ #define ddev_to_msm_kms(D) ((D) && (D)->dev_private ? \
((struct msm_drm_private *)((D)->dev_private))->kms : NULL) ((struct msm_drm_private *)((D)->dev_private))->kms : NULL)
/**
* dpu_kms_is_suspend_state - whether or not the system is pm suspended
* @dev: Pointer to drm device
* Return: Suspend status
*/
static inline bool dpu_kms_is_suspend_state(struct drm_device *dev)
{
if (!ddev_to_msm_kms(dev))
return false;
return to_dpu_kms(ddev_to_msm_kms(dev))->suspend_state != NULL;
}
/** /**
* Debugfs functions - extra helper functions for debugfs support * Debugfs functions - extra helper functions for debugfs support
* *
......
...@@ -749,7 +749,6 @@ TRACE_EVENT(dpu_crtc_vblank_enable, ...@@ -749,7 +749,6 @@ TRACE_EVENT(dpu_crtc_vblank_enable,
__field( uint32_t, enc_id ) __field( uint32_t, enc_id )
__field( bool, enable ) __field( bool, enable )
__field( bool, enabled ) __field( bool, enabled )
__field( bool, suspend )
__field( bool, vblank_requested ) __field( bool, vblank_requested )
), ),
TP_fast_assign( TP_fast_assign(
...@@ -757,15 +756,12 @@ TRACE_EVENT(dpu_crtc_vblank_enable, ...@@ -757,15 +756,12 @@ TRACE_EVENT(dpu_crtc_vblank_enable,
__entry->enc_id = enc_id; __entry->enc_id = enc_id;
__entry->enable = enable; __entry->enable = enable;
__entry->enabled = crtc->enabled; __entry->enabled = crtc->enabled;
__entry->suspend = crtc->suspend;
__entry->vblank_requested = crtc->vblank_requested; __entry->vblank_requested = crtc->vblank_requested;
), ),
TP_printk("id:%u encoder:%u enable:%s state{enabled:%s suspend:%s " TP_printk("id:%u encoder:%u enable:%s state{enabled:%s vblank_req:%s}",
"vblank_req:%s}",
__entry->drm_id, __entry->enc_id, __entry->drm_id, __entry->enc_id,
__entry->enable ? "true" : "false", __entry->enable ? "true" : "false",
__entry->enabled ? "true" : "false", __entry->enabled ? "true" : "false",
__entry->suspend ? "true" : "false",
__entry->vblank_requested ? "true" : "false") __entry->vblank_requested ? "true" : "false")
); );
...@@ -776,26 +772,19 @@ DECLARE_EVENT_CLASS(dpu_crtc_enable_template, ...@@ -776,26 +772,19 @@ DECLARE_EVENT_CLASS(dpu_crtc_enable_template,
__field( uint32_t, drm_id ) __field( uint32_t, drm_id )
__field( bool, enable ) __field( bool, enable )
__field( bool, enabled ) __field( bool, enabled )
__field( bool, suspend )
__field( bool, vblank_requested ) __field( bool, vblank_requested )
), ),
TP_fast_assign( TP_fast_assign(
__entry->drm_id = drm_id; __entry->drm_id = drm_id;
__entry->enable = enable; __entry->enable = enable;
__entry->enabled = crtc->enabled; __entry->enabled = crtc->enabled;
__entry->suspend = crtc->suspend;
__entry->vblank_requested = crtc->vblank_requested; __entry->vblank_requested = crtc->vblank_requested;
), ),
TP_printk("id:%u enable:%s state{enabled:%s suspend:%s vblank_req:%s}", TP_printk("id:%u enable:%s state{enabled:%s vblank_req:%s}",
__entry->drm_id, __entry->enable ? "true" : "false", __entry->drm_id, __entry->enable ? "true" : "false",
__entry->enabled ? "true" : "false", __entry->enabled ? "true" : "false",
__entry->suspend ? "true" : "false",
__entry->vblank_requested ? "true" : "false") __entry->vblank_requested ? "true" : "false")
); );
DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_set_suspend,
TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc),
TP_ARGS(drm_id, enable, crtc)
);
DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_enable, DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_enable,
TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc), TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc),
TP_ARGS(drm_id, enable, crtc) TP_ARGS(drm_id, enable, crtc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment