diff options
Diffstat (limited to 'drivers/media/video/cx18/cx18-queue.h')
-rw-r--r-- | drivers/media/video/cx18/cx18-queue.h | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/drivers/media/video/cx18/cx18-queue.h b/drivers/media/video/cx18/cx18-queue.h index 4de06269d88f..96747e5e7c3c 100644 --- a/drivers/media/video/cx18/cx18-queue.h +++ b/drivers/media/video/cx18/cx18-queue.h | |||
@@ -33,6 +33,19 @@ static inline void cx18_buf_sync_for_cpu(struct cx18_stream *s, | |||
33 | s->buf_size, s->dma); | 33 | s->buf_size, s->dma); |
34 | } | 34 | } |
35 | 35 | ||
36 | void _cx18_mdl_sync_for_cpu(struct cx18_stream *s, struct cx18_mdl *mdl); | ||
37 | |||
38 | static inline void cx18_mdl_sync_for_cpu(struct cx18_stream *s, | ||
39 | struct cx18_mdl *mdl) | ||
40 | { | ||
41 | if (list_is_singular(&mdl->buf_list)) | ||
42 | cx18_buf_sync_for_cpu(s, list_first_entry(&mdl->buf_list, | ||
43 | struct cx18_buffer, | ||
44 | list)); | ||
45 | else | ||
46 | _cx18_mdl_sync_for_cpu(s, mdl); | ||
47 | } | ||
48 | |||
36 | static inline void cx18_buf_sync_for_device(struct cx18_stream *s, | 49 | static inline void cx18_buf_sync_for_device(struct cx18_stream *s, |
37 | struct cx18_buffer *buf) | 50 | struct cx18_buffer *buf) |
38 | { | 51 | { |
@@ -40,32 +53,59 @@ static inline void cx18_buf_sync_for_device(struct cx18_stream *s, | |||
40 | s->buf_size, s->dma); | 53 | s->buf_size, s->dma); |
41 | } | 54 | } |
42 | 55 | ||
56 | void _cx18_mdl_sync_for_device(struct cx18_stream *s, struct cx18_mdl *mdl); | ||
57 | |||
58 | static inline void cx18_mdl_sync_for_device(struct cx18_stream *s, | ||
59 | struct cx18_mdl *mdl) | ||
60 | { | ||
61 | if (list_is_singular(&mdl->buf_list)) | ||
62 | cx18_buf_sync_for_device(s, list_first_entry(&mdl->buf_list, | ||
63 | struct cx18_buffer, | ||
64 | list)); | ||
65 | else | ||
66 | _cx18_mdl_sync_for_device(s, mdl); | ||
67 | } | ||
68 | |||
43 | void cx18_buf_swap(struct cx18_buffer *buf); | 69 | void cx18_buf_swap(struct cx18_buffer *buf); |
70 | void _cx18_mdl_swap(struct cx18_mdl *mdl); | ||
71 | |||
72 | static inline void cx18_mdl_swap(struct cx18_mdl *mdl) | ||
73 | { | ||
74 | if (list_is_singular(&mdl->buf_list)) | ||
75 | cx18_buf_swap(list_first_entry(&mdl->buf_list, | ||
76 | struct cx18_buffer, list)); | ||
77 | else | ||
78 | _cx18_mdl_swap(mdl); | ||
79 | } | ||
44 | 80 | ||
45 | /* cx18_queue utility functions */ | 81 | /* cx18_queue utility functions */ |
46 | struct cx18_queue *_cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, | 82 | struct cx18_queue *_cx18_enqueue(struct cx18_stream *s, struct cx18_mdl *mdl, |
47 | struct cx18_queue *q, int to_front); | 83 | struct cx18_queue *q, int to_front); |
48 | 84 | ||
49 | static inline | 85 | static inline |
50 | struct cx18_queue *cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, | 86 | struct cx18_queue *cx18_enqueue(struct cx18_stream *s, struct cx18_mdl *mdl, |
51 | struct cx18_queue *q) | 87 | struct cx18_queue *q) |
52 | { | 88 | { |
53 | return _cx18_enqueue(s, buf, q, 0); /* FIFO */ | 89 | return _cx18_enqueue(s, mdl, q, 0); /* FIFO */ |
54 | } | 90 | } |
55 | 91 | ||
56 | static inline | 92 | static inline |
57 | struct cx18_queue *cx18_push(struct cx18_stream *s, struct cx18_buffer *buf, | 93 | struct cx18_queue *cx18_push(struct cx18_stream *s, struct cx18_mdl *mdl, |
58 | struct cx18_queue *q) | 94 | struct cx18_queue *q) |
59 | { | 95 | { |
60 | return _cx18_enqueue(s, buf, q, 1); /* LIFO */ | 96 | return _cx18_enqueue(s, mdl, q, 1); /* LIFO */ |
61 | } | 97 | } |
62 | 98 | ||
63 | void cx18_queue_init(struct cx18_queue *q); | 99 | void cx18_queue_init(struct cx18_queue *q); |
64 | struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); | 100 | struct cx18_mdl *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); |
65 | struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id, | 101 | struct cx18_mdl *cx18_queue_get_mdl(struct cx18_stream *s, u32 id, |
66 | u32 bytesused); | 102 | u32 bytesused); |
67 | void cx18_flush_queues(struct cx18_stream *s); | 103 | void cx18_flush_queues(struct cx18_stream *s); |
68 | 104 | ||
105 | /* queue MDL reconfiguration helpers */ | ||
106 | void cx18_unload_queues(struct cx18_stream *s); | ||
107 | void cx18_load_queues(struct cx18_stream *s); | ||
108 | |||
69 | /* cx18_stream utility functions */ | 109 | /* cx18_stream utility functions */ |
70 | int cx18_stream_alloc(struct cx18_stream *s); | 110 | int cx18_stream_alloc(struct cx18_stream *s); |
71 | void cx18_stream_free(struct cx18_stream *s); | 111 | void cx18_stream_free(struct cx18_stream *s); |