static int rk3288_vpu_probe(struct platform_device *pdev)
{
struct rk3288_vpu_dev *vpu = NULL;
+ DEFINE_DMA_ATTRS(attrs_novm);
struct video_device *vfd;
int ret = 0;
goto err_hw_probe;
}
- vpu->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
+ dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs_novm);
+ vpu->alloc_ctx = vb2_dma_contig_init_ctx_attrs(&pdev->dev,
+ &attrs_novm);
if (IS_ERR(vpu->alloc_ctx)) {
ret = PTR_ERR(vpu->alloc_ctx);
goto err_dma_contig;
}
+ vpu->alloc_ctx_vm = vb2_dma_contig_init_ctx(&pdev->dev);
+ if (IS_ERR(vpu->alloc_ctx_vm)) {
+ ret = PTR_ERR(vpu->alloc_ctx_vm);
+ goto err_dma_contig_vm;
+ }
+
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
if (ret) {
dev_err(&pdev->dev, "Failed to register v4l2 device\n");
err_enc_alloc:
v4l2_device_unregister(&vpu->v4l2_dev);
err_v4l2_dev_reg:
+ vb2_dma_contig_cleanup_ctx(vpu->alloc_ctx_vm);
+err_dma_contig_vm:
vb2_dma_contig_cleanup_ctx(vpu->alloc_ctx);
err_dma_contig:
rk3288_vpu_hw_remove(vpu);
video_unregister_device(vpu->vfd_dec);
video_unregister_device(vpu->vfd_enc);
v4l2_device_unregister(&vpu->v4l2_dev);
+ vb2_dma_contig_cleanup_ctx(vpu->alloc_ctx_vm);
vb2_dma_contig_cleanup_ctx(vpu->alloc_ctx);
rk3288_vpu_hw_remove(vpu);
* @pdev: Pointer to VPU platform device.
* @dev: Pointer to device for convenient logging using
* dev_ macros.
- * @alloc_ctx: VB2 allocator context.
+ * @alloc_ctx: VB2 allocator context
+ * (for allocations without kernel mapping).
+ * @alloc_ctx_vm: VB2 allocator context
+ * (for allocations with kernel mapping).
* @aclk_vcodec: Handle of ACLK clock.
* @hclk_vcodec: Handle of HCLK clock.
* @base: Mapped address of VPU registers.
struct platform_device *pdev;
struct device *dev;
void *alloc_ctx;
+ void *alloc_ctx_vm;
struct clk *aclk_vcodec;
struct clk *hclk_vcodec;
void __iomem *base;
*buf_count = VIDEO_MAX_FRAME;
psize[0] = ctx->dst_fmt.plane_fmt[0].sizeimage;
- allocators[0] = ctx->dev->alloc_ctx;
+ /* Kernel mapping necessary for bitstream post processing. */
+ allocators[0] = ctx->dev->alloc_ctx_vm;
vpu_debug(0, "capture psize[%d]: %d\n", 0, psize[0]);
break;