The data_offset in v4l2_planes structure will help us point to the start of
data content for that particular plane. This may be useful when a single
buffer contains the data for different planes e.g. Y planes of two fields in
the same buffer. With this, user space can pass queue top field and
bottom field with same dmafd and different data_offsets.

Signed-off-by: Nikhil Devshatwar <nikhil...@ti.com>
---
 drivers/media/platform/ti-vpe/vpe.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/ti-vpe/vpe.c 
b/drivers/media/platform/ti-vpe/vpe.c
index 0ae19ee..e59eb81 100644
--- a/drivers/media/platform/ti-vpe/vpe.c
+++ b/drivers/media/platform/ti-vpe/vpe.c
@@ -495,6 +495,14 @@ struct vpe_mmr_adb {
 
 #define VPE_SET_MMR_ADB_HDR(ctx, hdr, regs, offset_a)  \
        VPDMA_SET_MMR_ADB_HDR(ctx->mmr_adb, vpe_mmr_adb, hdr, regs, offset_a)
+
+static inline dma_addr_t vb2_dma_addr_plus_data_offset(struct vb2_buffer *vb,
+       unsigned int plane_no)
+{
+       return vb2_dma_contig_plane_dma_addr(vb, plane_no) +
+               vb->v4l2_planes[plane_no].data_offset;
+}
+
 /*
  * Set the headers for all of the address/data block structures.
  */
@@ -1002,7 +1010,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port)
                int plane = fmt->coplanar ? p_data->vb_part : 0;
 
                vpdma_fmt = fmt->vpdma_fmt[plane];
-               dma_addr = vb2_dma_contig_plane_dma_addr(vb, plane);
+               dma_addr = vb2_dma_addr_plus_data_offset(vb, plane);
                if (!dma_addr) {
                        vpe_err(ctx->dev,
                                "acquiring output buffer(%d) dma_addr failed\n",
@@ -1042,7 +1050,7 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port)
 
                vpdma_fmt = fmt->vpdma_fmt[plane];
 
-               dma_addr = vb2_dma_contig_plane_dma_addr(vb, plane);
+               dma_addr = vb2_dma_addr_plus_data_offset(vb, plane);
                if (!dma_addr) {
                        vpe_err(ctx->dev,
                                "acquiring input buffer(%d) dma_addr failed\n",
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to