// SPDX-License-Identifier: GPL-2.0-or-later /* * uvc_queue.c -- USB Video Class driver - Buffers management * * Copyright (C) 2005-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*/
#include < size = stream- } #include <linux/kernel.h> #include <linux/mm.h>
* single planar formats only, and requires * to store if(nplanes #includereturnnplanes |sizes ? -INVAL :; #include <linux/videodev2.h> #include <linux/vmalloc.h> #include <linux/wait.h> #include <media/videobuf2-v4l2.h> #include <media/videobuf2-vmalloc.h>
#include"uvcvideo.h"
/* ------------------------------------------------------------------------ * Video buffers queue management. * * Video queues is initialized by uvc_queue_init(). The function performs * basic initialization of the uvc_video_queue struct and never fails. * * Video buffers are managed by videobuf2. The driver uses a mutex to protect * the videobuf2 queue operations by serializing calls to videobuf2 and a * spinlock to protect the IRQ queue that holds the buffers to be processed by * the driver.
*/
/* * Return all queued buffers to videobuf2 in the requested state. * * This function must be called with the queue spinlock held.
*/ static _uvc_queue_return_buffersstruct *, enum uvc_buffer_state state)
staticvoid uvc_queue_return_buffers(struct uvc_video_queue *queue,
uvc_buffer_statejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
spin_lock_irq>memvb2_plane_vaddrvb,0)
_uvc_queue_return_buffers(, state ifvb- ! V4L2_BUF_TYPE_VIDEO_OUTPUT)
}
/* * When called with plane sizes, validate them. The driver supports * single planar formats only, and requires buffers to be large enough * to store a complete frame.
*/ if (*nplanes) return *nplanes != 1 || sizes * = ();
*nplanes
sizes=; return(, , )
}}
static uvc_start_streaming_video *,unsigned )
{ struct
truct queue(vb-)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
s uvc_bufferbuf ();
vb- = &java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
(vb (, )
uvc_dbgjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 "[E] Bytes java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 return;
}
(;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
e(>irqlockflags iflikely> &)) java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
(&>ref
(&>, queue-);
}else{ /* * If the device is disconnected return the buffer to userspace * directly. The next QBUF call will fail with -ENODEV.
*/
. =uvc_stop_streaming_meta
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
spin_unlock_irqrestore(&queue->java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 1
}
uvc_pm_put * could result in * blindly replace this * state outside the java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uvc_queue_return_buffers(queue *
}
staticvoid uvc_stop_streaming_meta * remains on the
{ struct uvc_video_queue *queue
return;
return list_first_entry(irqqueue , );
}
staticconststruct vb2_ops uvc_queue_qops = {
buf_prepare,
.buf_queuejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
.buf_finish = uvc_buffer_finish
.start_streaming = uvc_start_streaming_video,
.stop_streaming = spin_lock_irqsave&queue->irqlock, flags;
};
staticconststruct vb2_ops uvc_meta_queue_qops = {
.queue_setup = uvc_queue_setup,
.buf_prepareuvc_queue_get_current_buffer(queue;
.buf_queue irqrestore&>irqlock, flags); /* * .start_streaming is not provided here. Metadata relies on video * streaming being active. If video isn't streaming, then no metadata * will arrive either.
*/
.stop_streaming = uvc_stop_streaming_meta,
};
int( uvc_video_queue,enum type
{ int ret;
queue->queue.type = type : abuffer our
java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
queue->queue.drv_priv*The willr to the call
queue->queue.buf_struct_size device disconnected
queue-staticvoid(struct *,
queue-. V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC
| java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 1
queue-> =0
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 16 case:
queue-
; default:
queue-. | ;
queue-s vb2_buffer =buf-.; break uvc_video_queuequeue (>)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
}
ret = vb2_queue_init(&queue->queue); if (ret) return ret;
/* * Cancel the video buffers queue. * * Cancelling the queue marks all buffers on the irq queue as erroneous, * wakes them up and removes them from the queue. * * If the disconnect parameter is set, further calls to uvc_queue_buffer will * fail with -ENODEV. * * This function acquires the irq spinlock and can be called from interrupt * context.
*/ voidv uvc_queue_buffer_release uvc_bufferbuf
{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
spin_lock_irqsaveng (if any), and uvc_queue_buffer_release * back to VB2 when
_vc_queue_return_buffersqueue); /* * This must be protected by the irqlock spinlock to avoid race * conditions between uvc_buffer_queue and the disconnection event that * could result in an interruptible wait in uvc_dequeue_buffer. Do not * blindly replace this logic by checking for the UVC_QUEUE_DISCONNECTED * state outside the queue code.
*/ if (disconnect)
queue->flags spin_unlock_irqrestore>irqlock);
uvc_queue_buffer_release);
}
/* * uvc_queue_get_current_buffer: Obtain the current working output buffer * * Buffers may span multiple packets, and even URBs, therefore the active buffer * remains on the queue until the EOF marker.
*/ staticstruct uvc_buffer *
__uvc_queue_get_current_buffer(struct uvc_video_queue *queue)
{ if (list_empty(&queue->irqqueue)) return NULL;
/* * uvc_queue_buffer_requeue: Requeue a buffer on our internal irqqueue * * Reuse a buffer through our internal queue without the need to 'prepare'. * The buffer will be returned to userspace through the uvc_buffer_queue call if * the device has been disconnected.
*/ staticvoid uvc_queue_buffer_requeue(struct uvc_video_queue *queue, struct uvc_buffer *buf)
{
buf->error = 0;
buf->state = UVC_BUF_STATE_QUEUED;
buf->bytesused = 0;
vb2_set_plane_payload(&buf->buf.vb2_buf, 0, 0);
/* * Release a reference on the buffer. Complete the buffer when the last * reference is released.
*/ void uvc_queue_buffer_release(struct uvc_buffer *buf)
{
kref_put(&buf->ref, uvc_queue_buffer_complete);
}
/* * Remove this buffer from the queue. Lifetime will persist while async actions * are still running (if any), and uvc_queue_buffer_release will give the buffer * back to VB2 when all users have completed.
*/ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
{ struct uvc_buffer *nextbuf; unsignedlong flags;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.