fbdev: dpu20: AFBC debug patch modified
authorMin Ho Kim <m8891.kim@samsung.com>
Fri, 18 May 2018 11:35:07 +0000 (20:35 +0900)
committerjungi.lee <jungilsi.lee@samsung.com>
Tue, 17 Jul 2018 10:50:39 +0000 (19:50 +0900)
- added sgtables for each afbc channel for the buffer dump
- name change (vgf -> afbc)

Change-Id: I3daa0e361800658c40798316a3bc4212d0973d7a
Signed-off-by: Min Ho Kim <m8891.kim@samsung.com>
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/decon_dsi.c
drivers/video/fbdev/exynos/dpu20/dpp_drv.c
drivers/video/fbdev/exynos/dpu20/helper.c

index b80b4559cb58681e1264c8bbcc7e35201a819d29..78de8fcb81d1079b0e964af0e27f464a92fbd94a 100644 (file)
@@ -732,6 +732,7 @@ struct dpu_afbc_info {
        void *dma_v_addr[MAX_DECON_WIN];
        struct dma_buf *dma_buf[MAX_DECON_WIN];
        bool is_afbc[MAX_DECON_WIN];
+       struct sg_table *sg_table[MAX_DECON_WIN];
 };
 
 struct decon_debug {
@@ -761,7 +762,7 @@ struct decon_debug {
 #else
        struct dma_buf *dmabuf[MAX_DECON_WIN][MAX_PLANE_CNT];
 #endif
-       int prev_vgf_win_id[MAX_DECON_WIN];
+       int prev_afbc_win_id[MAX_DECON_WIN];
 };
 
 struct decon_update_regs {
index 8c4517b4c89cb2cf17917868668338527400bfbf..ebf652f20d303672f540c4dd91509cea37c72a45 100644 (file)
@@ -1589,7 +1589,7 @@ static int decon_set_dpp_config(struct decon_device *decon,
 }
 
 #if defined(CONFIG_EXYNOS_AFBC_DEBUG)
-static void decon_save_vgf_connected_win_id(struct decon_device *decon,
+static void decon_save_afbc_enabled_win_id(struct decon_device *decon,
                struct decon_reg_data *regs)
 {
        int i;
@@ -1597,22 +1597,28 @@ static void decon_save_vgf_connected_win_id(struct decon_device *decon,
        int afbc_enabled;
 
        for (i = 0; i < decon->dt.max_win; ++i)
-               decon->d.prev_vgf_win_id[i] = -1;
+               decon->d.prev_afbc_win_id[i] = -1;
 
        for (i = 0; i < decon->dt.max_win; ++i) {
                if (regs->dpp_config[i].state == DECON_WIN_STATE_BUFFER) {
-                       sd = decon->dpp_sd[DPU_DMA2CH(regs->dpp_config[i].idma_type)];
+                       sd = decon->dpp_sd[DPU_DMA2CH(
+                                       regs->dpp_config[i].idma_type)];
                        afbc_enabled = 0;
                        v4l2_subdev_call(sd, core, ioctl,
                                        DPP_AFBC_ATTR_ENABLED, &afbc_enabled);
+                       /* if afbc enabled, DMA2CH <-> win_id mapping */
                        if (regs->dpp_config[i].compression && afbc_enabled)
-                               decon->d.prev_vgf_win_id[DPU_DMA2CH(regs->dpp_config[i].idma_type)] = i;
+                               decon->d.prev_afbc_win_id[DPU_DMA2CH(
+                                       regs->dpp_config[i].idma_type)] = i;
                        else
-                               decon->d.prev_vgf_win_id[DPU_DMA2CH(regs->dpp_config[i].idma_type)] = -1;
+                               decon->d.prev_afbc_win_id[DPU_DMA2CH(
+                                       regs->dpp_config[i].idma_type)] = -1;
 
-                       decon_dbg("%s:%d win(%d), dma(%d), afbc(%d), save(%d)\n", __func__, __LINE__,
-                                       i, regs->dpp_config[i].idma_type, afbc_enabled,
-                                       decon->d.prev_vgf_win_id[DPU_DMA2CH(regs->dpp_config[i].idma_type)]);
+                       decon_dbg("%s:%d win(%d), dma(%d),\
+                               afbc(%d), save(%d)\n", __func__, __LINE__,
+                               i, regs->dpp_config[i].idma_type, afbc_enabled,
+                               decon->d.prev_afbc_win_id[DPU_DMA2CH(
+                                       regs->dpp_config[i].idma_type)]);
                }
        }
 }
@@ -1627,29 +1633,34 @@ static void decon_dump_afbc_handle(struct decon_device *decon,
 
        decon_info("%s +\n", __func__);
 
-       for (i = 0; i < decon->dt.max_win; i++) {
-               if (decon->d.prev_vgf_win_id[i] != -1
+       for (i = 0; i < (MAX_DPP_SUBDEV - 1); i++) {
+               /* check each channel whether they were prev-enabled */
+               if (decon->d.prev_afbc_win_id[i] != -1
                                && test_bit(i, &decon->prev_used_dpp)) {
-                       win_id = decon->d.prev_vgf_win_id[i];
+                       win_id = decon->d.prev_afbc_win_id[i];
 
 #if defined(CONFIG_SUPPORT_LEGACY_ION)
-                       decon->d.handle[win_id][0] = dma_bufs[win_id][0].ion_handle;
+                       decon->d.handle[win_id][0] =
+                               dma_bufs[win_id][0].ion_handle;
                        decon_info("DMA%d(WIN%d): handle=0x%p\n",
-                               i, win_id, decon->d.handle[win_id][0]);
+                               DPU_CH2DMA(i), win_id, decon->d.handle[win_id][0]);
 
                        v_addr = ion_map_kernel(decon->ion_client,
                                        dma_bufs[win_id][0].ion_handle);
                        if (IS_ERR_OR_NULL(v_addr)) {
-                               decon_err("%s: failed to map afbc buffer\n", __func__);
+                               decon_err("%s: failed to map afbc buffer\n",
+                                               __func__);
                                return;
                        }
 #else
-                       decon->d.dmabuf[win_id][0] = dma_bufs[win_id][0].dma_buf;
+                       decon->d.dmabuf[win_id][0] =
+                               dma_bufs[win_id][0].dma_buf;
                        decon_info("DMA%d(WIN%d): dmabuf=0x%p\n",
-                               i, win_id, decon->d.dmabuf[win_id][0]);
+                               DPU_CH2DMA(i), win_id, decon->d.dmabuf[win_id][0]);
                        v_addr = dma_buf_vmap(dma_bufs[win_id][0].dma_buf);
                        if (IS_ERR_OR_NULL(v_addr)) {
-                               decon_err("%s: failed to map afbc buffer\n", __func__);
+                               decon_err("%s: failed to map afbc buffer\n",
+                                               __func__);
                                return;
                        }
 #endif
@@ -1991,10 +2002,10 @@ err_hdr:
 }
 
 #if defined(CONFIG_EXYNOS_AFBC_DEBUG)
-static void decon_update_vgf_info(struct decon_device *decon,
+static void decon_update_afbc_info(struct decon_device *decon,
                struct decon_reg_data *regs, bool cur)
 {
-       int i;
+       int i, ch;
        struct dpu_afbc_info *afbc_info;
 
        decon_dbg("%s +\n", __func__);
@@ -2010,21 +2021,19 @@ static void decon_update_vgf_info(struct decon_device *decon,
                if (!regs->dpp_config[i].compression)
                        continue;
 
-               if (test_bit(i, &decon->cur_using_dpp)) {
-                       afbc_info->is_afbc[i] = true;
-
+               ch = DPU_DMA2CH(regs->dpp_config[i].idma_type);
+               if (test_bit(ch, &decon->cur_using_dpp)) {
                        if (regs->dma_buf_data[i][0].dma_buf == NULL)
                                continue;
 
-                       afbc_info->dma_addr[i] =
+                       afbc_info->is_afbc[ch] = true;
+
+                       afbc_info->dma_addr[ch] =
                                regs->dma_buf_data[i][0].dma_addr;
-                       afbc_info->dma_buf[i] =
+                       afbc_info->dma_buf[ch] =
                                regs->dma_buf_data[i][0].dma_buf;
-#if defined(DPU_DUMP_BUFFER_IRQ)
-                       afbc_info->dma_v_addr[i] =
-                               dma_buf_vmap(afbc_info->dma_buf[i]);
-                       dma_buf_vunmap(afbc_info->dma_buf[i], afbc_info->dma_v_addr[i]);
-#endif
+                       afbc_info->sg_table[ch] =
+                               regs->dma_buf_data[i][0].sg_table;
                }
        }
 
@@ -2063,7 +2072,7 @@ static void decon_update_regs(struct decon_device *decon,
        decon_check_used_dpp(decon, regs);
 
 #if defined(CONFIG_EXYNOS_AFBC_DEBUG)
-       decon_update_vgf_info(decon, regs, true);
+       decon_update_afbc_info(decon, regs, true);
 #endif
 
        decon_update_hdr_info(decon, regs);
@@ -2144,8 +2153,8 @@ end:
        DPU_EVENT_LOG(DPU_EVT_FENCE_RELEASE, &decon->sd, ktime_set(0, 0));
 
 #if defined(CONFIG_EXYNOS_AFBC_DEBUG)
-       decon_save_vgf_connected_win_id(decon, regs);
-       decon_update_vgf_info(decon, regs, false);
+       decon_save_afbc_enabled_win_id(decon, regs);
+       decon_update_afbc_info(decon, regs, false);
 #endif
 
 #if defined(CONFIG_EXYNOS_BTS)
index 3e42519dbcbb617520a73128d8541b0a0afe9e90..3cfe3a38934e6586d2c12c541a3dc6c36c4ca797 100644 (file)
@@ -70,13 +70,8 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_data)
        if (ext_irq & DPU_RESOURCE_CONFLICT_INT_PEND)
                DPU_EVENT_LOG(DPU_EVT_RSC_CONFLICT, &decon->sd, ktime_set(0, 0));
 
-       if (ext_irq & DPU_TIME_OUT_INT_PEND) {
+       if (ext_irq & DPU_TIME_OUT_INT_PEND)
                decon_err("%s: DECON%d timeout irq occurs\n", __func__, decon->id);
-#if defined(DPU_DUMP_BUFFER_IRQ)
-               dpu_dump_afbc_info();
-#endif
-               BUG();
-       }
 
 irq_end:
        spin_unlock(&decon->slock);
index bef7af8f481c4a6580e6ef6cfc373dd25db25ab2..39061a32c5ce99bfea463cbd9115048dcf2a3c7a 100644 (file)
@@ -751,13 +751,10 @@ static irqreturn_t dma_irq_handler(int irq, void *priv)
                                        ktime_set(0, 0));
                        val = (u32)dpp->dpp_config->config.dpp_parm.comp_src;
                        dpp->d.recovery_cnt++;
-#if 0 /* TODO: This will be implemented */
-                       dpp_info("dma%d recovery start(0x%x).. [src=%s], cnt[%d %d]\n",
+                       dpp_info("dma%d recovery start(0x%x).. [src=%s], cnt[%d]\n",
                                        dpp->id, irqs,
                                        val == DPP_COMP_SRC_G2D ? "G2D" : "GPU",
-                                       get_dpp_drvdata(DPU_DMA2CH(IDMA_VGF0))->d.recovery_cnt,
-                                       get_dpp_drvdata(DPU_DMA2CH(IDMA_VGF1))->d.recovery_cnt);
-#endif
+                                       dpp->d.recovery_cnt);
                        goto irq_end;
                }
                if ((irqs & IDMA_AFBC_TIMEOUT_IRQ) ||
index 5cab67fe9c378b6acb14fffd44a9c8ba9a812d03..ecbfe76bc578e000b8ab8138270189758fde5e17 100644 (file)
@@ -591,15 +591,18 @@ void dpu_dump_afbc_info(void)
        struct dpu_afbc_info *afbc_info;
        void *v_addr[MAX_DECON_WIN];
        int size[MAX_DECON_WIN];
+       int decon_cnt;
 
-       for (i = 0; i < 3; i++) {
+       decon_cnt = get_decon_drvdata(0)->dt.decon_cnt;
+
+       for (i = 0; i < decon_cnt; i++) {
                decon = get_decon_drvdata(i);
                if (decon == NULL)
                        continue;
 
                afbc_info = &decon->d.prev_afbc_info;
                decon_info("%s: previous AFBC channel information\n", __func__);
-               for (j = 0; j < MAX_DECON_WIN; ++j) { /* all the dpp that has afbc */
+               for (j = 0; j < decon->dt.max_win; ++j) { /* all the dpp that has afbc */
                        if (!afbc_info->is_afbc[j])
                                continue;
 
@@ -613,7 +616,7 @@ void dpu_dump_afbc_info(void)
 
                afbc_info = &decon->d.cur_afbc_info;
                decon_info("%s: current AFBC channel information\n", __func__);
-               for (j = 0; j < MAX_DECON_WIN; ++j) { /* all the dpp that has afbc */
+               for (j = 0; j < decon->dt.max_win; ++j) { /* all the dpp that has afbc */
                        if (!afbc_info->is_afbc[j])
                                continue;
 
@@ -632,12 +635,15 @@ static int dpu_dump_buffer_data(struct dpp_device *dpp)
        int i;
        int id_idx = 0;
        int dump_size = 128;
+       int decon_cnt;
        struct decon_device *decon;
        struct dpu_afbc_info *afbc_info;
 
+       decon_cnt = get_decon_drvdata(0)->dt.decon_cnt;
+
        if (dpp->state == DPP_STATE_ON) {
 
-               for (i = 0; i < MAX_DECON_CNT; i++) {
+               for (i = 0; i < decon_cnt; i++) {
                        decon = get_decon_drvdata(i);
                        if (decon == NULL)
                                continue;