mirror of
https://github.com/patjak/facetimehd.git
synced 2026-04-09 11:02:31 +02:00
vb2: replace void *alloc_ctxs by struct device *alloc_devs
Upstream: torvalds/linux@36c0f8b32c ("[media] vb2: replace void *alloc_ctxs by struct device *alloc_devs")
This commit is contained in:
@@ -118,7 +118,9 @@ struct fthd_private {
|
|||||||
struct vb2_queue vb2_queue;
|
struct vb2_queue vb2_queue;
|
||||||
struct mutex vb2_queue_lock;
|
struct mutex vb2_queue_lock;
|
||||||
struct list_head buffer_queue;
|
struct list_head buffer_queue;
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
|
||||||
struct vb2_alloc_ctx *alloc_ctx;
|
struct vb2_alloc_ctx *alloc_ctx;
|
||||||
|
#endif
|
||||||
struct h2t_buf_ctx h2t_bufs[FTHD_BUFFERS];
|
struct h2t_buf_ctx h2t_bufs[FTHD_BUFFERS];
|
||||||
|
|
||||||
struct v4l2_ctrl_handler v4l2_ctrl_handler;
|
struct v4l2_ctrl_handler v4l2_ctrl_handler;
|
||||||
|
|||||||
12
fthd_v4l2.c
12
fthd_v4l2.c
@@ -52,7 +52,11 @@ static int fthd_buffer_queue_setup(
|
|||||||
unsigned int *nbuffers,
|
unsigned int *nbuffers,
|
||||||
unsigned int *nplanes,
|
unsigned int *nplanes,
|
||||||
unsigned int sizes[],
|
unsigned int sizes[],
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)
|
||||||
|
struct device *alloc_devs[]
|
||||||
|
#else
|
||||||
void *alloc_ctxs[]
|
void *alloc_ctxs[]
|
||||||
|
#endif
|
||||||
) {
|
) {
|
||||||
|
|
||||||
struct fthd_private *dev_priv = vb2_get_drv_priv(vq);
|
struct fthd_private *dev_priv = vb2_get_drv_priv(vq);
|
||||||
@@ -70,7 +74,11 @@ static int fthd_buffer_queue_setup(
|
|||||||
/* FIXME: We assume single plane format here but not below */
|
/* FIXME: We assume single plane format here but not below */
|
||||||
for (i = 0; i < *nplanes; i++) {
|
for (i = 0; i < *nplanes; i++) {
|
||||||
sizes[i] = cur_fmt->sizeimage;
|
sizes[i] = cur_fmt->sizeimage;
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)
|
||||||
|
alloc_devs[i] = &dev_priv->pdev->dev;
|
||||||
|
#else
|
||||||
alloc_ctxs[i] = dev_priv->alloc_ctx;
|
alloc_ctxs[i] = dev_priv->alloc_ctx;
|
||||||
|
#endif
|
||||||
total_size += sizes[i];
|
total_size += sizes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,7 +719,9 @@ int fthd_v4l2_register(struct fthd_private *dev_priv)
|
|||||||
v4l2_ctrl_handler_free(&dev_priv->v4l2_ctrl_handler);
|
v4l2_ctrl_handler_free(&dev_priv->v4l2_ctrl_handler);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
|
||||||
dev_priv->alloc_ctx = vb2_dma_sg_init_ctx(&dev_priv->pdev->dev);
|
dev_priv->alloc_ctx = vb2_dma_sg_init_ctx(&dev_priv->pdev->dev);
|
||||||
|
#endif
|
||||||
vdev->v4l2_dev = v4l2_dev;
|
vdev->v4l2_dev = v4l2_dev;
|
||||||
strcpy(vdev->name, "Apple Facetime HD"); // XXX: Length?
|
strcpy(vdev->name, "Apple Facetime HD"); // XXX: Length?
|
||||||
vdev->vfl_dir = VFL_DIR_RX;
|
vdev->vfl_dir = VFL_DIR_RX;
|
||||||
@@ -746,7 +756,9 @@ void fthd_v4l2_unregister(struct fthd_private *dev_priv)
|
|||||||
{
|
{
|
||||||
|
|
||||||
v4l2_ctrl_handler_free(&dev_priv->v4l2_ctrl_handler);
|
v4l2_ctrl_handler_free(&dev_priv->v4l2_ctrl_handler);
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
|
||||||
vb2_dma_sg_cleanup_ctx(dev_priv->alloc_ctx);
|
vb2_dma_sg_cleanup_ctx(dev_priv->alloc_ctx);
|
||||||
|
#endif
|
||||||
video_unregister_device(dev_priv->videodev);
|
video_unregister_device(dev_priv->videodev);
|
||||||
v4l2_device_unregister(&dev_priv->v4l2_dev);
|
v4l2_device_unregister(&dev_priv->v4l2_dev);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user