From: "Ville Syrjälä" <ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Shirish S <shirish.s12-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
shirish.s-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH] drm: add check for plane functions
Date: Fri, 17 Mar 2017 13:08:43 +0200 [thread overview]
Message-ID: <20170317110843.GQ31595@intel.com> (raw)
In-Reply-To: <CAE=Z4VBsuzAPWSiy9NSXXFZfWEuSEi0miANhNmq5u0xR6M0BWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Fri, Mar 17, 2017 at 03:46:34PM +0530, Shirish S wrote:
> On Fri, Mar 17, 2017 at 3:26 PM, Ville Syrjälä
> <ville.syrjala@linux.intel.com> wrote:
> > On Fri, Mar 17, 2017 at 01:25:08PM +0530, Shirish S wrote:
> >> update_plane() and disable_plane() functions
> >> assoiciated with setting plane are called
> >> without any check, causing kernel panic.
> >
> > Why are you registering a plane without the funcs?
> >
> Basically, enabling planes and making them fully functional is
> generally a 2 -step process,
> so i suggest for new drivers wanting to implement/re-design planes,
> would like to tap
> the flow at enabling(listing caps) and later at ensuring it works.
I don't think there's much point in exposing something that
doesn't work. And even if you do, you could always just use
stub functions.
> I noticed that there is a underlying assumption only for
> plane->(funcs) are implemented, whereas for
> other function for crtc/connector/encoder function calls there is a
> sanity check(or WARN_ON) through out the framework.
>
> I believe this check wont cause any performance/functional impact.
> Please let me know if am missing anything.
> And further more help developers to focus on enabling planes via
> various tests without causing reboots/system hangs.
I don't particularly like adding more unconditional runtime checks
that just to protect developers from themselves. If you really
think there's value in these, then at least add the checks into
the plane init codepath so that it's a one time cost.
The same approach could be used for all the other non-optional
hooks. Otherwise the same WARN_ON()s would have to be sprinkled
all over the place, and there's always the risk of missing a few
codepaths that call a specific hook.
> >>
> >> This patch adds the required check to avoid it.
> >>
> >> Change-Id: I0d6792608b33e674c217388aa57c4b7d680d9bc7
> >> Signed-off-by: Shirish S <shirish.s@amd.com>
> >> ---
> >> drivers/gpu/drm/drm_plane.c | 6 ++++++
> >> 1 file changed, 6 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> >> index 249c0ae..f675f8b 100644
> >> --- a/drivers/gpu/drm/drm_plane.c
> >> +++ b/drivers/gpu/drm/drm_plane.c
> >> @@ -456,6 +456,12 @@ static int __setplane_internal(struct drm_plane *plane,
> >> {
> >> int ret = 0;
> >>
> >> + if (plane->funcs->disable_plane == NULL ||
> >> + plane->funcs->update_plane == NULL) {
> >> + DRM_ERROR("plane funcs not implemented\n");
> >> + ret = -EPERM;
> >> + goto out;
> >> + }
> >> /* No fb means shut it down */
> >> if (!fb) {
> >> plane->old_fb = plane->fb;
> >> --
> >> 2.7.4
> >>
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> > --
> > Ville Syrjälä
> > Intel OTC
--
Ville Syrjälä
Intel OTC
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-03-17 11:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 7:55 [PATCH] drm: add check for plane functions Shirish S
[not found] ` <1489737308-30713-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
2017-03-17 9:56 ` Ville Syrjälä
[not found] ` <20170317095647.GN31595-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-03-17 10:16 ` Shirish S
[not found] ` <CAE=Z4VBsuzAPWSiy9NSXXFZfWEuSEi0miANhNmq5u0xR6M0BWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-17 11:08 ` Ville Syrjälä [this message]
[not found] ` <20170317110843.GQ31595-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-03-17 16:57 ` Daniel Vetter
[not found] ` <20170317165752.hm6htsx3jlhusx4s-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-03-17 17:19 ` Ville Syrjälä
2017-03-17 19:29 ` Eric Anholt
[not found] ` <87k27nsnuw.fsf-omZaPlIz5HhaEpDpdNBo/KxOck334EZe@public.gmane.org>
2017-03-20 4:28 ` Shirish S
[not found] ` <CAE=Z4VBgLWzrNVRkgKJNSmyBuDRrNmTuY3YoVTRKc956mB3TAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-20 8:21 ` Daniel Vetter
[not found] ` <20170320082131.kfn7qwihrvz4qdnc-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-03-20 9:42 ` Shirish S
[not found] ` <CAE=Z4VDp4tOhvbkk9OsG7EiG1_rTu8NWqoKUHUFnrVOc8s2Tuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-21 15:27 ` Harry Wentland
2017-03-17 20:05 ` Harry Wentland
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=20170317110843.GQ31595@intel.com \
--to=ville.syrjala-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=shirish.s-5C7GfCeVMHo@public.gmane.org \
--cc=shirish.s12-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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.