Commit bed04f93 authored by Junghak Sung's avatar Junghak Sung Committed by Mauro Carvalho Chehab

[media] media: videobuf2: Replace v4l2-specific data with vb2 data

Simple changes that replace v4l2-specific data with vb2 data
in videobuf2-core.

enum v4l2_buf_type --> int
enum v4l2_memory --> enum vb2_memory
VIDEO_MAX_FRAME --> VB2_MAX_FRAME
VIDEO_MAX_PLANES --> VB2_MAX_PLANES
struct v4l2_fh *owner --> void *owner
V4L2_TYPE_IS_MULTIPLANAR() --> is_multiplanar
V4L2_TYPE_IS_OUTPUT() --> is_output
Signed-off-by: 's avatarJunghak Sung <jh1009.sung@samsung.com>
Signed-off-by: 's avatarGeunyoung Kim <nenggun.kim@samsung.com>
Acked-by: 's avatarSeung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: 's avatarInki Dae <inki.dae@samsung.com>
Signed-off-by: 's avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: 's avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 33119e80
This diff is collapsed.
......@@ -18,6 +18,16 @@
#include <linux/videodev2.h>
#include <linux/dma-buf.h>
#define VB2_MAX_FRAME (32)
#define VB2_MAX_PLANES (8)
enum vb2_memory {
VB2_MEMORY_UNKNOWN = 0,
VB2_MEMORY_MMAP = 1,
VB2_MEMORY_USERPTR = 2,
VB2_MEMORY_DMABUF = 4,
};
struct vb2_alloc_ctx;
struct vb2_fileio_data;
struct vb2_threadio_data;
......@@ -209,7 +219,7 @@ struct vb2_buffer {
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
struct vb2_plane planes[VB2_MAX_PLANES];
/* private: internal use only
*
......@@ -353,12 +363,13 @@ struct vb2_ops {
void (*buf_queue)(struct vb2_buffer *vb);
};
struct v4l2_fh;
/**
* struct vb2_queue - a videobuf queue
*
* @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h
* @type: private buffer type whose content is defined by the vb2-core
* caller. For example, for V4L2, it should match
* the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h
* @io_modes: supported io methods (see vb2_io_modes enum)
* @fileio_read_once: report EOF after reading the first buffer
* @fileio_write_immediately: queue buffer after each write() call
......@@ -409,6 +420,8 @@ struct v4l2_fh;
* @waiting_for_buffers: used in poll() to check if vb2 is still waiting for
* buffers. Only set for capture queues if qbuf has not yet been
* called since poll() needs to return POLLERR in that situation.
* @is_multiplanar: set if buffer type is multiplanar
* @is_output: set if buffer type is output
* @last_buffer_dequeued: used in poll() and DQBUF to immediately return if the
* last decoded buffer was already dequeued. Set for capture queues
* when a buffer with the V4L2_BUF_FLAG_LAST is dequeued.
......@@ -416,14 +429,14 @@ struct v4l2_fh;
* @threadio: thread io internal data, used only if thread is active
*/
struct vb2_queue {
enum v4l2_buf_type type;
unsigned int type;
unsigned int io_modes;
unsigned fileio_read_once:1;
unsigned fileio_write_immediately:1;
unsigned allow_zero_bytesused:1;
struct mutex *lock;
struct v4l2_fh *owner;
void *owner;
const struct vb2_ops *ops;
const struct vb2_mem_ops *mem_ops;
......@@ -435,8 +448,8 @@ struct vb2_queue {
/* private: internal use only */
struct mutex mmap_lock;
enum v4l2_memory memory;
struct vb2_buffer *bufs[VIDEO_MAX_FRAME];
unsigned int memory;
struct vb2_buffer *bufs[VB2_MAX_FRAME];
unsigned int num_buffers;
struct list_head queued_list;
......@@ -447,13 +460,15 @@ struct vb2_queue {
spinlock_t done_lock;
wait_queue_head_t done_wq;
void *alloc_ctx[VIDEO_MAX_PLANES];
unsigned int plane_sizes[VIDEO_MAX_PLANES];
void *alloc_ctx[VB2_MAX_PLANES];
unsigned int plane_sizes[VB2_MAX_PLANES];
unsigned int streaming:1;
unsigned int start_streaming_called:1;
unsigned int error:1;
unsigned int waiting_for_buffers:1;
unsigned int is_multiplanar:1;
unsigned int is_output:1;
unsigned int last_buffer_dequeued:1;
struct vb2_fileio_data *fileio;
......
......@@ -15,6 +15,14 @@
#include <linux/videodev2.h>
#include <media/videobuf2-core.h>
#if VB2_MAX_FRAME != VIDEO_MAX_FRAME
#error VB2_MAX_FRAME != VIDEO_MAX_FRAME
#endif
#if VB2_MAX_PLANES != VIDEO_MAX_PLANES
#error VB2_MAX_PLANES != VIDEO_MAX_PLANES
#endif
/**
* struct vb2_v4l2_buffer - video buffer information for v4l2
* @vb2_buf: video buffer 2
......
......@@ -5,6 +5,7 @@
#define _TRACE_V4L2_H
#include <linux/tracepoint.h>
#include <media/videobuf2-v4l2.h>
/* Enums require being exported to userspace, for user tool parsing */
#undef EM
......@@ -203,7 +204,9 @@ DECLARE_EVENT_CLASS(vb2_event_class,
TP_fast_assign(
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
__entry->minor = q->owner ? q->owner->vdev->minor : -1;
struct v4l2_fh *owner = q->owner;
__entry->minor = owner ? owner->vdev->minor : -1;
__entry->queued_count = q->queued_count;
__entry->owned_by_drv_count =
atomic_read(&q->owned_by_drv_count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment