Commit 86960eec authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Store the memory format in struct vsp1_rwpf

Move the format from struct vsp1_video to struct vsp1_rwpf to prepare
for VSPD KMS support that will not instantiate V4L2 video device nodes.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 8b4a0563
...@@ -94,7 +94,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -94,7 +94,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
/* Disable dithering and enable color data normalization unless the /* Disable dithering and enable color data normalization unless the
* format at the pipeline output is premultiplied. * format at the pipeline output is premultiplied.
*/ */
flags = pipe->output ? pipe->output->video.format.flags : 0; flags = pipe->output ? pipe->output->format.flags : 0;
vsp1_bru_write(bru, VI6_BRU_INCTRL, vsp1_bru_write(bru, VI6_BRU_INCTRL,
flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ? flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
0 : VI6_BRU_INCTRL_NRM); 0 : VI6_BRU_INCTRL_NRM);
...@@ -125,7 +125,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -125,7 +125,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
if (bru->inputs[i].rpf) { if (bru->inputs[i].rpf) {
ctrl |= VI6_BRU_CTRL_RBC; ctrl |= VI6_BRU_CTRL_RBC;
premultiplied = bru->inputs[i].rpf->video.format.flags premultiplied = bru->inputs[i].rpf->format.flags
& V4L2_PIX_FMT_FLAG_PREMUL_ALPHA; & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
} else { } else {
ctrl |= VI6_BRU_CTRL_CROP(VI6_ROP_NOP) ctrl |= VI6_BRU_CTRL_CROP(VI6_ROP_NOP)
......
...@@ -75,8 +75,8 @@ static const struct v4l2_ctrl_ops rpf_ctrl_ops = { ...@@ -75,8 +75,8 @@ static const struct v4l2_ctrl_ops rpf_ctrl_ops = {
static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) static int rpf_s_stream(struct v4l2_subdev *subdev, int enable)
{ {
struct vsp1_rwpf *rpf = to_rwpf(subdev); struct vsp1_rwpf *rpf = to_rwpf(subdev);
const struct vsp1_format_info *fmtinfo = rpf->video.fmtinfo; const struct vsp1_format_info *fmtinfo = rpf->fmtinfo;
const struct v4l2_pix_format_mplane *format = &rpf->video.format; const struct v4l2_pix_format_mplane *format = &rpf->format;
const struct v4l2_rect *crop = &rpf->crop; const struct v4l2_rect *crop = &rpf->crop;
u32 pstride; u32 pstride;
u32 infmt; u32 infmt;
......
...@@ -32,6 +32,8 @@ struct vsp1_rwpf { ...@@ -32,6 +32,8 @@ struct vsp1_rwpf {
unsigned int max_width; unsigned int max_width;
unsigned int max_height; unsigned int max_height;
struct v4l2_pix_format_mplane format;
const struct vsp1_format_info *fmtinfo;
struct { struct {
unsigned int left; unsigned int left;
unsigned int top; unsigned int top;
......
...@@ -204,9 +204,9 @@ static int vsp1_video_verify_format(struct vsp1_video *video) ...@@ -204,9 +204,9 @@ static int vsp1_video_verify_format(struct vsp1_video *video)
if (ret < 0) if (ret < 0)
return ret == -ENOIOCTLCMD ? -EINVAL : ret; return ret == -ENOIOCTLCMD ? -EINVAL : ret;
if (video->fmtinfo->mbus != fmt.format.code || if (video->rwpf->fmtinfo->mbus != fmt.format.code ||
video->format.height != fmt.format.height || video->rwpf->format.height != fmt.format.height ||
video->format.width != fmt.format.width) video->rwpf->format.width != fmt.format.width)
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -807,7 +807,7 @@ vsp1_video_queue_setup(struct vb2_queue *vq, ...@@ -807,7 +807,7 @@ vsp1_video_queue_setup(struct vb2_queue *vq,
unsigned int sizes[], void *alloc_ctxs[]) unsigned int sizes[], void *alloc_ctxs[])
{ {
struct vsp1_video *video = vb2_get_drv_priv(vq); struct vsp1_video *video = vb2_get_drv_priv(vq);
const struct v4l2_pix_format_mplane *format = &video->format; const struct v4l2_pix_format_mplane *format = &video->rwpf->format;
unsigned int i; unsigned int i;
if (*nplanes) { if (*nplanes) {
...@@ -837,7 +837,7 @@ static int vsp1_video_buffer_prepare(struct vb2_buffer *vb) ...@@ -837,7 +837,7 @@ static int vsp1_video_buffer_prepare(struct vb2_buffer *vb)
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue); struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue);
struct vsp1_video_buffer *buf = to_vsp1_video_buffer(vbuf); struct vsp1_video_buffer *buf = to_vsp1_video_buffer(vbuf);
const struct v4l2_pix_format_mplane *format = &video->format; const struct v4l2_pix_format_mplane *format = &video->rwpf->format;
unsigned int i; unsigned int i;
if (vb->num_planes < format->num_planes) if (vb->num_planes < format->num_planes)
...@@ -920,7 +920,7 @@ static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int count) ...@@ -920,7 +920,7 @@ static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int count)
struct vsp1_rwpf *rpf = struct vsp1_rwpf *rpf =
to_rwpf(&pipe->uds_input->subdev); to_rwpf(&pipe->uds_input->subdev);
uds->scale_alpha = rpf->video.fmtinfo->alpha; uds->scale_alpha = rpf->fmtinfo->alpha;
} }
} }
...@@ -1024,7 +1024,7 @@ vsp1_video_get_format(struct file *file, void *fh, struct v4l2_format *format) ...@@ -1024,7 +1024,7 @@ vsp1_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
return -EINVAL; return -EINVAL;
mutex_lock(&video->lock); mutex_lock(&video->lock);
format->fmt.pix_mp = video->format; format->fmt.pix_mp = video->rwpf->format;
mutex_unlock(&video->lock); mutex_unlock(&video->lock);
return 0; return 0;
...@@ -1064,8 +1064,8 @@ vsp1_video_set_format(struct file *file, void *fh, struct v4l2_format *format) ...@@ -1064,8 +1064,8 @@ vsp1_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
goto done; goto done;
} }
video->format = format->fmt.pix_mp; video->rwpf->format = format->fmt.pix_mp;
video->fmtinfo = info; video->rwpf->fmtinfo = info;
done: done:
mutex_unlock(&video->lock); mutex_unlock(&video->lock);
...@@ -1242,17 +1242,17 @@ int vsp1_video_init(struct vsp1_video *video, struct vsp1_rwpf *rwpf) ...@@ -1242,17 +1242,17 @@ int vsp1_video_init(struct vsp1_video *video, struct vsp1_rwpf *rwpf)
return ret; return ret;
/* ... and the format ... */ /* ... and the format ... */
video->fmtinfo = vsp1_get_format_info(VSP1_VIDEO_DEF_FORMAT); rwpf->fmtinfo = vsp1_get_format_info(VSP1_VIDEO_DEF_FORMAT);
video->format.pixelformat = video->fmtinfo->fourcc; rwpf->format.pixelformat = rwpf->fmtinfo->fourcc;
video->format.colorspace = V4L2_COLORSPACE_SRGB; rwpf->format.colorspace = V4L2_COLORSPACE_SRGB;
video->format.field = V4L2_FIELD_NONE; rwpf->format.field = V4L2_FIELD_NONE;
video->format.width = VSP1_VIDEO_DEF_WIDTH; rwpf->format.width = VSP1_VIDEO_DEF_WIDTH;
video->format.height = VSP1_VIDEO_DEF_HEIGHT; rwpf->format.height = VSP1_VIDEO_DEF_HEIGHT;
video->format.num_planes = 1; rwpf->format.num_planes = 1;
video->format.plane_fmt[0].bytesperline = rwpf->format.plane_fmt[0].bytesperline =
video->format.width * video->fmtinfo->bpp[0] / 8; rwpf->format.width * rwpf->fmtinfo->bpp[0] / 8;
video->format.plane_fmt[0].sizeimage = rwpf->format.plane_fmt[0].sizeimage =
video->format.plane_fmt[0].bytesperline * video->format.height; rwpf->format.plane_fmt[0].bytesperline * rwpf->format.height;
/* ... and the video node... */ /* ... and the video node... */
video->video.v4l2_dev = &video->vsp1->v4l2_dev; video->video.v4l2_dev = &video->vsp1->v4l2_dev;
......
...@@ -123,8 +123,6 @@ struct vsp1_video { ...@@ -123,8 +123,6 @@ struct vsp1_video {
struct media_pad pad; struct media_pad pad;
struct mutex lock; struct mutex lock;
struct v4l2_pix_format_mplane format;
const struct vsp1_format_info *fmtinfo;
struct vsp1_pipeline pipe; struct vsp1_pipeline pipe;
unsigned int pipe_index; unsigned int pipe_index;
......
...@@ -112,7 +112,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -112,7 +112,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
/* Destination stride. */ /* Destination stride. */
if (!pipe->lif) { if (!pipe->lif) {
struct v4l2_pix_format_mplane *format = &wpf->video.format; struct v4l2_pix_format_mplane *format = &wpf->format;
vsp1_wpf_write(wpf, VI6_WPF_DSTM_STRIDE_Y, vsp1_wpf_write(wpf, VI6_WPF_DSTM_STRIDE_Y,
format->plane_fmt[0].bytesperline); format->plane_fmt[0].bytesperline);
...@@ -130,7 +130,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) ...@@ -130,7 +130,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
/* Format */ /* Format */
if (!pipe->lif) { if (!pipe->lif) {
const struct vsp1_format_info *fmtinfo = wpf->video.fmtinfo; const struct vsp1_format_info *fmtinfo = wpf->fmtinfo;
outfmt = fmtinfo->hwfmt << VI6_WPF_OUTFMT_WRFMT_SHIFT; outfmt = fmtinfo->hwfmt << VI6_WPF_OUTFMT_WRFMT_SHIFT;
......
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