dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Engestrom <eric.engestrom@imgtec.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 13/13] drm: Don't export the drm_fb_get_bpp_depth() function
Date: Tue, 18 Oct 2016 16:14:37 +0100	[thread overview]
Message-ID: <20161018151436.GF3759@imgtec.com> (raw)
In-Reply-To: <1476744081-24485-14-git-send-email-laurent.pinchart@ideasonboard.com>

On Tuesday, 2016-10-18 01:41:21 +0300, Laurent Pinchart wrote:
> The function is only used by the drm_helper_mode_fill_fb_struct() core
> function to fill the drm_framebuffer bpp and depth fields, used by
> drivers that haven't been converted to use pixel formats directly yet.
> It should not be used by new drivers, so inline it in its only caller.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

> ---
>  drivers/gpu/drm/drm_fourcc.c         | 31 -------------------------------
>  drivers/gpu/drm/drm_modeset_helper.c | 17 +++++++++++++++--
>  include/drm/drm_fourcc.h             |  1 -
>  3 files changed, 15 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> index 523ed916a1c0..cbb8b77c363c 100644
> --- a/drivers/gpu/drm/drm_fourcc.c
> +++ b/drivers/gpu/drm/drm_fourcc.c
> @@ -203,37 +203,6 @@ const struct drm_format_info *drm_format_info(u32 format)
>  EXPORT_SYMBOL(drm_format_info);
>  
>  /**
> - * drm_fb_get_bpp_depth - get the bpp/depth values for format
> - * @format: pixel format (DRM_FORMAT_*)
> - * @depth: storage for the depth value
> - * @bpp: storage for the bpp value
> - *
> - * This only supports RGB formats here for compat with code that doesn't use
> - * pixel formats directly yet.
> - */
> -void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
> -			  int *bpp)
> -{
> -	const struct drm_format_info *info;
> -
> -	info = drm_format_info(format);
> -	if (!info || !info->depth) {
> -		char *format_name = drm_get_format_name(format);
> -
> -		DRM_DEBUG_KMS("unsupported pixel format %s\n", format_name);
> -		kfree(format_name);
> -
> -		*depth = 0;
> -		*bpp = 0;
> -		return;
> -	}
> -
> -	*depth = info->depth;
> -	*bpp = info->cpp[0] * 8;
> -}
> -EXPORT_SYMBOL(drm_fb_get_bpp_depth);
> -
> -/**
>   * drm_format_num_planes - get the number of planes for format
>   * @format: pixel format (DRM_FORMAT_*)
>   *
> diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
> index 1d45738f8f98..2544dfe7354c 100644
> --- a/drivers/gpu/drm/drm_modeset_helper.c
> +++ b/drivers/gpu/drm/drm_modeset_helper.c
> @@ -70,8 +70,23 @@ EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
>  void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
>  				    const struct drm_mode_fb_cmd2 *mode_cmd)
>  {
> +	const struct drm_format_info *info;
>  	int i;
>  
> +	info = drm_format_info(mode_cmd->pixel_format);
> +	if (!info || !info->depth) {
> +		char *format_name = drm_get_format_name(mode_cmd->pixel_format);
> +
> +		DRM_DEBUG_KMS("non-RGB pixel format %s\n", format_name);
> +		kfree(format_name);
> +
> +		fb->depth = 0;
> +		fb->bits_per_pixel = 0;
> +	} else {
> +		fb->depth = info->depth;
> +		fb->bits_per_pixel = info->cpp[0] * 8;
> +	}
> +
>  	fb->width = mode_cmd->width;
>  	fb->height = mode_cmd->height;
>  	for (i = 0; i < 4; i++) {
> @@ -79,8 +94,6 @@ void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
>  		fb->offsets[i] = mode_cmd->offsets[i];
>  		fb->modifier[i] = mode_cmd->modifier[i];
>  	}
> -	drm_fb_get_bpp_depth(mode_cmd->pixel_format, &fb->depth,
> -				    &fb->bits_per_pixel);
>  	fb->pixel_format = mode_cmd->pixel_format;
>  	fb->flags = mode_cmd->flags;
>  }
> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> index f73f97afd1e2..dc0aafab9ffd 100644
> --- a/include/drm/drm_fourcc.h
> +++ b/include/drm/drm_fourcc.h
> @@ -48,7 +48,6 @@ struct drm_format_info {
>  const struct drm_format_info *__drm_format_info(u32 format);
>  const struct drm_format_info *drm_format_info(u32 format);
>  uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
> -void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, int *bpp);
>  int drm_format_num_planes(uint32_t format);
>  int drm_format_plane_cpp(uint32_t format, int plane);
>  int drm_format_horz_chroma_subsampling(uint32_t format);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-10-18 15:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 22:41 [PATCH v5 00/13] Centralize format information Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 01/13] drm: " Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 02/13] drm: Implement the drm_format_*() helpers as drm_format_info() wrappers Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 03/13] drm: Use drm_format_info() in DRM core code Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 04/13] drm: WARN when calling drm_format_info() for an unsupported format Laurent Pinchart
2016-10-18 15:14   ` Eric Engestrom
2016-10-17 22:41 ` [PATCH v5 05/13] drm: hdlcd: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 06/13] drm: tilcdc: " Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 07/13] drm: cirrus: " Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 08/13] drm: gma500: Replace drm_fb_get_bpp_depth() with drm_format_info() Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 09/13] drm: amdgpu: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 10/13] drm: radeon: " Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 11/13] drm: vmwgfx: Replace drm_fb_get_bpp_depth() with drm_format_info() Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 12/13] drm/arm: mali-dp: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 13/13] drm: Don't export the drm_fb_get_bpp_depth() function Laurent Pinchart
2016-10-18 15:14   ` Eric Engestrom [this message]
2016-10-18 10:33 ` [PATCH v5 00/13] Centralize format information Archit Taneja
2016-10-18 11:43 ` Ville Syrjälä
2016-10-18 12:33   ` Laurent Pinchart
2016-10-18 12:45     ` Ville Syrjälä
2016-10-18 12:49       ` 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=20161018151436.GF3759@imgtec.com \
    --to=eric.engestrom@imgtec.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=tomi.valkeinen@ti.com \
    /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