V4L/DVB (9891): cx18 Replace magic number 63 with CX18_MAX_FW_MDLS_PER_STREAM
authorAndy Walls <awalls@radix.net>
Sun, 14 Dec 2008 21:52:12 +0000 (18:52 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 30 Dec 2008 11:39:07 +0000 (09:39 -0200)
Removed magic number that referred to firmware limit on the number of
MDLs the firmware can maintain for any stream at any one time.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-driver.h
drivers/media/video/cx18/cx18-queue.c
drivers/media/video/cx18/cx18-streams.c

index 018d98f94f97095f29abbd540bf8204f30fa3ffb..0d2edebc39b4e199ca3cf5c1c1a20b0cc11580d0 100644 (file)
 #define CX18_DEFAULT_ENC_PCM_BUFFERS 1
 
 /* Maximum firmware DMA buffers per stream */
-#define CX18_MAX_MDLS_PER_STREAM 63
+#define CX18_MAX_FW_MDLS_PER_STREAM 63
 
 /* DMA buffer, default size in kB allocated */
 #define CX18_DEFAULT_ENC_TS_BUFSIZE   32
@@ -255,7 +255,8 @@ struct cx18_scb; /* forward reference */
 
 
 #define CX18_MAX_MDL_ACKS 2
-#define CX18_MAX_EPU_WORK_ORDERS 70 /* CPU_DE_RELEASE_MDL bursts 63 commands */
+#define CX18_MAX_EPU_WORK_ORDERS (CX18_MAX_FW_MDLS_PER_STREAM + 7)
+/* CPU_DE_RELEASE_MDL can burst CX18_MAX_FW_MDLS_PER_STREAM orders in a group */
 
 #define CX18_F_EWO_MB_STALE_UPON_RECEIPT 0x1
 #define CX18_F_EWO_MB_STALE_WHILE_PROC   0x2
index a6b0666f0ba3a6f3138ded66a33f358b8d4e900f..2c58b0c478c0e2861065112a819aef777173e2d8 100644 (file)
@@ -55,8 +55,9 @@ struct cx18_queue *_cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf,
 
        mutex_lock(&s->qlock);
 
-       /* q_busy is restricted to 63 buffers to stay within firmware limits */
-       if (q == &s->q_busy && atomic_read(&q->buffers) >= 63)
+       /* q_busy is restricted to a max buffer count imposed by firmware */
+       if (q == &s->q_busy &&
+           atomic_read(&q->buffers) >= CX18_MAX_FW_MDLS_PER_STREAM)
                q = &s->q_free;
 
        if (to_front)
index 985bad89f31142d39b034d7a4117b8d95c05d7ad..8fc655d3ced97074af8cb4a9758387f0fa96d97a 100644 (file)
@@ -425,7 +425,7 @@ void cx18_stream_load_fw_queue(struct cx18_stream *s)
        struct cx18_buffer *buf;
 
        if (atomic_read(&s->q_free.buffers) == 0 ||
-           atomic_read(&s->q_busy.buffers) >= 63)
+           atomic_read(&s->q_busy.buffers) >= CX18_MAX_FW_MDLS_PER_STREAM)
                return;
 
        /* Move from q_free to q_busy notifying the firmware, until the limit */
@@ -434,7 +434,8 @@ void cx18_stream_load_fw_queue(struct cx18_stream *s)
                if (buf == NULL)
                        break;
                q = cx18_stream_put_buf_fw(s, buf);
-       } while (atomic_read(&s->q_busy.buffers) < 63 && q == &s->q_busy);
+       } while (atomic_read(&s->q_busy.buffers) < CX18_MAX_FW_MDLS_PER_STREAM
+                && q == &s->q_busy);
 }
 
 int cx18_start_v4l2_encode_stream(struct cx18_stream *s)