gdc: add gdc cpu cost optimize [1/1]
authorPengcheng Chen <pengcheng.chen@amlogic.com>
Fri, 19 Apr 2019 02:58:19 +0000 (10:58 +0800)
committerNick Xie <nick@khadas.com>
Mon, 5 Aug 2019 07:11:46 +0000 (15:11 +0800)
PD#SWPL-7422

Problem:
gdc ioctl have cpu usage issue

Solution:
1. dma buffer alloc gdc module,when dma buf exported, fd and phys
address can be recorded.driver can get phys address via fd internally.
2. dmabuf alloc by other driver module, need used gdc_dma_buffer_map/
gdc_dma_buffer_unmap to get phys address.

Verify:
Newman & W400 board

Change-Id: Ie270589a19dfae4fa750241fb5721154221f2448
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
ge2d: ge2d cpu cost optimize [2/2]

PD#SWPL-7422

Problem:
ge2d ioctl have cpu usage issue

Solution:
1. dma buffer alloc gdc module,when dma buf exported, fd and phys
address can be recorded.driver can get phys address via fd internally.
2. dmabuf alloc by other driver module, need used gdc_dma_buffer_map/
gdc_dma_buffer_unmap to get phys address.

Verify:
Newman & W400 board

Change-Id: I78d03b52e574daf2e8b2d53eb8fdfde06357ebfe
Signed-off-by: Pengcheng Chen <pengcheng.chen@amlogic.com>
drivers/amlogic/media/common/ge2d/ge2d_dmabuf.c
drivers/amlogic/media/common/ge2d/ge2d_dmabuf.h
drivers/amlogic/media/common/ge2d/ge2d_wq.c
drivers/amlogic/media/gdc/app/gdc_dmabuf.c
drivers/amlogic/media/gdc/app/gdc_dmabuf.h
drivers/amlogic/media/gdc/app/gdc_module.c

index 3ed7684..f024876 100644 (file)
@@ -504,6 +504,7 @@ int ge2d_dma_buffer_export(struct aml_dma_buffer *buffer,
 
        ge2d_log_dbg("buffer %d,exported as %d descriptor\n",
                index, ret);
+       buffer->gd_buffer[index].fd = ret;
        ge2d_exp_buf->fd = ret;
        return 0;
 }
@@ -578,26 +579,74 @@ attach_err:
        return ret;
 }
 
-int ge2d_dma_buffer_get_phys(struct aml_dma_cfg *cfg, unsigned long *addr)
+static int ge2d_dma_buffer_get_phys_internal(struct aml_dma_buffer *buffer,
+       int fd, unsigned long *addr)
+{
+       int i = 0, ret = -1;
+       struct aml_dma_buf *dma_buf;
+
+       for (i = 0; i < AML_MAX_DMABUF; i++) {
+               if (buffer->gd_buffer[i].alloc &&
+                       (fd == buffer->gd_buffer[i].fd)) {
+                       dma_buf = buffer->gd_buffer[i].mem_priv;
+                       *addr = dma_buf->dma_addr;
+                       ret = 0;
+                       break;
+               }
+       }
+       return ret;
+}
+
+int ge2d_dma_buffer_get_phys(struct aml_dma_buffer *buffer,
+       struct aml_dma_cfg *cfg, unsigned long *addr)
 {
        struct sg_table *sg_table;
        struct page *page;
-       int ret;
+       int ret = -1;
 
-       ret = ge2d_dma_buffer_map(cfg);
-       if (ret < 0) {
-               pr_err("gdc_dma_buffer_map failed\n");
-               return ret;
+       if (cfg == NULL || (cfg->fd < 0)) {
+               pr_err("error input param");
+               return -EINVAL;
        }
-       if (cfg->sg) {
-               sg_table = cfg->sg;
-               page = sg_page(sg_table->sgl);
-               *addr = PFN_PHYS(page_to_pfn(page));
-               ret = 0;
+       ret = ge2d_dma_buffer_get_phys_internal(buffer, cfg->fd, addr);
+       if (ret < 0) {
+               ret = ge2d_dma_buffer_map(cfg);
+               if (ret < 0) {
+                       pr_err("gdc_dma_buffer_map failed\n");
+                       return ret;
+               }
+               if (cfg->sg) {
+                       sg_table = cfg->sg;
+                       page = sg_page(sg_table->sgl);
+                       *addr = PFN_PHYS(page_to_pfn(page));
+                       ret = 0;
+               }
        }
        return ret;
 }
 
+int ge2d_dma_buffer_unmap_info(struct aml_dma_buffer *buffer,
+       struct aml_dma_cfg *cfg)
+{
+       int i, found = 0;
+
+       if (cfg == NULL || (cfg->fd < 0)) {
+               pr_err("error input param");
+               return -EINVAL;
+       }
+
+       for (i = 0; i < AML_MAX_DMABUF; i++) {
+               if (buffer->gd_buffer[i].alloc &&
+                       (cfg->fd == buffer->gd_buffer[i].fd)) {
+                       found = 1;
+                       break;
+               }
+       }
+       if (!found)
+               ge2d_dma_buffer_unmap(cfg);
+       return 0;
+}
+
 void ge2d_dma_buffer_unmap(struct aml_dma_cfg *cfg)
 {
        int fd = -1;
index c3c03d3..baf80c4 100644 (file)
@@ -45,6 +45,7 @@ struct aml_dma_buf {
 struct aml_dma_buf_priv {
        void *mem_priv;
        int index;
+       int fd;
        unsigned int alloc;
        struct dma_buf *dbuf;
 };
@@ -75,7 +76,10 @@ int ge2d_dma_buffer_export(struct aml_dma_buffer *buffer,
        struct ge2d_dmabuf_exp_s *ge2d_exp_buf);
 int ge2d_dma_buffer_map(struct aml_dma_cfg *cfg);
 void ge2d_dma_buffer_unmap(struct aml_dma_cfg *cfg);
-int ge2d_dma_buffer_get_phys(struct aml_dma_cfg *cfg, unsigned long *addr);
+int ge2d_dma_buffer_get_phys(struct aml_dma_buffer *buffer,
+       struct aml_dma_cfg *cfg, unsigned long *addr);
+int ge2d_dma_buffer_unmap_info(struct aml_dma_buffer *buffer,
+       struct aml_dma_cfg *cfg);
 void ge2d_dma_buffer_dma_flush(struct device *dev, int fd);
 void ge2d_dma_buffer_cache_flush(struct device *dev, int fd);
 #endif
index 6be65f7..1549b97 100644 (file)
@@ -120,6 +120,10 @@ static const int default_ge2d_color_lut[] = {
        GE2D_FORMAT_S32_ARGB,/* BPP_TYPE_32_ARGB=32, */
 };
 
+static int ge2d_buffer_get_phys(struct aml_dma_cfg *cfg,
+       unsigned long *addr);
+static int ge2d_buffer_unmap(struct aml_dma_cfg *cfg);
+
 static void ge2d_pre_init(void)
 {
        struct ge2d_gen_s ge2d_gen_cfg;
@@ -392,19 +396,19 @@ static int ge2d_process_work_queue(struct ge2d_context_s *wq)
                /* if dma buf detach it */
                for (i = 0; i < MAX_PLANE; i++) {
                        if (pitem->config.src_dma_cfg[i].dma_used) {
-                               ge2d_dma_buffer_unmap((struct aml_dma_cfg *
+                               ge2d_buffer_unmap((struct aml_dma_cfg *
                                        )pitem->config.src_dma_cfg[i].dma_cfg);
                                pitem->config.src_dma_cfg[i].dma_used = 0;
                                kfree(pitem->config.src_dma_cfg[i].dma_cfg);
                        }
                        if (pitem->config.src2_dma_cfg[i].dma_used) {
-                               ge2d_dma_buffer_unmap((struct aml_dma_cfg *
+                               ge2d_buffer_unmap((struct aml_dma_cfg *
                                        )pitem->config.src2_dma_cfg[i].dma_cfg);
                                pitem->config.src2_dma_cfg[i].dma_used = 0;
                                kfree(pitem->config.src2_dma_cfg[i].dma_cfg);
                        }
                        if (pitem->config.dst_dma_cfg[i].dma_used) {
-                               ge2d_dma_buffer_unmap((struct aml_dma_cfg *
+                               ge2d_buffer_unmap((struct aml_dma_cfg *
                                        )pitem->config.dst_dma_cfg[i].dma_cfg);
                                pitem->config.dst_dma_cfg[i].dma_used = 0;
                                kfree(pitem->config.dst_dma_cfg[i].dma_cfg);
@@ -1058,7 +1062,7 @@ static int build_ge2d_addr_config_dma(
                        dma_cfg->dev = &(ge2d_manager.pdev->dev);
                        dma_cfg->dir = dir;
                        cfg->dma_cfg = dma_cfg;
-                       ret = ge2d_dma_buffer_get_phys(dma_cfg, &addr_temp);
+                       ret = ge2d_buffer_get_phys(dma_cfg, &addr_temp);
                        if (ret != 0)
                                return ret;
                }
@@ -1231,7 +1235,7 @@ static int build_ge2d_config_ex_dma(struct ge2d_context_s *context,
                                dma_cfg->dev = &(ge2d_manager.pdev->dev);
                                dma_cfg->dir = dir;
                                cfg->dma_cfg = dma_cfg;
-                               ret = ge2d_dma_buffer_get_phys(dma_cfg, &addr);
+                               ret = ge2d_buffer_get_phys(dma_cfg, &addr);
                                if (ret != 0)
                                        return ret;
                                plane[i].addr = addr;
@@ -1239,10 +1243,10 @@ static int build_ge2d_config_ex_dma(struct ge2d_context_s *context,
                                *r_offset += 1;
 #ifdef CONFIG_AMLOGIC_MEDIA_CANVAS
                                canvas_config(index++, plane[i].addr,
-                                                 plane[i].w * bpp_value,
-                                                 plane[i].h,
-                                                 CANVAS_ADDR_NOWRAP,
-                                                 CANVAS_BLKMODE_LINEAR);
+                                       plane[i].w * bpp_value,
+                                       plane[i].h,
+                                       CANVAS_ADDR_NOWRAP,
+                                       CANVAS_BLKMODE_LINEAR);
 #endif
                        } else if (plane[i].addr) {
                                plane[i].addr += plane[0].addr;
@@ -1250,10 +1254,10 @@ static int build_ge2d_config_ex_dma(struct ge2d_context_s *context,
                                *r_offset += 1;
 #ifdef CONFIG_AMLOGIC_MEDIA_CANVAS
                                canvas_config(index++, plane[i].addr,
-                                             plane[i].w * bpp_value,
-                                             plane[i].h,
-                                             CANVAS_ADDR_NOWRAP,
-                                             CANVAS_BLKMODE_LINEAR);
+                                               plane[i].w * bpp_value,
+                                               plane[i].h,
+                                               CANVAS_ADDR_NOWRAP,
+                                               CANVAS_BLKMODE_LINEAR);
 #endif
                        }
                }
@@ -2543,6 +2547,16 @@ void ge2d_buffer_cache_flush(int dma_fd)
        ge2d_dma_buffer_cache_flush(dev, dma_fd);
 }
 
+static int ge2d_buffer_get_phys(struct aml_dma_cfg *cfg, unsigned long *addr)
+{
+       return ge2d_dma_buffer_get_phys(ge2d_manager.buffer, cfg, addr);
+}
+
+static int ge2d_buffer_unmap(struct aml_dma_cfg *cfg)
+{
+       return ge2d_dma_buffer_unmap_info(ge2d_manager.buffer, cfg);
+}
+
 struct ge2d_context_s *create_ge2d_work_queue(void)
 {
        int  i;
index 9cc9523..6d70165 100644 (file)
@@ -459,6 +459,7 @@ int gdc_dma_buffer_export(struct aml_dma_buffer *buffer,
        }
        gdc_log(LOG_INFO, "buffer %d,exported as %d descriptor\n",
                index, ret);
+       buffer->gd_buffer[index].fd = ret;
        gdc_exp_buf->fd = ret;
        return 0;
 }
@@ -532,25 +533,72 @@ attach_err:
        return ret;
 }
 
-int gdc_dma_buffer_get_phys(struct aml_dma_cfg *cfg, unsigned long *addr)
+static int gdc_dma_buffer_get_phys_internal(struct aml_dma_buffer *buffer,
+       int fd, unsigned long *addr)
+{
+       int i = 0, ret = -1;
+       struct aml_dma_buf *dma_buf;
+
+       for (i = 0; i < AML_MAX_DMABUF; i++) {
+               if (buffer->gd_buffer[i].alloc &&
+                       (fd == buffer->gd_buffer[i].fd)) {
+                       dma_buf = buffer->gd_buffer[i].mem_priv;
+                       *addr = dma_buf->dma_addr;
+                       ret = 0;
+                       break;
+               }
+       }
+       return ret;
+}
+int gdc_dma_buffer_get_phys(struct aml_dma_buffer *buffer,
+       struct aml_dma_cfg *cfg, unsigned long *addr)
 {
        struct sg_table *sg_table;
        struct page *page;
-       int ret;
+       int ret = -1;
 
-       ret = gdc_dma_buffer_map(cfg);
-       if (ret < 0) {
-               pr_err("gdc_dma_buffer_map failed\n");
-               return ret;
+       if (cfg == NULL || (cfg->fd < 0)) {
+               pr_err("error input param");
+               return -EINVAL;
        }
-       if (cfg->sg) {
-               sg_table = cfg->sg;
-               page = sg_page(sg_table->sgl);
-               *addr = PFN_PHYS(page_to_pfn(page));
-               ret = 0;
+       ret = gdc_dma_buffer_get_phys_internal(buffer, cfg->fd, addr);
+       if (ret < 0) {
+               gdc_log(LOG_INFO, "get_phys(fd=%d) failed.\n", cfg->fd);
+               ret = gdc_dma_buffer_map(cfg);
+               if (ret < 0) {
+                       pr_err("gdc_dma_buffer_map failed\n");
+                       return ret;
+               }
+               if (cfg->sg) {
+                       sg_table = cfg->sg;
+                       page = sg_page(sg_table->sgl);
+                       *addr = PFN_PHYS(page_to_pfn(page));
+                       ret = 0;
+               }
        }
        return ret;
 }
+int gdc_dma_buffer_unmap_info(struct aml_dma_buffer *buffer,
+       struct aml_dma_cfg *cfg)
+{
+       int i, found = 0;
+
+       if (cfg == NULL || (cfg->fd < 0)) {
+               pr_err("error input param");
+               return -EINVAL;
+       }
+
+       for (i = 0; i < AML_MAX_DMABUF; i++) {
+               if (buffer->gd_buffer[i].alloc &&
+                       (cfg->fd == buffer->gd_buffer[i].fd)) {
+                       found = 1;
+                       break;
+               }
+       }
+       if (!found)
+               gdc_dma_buffer_unmap(cfg);
+       return 0;
+}
 
 void gdc_dma_buffer_unmap(struct aml_dma_cfg *cfg)
 {
index a6e988d..1fc7ae0 100644 (file)
@@ -43,6 +43,7 @@ struct aml_dma_buf {
 struct aml_dma_buf_priv {
        void *mem_priv;
        int index;
+       int fd;
        unsigned int alloc;
        struct dma_buf *dbuf;
 };
@@ -73,7 +74,10 @@ int gdc_dma_buffer_export(struct aml_dma_buffer *buffer,
        struct gdc_dmabuf_exp_s *gdc_exp_buf);
 int gdc_dma_buffer_map(struct aml_dma_cfg *cfg);
 void gdc_dma_buffer_unmap(struct aml_dma_cfg *cfg);
-int gdc_dma_buffer_get_phys(struct aml_dma_cfg *cfg, unsigned long *addr);
+int gdc_dma_buffer_get_phys(struct aml_dma_buffer *buffer,
+       struct aml_dma_cfg *cfg, unsigned long *addr);
+int gdc_dma_buffer_unmap_info(struct aml_dma_buffer *buffer,
+       struct aml_dma_cfg *cfg);
 void gdc_dma_buffer_dma_flush(struct device *dev, int fd);
 void gdc_dma_buffer_cache_flush(struct device *dev, int fd);
 #endif
index 9506df6..2191096 100644 (file)
@@ -530,6 +530,16 @@ static void gdc_buffer_cache_flush(int dma_fd)
        gdc_dma_buffer_cache_flush(dev, dma_fd);
 }
 
+static int gdc_buffer_get_phys(struct aml_dma_cfg *cfg, unsigned long *addr)
+{
+       return gdc_dma_buffer_get_phys(gdc_manager.buffer, cfg, addr);
+}
+
+static int gdc_buffer_unmap(struct aml_dma_cfg *cfg)
+{
+       return gdc_dma_buffer_unmap_info(gdc_manager.buffer, cfg);
+}
+
 static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
        struct gdc_settings_ex *gs_ex)
 {
@@ -558,7 +568,7 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_TO_DEVICE;
 
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import input fd %d err\n",
@@ -572,15 +582,12 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                        }
                        gdc_log(LOG_INFO, "1 plane get input addr=%x\n",
                                gdc_cmd->y_base_addr);
-                       meson_gdc_dma_flush(&fh->gdev->pdev->dev,
-                               gdc_cmd->y_base_addr,
-                               gc->input_y_stride * gc->input_height);
                } else if (gs_ex->input_buffer.plane_number == 2) {
                        cfg = &fh->dma_cfg.input_cfg_plane1;
                        cfg->fd = gs_ex->input_buffer.y_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_TO_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import input fd %d err\n",
@@ -588,14 +595,11 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                                return -EINVAL;
                        }
                        gdc_cmd->y_base_addr = addr;
-                       meson_gdc_dma_flush(&fh->gdev->pdev->dev,
-                               gdc_cmd->y_base_addr,
-                               gc->input_y_stride * gc->input_height);
                        cfg = &fh->dma_cfg.input_cfg_plane2;
                        cfg->fd = gs_ex->input_buffer.uv_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_TO_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import input fd %d err\n",
@@ -603,9 +607,6 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                                return -EINVAL;
                        }
                        gdc_cmd->uv_base_addr = addr;
-                       meson_gdc_dma_flush(&fh->gdev->pdev->dev,
-                               gdc_cmd->uv_base_addr,
-                               gc->input_y_stride * gc->input_height / 2);
                        gdc_log(LOG_INFO, "2 plane get input y_addr=%x\n",
                                gdc_cmd->y_base_addr);
                        gdc_log(LOG_INFO, "2 plane get input uv_addr=%x\n",
@@ -620,7 +621,7 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_TO_DEVICE;
 
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import input fd %d err\n",
@@ -634,15 +635,12 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                        }
                        gdc_log(LOG_INFO, "1 plane get input addr=%x\n",
                                gdc_cmd->y_base_addr);
-                       meson_gdc_dma_flush(&fh->gdev->pdev->dev,
-                               gdc_cmd->y_base_addr,
-                               gc->input_y_stride * gc->input_height);
                } else if (gs_ex->input_buffer.plane_number == 3) {
                        cfg = &fh->dma_cfg.input_cfg_plane1;
                        cfg->fd = gs_ex->input_buffer.y_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_TO_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import input fd %d err\n",
@@ -650,15 +648,11 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                                return -EINVAL;
                        }
                        gdc_cmd->y_base_addr = addr;
-                       meson_gdc_dma_flush(&fh->gdev->pdev->dev,
-                               gdc_cmd->y_base_addr,
-                               gc->input_y_stride * gc->input_height);
-
                        cfg = &fh->dma_cfg.input_cfg_plane2;
                        cfg->fd = gs_ex->input_buffer.u_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_TO_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import input fd %d err\n",
@@ -666,15 +660,11 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                                return -EINVAL;
                        }
                        gdc_cmd->u_base_addr = addr;
-                       meson_gdc_dma_flush(&fh->gdev->pdev->dev,
-                               gdc_cmd->u_base_addr,
-                               gc->input_y_stride * gc->input_height / 2);
-
                        cfg = &fh->dma_cfg.input_cfg_plane3;
                        cfg->fd = gs_ex->input_buffer.v_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_TO_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import input fd %d err\n",
@@ -682,10 +672,6 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                                return -EINVAL;
                        }
                        gdc_cmd->v_base_addr = addr;
-                       meson_gdc_dma_flush(&fh->gdev->pdev->dev,
-                               gdc_cmd->v_base_addr,
-                               gc->input_y_stride * gc->input_height / 2);
-
                        gdc_log(LOG_INFO, "3 plane get input y_addr=%x\n",
                                gdc_cmd->y_base_addr);
                        gdc_log(LOG_INFO, "3 plane get input u_addr=%x\n",
@@ -700,7 +686,7 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                cfg->fd = gs_ex->input_buffer.y_base_fd;
                cfg->dev = &(fh->gdev->pdev->dev);
                cfg->dir = DMA_TO_DEVICE;
-               ret = gdc_dma_buffer_get_phys(cfg, &addr);
+               ret = gdc_buffer_get_phys(cfg, &addr);
                if (ret < 0) {
                        gdc_log(LOG_ERR,
                                "dma import input fd %d failed\n",
@@ -709,9 +695,6 @@ static long gdc_process_input_dma_info(struct mgdc_fh_s *fh,
                }
                gdc_cmd->y_base_addr = addr;
                gdc_cmd->uv_base_addr = 0;
-               meson_gdc_dma_flush(&fh->gdev->pdev->dev,
-                       gdc_cmd->y_base_addr,
-                       gc->input_y_stride * gc->input_height);
        break;
        default:
                gdc_log(LOG_ERR, "Error image format");
@@ -891,7 +874,7 @@ static long gdc_process_output_dma_info(struct mgdc_fh_s *fh,
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_FROM_DEVICE;
 
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import output fd %d err\n",
@@ -907,7 +890,7 @@ static long gdc_process_output_dma_info(struct mgdc_fh_s *fh,
                        cfg->fd = gs_ex->output_buffer.y_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_FROM_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import output fd %d err\n",
@@ -921,7 +904,7 @@ static long gdc_process_output_dma_info(struct mgdc_fh_s *fh,
                        cfg->fd = gs_ex->output_buffer.uv_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_FROM_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import output fd %d err\n",
@@ -944,7 +927,7 @@ static long gdc_process_output_dma_info(struct mgdc_fh_s *fh,
                        cfg->fd = gs_ex->output_buffer.y_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_FROM_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import output fd %d err\n",
@@ -960,7 +943,7 @@ static long gdc_process_output_dma_info(struct mgdc_fh_s *fh,
                        cfg->fd = gs_ex->output_buffer.y_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_FROM_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import output fd %d err\n",
@@ -974,7 +957,7 @@ static long gdc_process_output_dma_info(struct mgdc_fh_s *fh,
                        cfg->fd = gs_ex->output_buffer.u_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_FROM_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import output fd %d err\n",
@@ -987,7 +970,7 @@ static long gdc_process_output_dma_info(struct mgdc_fh_s *fh,
                        cfg->fd = gs_ex->output_buffer.v_base_fd;
                        cfg->dev = &fh->gdev->pdev->dev;
                        cfg->dir = DMA_FROM_DEVICE;
-                       ret = gdc_dma_buffer_get_phys(cfg, &addr);
+                       ret = gdc_buffer_get_phys(cfg, &addr);
                        if (ret < 0) {
                                gdc_log(LOG_ERR,
                                        "dma import output fd %d err\n",
@@ -1009,7 +992,7 @@ static long gdc_process_output_dma_info(struct mgdc_fh_s *fh,
                cfg->fd = gs_ex->output_buffer.y_base_fd;
                cfg->dev = &(fh->gdev->pdev->dev);
                cfg->dir = DMA_FROM_DEVICE;
-               ret = gdc_dma_buffer_get_phys(cfg, &addr);
+               ret = gdc_buffer_get_phys(cfg, &addr);
                if (ret < 0) {
                        gdc_log(LOG_ERR,
                                "dma import output fd %d err\n",
@@ -1205,7 +1188,7 @@ static long gdc_process_ex_info(struct mgdc_fh_s *fh,
                cfg->fd = gs_ex->config_buffer.y_base_fd;
                cfg->dev = &(gdc_manager.gdc_dev->pdev->dev);
                cfg->dir = DMA_TO_DEVICE;
-               ret = gdc_dma_buffer_get_phys(cfg, &addr);
+               ret = gdc_buffer_get_phys(cfg, &addr);
                if (ret < 0) {
                        gdc_log(LOG_ERR, "dma import config fd %d failed\n",
                                gs_ex->config_buffer.shared_fd);
@@ -1250,28 +1233,24 @@ static long gdc_process_ex_info(struct mgdc_fh_s *fh,
        if (!gdc_reg_store_mode)
                gdc_pwr_config(false);
        mutex_unlock(&fh->gdev->d_mutext);
-       #if 0
-       if (gs_ex->output_buffer.mem_alloc_type == AML_GDC_MEM_DMABUF)
-               gdc_buffer_cache_flush(gs_ex->output_buffer.shared_fd);
-       #endif
        if (gs_ex->input_buffer.mem_alloc_type == AML_GDC_MEM_DMABUF) {
-               gdc_dma_buffer_unmap(&fh->dma_cfg.input_cfg_plane1);
+               gdc_buffer_unmap(&fh->dma_cfg.input_cfg_plane1);
                if (gs_ex->input_buffer.plane_number == 2)
-                       gdc_dma_buffer_unmap(&fh->dma_cfg.input_cfg_plane2);
+                       gdc_buffer_unmap(&fh->dma_cfg.input_cfg_plane2);
                if (gs_ex->input_buffer.plane_number == 3) {
-                       gdc_dma_buffer_unmap(&fh->dma_cfg.input_cfg_plane2);
-                       gdc_dma_buffer_unmap(&fh->dma_cfg.input_cfg_plane3);
+                       gdc_buffer_unmap(&fh->dma_cfg.input_cfg_plane2);
+                       gdc_buffer_unmap(&fh->dma_cfg.input_cfg_plane3);
                }
        }
        if (gs_ex->config_buffer.mem_alloc_type == AML_GDC_MEM_DMABUF)
-               gdc_dma_buffer_unmap(&fh->dma_cfg.config_cfg);
+               gdc_buffer_unmap(&fh->dma_cfg.config_cfg);
        if (gs_ex->output_buffer.mem_alloc_type == AML_GDC_MEM_DMABUF) {
-               gdc_dma_buffer_unmap(&fh->dma_cfg.output_cfg_plane1);
+               gdc_buffer_unmap(&fh->dma_cfg.output_cfg_plane1);
                if (gs_ex->output_buffer.plane_number == 2)
-                       gdc_dma_buffer_unmap(&fh->dma_cfg.output_cfg_plane2);
+                       gdc_buffer_unmap(&fh->dma_cfg.output_cfg_plane2);
                if (gs_ex->output_buffer.plane_number == 3) {
-                       gdc_dma_buffer_unmap(&fh->dma_cfg.output_cfg_plane2);
-                       gdc_dma_buffer_unmap(&fh->dma_cfg.output_cfg_plane3);
+                       gdc_buffer_unmap(&fh->dma_cfg.output_cfg_plane2);
+                       gdc_buffer_unmap(&fh->dma_cfg.output_cfg_plane3);
                }
        }
        return 0;