linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
	David Airlie <airlied@linux.ie>, Chen-Yu Tsai <wens@csie.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Sean Paul <sean@poorly.run>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	linux-sunxi@googlegroups.com, Daniel Vetter <daniel@ffwll.ch>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Subject: [PATCH v4 04/22] drm/sun4i: frontend: Pass DRM format info to input format helpers
Date: Wed,  5 Dec 2018 09:36:45 +0100	[thread overview]
Message-ID: <20181205083703.21488-5-paul.kocialkowski@bootlin.com> (raw)
In-Reply-To: <20181205083703.21488-1-paul.kocialkowski@bootlin.com>

The helper returning the input mode needs to know the number of planes
for the provided format. Passing the fourcc requires iterating through
the format info list in order to return the number of planes.

Pass the DRM format info structure directly instead to all helpers
related to configuring the input format, since it's available to the
caller. Also rename the input format in the caller function to keep
things consistent.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 drivers/gpu/drm/sun4i/sun4i_frontend.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c
index 1a7ebc45747e..dd5af3019099 100644
--- a/drivers/gpu/drm/sun4i/sun4i_frontend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c
@@ -104,9 +104,11 @@ void sun4i_frontend_update_buffer(struct sun4i_frontend *frontend,
 }
 EXPORT_SYMBOL(sun4i_frontend_update_buffer);
 
-static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val)
+static int
+sun4i_frontend_drm_format_to_input_fmt(const struct drm_format_info *format,
+				       u32 *val)
 {
-	switch (fmt) {
+	switch (format->format) {
 	case DRM_FORMAT_XRGB8888:
 		*val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB;
 		return 0;
@@ -116,9 +118,11 @@ static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val)
 	}
 }
 
-static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val)
+static int
+sun4i_frontend_drm_format_to_input_mode(const struct drm_format_info *format,
+					u32 *val)
 {
-	if (drm_format_num_planes(fmt) == 1)
+	if (format->num_planes == 1)
 		*val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED;
 	else
 		return -EINVAL;
@@ -126,9 +130,11 @@ static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val)
 	return 0;
 }
 
-static int sun4i_frontend_drm_format_to_input_sequence(uint32_t fmt, u32 *val)
+static int
+sun4i_frontend_drm_format_to_input_sequence(const struct drm_format_info *format,
+					    u32 *val)
 {
-	switch (fmt) {
+	switch (format->format) {
 	case DRM_FORMAT_BGRX8888:
 		*val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX;
 		return 0;
@@ -183,7 +189,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
 {
 	struct drm_plane_state *state = plane->state;
 	struct drm_framebuffer *fb = state->fb;
-	uint32_t format = fb->format->format;
+	const struct drm_format_info *format = fb->format;
 	u32 out_fmt_val;
 	u32 in_fmt_val, in_mod_val, in_ps_val;
 	int ret;
-- 
2.19.2


  parent reply	other threads:[~2018-12-05  8:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05  8:36 [PATCH v4 00/22] drm/sun4i: Support for linear and tiled YUV formats with the frontend Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 01/22] drm/fourcc: Add format info helpers for checking YUV planes disposition Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 02/22] drm/fourcc: Add format info helpers for checking YUV sub-sampling Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 03/22] drm/sun4i: backend: Use explicit fourcc helpers for packed YUV422 check Paul Kocialkowski
2018-12-05  8:36 ` Paul Kocialkowski [this message]
2018-12-05 15:35   ` [PATCH v4 04/22] drm/sun4i: frontend: Pass DRM format info to input format helpers Maxime Ripard
2018-12-05  8:36 ` [PATCH v4 05/22] drm/sun4i: frontend: Determine input format based on colorspace Paul Kocialkowski
2018-12-05 15:39   ` Maxime Ripard
2018-12-05  8:36 ` [PATCH v4 06/22] drm/sun4i: Move the BT.601 CSC coefficients to the frontend Paul Kocialkowski
2018-12-05 15:38   ` Maxime Ripard
2018-12-05  8:36 ` [PATCH v4 07/22] drm/sun4i: frontend: Configure and enable YUV to RGB CSC when needed Paul Kocialkowski
2018-12-05 15:38   ` Maxime Ripard
2018-12-05  8:36 ` [PATCH v4 08/22] drm/sun4i: frontend: Add support for packed YUV422 input formats Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 09/22] drm/sun4i: frontend: Add support for semi-planar YUV " Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 10/22] drm/sun4i: frontend: Add support for planar " Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 11/22] drm/fourcc: Add definitions for Allwinner vendor and VPU tiled format Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 12/22] drm/sun4i: frontend: Add support for tiled YUV input mode configuration Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 13/22] drm/sun4i: Add buffer stride and offset configuration for tiling mode Paul Kocialkowski
2018-12-05 15:44   ` Maxime Ripard
2018-12-05  8:36 ` [PATCH v4 14/22] drm/sun4i: frontend: Add and use helper for checking tiling support Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 15/22] drm/sun4i: layer: Add tiled modifier support and helper Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 16/22] drm/sun4i: drv: Allow framebuffer modifiers in mode config Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 17/22] drm/sun4i: Move access control before setting the register as documented Paul Kocialkowski
2018-12-05  8:36 ` [PATCH v4 18/22] drm/sun4i: frontend: Add a quirk structure Paul Kocialkowski
2018-12-05  8:37 ` [PATCH v4 19/22] drm/sun4i: Set the coef_rdy bit right after the coef have been set Paul Kocialkowski
2018-12-05  8:37 ` [PATCH v4 20/22] drm/sun4i: Make COEF_RDY conditional Paul Kocialkowski
2018-12-05  8:37 ` [PATCH v4 21/22] drm/sun4i: frontend: Move the FIR filter phases to our quirks Paul Kocialkowski
2018-12-05  8:37 ` [PATCH v4 22/22] drm/sun4i: frontend: Add A20-specific device-tree compatible and quirks Paul Kocialkowski
2019-01-03 10:10 ` [PATCH v4 00/22] drm/sun4i: Support for linear and tiled YUV formats with the frontend Paul Kocialkowski

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=20181205083703.21488-5-paul.kocialkowski@bootlin.com \
    --to=paul.kocialkowski@bootlin.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=sean@poorly.run \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wens@csie.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).