Skip to content

Commit

Permalink
[media] solo6x10: convert the display node to vb2
Browse files Browse the repository at this point in the history
As a consequence the ioctl op has been replaced by unlocked_ioctl.
Since we are now using the core lock the locking scheme has been
simplified as well.
The main reason for converting this driver to vb2 was that the locking
scheme in v4l2.c was hopeless. It was easier to just convert the driver
then to try and salvage a threading and videobuf nightmare.
The videobuf2 framework is far, far superior compared to the old videobuf.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 25, 2013
1 parent 382c31a commit a4056c2
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 207 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/media/solo6x10/Kconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
config SOLO6X10
tristate "Softlogic 6x10 MPEG codec cards"
depends on PCI && VIDEO_DEV && SND && I2C
select VIDEOBUF_DMA_SG
select VIDEOBUF2_DMA_SG
select VIDEOBUF2_DMA_CONTIG
select SND_PCM
---help---
This driver supports the Softlogic based MPEG-4 and h.264 codec
Expand Down
7 changes: 3 additions & 4 deletions drivers/staging/media/solo6x10/solo6x10.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <media/v4l2-dev.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <media/videobuf-core.h>
#include <media/videobuf2-core.h>

#include "registers.h"
Expand Down Expand Up @@ -259,17 +258,17 @@ struct solo_dev {
/* Ring thread */
struct task_struct *ring_thread;
wait_queue_head_t ring_thread_wait;
atomic_t enc_users;
atomic_t disp_users;

/* VOP_HEADER handling */
void *vh_buf;
dma_addr_t vh_dma;
int vh_size;

/* Buffer handling */
struct videobuf_queue vidq;
struct vb2_queue vidq;
struct vb2_alloc_ctx *alloc_ctx;
struct task_struct *kthread;
struct mutex lock;
spinlock_t slock;
int old_write;
struct list_head vidq_active;
Expand Down
12 changes: 0 additions & 12 deletions drivers/staging/media/solo6x10/v4l2-enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
#define MP4_QS 16
#define DMA_ALIGN 4096

struct solo_videobuf {
struct videobuf_buffer vb;
unsigned int flags;
};

/* 6010 M4V */
static unsigned char vop_6010_ntsc_d1[] = {
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x20,
Expand Down Expand Up @@ -672,9 +667,6 @@ static void solo_enc_buf_queue(struct vb2_buffer *vb)

static int solo_ring_start(struct solo_dev *solo_dev)
{
if (atomic_inc_return(&solo_dev->enc_users) > 1)
return 0;

solo_dev->ring_thread = kthread_run(solo_ring_thread, solo_dev,
SOLO6X10_NAME "_ring");
if (IS_ERR(solo_dev->ring_thread)) {
Expand All @@ -690,9 +682,6 @@ static int solo_ring_start(struct solo_dev *solo_dev)

static void solo_ring_stop(struct solo_dev *solo_dev)
{
if (atomic_dec_return(&solo_dev->enc_users) > 0)
return;

if (solo_dev->ring_thread) {
kthread_stop(solo_dev->ring_thread);
solo_dev->ring_thread = NULL;
Expand Down Expand Up @@ -1279,7 +1268,6 @@ int solo_enc_v4l2_init(struct solo_dev *solo_dev, unsigned nr)
{
int i;

atomic_set(&solo_dev->enc_users, 0);
init_waitqueue_head(&solo_dev->ring_thread_wait);

solo_dev->vh_size = sizeof(struct vop_header);
Expand Down
Loading

0 comments on commit a4056c2

Please sign in to comment.