From 2bc46b3ad3c15165f91459b07ff8682478683194 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 15 Feb 2016 12:37:15 -0200 Subject: [media] media/pci: convert drivers to use the new vb2_queue dev field Stop using alloc_ctx and just fill in the device pointer. Signed-off-by: Hans Verkuil Cc: Federico Vaga Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c') diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c index 67a14c41c227..f48ef3392576 100644 --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c @@ -666,10 +666,7 @@ static int solo_enc_queue_setup(struct vb2_queue *q, unsigned int *num_planes, unsigned int sizes[], void *alloc_ctxs[]) { - struct solo_enc_dev *solo_enc = vb2_get_drv_priv(q); - sizes[0] = FRAME_BUF_SIZE; - alloc_ctxs[0] = solo_enc->alloc_ctx; *num_planes = 1; if (*num_buffers < MIN_VID_BUFFERS) @@ -1239,11 +1236,6 @@ static struct solo_enc_dev *solo_enc_alloc(struct solo_dev *solo_dev, return ERR_PTR(-ENOMEM); hdl = &solo_enc->hdl; - solo_enc->alloc_ctx = vb2_dma_sg_init_ctx(&solo_dev->pdev->dev); - if (IS_ERR(solo_enc->alloc_ctx)) { - ret = PTR_ERR(solo_enc->alloc_ctx); - goto hdl_free; - } v4l2_ctrl_handler_init(hdl, 10); v4l2_ctrl_new_std(hdl, &solo_ctrl_ops, V4L2_CID_BRIGHTNESS, 0, 255, 1, 128); @@ -1299,6 +1291,7 @@ static struct solo_enc_dev *solo_enc_alloc(struct solo_dev *solo_dev, solo_enc->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; solo_enc->vidq.buf_struct_size = sizeof(struct solo_vb2_buf); solo_enc->vidq.lock = &solo_enc->lock; + solo_enc->vidq.dev = &solo_dev->pdev->dev; ret = vb2_queue_init(&solo_enc->vidq); if (ret) goto hdl_free; @@ -1347,7 +1340,6 @@ pci_free: solo_enc->desc_items, solo_enc->desc_dma); hdl_free: v4l2_ctrl_handler_free(hdl); - vb2_dma_sg_cleanup_ctx(solo_enc->alloc_ctx); kfree(solo_enc); return ERR_PTR(ret); } @@ -1362,7 +1354,6 @@ static void solo_enc_free(struct solo_enc_dev *solo_enc) solo_enc->desc_items, solo_enc->desc_dma); video_unregister_device(solo_enc->vfd); v4l2_ctrl_handler_free(&solo_enc->hdl); - vb2_dma_sg_cleanup_ctx(solo_enc->alloc_ctx); kfree(solo_enc); } -- cgit v1.2.1 From 36c0f8b32c4bd4f668cedfba6d97afaa84f055fb Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 15 Apr 2016 09:15:05 -0300 Subject: [media] vb2: replace void *alloc_ctxs by struct device *alloc_devs Make this a proper typed array. Drop the old allocate context code since that is no longer used. Note that the memops functions now get a struct device pointer instead of the struct device ** that was there initially (actually a void pointer to a struct containing only a struct device pointer). This code is now a lot cleaner. Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart Cc: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c') diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c index f48ef3392576..8b1cde57c817 100644 --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c @@ -664,7 +664,7 @@ static int solo_ring_thread(void *data) static int solo_enc_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], - void *alloc_ctxs[]) + struct device *alloc_devs[]) { sizes[0] = FRAME_BUF_SIZE; *num_planes = 1; -- cgit v1.2.1 From e34f2a96a44f3c9f2458aa53574e522306e76fe7 Mon Sep 17 00:00:00 2001 From: Andrey Utkin Date: Sat, 9 Jul 2016 21:44:50 -0300 Subject: [media] media: solo6x10: increase FRAME_BUF_SIZE In practice, devices sometimes return frames larger than current buffer size, leading to failure in solo_send_desc(). It is not clear which minimal increase in buffer size would be enough, so this patch doubles it, this should be safely assumed as sufficient. Signed-off-by: Andrey Utkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c') diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c index 8b1cde57c817..399164314c28 100644 --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c @@ -33,7 +33,7 @@ #include "solo6x10-jpeg.h" #define MIN_VID_BUFFERS 2 -#define FRAME_BUF_SIZE (196 * 1024) +#define FRAME_BUF_SIZE (400 * 1024) #define MP4_QS 16 #define DMA_ALIGN 4096 -- cgit v1.2.1