2013-06-04 14:22:30 +00:00
|
|
|
/*
|
|
|
|
* vsp1_video.h -- R-Car VSP1 Video Node
|
|
|
|
*
|
2015-03-15 14:33:07 +00:00
|
|
|
* Copyright (C) 2013-2015 Renesas Electronics Corporation
|
2013-06-04 14:22:30 +00:00
|
|
|
*
|
|
|
|
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
#ifndef __VSP1_VIDEO_H__
|
|
|
|
#define __VSP1_VIDEO_H__
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/wait.h>
|
|
|
|
|
|
|
|
#include <media/media-entity.h>
|
2015-09-22 13:30:29 +00:00
|
|
|
#include <media/videobuf2-v4l2.h>
|
2013-06-04 14:22:30 +00:00
|
|
|
|
2015-07-28 16:54:03 +00:00
|
|
|
struct vsp1_rwpf;
|
2013-06-04 14:22:30 +00:00
|
|
|
struct vsp1_video;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* struct vsp1_format_info - VSP1 video format description
|
|
|
|
* @mbus: media bus format code
|
|
|
|
* @fourcc: V4L2 pixel format FCC identifier
|
|
|
|
* @planes: number of planes
|
|
|
|
* @bpp: bits per pixel
|
|
|
|
* @hwfmt: VSP1 hardware format
|
|
|
|
* @swap_yc: the Y and C components are swapped (Y comes before C)
|
|
|
|
* @swap_uv: the U and V components are swapped (V comes before U)
|
|
|
|
* @hsub: horizontal subsampling factor
|
|
|
|
* @vsub: vertical subsampling factor
|
2014-05-26 23:12:53 +00:00
|
|
|
* @alpha: has an alpha channel
|
2013-06-04 14:22:30 +00:00
|
|
|
*/
|
|
|
|
struct vsp1_format_info {
|
|
|
|
u32 fourcc;
|
|
|
|
unsigned int mbus;
|
|
|
|
unsigned int hwfmt;
|
|
|
|
unsigned int swap;
|
|
|
|
unsigned int planes;
|
|
|
|
unsigned int bpp[3];
|
|
|
|
bool swap_yc;
|
|
|
|
bool swap_uv;
|
|
|
|
unsigned int hsub;
|
|
|
|
unsigned int vsub;
|
2014-05-26 23:12:53 +00:00
|
|
|
bool alpha;
|
2013-06-04 14:22:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum vsp1_pipeline_state {
|
|
|
|
VSP1_PIPELINE_STOPPED,
|
|
|
|
VSP1_PIPELINE_RUNNING,
|
|
|
|
VSP1_PIPELINE_STOPPING,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* struct vsp1_pipeline - A VSP1 hardware pipeline
|
|
|
|
* @media: the media pipeline
|
|
|
|
* @irqlock: protects the pipeline state
|
|
|
|
* @lock: protects the pipeline use count and stream count
|
|
|
|
*/
|
|
|
|
struct vsp1_pipeline {
|
|
|
|
struct media_pipeline pipe;
|
|
|
|
|
|
|
|
spinlock_t irqlock;
|
|
|
|
enum vsp1_pipeline_state state;
|
|
|
|
wait_queue_head_t wq;
|
|
|
|
|
|
|
|
struct mutex lock;
|
|
|
|
unsigned int use_count;
|
|
|
|
unsigned int stream_count;
|
|
|
|
unsigned int buffers_ready;
|
|
|
|
|
|
|
|
unsigned int num_video;
|
|
|
|
unsigned int num_inputs;
|
2014-05-27 15:59:39 +00:00
|
|
|
struct vsp1_rwpf *inputs[VSP1_MAX_RPF];
|
2013-06-04 14:22:30 +00:00
|
|
|
struct vsp1_rwpf *output;
|
2013-07-10 21:03:46 +00:00
|
|
|
struct vsp1_entity *bru;
|
2013-06-04 14:22:30 +00:00
|
|
|
struct vsp1_entity *lif;
|
2014-05-31 00:45:48 +00:00
|
|
|
struct vsp1_entity *uds;
|
|
|
|
struct vsp1_entity *uds_input;
|
2013-06-04 14:22:30 +00:00
|
|
|
|
|
|
|
struct list_head entities;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct vsp1_pipeline *to_vsp1_pipeline(struct media_entity *e)
|
|
|
|
{
|
|
|
|
if (likely(e->pipe))
|
|
|
|
return container_of(e->pipe, struct vsp1_pipeline, pipe);
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct vsp1_video_buffer {
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 13:30:30 +00:00
|
|
|
struct vb2_v4l2_buffer buf;
|
2013-06-04 14:22:30 +00:00
|
|
|
struct list_head queue;
|
|
|
|
|
|
|
|
dma_addr_t addr[3];
|
|
|
|
unsigned int length[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct vsp1_video_buffer *
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 13:30:30 +00:00
|
|
|
to_vsp1_video_buffer(struct vb2_v4l2_buffer *vbuf)
|
2013-06-04 14:22:30 +00:00
|
|
|
{
|
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-22 13:30:30 +00:00
|
|
|
return container_of(vbuf, struct vsp1_video_buffer, buf);
|
2013-06-04 14:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct vsp1_video {
|
|
|
|
struct vsp1_device *vsp1;
|
2015-07-28 16:54:03 +00:00
|
|
|
struct vsp1_rwpf *rwpf;
|
2013-06-04 14:22:30 +00:00
|
|
|
|
|
|
|
struct video_device video;
|
|
|
|
enum v4l2_buf_type type;
|
|
|
|
struct media_pad pad;
|
|
|
|
|
|
|
|
struct mutex lock;
|
|
|
|
|
|
|
|
struct vsp1_pipeline pipe;
|
|
|
|
unsigned int pipe_index;
|
|
|
|
|
|
|
|
struct vb2_queue queue;
|
|
|
|
void *alloc_ctx;
|
|
|
|
spinlock_t irqlock;
|
|
|
|
struct list_head irqqueue;
|
|
|
|
unsigned int sequence;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct vsp1_video *to_vsp1_video(struct video_device *vdev)
|
|
|
|
{
|
|
|
|
return container_of(vdev, struct vsp1_video, video);
|
|
|
|
}
|
|
|
|
|
2015-07-28 16:54:03 +00:00
|
|
|
int vsp1_video_init(struct vsp1_video *video, struct vsp1_rwpf *rwpf);
|
2013-06-04 14:22:30 +00:00
|
|
|
void vsp1_video_cleanup(struct vsp1_video *video);
|
|
|
|
|
|
|
|
void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe);
|
|
|
|
|
2014-05-31 00:45:48 +00:00
|
|
|
void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
|
|
|
|
struct vsp1_entity *input,
|
|
|
|
unsigned int alpha);
|
|
|
|
|
2015-03-15 14:33:07 +00:00
|
|
|
void vsp1_pipelines_suspend(struct vsp1_device *vsp1);
|
|
|
|
void vsp1_pipelines_resume(struct vsp1_device *vsp1);
|
|
|
|
|
2013-06-04 14:22:30 +00:00
|
|
|
#endif /* __VSP1_VIDEO_H__ */
|