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

[media] v4l: vsp1: Move vsp1_video pointer from vsp1_entity to vsp1_rwpf

Only RPFs and WPFs can be associated with video nodes, don't waste
memory by storing the video pointer in all entities.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 62a40903
...@@ -89,8 +89,8 @@ static int vsp1_create_links(struct vsp1_device *vsp1, struct vsp1_entity *sink) ...@@ -89,8 +89,8 @@ static int vsp1_create_links(struct vsp1_device *vsp1, struct vsp1_entity *sink)
/* RPFs have no source entities, just connect their source pad /* RPFs have no source entities, just connect their source pad
* to their video device. * to their video device.
*/ */
return media_create_pad_link(&rpf->entity.video->video.entity, return media_create_pad_link(&rpf->video->video.entity, 0,
0, &rpf->entity.subdev.entity, &rpf->entity.subdev.entity,
RWPF_PAD_SINK, RWPF_PAD_SINK,
MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE); MEDIA_LNK_FL_IMMUTABLE);
...@@ -139,7 +139,7 @@ static int vsp1_create_links(struct vsp1_device *vsp1, struct vsp1_entity *sink) ...@@ -139,7 +139,7 @@ static int vsp1_create_links(struct vsp1_device *vsp1, struct vsp1_entity *sink)
return media_create_pad_link(&wpf->entity.subdev.entity, return media_create_pad_link(&wpf->entity.subdev.entity,
RWPF_PAD_SOURCE, RWPF_PAD_SOURCE,
&wpf->entity.video->video.entity, &wpf->video->video.entity,
0, flags); 0, flags);
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <media/v4l2-subdev.h> #include <media/v4l2-subdev.h>
struct vsp1_device; struct vsp1_device;
struct vsp1_video;
enum vsp1_entity_type { enum vsp1_entity_type {
VSP1_ENTITY_BRU, VSP1_ENTITY_BRU,
...@@ -71,8 +70,6 @@ struct vsp1_entity { ...@@ -71,8 +70,6 @@ struct vsp1_entity {
struct v4l2_subdev subdev; struct v4l2_subdev subdev;
struct v4l2_mbus_framefmt *formats; struct v4l2_mbus_framefmt *formats;
struct vsp1_video *video;
spinlock_t lock; /* Protects the streaming field */ spinlock_t lock; /* Protects the streaming field */
bool streaming; bool streaming;
}; };
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define RWPF_PAD_SOURCE 1 #define RWPF_PAD_SOURCE 1
struct vsp1_rwpf; struct vsp1_rwpf;
struct vsp1_video;
struct vsp1_rwpf_memory { struct vsp1_rwpf_memory {
unsigned int num_planes; unsigned int num_planes;
...@@ -40,6 +41,8 @@ struct vsp1_rwpf { ...@@ -40,6 +41,8 @@ struct vsp1_rwpf {
struct vsp1_entity entity; struct vsp1_entity entity;
struct v4l2_ctrl_handler ctrls; struct v4l2_ctrl_handler ctrls;
struct vsp1_video *video;
const struct vsp1_rwpf_operations *ops; const struct vsp1_rwpf_operations *ops;
unsigned int max_width; unsigned int max_width;
......
...@@ -448,11 +448,11 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe, ...@@ -448,11 +448,11 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
if (e->type == VSP1_ENTITY_RPF) { if (e->type == VSP1_ENTITY_RPF) {
rwpf = to_rwpf(subdev); rwpf = to_rwpf(subdev);
pipe->inputs[pipe->num_inputs++] = rwpf; pipe->inputs[pipe->num_inputs++] = rwpf;
rwpf->entity.video->pipe_index = pipe->num_inputs; rwpf->video->pipe_index = pipe->num_inputs;
} else if (e->type == VSP1_ENTITY_WPF) { } else if (e->type == VSP1_ENTITY_WPF) {
rwpf = to_rwpf(subdev); rwpf = to_rwpf(subdev);
pipe->output = to_rwpf(subdev); pipe->output = to_rwpf(subdev);
rwpf->entity.video->pipe_index = 0; rwpf->video->pipe_index = 0;
} else if (e->type == VSP1_ENTITY_LIF) { } else if (e->type == VSP1_ENTITY_LIF) {
pipe->lif = e; pipe->lif = e;
} else if (e->type == VSP1_ENTITY_BRU) { } else if (e->type == VSP1_ENTITY_BRU) {
...@@ -664,10 +664,10 @@ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe) ...@@ -664,10 +664,10 @@ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
/* Complete buffers on all video nodes. */ /* Complete buffers on all video nodes. */
for (i = 0; i < pipe->num_inputs; ++i) for (i = 0; i < pipe->num_inputs; ++i)
vsp1_video_frame_end(pipe, pipe->inputs[i]->entity.video); vsp1_video_frame_end(pipe, pipe->inputs[i]->video);
if (!pipe->lif) if (!pipe->lif)
vsp1_video_frame_end(pipe, pipe->output->entity.video); vsp1_video_frame_end(pipe, pipe->output->video);
spin_lock_irqsave(&pipe->irqlock, flags); spin_lock_irqsave(&pipe->irqlock, flags);
...@@ -1217,7 +1217,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device *vsp1, ...@@ -1217,7 +1217,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device *vsp1,
if (!video) if (!video)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
rwpf->entity.video = video; rwpf->video = video;
video->vsp1 = vsp1; video->vsp1 = vsp1;
video->rwpf = rwpf; video->rwpf = rwpf;
......
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