return -EINVAL;
}
}
-
- /*
- * FIXME: handle this
- * There is no chance to clean CPU caches if HWFC is
- * enabled because the compression starts before the
- * image producer completes writing.
- * Therefore, the image producer (MCSC) and the read DMA
- * of JPEG/SMFC should access the memory with the same
- * shareability attributes.
- if (ctx->enable_hwfc)
- clean_cache = false;
- */
} else {
/* buffer contains JPEG stream to decompress */
int ret = smfc_parse_jpeg_header(ctx, vb);
vb2_wait_for_all_buffers(vq);
}
+static int smfc_vb2_dma_sg_flags(struct vb2_buffer *vb)
+{
+ int flags = 0;
+ struct vb2_queue *vq = vb->vb2_queue;
+
+ /*
+ * There is no chance to clean CPU caches if HWFC is
+ * enabled because the compression starts before the
+ * image producer completes writing.
+ * Therefore, the image producer (MCSC) and the read DMA
+ * of JPEG/SMFC should access the memory with the same
+ * shareability attributes.
+ * MCSC does use shareable memory access for now. Let's make
+ * unshareable to the shared buffer with MSCS here.
+ */
+ if (V4L2_TYPE_IS_OUTPUT(vq->type)) {
+ struct smfc_ctx *ctx = vq->drv_priv;
+
+ if (!!(ctx->flags & SMFC_CTX_COMPRESS) && ctx->enable_hwfc)
+ flags = VB2_DMA_SG_MEMFLAG_IOMMU_UNCACHED;
+ }
+
+ return flags;
+}
+
static struct vb2_ops smfc_vb2_ops = {
.queue_setup = smfc_vb2_queue_setup,
.buf_prepare = smfc_vb2_buf_prepare,
.wait_finish = vb2_ops_wait_finish,
.wait_prepare = vb2_ops_wait_prepare,
.stop_streaming = smfc_vb2_stop_streaming,
+ .mem_flags = smfc_vb2_dma_sg_flags,
};
static int smfc_queue_init(void *priv, struct vb2_queue *src_vq,