mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Noralf Trønnes" <noralf@tronnes.org>
Cc: dri-devel@lists.freedesktop.org, daniel@ffwll.ch,
	treding@nvidia.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] drm: Add helper for simple display pipeline
Date: Mon, 9 May 2016 16:46:48 +0200	[thread overview]
Message-ID: <20160509144648.GA27098@phenom.ffwll.local> (raw)
In-Reply-To: <1462454674-2246-4-git-send-email-noralf@tronnes.org>

On Thu, May 05, 2016 at 03:24:33PM +0200, Noralf Trønnes wrote:
> Provides helper functions for drivers that have a simple display
> pipeline. Plane, crtc and encoder are collapsed into one entity.
> 
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

> +static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
> +					struct drm_plane_state *pstate)
> +{
> +	struct drm_simple_display_pipe *pipe;
> +	struct drm_crtc_state *cstate;
> +
> +	pipe = container_of(plane, struct drm_simple_display_pipe, plane);
> +	if (!pipe->funcs || !pipe->funcs->check)
> +		return 0;
> +
> +	cstate = drm_atomic_get_existing_crtc_state(pstate->state,
> +						    &pipe->crtc);
> +
> +	return pipe->funcs->check(pipe, pstate, cstate);
> +}

Ok one thing I've missed here is that for most drivers this is way too
simple a check function, which means we'll end up with tons of duplicated
code. Things which the drm core allows, but simple pipelines all don't
really cope with:
- plane scaling
- disabling the plane without the crtc (i.e. scan out black)
- plane not sized to fill the entire hactive/vactive

There's a helper to do most of these checks for you -
drm_plane_helper_check_update. I think it'd be good to place a call for
that in here, before we call down into the driver's ->check callback. But
ofc before we return 0; we want these checks always done. And catch all
these things so that drivers never fall over this pitfall.

Noticed while discussing tilcdc atomic patches, since tilcdc could
probably use drm_simple_display_pipe too.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  parent reply	other threads:[~2016-05-09 14:46 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 13:24 [PATCH 0/4] drm: Add various helpers for simple drivers Noralf Trønnes
2016-05-05 13:24 ` [PATCH 1/4] drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs() Noralf Trønnes
2016-05-05 16:27   ` Daniel Vetter
2016-05-06 13:01     ` Noralf Trønnes
2016-05-06 13:13       ` Daniel Vetter
2016-05-05 13:24 ` [PATCH 2/4] drm: Make drm_encoder_helper_funcs optional Noralf Trønnes
2016-05-05 16:23   ` Daniel Vetter
2016-05-09 19:19     ` Noralf Trønnes
2016-05-10  6:53       ` Daniel Vetter
2016-05-05 13:24 ` [PATCH 3/4] drm: Add helper for simple display pipeline Noralf Trønnes
2016-05-05 16:45   ` Daniel Vetter
2016-05-09 14:46   ` Daniel Vetter [this message]
2016-05-09 18:37     ` Noralf Trønnes
2016-05-10  6:59       ` Daniel Vetter
2016-05-10 22:36         ` Daniel Vetter
2016-05-05 13:24 ` [PATCH 4/4] drm/panel: Add helper for simple panel connector Noralf Trønnes
2016-05-05 17:03   ` Daniel Vetter
2016-05-06 13:39     ` Noralf Trønnes
2016-05-06 14:01       ` Thierry Reding
2016-05-06 14:07         ` Daniel Vetter
2016-05-06 14:03   ` Thierry Reding
2016-05-06 14:08     ` Daniel Vetter
2016-05-06 14:15       ` Thierry Reding
2016-05-06 14:34         ` Noralf Trønnes
2016-05-06 14:41           ` Daniel Vetter
2016-05-06 14:43           ` Thierry Reding
2016-05-06 19:45             ` Noralf Trønnes
2016-05-07  9:59               ` Daniel Vetter
2016-05-07 12:46                 ` Noralf Trønnes

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=20160509144648.GA27098@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noralf@tronnes.org \
    --cc=treding@nvidia.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

all inboxes | Powered by JetHome®