aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-queue.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx18/cx18-queue.h')
-rw-r--r--drivers/media/video/cx18/cx18-queue.h54
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
36void _cx18_mdl_sync_for_cpu(struct cx18_stream *s, struct cx18_mdl *mdl);
37
38static 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
36static inline void cx18_buf_sync_for_device(struct cx18_stream *s, 49static 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
56void _cx18_mdl_sync_for_device(struct cx18_stream *s, struct cx18_mdl *mdl);
57
58static 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
43void cx18_buf_swap(struct cx18_buffer *buf); 69void cx18_buf_swap(struct cx18_buffer *buf);
70void _cx18_mdl_swap(struct cx18_mdl *mdl);
71
72static 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 */
46struct cx18_queue *_cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, 82struct 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
49static inline 85static inline
50struct cx18_queue *cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, 86struct 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
56static inline 92static inline
57struct cx18_queue *cx18_push(struct cx18_stream *s, struct cx18_buffer *buf, 93struct 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
63void cx18_queue_init(struct cx18_queue *q); 99void cx18_queue_init(struct cx18_queue *q);
64struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); 100struct cx18_mdl *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q);
65struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id, 101struct cx18_mdl *cx18_queue_get_mdl(struct cx18_stream *s, u32 id,
66 u32 bytesused); 102 u32 bytesused);
67void cx18_flush_queues(struct cx18_stream *s); 103void cx18_flush_queues(struct cx18_stream *s);
68 104
105/* queue MDL reconfiguration helpers */
106void cx18_unload_queues(struct cx18_stream *s);
107void cx18_load_queues(struct cx18_stream *s);
108
69/* cx18_stream utility functions */ 109/* cx18_stream utility functions */
70int cx18_stream_alloc(struct cx18_stream *s); 110int cx18_stream_alloc(struct cx18_stream *s);
71void cx18_stream_free(struct cx18_stream *s); 111void cx18_stream_free(struct cx18_stream *s);