drm/msm/sde: Move some frame_events from crtc commit to event thread

Move frame data stats collection/notification during frame-done and
retire fence sysfs notification to event thread. This will free up
some interrupt time.

Change-Id: I2648ac4287ce8712e9a059edd408a59753aa6d32
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
Signed-off-by: V S Ganga VaraPrasad (VARA) Adabala <quic_vadabala@quicinc.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Veera Sundaram Sankaran 2022-09-01 21:40:58 -07:00 committed by Richard Raya
parent 8e987df038
commit 56d8abf539

View File

@ -2751,8 +2751,6 @@ static void sde_crtc_frame_event_cb(void *data, u32 event)
struct msm_drm_private *priv;
struct sde_crtc_frame_event *fevent;
struct sde_crtc_frame_event_cb_data *cb_data;
struct drm_plane *plane;
u32 ubwc_error;
unsigned long flags;
u32 crtc_id;
@ -2782,30 +2780,11 @@ static void sde_crtc_frame_event_cb(void *data, u32 event)
spin_unlock_irqrestore(&sde_crtc->spin_lock, flags);
if (!fevent) {
SDE_ERROR("crtc%d event %d overflow\n",
crtc->base.id, event);
SDE_ERROR("crtc%d event %d overflow\n", DRMID(crtc), event);
SDE_EVT32(DRMID(crtc), event);
return;
}
/* log and clear plane ubwc errors if any */
if (event & (SDE_ENCODER_FRAME_EVENT_ERROR
| SDE_ENCODER_FRAME_EVENT_PANEL_DEAD
| SDE_ENCODER_FRAME_EVENT_DONE)) {
drm_for_each_plane_mask(plane, crtc->dev,
sde_crtc->plane_mask_old) {
ubwc_error = sde_plane_get_ubwc_error(plane);
if (ubwc_error) {
SDE_EVT32(DRMID(crtc), DRMID(plane),
ubwc_error, SDE_EVTLOG_ERROR);
SDE_DEBUG("crtc%d plane %d ubwc_error %d\n",
DRMID(crtc), DRMID(plane),
ubwc_error);
sde_plane_clear_ubwc_error(plane);
}
}
}
fevent->event = event;
fevent->crtc = crtc;
fevent->connector = cb_data->connector;
@ -2957,6 +2936,9 @@ static void sde_crtc_frame_event_work(struct kthread_work *work)
struct sde_kms *sde_kms;
unsigned long flags;
bool in_clone_mode = false;
int ret;
struct drm_plane *plane;
u32 ubwc_error;
if (!work) {
SDE_ERROR("invalid work handle\n");
@ -2990,6 +2972,28 @@ static void sde_crtc_frame_event_work(struct kthread_work *work)
if (!in_clone_mode && (fevent->event & (SDE_ENCODER_FRAME_EVENT_ERROR
| SDE_ENCODER_FRAME_EVENT_PANEL_DEAD
| SDE_ENCODER_FRAME_EVENT_DONE))) {
ret = pm_runtime_resume(crtc->dev->dev);
if (ret < 0) {
SDE_ERROR("failed to enable power resource %d\n", ret);
SDE_EVT32(ret, SDE_EVTLOG_ERROR);
} else {
/* log and clear plane ubwc errors if any */
drm_for_each_plane_mask(plane, crtc->dev,
sde_crtc->plane_mask_old) {
ubwc_error = sde_plane_get_ubwc_error(plane);
if (ubwc_error) {
SDE_EVT32(DRMID(crtc), DRMID(plane),
ubwc_error, SDE_EVTLOG_ERROR);
SDE_DEBUG("crtc%d plane %d ubwc_error %d\n",
DRMID(crtc), DRMID(plane),
ubwc_error);
sde_plane_clear_ubwc_error(plane);
}
}
pm_runtime_put_sync(crtc->dev->dev);
}
if (atomic_read(&sde_crtc->frame_pending) < 1) {
/* this should not happen */
SDE_ERROR("crtc%d ts:%lld invalid frame_pending:%d\n",
@ -3020,11 +3024,12 @@ static void sde_crtc_frame_event_work(struct kthread_work *work)
SDE_ATRACE_END("signal_release_fence");
}
if (fevent->event & SDE_ENCODER_FRAME_EVENT_SIGNAL_RETIRE_FENCE)
if (fevent->event & SDE_ENCODER_FRAME_EVENT_SIGNAL_RETIRE_FENCE) {
/* this api should be called without spin_lock */
_sde_crtc_retire_event(fevent->connector, fevent->ts,
(fevent->event & SDE_ENCODER_FRAME_EVENT_ERROR)
? SDE_FENCE_SIGNAL_ERROR : SDE_FENCE_SIGNAL);
}
if (fevent->event & SDE_ENCODER_FRAME_EVENT_PANEL_DEAD)
SDE_ERROR("crtc%d ts:%lld received panel dead event\n",