dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: Dave Airlie <airlied@redhat.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm: Tune up error message during format->bpp/cpp conversion
Date: Thu, 12 May 2016 16:10:37 +0300	[thread overview]
Message-ID: <20160512131037.GM4329@intel.com> (raw)
In-Reply-To: <1463058040-31828-2-git-send-email-imre.deak@intel.com>

On Thu, May 12, 2016 at 04:00:38PM +0300, Imre Deak wrote:
> Returning a 0 bpp/cpp value from these functions isn't ever valid. In
> many cases it can also lead to a div-by-zero possibly at some later
> point in time, so make sure we catch such errors as soon as possible via
> louder error reporting.
> 
> CC: Dave Airlie <airlied@redhat.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/drm_crtc.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 70f9c68..3a32606 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -5610,8 +5610,8 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
>  		*bpp = 32;
>  		break;
>  	default:
> -		DRM_DEBUG_KMS("unsupported pixel format %s\n",
> -			      drm_get_format_name(format));
> +		WARN(1, "unsupported pixel format %s\n",
> +		     drm_get_format_name(format));

NAK. This will happen every time drm_helper_mode_fill_fb_struct()
is called with a non-RGB format.

>  		*depth = 0;
>  		*bpp = 0;
>  		break;
> @@ -5666,8 +5666,12 @@ int drm_format_plane_cpp(uint32_t format, int plane)
>  	unsigned int depth;
>  	int bpp;
>  
> -	if (plane >= drm_format_num_planes(format))
> +	if (plane >= drm_format_num_planes(format)) {
> +		WARN(1, "invalid plane %d for format %s\n",
> +		     plane, drm_get_format_name(format));
> +

We have this check in many places. Should either convert all or none.

>  		return 0;
> +	}
>  
>  	switch (format) {
>  	case DRM_FORMAT_YUYV:
> -- 
> 2.5.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-05-12 13:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 13:00 [PATCH 0/3] drm: Fix/annotate better a few error paths Imre Deak
2016-05-12 13:00 ` [PATCH 1/3] drm: Tune up error message during format->bpp/cpp conversion Imre Deak
2016-05-12 13:10   ` Ville Syrjälä [this message]
2016-05-12 13:43     ` Imre Deak
2016-05-12 13:52       ` Ville Syrjälä
2016-05-12 14:00         ` Imre Deak
2016-05-12 14:02           ` Daniel Vetter
2016-05-12 15:28   ` [PATCH v2 1/3] drm: Tune up error message for incorrect plane/format combinations Imre Deak
2016-05-12 13:00 ` [PATCH 2/3] drm/mst: Fix error handling during MST sideband message reception Imre Deak
2016-05-12 22:00   ` [2/3] " Lyude Paul
2016-05-13 14:31   ` [PATCH v2 2/3] " Imre Deak
2016-05-12 13:00 ` [PATCH 3/3] drm: Avoid dereferencing a NULL mstb in drm_dp_mst_handle_up_req() Imre Deak
2017-07-17 12:10   ` Imre Deak
2017-07-17 15:33     ` Lyude Paul

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=20160512131037.GM4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imre.deak@intel.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;
as well as URLs for NNTP newsgroup(s).