lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181204152158.rclvmyql6ct5jley@flea>
Date:   Tue, 4 Dec 2018 16:21:58 +0100
From:   Maxime Ripard <maxime.ripard@...tlin.com>
To:     Paul Kocialkowski <paul.kocialkowski@...tlin.com>
Cc:     dri-devel@...ts.freedesktop.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        David Airlie <airlied@...ux.ie>, Chen-Yu Tsai <wens@...e.org>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Sean Paul <sean@...rly.run>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        linux-sunxi@...glegroups.com, Daniel Vetter <daniel@...ll.ch>
Subject: Re: [PATCH v3 04/21] drm/sun4i: frontend: Pass DRM format info to
 input mode helper

On Tue, Dec 04, 2018 at 03:22:01PM +0100, Paul Kocialkowski wrote:
> 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, 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@...tlin.com>
> ---
>  drivers/gpu/drm/sun4i/sun4i_frontend.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c
> index 1a7ebc45747e..c436fa97928f 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c
> @@ -116,9 +116,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;
> @@ -183,12 +185,13 @@ 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;
>  
> -	ret = sun4i_frontend_drm_format_to_input_fmt(format, &in_fmt_val);
> +	ret = sun4i_frontend_drm_format_to_input_fmt(format->format,
> +						     &in_fmt_val);
>  	if (ret) {
>  		DRM_DEBUG_DRIVER("Invalid input format\n");
>  		return ret;
> @@ -200,7 +203,8 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
>  		return ret;
>  	}
>  
> -	ret = sun4i_frontend_drm_format_to_input_sequence(format, &in_ps_val);
> +	ret = sun4i_frontend_drm_format_to_input_sequence(format->format,
> +							  &in_ps_val);

To keep things really consistent, we should also convert those
functions to get a drm_format_info pointer instead of the fourcc :)

It can come as a later patch though.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ