Lines Matching refs:ctx
37 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); in _queue_setup() local
39 ctx->buf_cnt = *nbuffers; in _queue_setup()
41 sizes[0] = ctx->buf_siz; in _queue_setup()
48 dprintk(3, "[%s] count=%d, size=%d\n", ctx->name, in _queue_setup()
56 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); in _buffer_prepare() local
57 unsigned long size = ctx->buf_siz; in _buffer_prepare()
61 ctx->name, vb2_plane_size(vb, 0), size); in _buffer_prepare()
66 dprintk(3, "[%s]\n", ctx->name); in _buffer_prepare()
73 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); in _buffer_queue() local
77 spin_lock_irqsave(&ctx->slock, flags); in _buffer_queue()
78 list_add_tail(&buf->list, &ctx->dvb_q); in _buffer_queue()
79 spin_unlock_irqrestore(&ctx->slock, flags); in _buffer_queue()
81 dprintk(3, "[%s]\n", ctx->name); in _buffer_queue()
86 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); in _start_streaming() local
88 dprintk(3, "[%s] count=%d\n", ctx->name, count); in _start_streaming()
94 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); in _stop_streaming() local
98 dprintk(3, "[%s]\n", ctx->name); in _stop_streaming()
100 spin_lock_irqsave(&ctx->slock, flags); in _stop_streaming()
101 while (!list_empty(&ctx->dvb_q)) { in _stop_streaming()
102 buf = list_entry(ctx->dvb_q.next, in _stop_streaming()
107 spin_unlock_irqrestore(&ctx->slock, flags); in _stop_streaming()
112 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); in _dmxdev_lock() local
114 mutex_lock(&ctx->mutex); in _dmxdev_lock()
115 dprintk(3, "[%s]\n", ctx->name); in _dmxdev_lock()
120 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); in _dmxdev_unlock() local
122 if (mutex_is_locked(&ctx->mutex)) in _dmxdev_unlock()
123 mutex_unlock(&ctx->mutex); in _dmxdev_unlock()
124 dprintk(3, "[%s]\n", ctx->name); in _dmxdev_unlock()
139 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); in _fill_dmx_buffer() local
146 dprintk(3, "[%s]\n", ctx->name); in _fill_dmx_buffer()
151 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); in _fill_vb2_buffer() local
154 dprintk(3, "[%s]\n", ctx->name); in _fill_vb2_buffer()
167 int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int nonblocking) in dvb_vb2_init() argument
169 struct vb2_queue *q = &ctx->vb_q; in dvb_vb2_init()
172 memset(ctx, 0, sizeof(struct dvb_vb2_ctx)); in dvb_vb2_init()
178 q->drv_priv = ctx; in dvb_vb2_init()
187 ctx->state = DVB_VB2_STATE_NONE; in dvb_vb2_init()
188 dprintk(1, "[%s] errno=%d\n", ctx->name, ret); in dvb_vb2_init()
192 mutex_init(&ctx->mutex); in dvb_vb2_init()
193 spin_lock_init(&ctx->slock); in dvb_vb2_init()
194 INIT_LIST_HEAD(&ctx->dvb_q); in dvb_vb2_init()
196 strscpy(ctx->name, name, DVB_VB2_NAME_MAX); in dvb_vb2_init()
197 ctx->nonblocking = nonblocking; in dvb_vb2_init()
198 ctx->state = DVB_VB2_STATE_INIT; in dvb_vb2_init()
200 dprintk(3, "[%s]\n", ctx->name); in dvb_vb2_init()
205 int dvb_vb2_release(struct dvb_vb2_ctx *ctx) in dvb_vb2_release() argument
207 struct vb2_queue *q = (struct vb2_queue *)&ctx->vb_q; in dvb_vb2_release()
209 if (ctx->state & DVB_VB2_STATE_INIT) in dvb_vb2_release()
212 ctx->state = DVB_VB2_STATE_NONE; in dvb_vb2_release()
213 dprintk(3, "[%s]\n", ctx->name); in dvb_vb2_release()
218 int dvb_vb2_stream_on(struct dvb_vb2_ctx *ctx) in dvb_vb2_stream_on() argument
220 struct vb2_queue *q = &ctx->vb_q; in dvb_vb2_stream_on()
225 ctx->state = DVB_VB2_STATE_NONE; in dvb_vb2_stream_on()
226 dprintk(1, "[%s] errno=%d\n", ctx->name, ret); in dvb_vb2_stream_on()
229 ctx->state |= DVB_VB2_STATE_STREAMON; in dvb_vb2_stream_on()
230 dprintk(3, "[%s]\n", ctx->name); in dvb_vb2_stream_on()
235 int dvb_vb2_stream_off(struct dvb_vb2_ctx *ctx) in dvb_vb2_stream_off() argument
237 struct vb2_queue *q = (struct vb2_queue *)&ctx->vb_q; in dvb_vb2_stream_off()
240 ctx->state &= ~DVB_VB2_STATE_STREAMON; in dvb_vb2_stream_off()
243 ctx->state = DVB_VB2_STATE_NONE; in dvb_vb2_stream_off()
244 dprintk(1, "[%s] errno=%d\n", ctx->name, ret); in dvb_vb2_stream_off()
247 dprintk(3, "[%s]\n", ctx->name); in dvb_vb2_stream_off()
252 int dvb_vb2_is_streaming(struct dvb_vb2_ctx *ctx) in dvb_vb2_is_streaming() argument
254 return (ctx->state & DVB_VB2_STATE_STREAMON); in dvb_vb2_is_streaming()
257 int dvb_vb2_fill_buffer(struct dvb_vb2_ctx *ctx, in dvb_vb2_fill_buffer() argument
273 spin_lock_irqsave(&ctx->slock, flags); in dvb_vb2_fill_buffer()
275 ctx->flags |= *buffer_flags; in dvb_vb2_fill_buffer()
279 if (!ctx->buf) { in dvb_vb2_fill_buffer()
280 if (list_empty(&ctx->dvb_q)) { in dvb_vb2_fill_buffer()
282 ctx->name); in dvb_vb2_fill_buffer()
286 ctx->buf = list_entry(ctx->dvb_q.next, in dvb_vb2_fill_buffer()
288 ctx->remain = vb2_plane_size(&ctx->buf->vb, 0); in dvb_vb2_fill_buffer()
289 ctx->offset = 0; in dvb_vb2_fill_buffer()
292 if (!dvb_vb2_is_streaming(ctx)) { in dvb_vb2_fill_buffer()
293 vb2_buffer_done(&ctx->buf->vb, VB2_BUF_STATE_ERROR); in dvb_vb2_fill_buffer()
294 list_del(&ctx->buf->list); in dvb_vb2_fill_buffer()
295 ctx->buf = NULL; in dvb_vb2_fill_buffer()
300 ll = min(todo, ctx->remain); in dvb_vb2_fill_buffer()
301 vbuf = vb2_plane_vaddr(&ctx->buf->vb, 0); in dvb_vb2_fill_buffer()
302 memcpy(vbuf + ctx->offset, psrc, ll); in dvb_vb2_fill_buffer()
306 ctx->remain -= ll; in dvb_vb2_fill_buffer()
307 ctx->offset += ll; in dvb_vb2_fill_buffer()
309 if (ctx->remain == 0) { in dvb_vb2_fill_buffer()
310 vb2_buffer_done(&ctx->buf->vb, VB2_BUF_STATE_DONE); in dvb_vb2_fill_buffer()
311 list_del(&ctx->buf->list); in dvb_vb2_fill_buffer()
312 ctx->buf = NULL; in dvb_vb2_fill_buffer()
316 if (ctx->nonblocking && ctx->buf) { in dvb_vb2_fill_buffer()
317 vb2_set_plane_payload(&ctx->buf->vb, 0, ll); in dvb_vb2_fill_buffer()
318 vb2_buffer_done(&ctx->buf->vb, VB2_BUF_STATE_DONE); in dvb_vb2_fill_buffer()
319 list_del(&ctx->buf->list); in dvb_vb2_fill_buffer()
320 ctx->buf = NULL; in dvb_vb2_fill_buffer()
322 spin_unlock_irqrestore(&ctx->slock, flags); in dvb_vb2_fill_buffer()
325 dprintk(1, "[%s] %d bytes are dropped.\n", ctx->name, todo); in dvb_vb2_fill_buffer()
327 dprintk(3, "[%s]\n", ctx->name); in dvb_vb2_fill_buffer()
329 dprintk(3, "[%s] %d bytes are copied\n", ctx->name, len - todo); in dvb_vb2_fill_buffer()
333 int dvb_vb2_reqbufs(struct dvb_vb2_ctx *ctx, struct dmx_requestbuffers *req) in dvb_vb2_reqbufs() argument
343 ctx->buf_siz = req->size; in dvb_vb2_reqbufs()
344 ctx->buf_cnt = req->count; in dvb_vb2_reqbufs()
345 ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, 0, &req->count); in dvb_vb2_reqbufs()
347 ctx->state = DVB_VB2_STATE_NONE; in dvb_vb2_reqbufs()
348 dprintk(1, "[%s] count=%d size=%d errno=%d\n", ctx->name, in dvb_vb2_reqbufs()
349 ctx->buf_cnt, ctx->buf_siz, ret); in dvb_vb2_reqbufs()
352 ctx->state |= DVB_VB2_STATE_REQBUFS; in dvb_vb2_reqbufs()
353 dprintk(3, "[%s] count=%d size=%d\n", ctx->name, in dvb_vb2_reqbufs()
354 ctx->buf_cnt, ctx->buf_siz); in dvb_vb2_reqbufs()
359 int dvb_vb2_querybuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b) in dvb_vb2_querybuf() argument
361 vb2_core_querybuf(&ctx->vb_q, b->index, b); in dvb_vb2_querybuf()
362 dprintk(3, "[%s] index=%d\n", ctx->name, b->index); in dvb_vb2_querybuf()
366 int dvb_vb2_expbuf(struct dvb_vb2_ctx *ctx, struct dmx_exportbuffer *exp) in dvb_vb2_expbuf() argument
368 struct vb2_queue *q = &ctx->vb_q; in dvb_vb2_expbuf()
371 ret = vb2_core_expbuf(&ctx->vb_q, &exp->fd, q->type, exp->index, in dvb_vb2_expbuf()
374 dprintk(1, "[%s] index=%d errno=%d\n", ctx->name, in dvb_vb2_expbuf()
378 dprintk(3, "[%s] index=%d fd=%d\n", ctx->name, exp->index, exp->fd); in dvb_vb2_expbuf()
383 int dvb_vb2_qbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b) in dvb_vb2_qbuf() argument
387 ret = vb2_core_qbuf(&ctx->vb_q, b->index, b, NULL); in dvb_vb2_qbuf()
389 dprintk(1, "[%s] index=%d errno=%d\n", ctx->name, in dvb_vb2_qbuf()
393 dprintk(5, "[%s] index=%d\n", ctx->name, b->index); in dvb_vb2_qbuf()
398 int dvb_vb2_dqbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b) in dvb_vb2_dqbuf() argument
403 ret = vb2_core_dqbuf(&ctx->vb_q, &b->index, b, ctx->nonblocking); in dvb_vb2_dqbuf()
405 dprintk(1, "[%s] errno=%d\n", ctx->name, ret); in dvb_vb2_dqbuf()
409 spin_lock_irqsave(&ctx->slock, flags); in dvb_vb2_dqbuf()
410 b->count = ctx->count++; in dvb_vb2_dqbuf()
411 b->flags = ctx->flags; in dvb_vb2_dqbuf()
412 ctx->flags = 0; in dvb_vb2_dqbuf()
413 spin_unlock_irqrestore(&ctx->slock, flags); in dvb_vb2_dqbuf()
416 ctx->name, b->index, ctx->count, b->flags); in dvb_vb2_dqbuf()
422 int dvb_vb2_mmap(struct dvb_vb2_ctx *ctx, struct vm_area_struct *vma) in dvb_vb2_mmap() argument
426 ret = vb2_mmap(&ctx->vb_q, vma); in dvb_vb2_mmap()
428 dprintk(1, "[%s] errno=%d\n", ctx->name, ret); in dvb_vb2_mmap()
431 dprintk(3, "[%s] ret=%d\n", ctx->name, ret); in dvb_vb2_mmap()
436 __poll_t dvb_vb2_poll(struct dvb_vb2_ctx *ctx, struct file *file, in dvb_vb2_poll() argument
439 dprintk(3, "[%s]\n", ctx->name); in dvb_vb2_poll()
440 return vb2_core_poll(&ctx->vb_q, file, wait); in dvb_vb2_poll()