disp: msm: sde: report AVR_STATUS in vsync_event sysfs node

Report the AVR_STATUS which indicates if there's a pending
trigger when Adaptive Variable Refresh feature is enabled.
This allows SW to detect whether the old frame is repeated
or if the new frame was taken when the trigger is very
close to Vsync.

Change-Id: I6b04482e5c4c3bb92bad426c529c1fd3612d41c3
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
此提交包含在:
Steve Cohen
2021-03-17 17:34:35 -04:00
父節點 3090ffd63f
當前提交 61e6723732
共有 7 個檔案被更改,包括 71 行新增2 行删除

查看文件

@@ -387,6 +387,8 @@ static ssize_t vsync_event_show(struct device *device,
{
struct drm_crtc *crtc;
struct sde_crtc *sde_crtc;
struct drm_encoder *encoder;
int avr_status = -EPIPE;
if (!device || !buf) {
SDE_ERROR("invalid input param(s)\n");
@@ -395,8 +397,21 @@ static ssize_t vsync_event_show(struct device *device,
crtc = dev_get_drvdata(device);
sde_crtc = to_sde_crtc(crtc);
return scnprintf(buf, PAGE_SIZE, "VSYNC=%llu\n",
ktime_to_ns(sde_crtc->vblank_last_cb_time));
mutex_lock(&sde_crtc->crtc_lock);
if (sde_crtc->enabled) {
drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) {
if (sde_encoder_in_clone_mode(encoder))
continue;
avr_status = sde_encoder_get_avr_status(encoder);
break;
}
}
mutex_unlock(&sde_crtc->crtc_lock);
return scnprintf(buf, PAGE_SIZE, "VSYNC=%llu\nAVR_STATUS=%d\n",
ktime_to_ns(sde_crtc->vblank_last_cb_time), avr_status);
}
static ssize_t retire_frame_event_show(struct device *device,