diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 3f61f5863bf7..cb4685c9c51f 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -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); diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index b0101e08fcdc..503de4430b25 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -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) diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 3f4f171a790b..7ae816d8bd80 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -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.