[RAMEN9610-12270][COMMON] media: vb2: modify to support offset in dmabuf
authorSeungchul Kim <sc377.kim@samsung.com>
Thu, 27 Sep 2018 05:03:43 +0000 (14:03 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:17 +0000 (20:23 +0300)
The offset was added to v4l2_buffer,
but vb2 does not support offset.
So vb2 is modified to support offset calculation.

Change-Id: Iee6e4b1146043eae00450556ba4686ba412aec0d
Signed-off-by: Seungchul Kim <sc377.kim@samsung.com>
drivers/media/v4l2-core/videobuf2-dma-sg.c
drivers/media/v4l2-core/videobuf2-v4l2.c

index b0010bf149e639e8bc84c7f95487dbed1efb778a..a78c88ed0e7c1f149de4bf62b93873ef00d0a73e 100644 (file)
@@ -729,7 +729,7 @@ dma_addr_t vb2_dma_sg_plane_dma_addr(struct vb2_buffer *vb,
 {
        struct vb2_dma_sg_buf *buf = vb->planes[plane_no].mem_priv;
 
-       return buf->iova;
+       return buf->iova + vb->planes[plane_no].data_offset;
 }
 
 const struct vb2_mem_ops vb2_dma_sg_memops = {
index d0eac0d12cda84fb17a297ac9077b80af28a68d1..900c5f67b261e99237476f314bcace3dcf85992a 100644 (file)
@@ -358,6 +358,8 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb,
                                        b->m.planes[plane].m.fd;
                                planes[plane].length =
                                        b->m.planes[plane].length;
+                               planes[plane].data_offset =
+                                       b->m.planes[plane].data_offset;
                        }
                }