Commit 53ddcc68 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] media/platform: convert drivers to use the new vb2_queue dev field

Stop using alloc_ctx and just fill in the device pointer.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Scott Jiang <scott.jiang.linux@gmail.com>
Acked-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 57813da4
...@@ -1915,7 +1915,6 @@ static int vpfe_queue_setup(struct vb2_queue *vq, ...@@ -1915,7 +1915,6 @@ static int vpfe_queue_setup(struct vb2_queue *vq,
if (vq->num_buffers + *nbuffers < 3) if (vq->num_buffers + *nbuffers < 3)
*nbuffers = 3 - vq->num_buffers; *nbuffers = 3 - vq->num_buffers;
alloc_ctxs[0] = vpfe->alloc_ctx;
if (*nplanes) { if (*nplanes) {
if (sizes[0] < size) if (sizes[0] < size)
...@@ -2364,13 +2363,6 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe) ...@@ -2364,13 +2363,6 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe)
goto probe_out; goto probe_out;
/* Initialize videobuf2 queue as per the buffer type */ /* Initialize videobuf2 queue as per the buffer type */
vpfe->alloc_ctx = vb2_dma_contig_init_ctx(vpfe->pdev);
if (IS_ERR(vpfe->alloc_ctx)) {
vpfe_err(vpfe, "Failed to get the context\n");
err = PTR_ERR(vpfe->alloc_ctx);
goto probe_out;
}
q = &vpfe->buffer_queue; q = &vpfe->buffer_queue;
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ;
...@@ -2381,11 +2373,11 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe) ...@@ -2381,11 +2373,11 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->lock = &vpfe->lock; q->lock = &vpfe->lock;
q->min_buffers_needed = 1; q->min_buffers_needed = 1;
q->dev = vpfe->pdev;
err = vb2_queue_init(q); err = vb2_queue_init(q);
if (err) { if (err) {
vpfe_err(vpfe, "vb2_queue_init() failed\n"); vpfe_err(vpfe, "vb2_queue_init() failed\n");
vb2_dma_contig_cleanup_ctx(vpfe->alloc_ctx);
goto probe_out; goto probe_out;
} }
......
...@@ -264,8 +264,6 @@ struct vpfe_device { ...@@ -264,8 +264,6 @@ struct vpfe_device {
struct v4l2_rect crop; struct v4l2_rect crop;
/* Buffer queue used in video-buf */ /* Buffer queue used in video-buf */
struct vb2_queue buffer_queue; struct vb2_queue buffer_queue;
/* Allocator-specific contexts for each plane */
struct vb2_alloc_ctx *alloc_ctx;
/* Queue of filled frames */ /* Queue of filled frames */
struct list_head dma_queue; struct list_head dma_queue;
/* IRQ lock for DMA queue */ /* IRQ lock for DMA queue */
......
...@@ -91,8 +91,6 @@ struct bcap_device { ...@@ -91,8 +91,6 @@ struct bcap_device {
struct bcap_buffer *cur_frm; struct bcap_buffer *cur_frm;
/* buffer queue used in videobuf2 */ /* buffer queue used in videobuf2 */
struct vb2_queue buffer_queue; struct vb2_queue buffer_queue;
/* allocator-specific contexts for each plane */
struct vb2_alloc_ctx *alloc_ctx;
/* queue of filled frames */ /* queue of filled frames */
struct list_head dma_queue; struct list_head dma_queue;
/* used in videobuf2 callback */ /* used in videobuf2 callback */
...@@ -209,7 +207,6 @@ static int bcap_queue_setup(struct vb2_queue *vq, ...@@ -209,7 +207,6 @@ static int bcap_queue_setup(struct vb2_queue *vq,
if (vq->num_buffers + *nbuffers < 2) if (vq->num_buffers + *nbuffers < 2)
*nbuffers = 2; *nbuffers = 2;
alloc_ctxs[0] = bcap_dev->alloc_ctx;
if (*nplanes) if (*nplanes)
return sizes[0] < bcap_dev->fmt.sizeimage ? -EINVAL : 0; return sizes[0] < bcap_dev->fmt.sizeimage ? -EINVAL : 0;
...@@ -820,12 +817,6 @@ static int bcap_probe(struct platform_device *pdev) ...@@ -820,12 +817,6 @@ static int bcap_probe(struct platform_device *pdev)
} }
bcap_dev->ppi->priv = bcap_dev; bcap_dev->ppi->priv = bcap_dev;
bcap_dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
if (IS_ERR(bcap_dev->alloc_ctx)) {
ret = PTR_ERR(bcap_dev->alloc_ctx);
goto err_free_ppi;
}
vfd = &bcap_dev->video_dev; vfd = &bcap_dev->video_dev;
/* initialize field of video device */ /* initialize field of video device */
vfd->release = video_device_release_empty; vfd->release = video_device_release_empty;
...@@ -839,7 +830,7 @@ static int bcap_probe(struct platform_device *pdev) ...@@ -839,7 +830,7 @@ static int bcap_probe(struct platform_device *pdev)
if (ret) { if (ret) {
v4l2_err(pdev->dev.driver, v4l2_err(pdev->dev.driver,
"Unable to register v4l2 device\n"); "Unable to register v4l2 device\n");
goto err_cleanup_ctx; goto err_free_ppi;
} }
v4l2_info(&bcap_dev->v4l2_dev, "v4l2 device registered\n"); v4l2_info(&bcap_dev->v4l2_dev, "v4l2 device registered\n");
...@@ -863,6 +854,7 @@ static int bcap_probe(struct platform_device *pdev) ...@@ -863,6 +854,7 @@ static int bcap_probe(struct platform_device *pdev)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->lock = &bcap_dev->mutex; q->lock = &bcap_dev->mutex;
q->min_buffers_needed = 1; q->min_buffers_needed = 1;
q->dev = &pdev->dev;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret) if (ret)
...@@ -967,8 +959,6 @@ static int bcap_probe(struct platform_device *pdev) ...@@ -967,8 +959,6 @@ static int bcap_probe(struct platform_device *pdev)
v4l2_ctrl_handler_free(&bcap_dev->ctrl_handler); v4l2_ctrl_handler_free(&bcap_dev->ctrl_handler);
err_unreg_v4l2: err_unreg_v4l2:
v4l2_device_unregister(&bcap_dev->v4l2_dev); v4l2_device_unregister(&bcap_dev->v4l2_dev);
err_cleanup_ctx:
vb2_dma_contig_cleanup_ctx(bcap_dev->alloc_ctx);
err_free_ppi: err_free_ppi:
ppi_delete_instance(bcap_dev->ppi); ppi_delete_instance(bcap_dev->ppi);
err_free_dev: err_free_dev:
...@@ -986,7 +976,6 @@ static int bcap_remove(struct platform_device *pdev) ...@@ -986,7 +976,6 @@ static int bcap_remove(struct platform_device *pdev)
video_unregister_device(&bcap_dev->video_dev); video_unregister_device(&bcap_dev->video_dev);
v4l2_ctrl_handler_free(&bcap_dev->ctrl_handler); v4l2_ctrl_handler_free(&bcap_dev->ctrl_handler);
v4l2_device_unregister(v4l2_dev); v4l2_device_unregister(v4l2_dev);
vb2_dma_contig_cleanup_ctx(bcap_dev->alloc_ctx);
ppi_delete_instance(bcap_dev->ppi); ppi_delete_instance(bcap_dev->ppi);
kfree(bcap_dev); kfree(bcap_dev);
return 0; return 0;
......
...@@ -1151,9 +1151,6 @@ static int coda_queue_setup(struct vb2_queue *vq, ...@@ -1151,9 +1151,6 @@ static int coda_queue_setup(struct vb2_queue *vq,
*nplanes = 1; *nplanes = 1;
sizes[0] = size; sizes[0] = size;
/* Set to vb2-dma-contig allocator context, ignored by vb2-vmalloc */
alloc_ctxs[0] = ctx->dev->alloc_ctx;
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
"get %d buffer(s) of size %d each.\n", *nbuffers, size); "get %d buffer(s) of size %d each.\n", *nbuffers, size);
...@@ -1599,6 +1596,7 @@ static int coda_queue_init(struct coda_ctx *ctx, struct vb2_queue *vq) ...@@ -1599,6 +1596,7 @@ static int coda_queue_init(struct coda_ctx *ctx, struct vb2_queue *vq)
* that videobuf2 will keep the value of bytesused intact. * that videobuf2 will keep the value of bytesused intact.
*/ */
vq->allow_zero_bytesused = 1; vq->allow_zero_bytesused = 1;
vq->dev = &ctx->dev->plat_dev->dev;
return vb2_queue_init(vq); return vb2_queue_init(vq);
} }
...@@ -2040,16 +2038,10 @@ static void coda_fw_callback(const struct firmware *fw, void *context) ...@@ -2040,16 +2038,10 @@ static void coda_fw_callback(const struct firmware *fw, void *context)
if (ret < 0) if (ret < 0)
goto put_pm; goto put_pm;
dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
if (IS_ERR(dev->alloc_ctx)) {
v4l2_err(&dev->v4l2_dev, "Failed to alloc vb2 context\n");
goto put_pm;
}
dev->m2m_dev = v4l2_m2m_init(&coda_m2m_ops); dev->m2m_dev = v4l2_m2m_init(&coda_m2m_ops);
if (IS_ERR(dev->m2m_dev)) { if (IS_ERR(dev->m2m_dev)) {
v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n"); v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n");
goto rel_ctx; goto put_pm;
} }
for (i = 0; i < dev->devtype->num_vdevs; i++) { for (i = 0; i < dev->devtype->num_vdevs; i++) {
...@@ -2072,8 +2064,6 @@ static void coda_fw_callback(const struct firmware *fw, void *context) ...@@ -2072,8 +2064,6 @@ static void coda_fw_callback(const struct firmware *fw, void *context)
while (--i >= 0) while (--i >= 0)
video_unregister_device(&dev->vfd[i]); video_unregister_device(&dev->vfd[i]);
v4l2_m2m_release(dev->m2m_dev); v4l2_m2m_release(dev->m2m_dev);
rel_ctx:
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
put_pm: put_pm:
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
} }
...@@ -2324,8 +2314,6 @@ static int coda_remove(struct platform_device *pdev) ...@@ -2324,8 +2314,6 @@ static int coda_remove(struct platform_device *pdev)
if (dev->m2m_dev) if (dev->m2m_dev)
v4l2_m2m_release(dev->m2m_dev); v4l2_m2m_release(dev->m2m_dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
if (dev->alloc_ctx)
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
v4l2_device_unregister(&dev->v4l2_dev); v4l2_device_unregister(&dev->v4l2_dev);
destroy_workqueue(dev->workqueue); destroy_workqueue(dev->workqueue);
if (dev->iram.vaddr) if (dev->iram.vaddr)
......
...@@ -92,7 +92,6 @@ struct coda_dev { ...@@ -92,7 +92,6 @@ struct coda_dev {
struct mutex coda_mutex; struct mutex coda_mutex;
struct workqueue_struct *workqueue; struct workqueue_struct *workqueue;
struct v4l2_m2m_dev *m2m_dev; struct v4l2_m2m_dev *m2m_dev;
struct vb2_alloc_ctx *alloc_ctx;
struct list_head instances; struct list_head instances;
unsigned long instance_mask; unsigned long instance_mask;
struct dentry *debugfs_root; struct dentry *debugfs_root;
......
...@@ -242,7 +242,6 @@ vpbe_buffer_queue_setup(struct vb2_queue *vq, ...@@ -242,7 +242,6 @@ vpbe_buffer_queue_setup(struct vb2_queue *vq,
/* Store number of buffers allocated in numbuffer member */ /* Store number of buffers allocated in numbuffer member */
if (vq->num_buffers + *nbuffers < VPBE_DEFAULT_NUM_BUFS) if (vq->num_buffers + *nbuffers < VPBE_DEFAULT_NUM_BUFS)
*nbuffers = VPBE_DEFAULT_NUM_BUFS - vq->num_buffers; *nbuffers = VPBE_DEFAULT_NUM_BUFS - vq->num_buffers;
alloc_ctxs[0] = layer->alloc_ctx;
if (*nplanes) if (*nplanes)
return sizes[0] < layer->pix_fmt.sizeimage ? -EINVAL : 0; return sizes[0] < layer->pix_fmt.sizeimage ? -EINVAL : 0;
...@@ -1451,20 +1450,13 @@ static int vpbe_display_probe(struct platform_device *pdev) ...@@ -1451,20 +1450,13 @@ static int vpbe_display_probe(struct platform_device *pdev)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 1; q->min_buffers_needed = 1;
q->lock = &disp_dev->dev[i]->opslock; q->lock = &disp_dev->dev[i]->opslock;
q->dev = disp_dev->vpbe_dev->pdev;
err = vb2_queue_init(q); err = vb2_queue_init(q);
if (err) { if (err) {
v4l2_err(v4l2_dev, "vb2_queue_init() failed\n"); v4l2_err(v4l2_dev, "vb2_queue_init() failed\n");
goto probe_out; goto probe_out;
} }
disp_dev->dev[i]->alloc_ctx =
vb2_dma_contig_init_ctx(disp_dev->vpbe_dev->pdev);
if (IS_ERR(disp_dev->dev[i]->alloc_ctx)) {
v4l2_err(v4l2_dev, "Failed to get the context\n");
err = PTR_ERR(disp_dev->dev[i]->alloc_ctx);
goto probe_out;
}
INIT_LIST_HEAD(&disp_dev->dev[i]->dma_queue); INIT_LIST_HEAD(&disp_dev->dev[i]->dma_queue);
if (register_device(disp_dev->dev[i], disp_dev, pdev)) { if (register_device(disp_dev->dev[i], disp_dev, pdev)) {
...@@ -1482,7 +1474,6 @@ static int vpbe_display_probe(struct platform_device *pdev) ...@@ -1482,7 +1474,6 @@ static int vpbe_display_probe(struct platform_device *pdev)
for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) { for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) {
/* Unregister video device */ /* Unregister video device */
if (disp_dev->dev[k] != NULL) { if (disp_dev->dev[k] != NULL) {
vb2_dma_contig_cleanup_ctx(disp_dev->dev[k]->alloc_ctx);
video_unregister_device(&disp_dev->dev[k]->video_dev); video_unregister_device(&disp_dev->dev[k]->video_dev);
kfree(disp_dev->dev[k]); kfree(disp_dev->dev[k]);
} }
...@@ -1510,7 +1501,6 @@ static int vpbe_display_remove(struct platform_device *pdev) ...@@ -1510,7 +1501,6 @@ static int vpbe_display_remove(struct platform_device *pdev)
for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) {
/* Get the pointer to the layer object */ /* Get the pointer to the layer object */
vpbe_display_layer = disp_dev->dev[i]; vpbe_display_layer = disp_dev->dev[i];
vb2_dma_contig_cleanup_ctx(vpbe_display_layer->alloc_ctx);
/* Unregister video device */ /* Unregister video device */
video_unregister_device(&vpbe_display_layer->video_dev); video_unregister_device(&vpbe_display_layer->video_dev);
......
...@@ -133,7 +133,6 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq, ...@@ -133,7 +133,6 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
*nplanes = 1; *nplanes = 1;
sizes[0] = size; sizes[0] = size;
alloc_ctxs[0] = common->alloc_ctx;
/* Calculate the offset for Y and C data in the buffer */ /* Calculate the offset for Y and C data in the buffer */
vpif_calculate_offsets(ch); vpif_calculate_offsets(ch);
...@@ -1371,6 +1370,7 @@ static int vpif_probe_complete(void) ...@@ -1371,6 +1370,7 @@ static int vpif_probe_complete(void)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 1; q->min_buffers_needed = 1;
q->lock = &common->lock; q->lock = &common->lock;
q->dev = vpif_dev;
err = vb2_queue_init(q); err = vb2_queue_init(q);
if (err) { if (err) {
...@@ -1378,13 +1378,6 @@ static int vpif_probe_complete(void) ...@@ -1378,13 +1378,6 @@ static int vpif_probe_complete(void)
goto probe_out; goto probe_out;
} }
common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
if (IS_ERR(common->alloc_ctx)) {
vpif_err("Failed to get the context\n");
err = PTR_ERR(common->alloc_ctx);
goto probe_out;
}
INIT_LIST_HEAD(&common->dma_queue); INIT_LIST_HEAD(&common->dma_queue);
/* Initialize the video_device structure */ /* Initialize the video_device structure */
...@@ -1412,7 +1405,6 @@ static int vpif_probe_complete(void) ...@@ -1412,7 +1405,6 @@ static int vpif_probe_complete(void)
/* Get the pointer to the channel object */ /* Get the pointer to the channel object */
ch = vpif_obj.dev[k]; ch = vpif_obj.dev[k];
common = &ch->common[k]; common = &ch->common[k];
vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
/* Unregister video device */ /* Unregister video device */
video_unregister_device(&ch->video_dev); video_unregister_device(&ch->video_dev);
} }
...@@ -1546,7 +1538,6 @@ static int vpif_remove(struct platform_device *device) ...@@ -1546,7 +1538,6 @@ static int vpif_remove(struct platform_device *device)
/* Get the pointer to the channel object */ /* Get the pointer to the channel object */
ch = vpif_obj.dev[i]; ch = vpif_obj.dev[i];
common = &ch->common[VPIF_VIDEO_INDEX]; common = &ch->common[VPIF_VIDEO_INDEX];
vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
/* Unregister video device */ /* Unregister video device */
video_unregister_device(&ch->video_dev); video_unregister_device(&ch->video_dev);
kfree(vpif_obj.dev[i]); kfree(vpif_obj.dev[i]);
......
...@@ -65,8 +65,6 @@ struct common_obj { ...@@ -65,8 +65,6 @@ struct common_obj {
struct v4l2_format fmt; struct v4l2_format fmt;
/* Buffer queue used in video-buf */ /* Buffer queue used in video-buf */
struct vb2_queue buffer_queue; struct vb2_queue buffer_queue;
/* allocator-specific contexts for each plane */
struct vb2_alloc_ctx *alloc_ctx;
/* Queue of filled frames */ /* Queue of filled frames */
struct list_head dma_queue; struct list_head dma_queue;
/* Used in video-buf */ /* Used in video-buf */
......
...@@ -126,7 +126,6 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq, ...@@ -126,7 +126,6 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
*nplanes = 1; *nplanes = 1;
sizes[0] = size; sizes[0] = size;
alloc_ctxs[0] = common->alloc_ctx;
/* Calculate the offset for Y and C data in the buffer */ /* Calculate the offset for Y and C data in the buffer */
vpif_calculate_offsets(ch); vpif_calculate_offsets(ch);
...@@ -1191,19 +1190,13 @@ static int vpif_probe_complete(void) ...@@ -1191,19 +1190,13 @@ static int vpif_probe_complete(void)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 1; q->min_buffers_needed = 1;
q->lock = &common->lock; q->lock = &common->lock;
q->dev = vpif_dev;
err = vb2_queue_init(q); err = vb2_queue_init(q);
if (err) { if (err) {
vpif_err("vpif_display: vb2_queue_init() failed\n"); vpif_err("vpif_display: vb2_queue_init() failed\n");
goto probe_out; goto probe_out;
} }
common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
if (IS_ERR(common->alloc_ctx)) {
vpif_err("Failed to get the context\n");
err = PTR_ERR(common->alloc_ctx);
goto probe_out;
}
INIT_LIST_HEAD(&common->dma_queue); INIT_LIST_HEAD(&common->dma_queue);
/* register video device */ /* register video device */
...@@ -1233,7 +1226,6 @@ static int vpif_probe_complete(void) ...@@ -1233,7 +1226,6 @@ static int vpif_probe_complete(void)
for (k = 0; k < j; k++) { for (k = 0; k < j; k++) {
ch = vpif_obj.dev[k]; ch = vpif_obj.dev[k];
common = &ch->common[k]; common = &ch->common[k];
vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
video_unregister_device(&ch->video_dev); video_unregister_device(&ch->video_dev);
} }
return err; return err;
...@@ -1355,7 +1347,6 @@ static int vpif_remove(struct platform_device *device) ...@@ -1355,7 +1347,6 @@ static int vpif_remove(struct platform_device *device)
/* Get the pointer to the channel object */ /* Get the pointer to the channel object */
ch = vpif_obj.dev[i]; ch = vpif_obj.dev[i];
common = &ch->common[VPIF_VIDEO_INDEX]; common = &ch->common[VPIF_VIDEO_INDEX];
vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
/* Unregister video device */ /* Unregister video device */
video_unregister_device(&ch->video_dev); video_unregister_device(&ch->video_dev);
kfree(vpif_obj.dev[i]); kfree(vpif_obj.dev[i]);
......
...@@ -74,8 +74,6 @@ struct common_obj { ...@@ -74,8 +74,6 @@ struct common_obj {
struct v4l2_format fmt; /* Used to store the format */ struct v4l2_format fmt; /* Used to store the format */
struct vb2_queue buffer_queue; /* Buffer queue used in struct vb2_queue buffer_queue; /* Buffer queue used in
* video-buf */ * video-buf */
/* allocator-specific contexts for each plane */
struct vb2_alloc_ctx *alloc_ctx;
struct list_head dma_queue; /* Queue of filled frames */ struct list_head dma_queue; /* Queue of filled frames */
spinlock_t irqlock; /* Used in video-buf */ spinlock_t irqlock; /* Used in video-buf */
......
...@@ -979,7 +979,6 @@ static int rvin_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, ...@@ -979,7 +979,6 @@ static int rvin_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
{ {
struct rvin_dev *vin = vb2_get_drv_priv(vq); struct rvin_dev *vin = vb2_get_drv_priv(vq);
alloc_ctxs[0] = vin->alloc_ctx;
/* Make sure the image size is large enough. */ /* Make sure the image size is large enough. */
if (*nplanes) if (*nplanes)
return sizes[0] < vin->format.sizeimage ? -EINVAL : 0; return sizes[0] < vin->format.sizeimage ? -EINVAL : 0;
...@@ -1129,9 +1128,6 @@ static struct vb2_ops rvin_qops = { ...@@ -1129,9 +1128,6 @@ static struct vb2_ops rvin_qops = {
void rvin_dma_remove(struct rvin_dev *vin) void rvin_dma_remove(struct rvin_dev *vin)
{ {
if (!IS_ERR_OR_NULL(vin->alloc_ctx))
vb2_dma_contig_cleanup_ctx(vin->alloc_ctx);
mutex_destroy(&vin->lock); mutex_destroy(&vin->lock);
v4l2_device_unregister(&vin->v4l2_dev); v4l2_device_unregister(&vin->v4l2_dev);
...@@ -1158,12 +1154,6 @@ int rvin_dma_probe(struct rvin_dev *vin, int irq) ...@@ -1158,12 +1154,6 @@ int rvin_dma_probe(struct rvin_dev *vin, int irq)
vin->queue_buf[i] = NULL; vin->queue_buf[i] = NULL;
/* buffer queue */ /* buffer queue */
vin->alloc_ctx = vb2_dma_contig_init_ctx(vin->dev);
if (IS_ERR(vin->alloc_ctx)) {
ret = PTR_ERR(vin->alloc_ctx);
goto error;
}
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF; q->io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF;
q->lock = &vin->lock; q->lock = &vin->lock;
...@@ -1173,6 +1163,7 @@ int rvin_dma_probe(struct rvin_dev *vin, int irq) ...@@ -1173,6 +1163,7 @@ int rvin_dma_probe(struct rvin_dev *vin, int irq)
q->mem_ops = &vb2_dma_contig_memops; q->mem_ops = &vb2_dma_contig_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 2; q->min_buffers_needed = 2;
q->dev = vin->dev;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret < 0) { if (ret < 0) {
......
...@@ -94,7 +94,6 @@ struct rvin_graph_entity { ...@@ -94,7 +94,6 @@ struct rvin_graph_entity {
* *
* @lock: protects @queue * @lock: protects @queue
* @queue: vb2 buffers queue * @queue: vb2 buffers queue
* @alloc_ctx: allocation context for the vb2 @queue
* *
* @qlock: protects @queue_buf, @buf_list, @continuous, @sequence * @qlock: protects @queue_buf, @buf_list, @continuous, @sequence
* @state * @state
...@@ -125,7 +124,6 @@ struct rvin_dev { ...@@ -125,7 +124,6 @@ struct rvin_dev {
struct mutex lock; struct mutex lock;
struct vb2_queue queue; struct vb2_queue queue;
struct vb2_alloc_ctx *alloc_ctx;
spinlock_t qlock; spinlock_t qlock;
struct vb2_v4l2_buffer *queue_buf[HW_BUFFER_NUM]; struct vb2_v4l2_buffer *queue_buf[HW_BUFFER_NUM];
......
...@@ -81,8 +81,6 @@ struct vpbe_layer { ...@@ -81,8 +81,6 @@ struct vpbe_layer {
* Buffer queue used in video-buf * Buffer queue used in video-buf
*/ */
struct vb2_queue buffer_queue; struct vb2_queue buffer_queue;
/* allocator-specific contexts for each plane */
struct vb2_alloc_ctx *alloc_ctx;
/* Queue of filled frames */ /* Queue of filled frames */
struct list_head dma_queue; struct list_head dma_queue;
/* Used in video-buf */ /* Used in video-buf */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment