Re: [PATCH 1/4] media: qcom: camss: use contiguous buffers when there is no IOMMU

From: Bryan O'Donoghue

Date: Thu Nov 05 2026 - 05:00:12 EST


On 05/11/2026 09:57, Bryan O'Donoghue wrote:
On 04/11/2026 20:23, Allan Siriani wrote:
+static int video_buf_plane_addr(struct camss_video *video,
+                struct vb2_buffer *vb, unsigned int plane,
+                dma_addr_t *addr)
+{
+    struct scatterlist *sg;
+    struct sg_table *sgt;
+    dma_addr_t next;
+    unsigned int i;
+
+    if (video->vb2_q.mem_ops == &vb2_dma_contig_memops) {
+        *addr = vb2_dma_contig_plane_dma_addr(vb, plane);
+        return 0;
+    }
+
+    sgt = vb2_dma_sg_plane_desc(vb, plane);
+    if (!sgt || !sgt->nents)
+        return -EFAULT;
+
+    next = sg_dma_address(sgt->sgl);
+    for_each_sgtable_dma_sg(sgt, sg, i) {
+        if (sg_dma_address(sg) != next) {
+            dev_err(video->camss->dev,
+                "Plane %u is not contiguous in DMA space\n",
+                plane);
+            return -EINVAL;
+        }
+        next += sg_dma_len(sg);
+    }
+
+    *addr = sg_dma_address(sgt->sgl);
+
+    return 0;
+}

STOP SENDING THIS SLOP !

---
bod

Oops - pardon me I thought you resent and NAK'd patch.

My mistake :)

---
bod