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;
/* 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);
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;
}
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;
*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;
*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
}
}
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;
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)
{
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",
}
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",
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",
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",
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",
}
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",
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",
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",
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",
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",
}
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");
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",
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",
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",
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",
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",
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",
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",
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",
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);
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;