fbdev: dpu20: added acquire fence logging
authorChiHun Won <chihun.won@samsung.com>
Sat, 7 Jul 2018 03:36:03 +0000 (12:36 +0900)
committerjungi.lee <jungilsi.lee@samsung.com>
Tue, 17 Jul 2018 10:50:25 +0000 (19:50 +0900)
Change-Id: I6aba0ba31c43aa16579ad4f5829213dae1cc742c
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
drivers/video/fbdev/exynos/dpu20/decon.h
drivers/video/fbdev/exynos/dpu20/decon_core.c
drivers/video/fbdev/exynos/dpu20/event_log.c
drivers/video/fbdev/exynos/dpu20/fence.c

index a208d4b70cce09cf0a98ab8b768b23292644276f..b83f35b22e5157b2f31d48a911cf9712c7db2dbb 100644 (file)
@@ -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);
index 16f2875bd50f64cdc66d88960c2bcf7ed7e1975a..5f63d2023f8bbafc2c5f5573b888ad37aba8b8e1 100644 (file)
@@ -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);
index 56cb1c92b1cfd8e90fd6bd50adf98bcdf1b24123..95a193552be14ee18c6bfb6e15caceb2562f6545 100644 (file)
@@ -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;
index 9ff08bed09ef1772a374d707510d0720354b59a9..d10f39c5241d5a4cb554b0c3865bd48ce508b89d 100644 (file)
@@ -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)