From: ChiHun Won Date: Sat, 7 Jul 2018 03:36:03 +0000 (+0900) Subject: fbdev: dpu20: added acquire fence logging X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=032caa9ddca3a8fed04924f56cb59e5cdf7e4808;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git fbdev: dpu20: added acquire fence logging Change-Id: I6aba0ba31c43aa16579ad4f5829213dae1cc742c Signed-off-by: ChiHun Won --- diff --git a/drivers/video/fbdev/exynos/dpu20/decon.h b/drivers/video/fbdev/exynos/dpu20/decon.h index a208d4b70cce..b83f35b22e51 100644 --- a/drivers/video/fbdev/exynos/dpu20/decon.h +++ b/drivers/video/fbdev/exynos/dpu20/decon.h @@ -493,6 +493,7 @@ typedef enum dpu_event_type { DPU_EVT_DSIM_COMMAND, DPU_EVT_TRIG_MASK, DPU_EVT_TRIG_UNMASK, + DPU_EVT_FENCE_ACQUIRE, DPU_EVT_FENCE_RELEASE, DPU_EVT_DECON_FRAMEDONE_WAIT, DPU_EVT_DECON_SHUTDOWN, @@ -551,7 +552,9 @@ struct disp_log_cursor { }; /* Related with Fence */ +#define ACQ_FENCE_LEN 40 struct disp_log_fence { + char acq_fence[MAX_DECON_WIN][ACQ_FENCE_LEN]; u32 timeline_value; int timeline_max; }; @@ -642,6 +645,8 @@ void DPU_EVENT_LOG_WINUP_FLAGS(struct v4l2_subdev *sd, bool need_update, bool reconfigure); void DPU_EVENT_LOG_APPLY_REGION(struct v4l2_subdev *sd, struct decon_rect *apl_rect); +void DPU_EVENT_LOG_FENCE(struct v4l2_subdev *sd, + struct decon_reg_data *regs, dpu_event_t type); void DPU_EVENT_SHOW(struct seq_file *s, struct decon_device *decon); int decon_create_debugfs(struct decon_device *decon); void decon_destroy_debugfs(struct decon_device *decon); diff --git a/drivers/video/fbdev/exynos/dpu20/decon_core.c b/drivers/video/fbdev/exynos/dpu20/decon_core.c index 16f2875bd50f..5f63d2023f8b 100644 --- a/drivers/video/fbdev/exynos/dpu20/decon_core.c +++ b/drivers/video/fbdev/exynos/dpu20/decon_core.c @@ -2078,6 +2078,9 @@ static void decon_update_regs(struct decon_device *decon, decon_acquire_old_bufs(decon, regs, old_dma_bufs, old_plane_cnt); decon_systrace(decon, 'C', "decon_fence_wait", 1); + + DPU_EVENT_LOG_FENCE(&decon->sd, regs, DPU_EVT_FENCE_ACQUIRE); + for (i = 0; i < decon->dt.max_win; i++) { if (regs->dma_buf_data[i][0].fence) decon_wait_fence(regs->dma_buf_data[i][0].fence); diff --git a/drivers/video/fbdev/exynos/dpu20/event_log.c b/drivers/video/fbdev/exynos/dpu20/event_log.c index 56cb1c92b1cf..95a193552be1 100644 --- a/drivers/video/fbdev/exynos/dpu20/event_log.c +++ b/drivers/video/fbdev/exynos/dpu20/event_log.c @@ -475,6 +475,43 @@ void DPU_EVENT_LOG_APPLY_REGION(struct v4l2_subdev *sd, log->data.winup.apl_region.h = apl_rect->bottom - apl_rect->top + 1; } +void DPU_EVENT_LOG_FENCE(struct v4l2_subdev *sd, + struct decon_reg_data *regs, dpu_event_t type) +{ + struct decon_device *decon = container_of(sd, struct decon_device, sd); + int idx = atomic_inc_return(&decon->d.event_log_idx) % DPU_EVENT_LOG_MAX; + struct dpu_log *log = &decon->d.event_log[idx]; + int win = 0; + struct dma_fence *fence = NULL; + static int fence_log_cnt; + + log->time = ktime_get(); + log->type = type; + + if (++fence_log_cnt < (DPU_EVENT_LOG_MAX/2)) + return; + + --fence_log_cnt; + +#if !defined(CONFIG_SUPPORT_LEGACY_FENCE) + for (win = 0; win < decon->dt.max_win; win++) { + log->data.fence.acq_fence[win][0] = '\0'; + fence = regs->dma_buf_data[win][0].fence; + if (fence) { + snprintf(&log->data.fence.acq_fence[win][0], ACQ_FENCE_LEN, "%p:%s", + fence, fence->ops->get_driver_name(fence)); + } + } + + log->data.fence.timeline_value = atomic_read(&decon->fence.timeline); + log->data.fence.timeline_max = atomic_read(&decon->fence.timeline); +#else + log->data.fence.timeline_value = decon->timeline->value; + log->data.fence.timeline_max = decon->timeline_max; +#endif +} + + /* display logged events related with DECON */ void DPU_EVENT_SHOW(struct seq_file *s, struct decon_device *decon) { @@ -586,6 +623,9 @@ void DPU_EVENT_SHOW(struct seq_file *s, struct decon_device *decon) case DPU_EVT_TRIG_UNMASK: seq_printf(s, "%20s %20s", "TRIG_UNMASK", "-\n"); break; + case DPU_EVT_FENCE_ACQUIRE: + seq_printf(s, "%20s %20s", "FENCE_ACQUIRE", "-\n"); + break; case DPU_EVT_FENCE_RELEASE: seq_printf(s, "%20s %20s", "FENCE_RELEASE", "-\n"); break; diff --git a/drivers/video/fbdev/exynos/dpu20/fence.c b/drivers/video/fbdev/exynos/dpu20/fence.c index 9ff08bed09ef..d10f39c5241d 100644 --- a/drivers/video/fbdev/exynos/dpu20/fence.c +++ b/drivers/video/fbdev/exynos/dpu20/fence.c @@ -16,7 +16,6 @@ #include "decon.h" -#define ACQ_FENCE_LEN 40 char acq_fence_log[ACQ_FENCE_LEN]; #if defined(CONFIG_SUPPORT_LEGACY_FENCE)