Re: [PATCH v2 10/14] v4l: vsp1: Add support for multiple DRM pipelines
Hi Laurent, Last one - (and I thought I'd already done this one in the last batch .. but perhaps I lost it before hitting send) On 26/06/17 19:12, Laurent Pinchart wrote: > The R-Car H3 ES2.0 VSP-DL instance has two LIF entities and can drive > two display pipelines at the same time. Refactor the VSP DRM code to > support that by introducing a vsp_drm_pipeline object that models one > display pipeline. > > Signed-off-by: Laurent Pinchart I can't see anything wrong here, so maybe my eyes are going fuzzy from all the blue text in my mail client :-) Reviewed-by: Kieran Bingham > --- > drivers/media/platform/vsp1/vsp1_drm.c | 200 > - > drivers/media/platform/vsp1/vsp1_drm.h | 35 +++--- > 2 files changed, 141 insertions(+), 94 deletions(-) > > diff --git a/drivers/media/platform/vsp1/vsp1_drm.c > b/drivers/media/platform/vsp1/vsp1_drm.c > index 4e1b893e8f51..7791d7b5a743 100644 > --- a/drivers/media/platform/vsp1/vsp1_drm.c > +++ b/drivers/media/platform/vsp1/vsp1_drm.c > @@ -34,10 +34,10 @@ > > static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe) > { > - struct vsp1_drm *drm = to_vsp1_drm(pipe); > + struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe); > > - if (drm->du_complete) > - drm->du_complete(drm->du_private); > + if (drm_pipe->du_complete) > + drm_pipe->du_complete(drm_pipe->du_private); > } > > /* > - > @@ -80,15 +80,22 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int > pipe_index, > const struct vsp1_du_lif_config *cfg) > { > struct vsp1_device *vsp1 = dev_get_drvdata(dev); > - struct vsp1_pipeline *pipe = &vsp1->drm->pipe; > - struct vsp1_bru *bru = vsp1->bru; > + struct vsp1_drm_pipeline *drm_pipe; > + struct vsp1_pipeline *pipe; > + struct vsp1_bru *bru; > struct v4l2_subdev_format format; > + const char *bru_name; > unsigned int i; > int ret; > > - if (pipe_index > 0) > + if (pipe_index >= vsp1->info->lif_count) > return -EINVAL; > > + drm_pipe = &vsp1->drm->pipe[pipe_index]; > + pipe = &drm_pipe->pipe; > + bru = to_bru(&pipe->bru->subdev); > + bru_name = pipe->bru->type == VSP1_ENTITY_BRU ? "BRU" : "BRS"; > + > if (!cfg) { > /* >* NULL configuration means the CRTC is being disabled, stop > @@ -100,14 +107,25 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int > pipe_index, > > media_pipeline_stop(&pipe->output->entity.subdev.entity); > > - for (i = 0; i < bru->entity.source_pad; ++i) { > - vsp1->drm->inputs[i].enabled = false; > - bru->inputs[i].rpf = NULL; > + for (i = 0; i < ARRAY_SIZE(pipe->inputs); ++i) { > + struct vsp1_rwpf *rpf = pipe->inputs[i]; > + > + if (!rpf) > + continue; > + > + /* > + * Remove the RPF from the pipe and the list of BRU > + * inputs. > + */ > + WARN_ON(list_empty(&rpf->entity.list_pipe)); > + list_del_init(&rpf->entity.list_pipe); > pipe->inputs[i] = NULL; > + > + bru->inputs[rpf->bru_input].rpf = NULL; > } > > + drm_pipe->du_complete = NULL; > pipe->num_inputs = 0; > - vsp1->drm->du_complete = NULL; > > vsp1_dlm_reset(pipe->output->dlm); > vsp1_device_put(vsp1); > @@ -117,8 +135,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int > pipe_index, > return 0; > } > > - dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n", > - __func__, cfg->width, cfg->height); > + dev_dbg(vsp1->dev, "%s: configuring LIF%u with format %ux%u\n", > + __func__, pipe_index, cfg->width, cfg->height); > > /* >* Configure the format at the BRU sinks and propagate it through the > @@ -127,7 +145,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int > pipe_index, > memset(&format, 0, sizeof(format)); > format.which = V4L2_SUBDEV_FORMAT_ACTIVE; > > - for (i = 0; i < bru->entity.source_pad; ++i) { > + for (i = 0; i < pipe->bru->source_pad; ++i) { > format.pad = i; > > format.format.width = cfg->width; > @@ -135,60 +153,60 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int > pipe_index, > format.format.code = MEDIA_BUS_FMT_ARGB_1X32; > format.format.field = V4L2_FIELD_NONE; > > - ret = v4l2_subdev_call(&bru->entity.subdev, pad, > + ret = v4l2_subdev_call(&pipe->bru->subdev, pad, > set_fmt, NULL, &format);
Re: [PATCH v2 10/14] v4l: vsp1: Add support for multiple DRM pipelines
Em Mon, 26 Jun 2017 21:12:22 +0300 Laurent Pinchart escreveu: > The R-Car H3 ES2.0 VSP-DL instance has two LIF entities and can drive > two display pipelines at the same time. Refactor the VSP DRM code to > support that by introducing a vsp_drm_pipeline object that models one > display pipeline. > > Signed-off-by: Laurent Pinchart Acked-by: Mauro Carvalho Chehab Thanks, Mauro
[PATCH v2 10/14] v4l: vsp1: Add support for multiple DRM pipelines
The R-Car H3 ES2.0 VSP-DL instance has two LIF entities and can drive two display pipelines at the same time. Refactor the VSP DRM code to support that by introducing a vsp_drm_pipeline object that models one display pipeline. Signed-off-by: Laurent Pinchart --- drivers/media/platform/vsp1/vsp1_drm.c | 200 - drivers/media/platform/vsp1/vsp1_drm.h | 35 +++--- 2 files changed, 141 insertions(+), 94 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 4e1b893e8f51..7791d7b5a743 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -34,10 +34,10 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe) { - struct vsp1_drm *drm = to_vsp1_drm(pipe); + struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe); - if (drm->du_complete) - drm->du_complete(drm->du_private); + if (drm_pipe->du_complete) + drm_pipe->du_complete(drm_pipe->du_private); } /* - @@ -80,15 +80,22 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index, const struct vsp1_du_lif_config *cfg) { struct vsp1_device *vsp1 = dev_get_drvdata(dev); - struct vsp1_pipeline *pipe = &vsp1->drm->pipe; - struct vsp1_bru *bru = vsp1->bru; + struct vsp1_drm_pipeline *drm_pipe; + struct vsp1_pipeline *pipe; + struct vsp1_bru *bru; struct v4l2_subdev_format format; + const char *bru_name; unsigned int i; int ret; - if (pipe_index > 0) + if (pipe_index >= vsp1->info->lif_count) return -EINVAL; + drm_pipe = &vsp1->drm->pipe[pipe_index]; + pipe = &drm_pipe->pipe; + bru = to_bru(&pipe->bru->subdev); + bru_name = pipe->bru->type == VSP1_ENTITY_BRU ? "BRU" : "BRS"; + if (!cfg) { /* * NULL configuration means the CRTC is being disabled, stop @@ -100,14 +107,25 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index, media_pipeline_stop(&pipe->output->entity.subdev.entity); - for (i = 0; i < bru->entity.source_pad; ++i) { - vsp1->drm->inputs[i].enabled = false; - bru->inputs[i].rpf = NULL; + for (i = 0; i < ARRAY_SIZE(pipe->inputs); ++i) { + struct vsp1_rwpf *rpf = pipe->inputs[i]; + + if (!rpf) + continue; + + /* +* Remove the RPF from the pipe and the list of BRU +* inputs. +*/ + WARN_ON(list_empty(&rpf->entity.list_pipe)); + list_del_init(&rpf->entity.list_pipe); pipe->inputs[i] = NULL; + + bru->inputs[rpf->bru_input].rpf = NULL; } + drm_pipe->du_complete = NULL; pipe->num_inputs = 0; - vsp1->drm->du_complete = NULL; vsp1_dlm_reset(pipe->output->dlm); vsp1_device_put(vsp1); @@ -117,8 +135,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index, return 0; } - dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n", - __func__, cfg->width, cfg->height); + dev_dbg(vsp1->dev, "%s: configuring LIF%u with format %ux%u\n", + __func__, pipe_index, cfg->width, cfg->height); /* * Configure the format at the BRU sinks and propagate it through the @@ -127,7 +145,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index, memset(&format, 0, sizeof(format)); format.which = V4L2_SUBDEV_FORMAT_ACTIVE; - for (i = 0; i < bru->entity.source_pad; ++i) { + for (i = 0; i < pipe->bru->source_pad; ++i) { format.pad = i; format.format.width = cfg->width; @@ -135,60 +153,60 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index, format.format.code = MEDIA_BUS_FMT_ARGB_1X32; format.format.field = V4L2_FIELD_NONE; - ret = v4l2_subdev_call(&bru->entity.subdev, pad, + ret = v4l2_subdev_call(&pipe->bru->subdev, pad, set_fmt, NULL, &format); if (ret < 0) return ret; - dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on BRU pad %u\n", + dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on %s pad %u\n", __func__, format.format.width, format.format.height, - format.format.code, i); + format.format.code, bru_name, i); }