media: videobuf2: add plane data offset function
Add a new helper function to get the offset in the plane to the start of data for the usb gadget uvc function. Signed-off-by: William Wu <william.wu@rock-chips.com> Change-Id: Id2d2c928a531d0272e6241b967fb0deaf3f3e122
This commit is contained in:
@@ -295,6 +295,12 @@ static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b
|
||||
}
|
||||
|
||||
planes[0].data_offset = 0;
|
||||
#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_COMPAT_32BIT_TIME) && \
|
||||
IS_ENABLED(CONFIG_USB_F_UVC)
|
||||
if (b->memory == VB2_MEMORY_DMABUF)
|
||||
planes[0].data_offset = b->reserved2;
|
||||
#endif
|
||||
|
||||
if (V4L2_TYPE_IS_OUTPUT(b->type)) {
|
||||
if (b->bytesused == 0)
|
||||
vb2_warn_zero_bytesused(vb);
|
||||
|
||||
@@ -3159,6 +3159,9 @@ static int video_get_user(void __user *arg, void *parg, unsigned int cmd,
|
||||
.m.userptr = vb32.m.userptr,
|
||||
.length = vb32.length,
|
||||
.request_fd = vb32.request_fd,
|
||||
#if defined(CONFIG_ARCH_ROCKCHIP) && IS_ENABLED(CONFIG_USB_F_UVC)
|
||||
.reserved2 = vb32.reserved2,
|
||||
#endif
|
||||
};
|
||||
|
||||
if (cmd == VIDIOC_QUERYBUF_TIME32)
|
||||
|
||||
@@ -1177,6 +1177,22 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ARCH_ROCKCHIP) && IS_ENABLED(CONFIG_USB_F_UVC)
|
||||
/**
|
||||
* vb2_plane_data_offset() - return plane data_offset in bytes.
|
||||
* @vb: pointer to &struct vb2_buffer to which the plane in
|
||||
* question belongs to.
|
||||
* @plane_no: plane number for which size should be returned.
|
||||
*/
|
||||
static inline unsigned long
|
||||
vb2_plane_data_offset(struct vb2_buffer *vb, unsigned int plane_no)
|
||||
{
|
||||
if (plane_no < vb->num_planes)
|
||||
return vb->planes[plane_no].data_offset;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* vb2_start_streaming_called() - return streaming status of driver.
|
||||
* @q: pointer to &struct vb2_queue with videobuf2 queue.
|
||||
|
||||
Reference in New Issue
Block a user