diff options
author | Andy Walls <awalls@radix.net> | 2009-11-10 22:57:16 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:53 -0500 |
commit | ad689d54f979233c024c25a2221f4fd6f56543fe (patch) | |
tree | d28f3cb3958b387362c562c83ae5966e0a8874d9 /drivers | |
parent | 127ce5f0adcca71eeeed2386ed4742ea6363a063 (diff) |
V4L/DVB (13433): cx18: Remove duplicate list traversal when processing incoming MDLs
Update the incoming MDL's buffers' bytesused and sync the buffers for the cpu
in one pass instead of two.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/cx18/cx18-queue.c | 27 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-queue.h | 13 |
2 files changed, 8 insertions, 32 deletions
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c index f2d539f6bdf9..63304823cef5 100644 --- a/drivers/media/video/cx18/cx18-queue.c +++ b/drivers/media/video/cx18/cx18-queue.c | |||
@@ -100,8 +100,8 @@ struct cx18_mdl *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q) | |||
100 | return mdl; | 100 | return mdl; |
101 | } | 101 | } |
102 | 102 | ||
103 | static void _cx18_mdl_set_buf_bytesused(struct cx18_stream *s, | 103 | static void _cx18_mdl_update_bufs_for_cpu(struct cx18_stream *s, |
104 | struct cx18_mdl *mdl) | 104 | struct cx18_mdl *mdl) |
105 | { | 105 | { |
106 | struct cx18_buffer *buf; | 106 | struct cx18_buffer *buf; |
107 | u32 buf_size = s->buf_size; | 107 | u32 buf_size = s->buf_size; |
@@ -116,11 +116,12 @@ static void _cx18_mdl_set_buf_bytesused(struct cx18_stream *s, | |||
116 | buf->bytesused = bytesused; | 116 | buf->bytesused = bytesused; |
117 | bytesused = 0; | 117 | bytesused = 0; |
118 | } | 118 | } |
119 | cx18_buf_sync_for_cpu(s, buf); | ||
119 | } | 120 | } |
120 | } | 121 | } |
121 | 122 | ||
122 | static inline void cx18_mdl_set_buf_bytesused(struct cx18_stream *s, | 123 | static inline void cx18_mdl_update_bufs_for_cpu(struct cx18_stream *s, |
123 | struct cx18_mdl *mdl) | 124 | struct cx18_mdl *mdl) |
124 | { | 125 | { |
125 | struct cx18_buffer *buf; | 126 | struct cx18_buffer *buf; |
126 | 127 | ||
@@ -129,8 +130,9 @@ static inline void cx18_mdl_set_buf_bytesused(struct cx18_stream *s, | |||
129 | list); | 130 | list); |
130 | buf->bytesused = mdl->bytesused; | 131 | buf->bytesused = mdl->bytesused; |
131 | buf->readpos = 0; | 132 | buf->readpos = 0; |
133 | cx18_buf_sync_for_cpu(s, buf); | ||
132 | } else { | 134 | } else { |
133 | _cx18_mdl_set_buf_bytesused(s, mdl); | 135 | _cx18_mdl_update_bufs_for_cpu(s, mdl); |
134 | } | 136 | } |
135 | } | 137 | } |
136 | 138 | ||
@@ -191,8 +193,7 @@ struct cx18_mdl *cx18_queue_get_mdl(struct cx18_stream *s, u32 id, | |||
191 | ret->bytesused = bytesused; | 193 | ret->bytesused = bytesused; |
192 | ret->skipped = 0; | 194 | ret->skipped = 0; |
193 | /* 0'ed readpos, m_flags & curr_buf when mdl went on q_busy */ | 195 | /* 0'ed readpos, m_flags & curr_buf when mdl went on q_busy */ |
194 | cx18_mdl_set_buf_bytesused(s, ret); | 196 | cx18_mdl_update_bufs_for_cpu(s, ret); |
195 | cx18_mdl_sync_for_cpu(s, ret); | ||
196 | if (s->type != CX18_ENC_STREAM_TYPE_TS) | 197 | if (s->type != CX18_ENC_STREAM_TYPE_TS) |
197 | set_bit(CX18_F_M_NEED_SWAP, &ret->m_flags); | 198 | set_bit(CX18_F_M_NEED_SWAP, &ret->m_flags); |
198 | } | 199 | } |
@@ -331,18 +332,6 @@ void cx18_load_queues(struct cx18_stream *s) | |||
331 | } | 332 | } |
332 | } | 333 | } |
333 | 334 | ||
334 | void _cx18_mdl_sync_for_cpu(struct cx18_stream *s, struct cx18_mdl *mdl) | ||
335 | { | ||
336 | int dma = s->dma; | ||
337 | u32 buf_size = s->buf_size; | ||
338 | struct pci_dev *pci_dev = s->cx->pci_dev; | ||
339 | struct cx18_buffer *buf; | ||
340 | |||
341 | list_for_each_entry(buf, &mdl->buf_list, list) | ||
342 | pci_dma_sync_single_for_cpu(pci_dev, buf->dma_handle, | ||
343 | buf_size, dma); | ||
344 | } | ||
345 | |||
346 | void _cx18_mdl_sync_for_device(struct cx18_stream *s, struct cx18_mdl *mdl) | 335 | void _cx18_mdl_sync_for_device(struct cx18_stream *s, struct cx18_mdl *mdl) |
347 | { | 336 | { |
348 | int dma = s->dma; | 337 | int dma = s->dma; |
diff --git a/drivers/media/video/cx18/cx18-queue.h b/drivers/media/video/cx18/cx18-queue.h index 96747e5e7c3c..88a6d34ad3bb 100644 --- a/drivers/media/video/cx18/cx18-queue.h +++ b/drivers/media/video/cx18/cx18-queue.h | |||
@@ -33,19 +33,6 @@ 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 | |||
49 | static inline void cx18_buf_sync_for_device(struct cx18_stream *s, | 36 | static inline void cx18_buf_sync_for_device(struct cx18_stream *s, |
50 | struct cx18_buffer *buf) | 37 | struct cx18_buffer *buf) |
51 | { | 38 | { |