Lines Matching defs:cmdbuf

41  * Calls nine_queue_alloc to get a slice of memory in current cmdbuf.
44 * cmdbuf contains NINE_CMD_BUF_INSTR instructions.
51 * Calls nine_queue_wait_flush to wait for a cmdbuf.
52 * After waiting for a cmdbuf it calls nine_queue_get until NULL is returned.
85 struct nine_cmdbuf *cmdbuf = &ctx->pool[ctx->tail];
87 /* wait for cmdbuf full */
89 while (!cmdbuf->full)
91 DBG("waiting for full cmdbuf\n");
94 DBG("got cmdbuf=%p\n", cmdbuf);
97 cmdbuf->offset = 0;
103 * Returns NULL on empty cmdbuf. */
107 struct nine_cmdbuf *cmdbuf = &ctx->pool[ctx->tail];
110 /* At this pointer there's always a cmdbuf. */
112 if (ctx->cur_instr == cmdbuf->num_instr) {
115 DBG("freeing cmdbuf=%p\n", cmdbuf);
116 cmdbuf->full = 0;
125 /* At this pointer there's always a cmdbuf with instruction to process. */
126 offset = cmdbuf->offset;
127 cmdbuf->offset += cmdbuf->instr_size[ctx->cur_instr];
130 return cmdbuf->mem_pool + offset;
136 * Moves the current cmdbuf to worker thread.
137 * Blocks until next cmdbuf is free. */
141 struct nine_cmdbuf *cmdbuf = &ctx->pool[ctx->head];
143 DBG("flushing cmdbuf=%p instr=%d size=%d\n",
144 cmdbuf, cmdbuf->num_instr, cmdbuf->offset);
147 if (!cmdbuf->num_instr)
152 cmdbuf->full = 1;
158 cmdbuf = &ctx->pool[ctx->head];
162 while (cmdbuf->full)
164 DBG("waiting for empty cmdbuf\n");
167 DBG("got empty cmdbuf=%p\n", cmdbuf);
169 cmdbuf->offset = 0;
170 cmdbuf->num_instr = 0;
180 struct nine_cmdbuf *cmdbuf = &ctx->pool[ctx->head];
187 if ((cmdbuf->offset + space > NINE_QUEUE_SIZE) ||
188 (cmdbuf->num_instr == NINE_CMD_BUF_INSTR)) {
192 cmdbuf = &ctx->pool[ctx->head];
195 DBG("cmdbuf=%p space=%d\n", cmdbuf, space);
199 offset = cmdbuf->offset;
200 cmdbuf->offset += space;
201 cmdbuf->instr_size[cmdbuf->num_instr] = space;
202 cmdbuf->num_instr ++;
204 return cmdbuf->mem_pool + offset;
222 struct nine_cmdbuf *cmdbuf = &ctx->pool[ctx->head];
224 return (ctx->tail == ctx->head) && !cmdbuf->num_instr;
249 /* Block until first cmdbuf has been flushed. */