All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	Brian Starkey <brian.starkey@arm.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: [PATCH v6 09/18] media: vsp1: drm: Split RPF format setting to separate function
Date: Wed, 13 Mar 2019 02:05:23 +0200	[thread overview]
Message-ID: <20190313000532.7087-10-laurent.pinchart+renesas@ideasonboard.com> (raw)
In-Reply-To: <20190313000532.7087-1-laurent.pinchart+renesas@ideasonboard.com>

The code that initializes the RPF format-related fields for display
pipelines will also be useful for the WPF to implement writeback
support. Split it from vsp1_du_atomic_update() to a new
vsp1_du_pipeline_set_rwpf_format() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_drm.c | 55 ++++++++++++++++----------
 1 file changed, 35 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c
index 4f1bc51d1ef4..5601a787688b 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -566,6 +566,36 @@ static void vsp1_du_pipeline_configure(struct vsp1_pipeline *pipe)
 	vsp1_dl_list_commit(dl, dl_flags);
 }
 
+static int vsp1_du_pipeline_set_rwpf_format(struct vsp1_device *vsp1,
+					    struct vsp1_rwpf *rwpf,
+					    u32 pixelformat, unsigned int pitch)
+{
+	const struct vsp1_format_info *fmtinfo;
+	unsigned int chroma_hsub;
+
+	fmtinfo = vsp1_get_format_info(vsp1, pixelformat);
+	if (!fmtinfo) {
+		dev_dbg(vsp1->dev, "Unsupported pixel format %08x for RPF\n",
+			pixelformat);
+		return -EINVAL;
+	}
+
+	/*
+	 * Only formats with three planes can affect the chroma planes pitch.
+	 * All formats with two planes have a horizontal subsampling value of 2,
+	 * but combine U and V in a single chroma plane, which thus results in
+	 * the luma plane and chroma plane having the same pitch.
+	 */
+	chroma_hsub = (fmtinfo->planes == 3) ? fmtinfo->hsub : 1;
+
+	rwpf->fmtinfo = fmtinfo;
+	rwpf->format.num_planes = fmtinfo->planes;
+	rwpf->format.plane_fmt[0].bytesperline = pitch;
+	rwpf->format.plane_fmt[1].bytesperline = pitch / chroma_hsub;
+
+	return 0;
+}
+
 /* -----------------------------------------------------------------------------
  * DU Driver API
  */
@@ -773,9 +803,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
 {
 	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
 	struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index];
-	const struct vsp1_format_info *fmtinfo;
-	unsigned int chroma_hsub;
 	struct vsp1_rwpf *rpf;
+	int ret;
 
 	if (rpf_index >= vsp1->info->rpf_count)
 		return -EINVAL;
@@ -808,25 +837,11 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
 	 * Store the format, stride, memory buffer address, crop and compose
 	 * rectangles and Z-order position and for the input.
 	 */
-	fmtinfo = vsp1_get_format_info(vsp1, cfg->pixelformat);
-	if (!fmtinfo) {
-		dev_dbg(vsp1->dev, "Unsupported pixel format %08x for RPF\n",
-			cfg->pixelformat);
-		return -EINVAL;
-	}
+	ret = vsp1_du_pipeline_set_rwpf_format(vsp1, rpf, cfg->pixelformat,
+					       cfg->pitch);
+	if (ret < 0)
+		return ret;
 
-	/*
-	 * Only formats with three planes can affect the chroma planes pitch.
-	 * All formats with two planes have a horizontal subsampling value of 2,
-	 * but combine U and V in a single chroma plane, which thus results in
-	 * the luma plane and chroma plane having the same pitch.
-	 */
-	chroma_hsub = (fmtinfo->planes == 3) ? fmtinfo->hsub : 1;
-
-	rpf->fmtinfo = fmtinfo;
-	rpf->format.num_planes = fmtinfo->planes;
-	rpf->format.plane_fmt[0].bytesperline = cfg->pitch;
-	rpf->format.plane_fmt[1].bytesperline = cfg->pitch / chroma_hsub;
 	rpf->alpha = cfg->alpha;
 
 	rpf->mem.addr[0] = cfg->mem[0];
-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	linux-media@vger.kernel.org
Subject: [PATCH v6 09/18] media: vsp1: drm: Split RPF format setting to separate function
Date: Wed, 13 Mar 2019 02:05:23 +0200	[thread overview]
Message-ID: <20190313000532.7087-10-laurent.pinchart+renesas@ideasonboard.com> (raw)
In-Reply-To: <20190313000532.7087-1-laurent.pinchart+renesas@ideasonboard.com>

The code that initializes the RPF format-related fields for display
pipelines will also be useful for the WPF to implement writeback
support. Split it from vsp1_du_atomic_update() to a new
vsp1_du_pipeline_set_rwpf_format() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_drm.c | 55 ++++++++++++++++----------
 1 file changed, 35 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c
index 4f1bc51d1ef4..5601a787688b 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -566,6 +566,36 @@ static void vsp1_du_pipeline_configure(struct vsp1_pipeline *pipe)
 	vsp1_dl_list_commit(dl, dl_flags);
 }
 
+static int vsp1_du_pipeline_set_rwpf_format(struct vsp1_device *vsp1,
+					    struct vsp1_rwpf *rwpf,
+					    u32 pixelformat, unsigned int pitch)
+{
+	const struct vsp1_format_info *fmtinfo;
+	unsigned int chroma_hsub;
+
+	fmtinfo = vsp1_get_format_info(vsp1, pixelformat);
+	if (!fmtinfo) {
+		dev_dbg(vsp1->dev, "Unsupported pixel format %08x for RPF\n",
+			pixelformat);
+		return -EINVAL;
+	}
+
+	/*
+	 * Only formats with three planes can affect the chroma planes pitch.
+	 * All formats with two planes have a horizontal subsampling value of 2,
+	 * but combine U and V in a single chroma plane, which thus results in
+	 * the luma plane and chroma plane having the same pitch.
+	 */
+	chroma_hsub = (fmtinfo->planes == 3) ? fmtinfo->hsub : 1;
+
+	rwpf->fmtinfo = fmtinfo;
+	rwpf->format.num_planes = fmtinfo->planes;
+	rwpf->format.plane_fmt[0].bytesperline = pitch;
+	rwpf->format.plane_fmt[1].bytesperline = pitch / chroma_hsub;
+
+	return 0;
+}
+
 /* -----------------------------------------------------------------------------
  * DU Driver API
  */
@@ -773,9 +803,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
 {
 	struct vsp1_device *vsp1 = dev_get_drvdata(dev);
 	struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index];
-	const struct vsp1_format_info *fmtinfo;
-	unsigned int chroma_hsub;
 	struct vsp1_rwpf *rpf;
+	int ret;
 
 	if (rpf_index >= vsp1->info->rpf_count)
 		return -EINVAL;
@@ -808,25 +837,11 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
 	 * Store the format, stride, memory buffer address, crop and compose
 	 * rectangles and Z-order position and for the input.
 	 */
-	fmtinfo = vsp1_get_format_info(vsp1, cfg->pixelformat);
-	if (!fmtinfo) {
-		dev_dbg(vsp1->dev, "Unsupported pixel format %08x for RPF\n",
-			cfg->pixelformat);
-		return -EINVAL;
-	}
+	ret = vsp1_du_pipeline_set_rwpf_format(vsp1, rpf, cfg->pixelformat,
+					       cfg->pitch);
+	if (ret < 0)
+		return ret;
 
-	/*
-	 * Only formats with three planes can affect the chroma planes pitch.
-	 * All formats with two planes have a horizontal subsampling value of 2,
-	 * but combine U and V in a single chroma plane, which thus results in
-	 * the luma plane and chroma plane having the same pitch.
-	 */
-	chroma_hsub = (fmtinfo->planes == 3) ? fmtinfo->hsub : 1;
-
-	rpf->fmtinfo = fmtinfo;
-	rpf->format.num_planes = fmtinfo->planes;
-	rpf->format.plane_fmt[0].bytesperline = cfg->pitch;
-	rpf->format.plane_fmt[1].bytesperline = cfg->pitch / chroma_hsub;
 	rpf->alpha = cfg->alpha;
 
 	rpf->mem.addr[0] = cfg->mem[0];
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-03-13  0:05 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13  0:05 [PATCH v6 00/18] R-Car DU display writeback support Laurent Pinchart
2019-03-13  0:05 ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 01/18] Revert "[media] v4l: vsp1: Supply frames to the DU continuously" Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 02/18] media: vsp1: wpf: Fix partition configuration for display pipelines Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 03/18] media: vsp1: Replace leftover occurrence of fragment with body Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 04/18] media: vsp1: Fix addresses of display-related registers for VSP-DL Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 05/18] media: vsp1: Replace the display list internal flag with a flags field Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 06/18] media: vsp1: Add vsp1_dl_list argument to .configure_stream() operation Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13 10:36   ` Kieran Bingham
2019-03-13 10:36     ` Kieran Bingham
2019-03-13  0:05 ` [PATCH v6 07/18] media: vsp1: dl: Allow chained display lists for display pipelines Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13 11:07   ` Kieran Bingham
2019-03-13 11:07     ` Kieran Bingham
2019-03-13  0:05 ` [PATCH v6 08/18] media: vsp1: wpf: Add writeback support Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13 10:59   ` Kieran Bingham
2019-03-13 10:59     ` Kieran Bingham
2019-03-13 11:15     ` Laurent Pinchart
2019-03-13 11:15       ` Laurent Pinchart
2019-03-13  0:05 ` Laurent Pinchart [this message]
2019-03-13  0:05   ` [PATCH v6 09/18] media: vsp1: drm: Split RPF format setting to separate function Laurent Pinchart
2019-03-13 11:12   ` Kieran Bingham
2019-03-13 11:12     ` Kieran Bingham
2019-03-13 11:17     ` Laurent Pinchart
2019-03-13 11:17       ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 10/18] media: vsp1: drm: Extend frame completion API to the DU driver Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13 11:26   ` Kieran Bingham
2019-03-13 11:26     ` Kieran Bingham
2019-03-13 15:50     ` Laurent Pinchart
2019-03-13 15:50       ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 11/18] media: vsp1: drm: Implement writeback support Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13 11:42   ` Kieran Bingham
2019-03-13 11:42     ` Kieran Bingham
2019-03-13 15:56     ` Laurent Pinchart
2019-03-13 15:56       ` Laurent Pinchart
2019-03-14  8:28       ` Kieran Bingham
2019-03-14  8:28         ` Kieran Bingham
2019-03-14 12:09         ` Laurent Pinchart
2019-03-14 12:09           ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 12/18] drm: writeback: Cleanup job ownership handling when queuing job Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13 11:45   ` Kieran Bingham
2019-03-13 11:45     ` Kieran Bingham
2019-03-13  0:05 ` [PATCH v6 13/18] drm: writeback: Fix leak of writeback job Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 14/18] drm: writeback: Add job prepare and cleanup operations Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-15 17:54   ` Liviu Dudau
2019-03-15 17:54     ` Liviu Dudau
2019-03-13  0:05 ` [PATCH v6 15/18] drm: rcar-du: Fix rcar_du_crtc structure documentation Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 16/18] drm: rcar-du: Store V4L2 fourcc in rcar_du_format_info structure Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13  0:05 ` [PATCH v6 17/18] drm: rcar-du: vsp: Extract framebuffer (un)mapping to separate functions Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13 11:54   ` Kieran Bingham
2019-03-13 11:54     ` Kieran Bingham
2019-03-13  0:05 ` [PATCH v6 18/18] drm: rcar-du: Add writeback support for R-Car Gen3 Laurent Pinchart
2019-03-13  0:05   ` Laurent Pinchart
2019-03-13 12:06   ` Kieran Bingham
2019-03-13 12:06     ` Kieran Bingham
2019-03-13 16:08     ` Laurent Pinchart
2019-03-13 16:08       ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190313000532.7087-10-laurent.pinchart+renesas@ideasonboard.com \
    --to=laurent.pinchart+renesas@ideasonboard.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=brian.starkey@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.