default n
depends on VIDEO_EXYNOS
select VIDEOBUF2_CORE
+ select VIDEOBUF2_DMA_SG
select EXYNOS_MFC_V12
---help---
MFC driver for V4L2.
}
memset(roi_buf->vaddr, 0, buf_size->shared_buf);
- s5p_mfc_mem_clean(dev, roi_buf, 0, roi_buf->size);
return 0;
}
return -EINVAL;
}
memset(buf->vaddr, 0, raw->total_plane_size);
- s5p_mfc_mem_clean(dev, buf, 0, buf->size);
}
mfc_debug_leave();
}
memcpy(dev->fw_buf.vaddr, fw_blob->data, fw_blob->size);
- s5p_mfc_mem_clean(dev, &dev->fw_buf, 0, fw_blob->size);
- s5p_mfc_mem_invalidate(dev, &dev->fw_buf, 0, fw_blob->size);
if (dev->drm_fw_buf.vaddr) {
memcpy(dev->drm_fw_buf.vaddr, fw_blob->data, fw_blob->size);
mfc_debug(2, "copy firmware to secure region\n");
- s5p_mfc_mem_clean(dev, &dev->drm_fw_buf, 0, fw_blob->size);
- s5p_mfc_mem_invalidate(dev, &dev->drm_fw_buf, 0, fw_blob->size);
}
release_firmware(fw_blob);
trace_mfc_loadfw_end(dev->fw.size, firmware_size);
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/sched/clock.h>
+#include <linux/exynos_ion.h>
+#include <media/videobuf2-dma-sg.h>
+#include <asm/cacheflush.h>
#include "s5p_mfc_regs_v10.h"
#include "s5p_mfc_macros.h"
mfc_err_ctx("failed in to_buf_ctrls\n");
}
- s5p_mfc_mem_buf_prepare(vb);
-
return 0;
}
if (call_cop(ctx, to_ctx_ctrls, ctx, &ctx->src_ctrls[index]) < 0)
mfc_err_ctx("failed in to_ctx_ctrls\n");
}
-
- s5p_mfc_mem_buf_finish(vb);
}
static void s5p_mfc_dec_buf_cleanup(struct vb2_buffer *vb)
s5p_mfc_mem_get_daddr_vb(vb, 0),
buf->addr[0]);
if (dec->dst_memtype == V4L2_MEMORY_DMABUF &&
- ctx->state < MFCINST_HEAD_PARSED && !ctx->is_drm) {
+ ctx->state < MFCINST_HEAD_PARSED && !ctx->is_drm)
stream_vir = vb2_plane_vaddr(vb, 0);
- s5p_mfc_mem_inv_vb(vb, 1);
- }
+
buf->vir_addr = stream_vir;
s5p_mfc_add_tail_buf(&ctx->buf_queue_lock, &ctx->src_buf_queue, buf);
return -EINVAL;
}
- s5p_mfc_mem_buf_prepare(vb);
-
mfc_debug_leave();
return 0;
if (call_cop(ctx, to_ctx_ctrls, ctx, &ctx->src_ctrls[index]) < 0)
mfc_err_ctx("failed in to_ctx_ctrls\n");
}
-
- s5p_mfc_mem_buf_finish(vb);
}
static void s5p_mfc_enc_buf_cleanup(struct vb2_buffer *vb)
struct vb2_mem_ops *s5p_mfc_mem_ops(void)
{
- return (struct vb2_mem_ops *)&vb2_ion_memops;
+ return (struct vb2_mem_ops *)&vb2_dma_sg_memops;
}
void s5p_mfc_mem_clean(struct s5p_mfc_dev *dev,
struct s5p_mfc_special_buf *special_buf,
off_t offset, size_t size)
{
- exynos_ion_sync_vaddr_for_device(dev->device, special_buf->dma_buf,
- special_buf->vaddr, size, offset, DMA_TO_DEVICE);
+ __dma_map_area(special_buf->vaddr + offset, size, DMA_TO_DEVICE);
return;
}
struct s5p_mfc_special_buf *special_buf,
off_t offset, size_t size)
{
- exynos_ion_sync_vaddr_for_device(dev->device, special_buf->dma_buf,
- special_buf->vaddr, size, offset, DMA_FROM_DEVICE);
+ __dma_map_area(special_buf->vaddr + offset, size, DMA_FROM_DEVICE);
return;
}
-int s5p_mfc_mem_clean_vb(struct vb2_buffer *vb, u32 num_planes)
-{
- struct vb2_ion_cookie *cookie;
- int i;
- size_t size;
-
- for (i = 0; i < num_planes; i++) {
- cookie = vb2_plane_cookie(vb, i);
- if (!cookie)
- continue;
-
- size = vb->planes[i].length;
- vb2_ion_sync_for_device(cookie, 0, size, DMA_TO_DEVICE);
- }
-
- return 0;
-}
-
-int s5p_mfc_mem_inv_vb(struct vb2_buffer *vb, u32 num_planes)
-{
- struct vb2_ion_cookie *cookie;
- int i;
- size_t size;
-
- for (i = 0; i < num_planes; i++) {
- cookie = vb2_plane_cookie(vb, i);
- if (!cookie)
- continue;
-
- size = vb->planes[i].length;
- vb2_ion_sync_for_device(cookie, 0, size, DMA_FROM_DEVICE);
- }
-
- return 0;
-}
-
int s5p_mfc_mem_get_user_shared_handle(struct s5p_mfc_ctx *ctx,
struct mfc_user_shared_handle *handle)
{
#ifndef __S5P_MFC_MEM_H
#define __S5P_MFC_MEM_H __FILE__
-#include <media/videobuf2-ion.h>
-
#include "s5p_mfc_common.h"
/* Offset base used to differentiate between CAPTURE and OUTPUT
#define DST_QUEUE_OFF_BASE (TASK_SIZE / 2)
static inline dma_addr_t s5p_mfc_mem_get_daddr_vb(
- struct vb2_buffer *v, unsigned int n)
+ struct vb2_buffer *vb, unsigned int n)
{
- void *cookie = vb2_plane_cookie(v, n);
dma_addr_t addr = 0;
- WARN_ON(vb2_ion_dma_address(cookie, &addr) != 0);
+ addr = vb2_dma_sg_plane_dma_addr(vb, n);
+ WARN_ON((addr == 0) || IS_ERR_VALUE(addr));
return addr;
}
-static inline int s5p_mfc_mem_buf_prepare(struct vb2_buffer *vb)
-{
- return vb2_ion_buf_prepare(vb);
-}
-
-static inline void s5p_mfc_mem_buf_finish(struct vb2_buffer *vb)
-{
- vb2_ion_buf_finish(vb);
-}
-
struct vb2_mem_ops *s5p_mfc_mem_ops(void);
void s5p_mfc_mem_set_cacheable(bool cacheable);
void s5p_mfc_mem_invalidate(struct s5p_mfc_dev *dev,
struct s5p_mfc_special_buf *specail_buf,
off_t offset, size_t size);
-int s5p_mfc_mem_clean_vb(struct vb2_buffer *vb, u32 num_planes);
-int s5p_mfc_mem_inv_vb(struct vb2_buffer *vb, u32 num_planes);
int s5p_mfc_mem_get_user_shared_handle(struct s5p_mfc_ctx *ctx,
struct mfc_user_shared_handle *handle);