From: Daniel Vetter <daniel@ffwll.ch>
To: Shawn Guo <shawnguo@kernel.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm: add crtc helper drm_crtc_from_index()
Date: Fri, 30 Dec 2016 12:14:46 +0100 [thread overview]
Message-ID: <20161230111446.GC2667@dvetter-linux.ger.corp.intel.com> (raw)
In-Reply-To: <1483015290-16660-2-git-send-email-shawnguo@kernel.org>
On Thu, Dec 29, 2016 at 08:41:28PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
>
> It adds a crtc helper drm_crtc_from_index() to find the registered CRTC
> with a given index, just like drm_plane_from_index().
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> drivers/gpu/drm/drm_crtc.c | 20 ++++++++++++++++++++
> include/drm/drm_crtc.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index e75f62cd8a65..5c1bb1f34697 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -47,6 +47,26 @@
> #include "drm_internal.h"
>
> /**
> + * drm_crtc_from_index - find the registered CRTC at an index
> + * @dev: DRM device
> + * @idx: index of registered CRTC to find for
> + *
> + * Given a CRTC index, return the registered CRTC from DRM device's
> + * list of CRTCs with matching index.
> + */
Might be useful to go through al the drm_*_inde and drm_*_from_index
functions we have and a sentence to each likt "This is the inverse of
drm_crtc_index()." to cross link them a bit.
Also here a sentence explaining that this is useful in the vblank code,
e.g.
"This is useful in the vblank callbacks (like &drm_driver.enable_vblank or
&drm_driver.disable_vblank), since that still deals with indices instead
of pointers to &struct drm_crtc."
Follow-up pach, since I applied these here already.
-Daniel
> +struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx)
> +{
> + struct drm_crtc *crtc;
> +
> + drm_for_each_crtc(crtc, dev)
> + if (idx == crtc->index)
> + return crtc;
> +
> + return NULL;
> +}
> +EXPORT_SYMBOL(drm_crtc_from_index);
> +
> +/**
> * drm_crtc_force_disable - Forcibly turn off a CRTC
> * @crtc: CRTC to turn off
> *
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 946672f97e1e..a5627eb8621f 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -830,6 +830,7 @@ void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
> int drm_crtc_force_disable_all(struct drm_device *dev);
>
> int drm_mode_set_config_internal(struct drm_mode_set *set);
> +struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);
>
> /* Helpers */
> static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
> --
> 1.9.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-12-30 11:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-29 12:41 [PATCH 0/3] Add CRTC helper drm_crtc_from_index() Shawn Guo
2016-12-29 12:41 ` [PATCH 1/3] drm: add crtc " Shawn Guo
2016-12-30 11:14 ` Daniel Vetter [this message]
2016-12-29 12:41 ` [PATCH 2/3] drm: zte: use " Shawn Guo
2016-12-29 12:41 ` [PATCH 3/3] drm: rockchip: " Shawn Guo
2016-12-30 11:16 ` [PATCH 0/3] Add CRTC " Daniel Vetter
2017-01-09 9:03 ` Shawn Guo
2017-01-09 9:58 ` Daniel Vetter
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=20161230111446.GC2667@dvetter-linux.ger.corp.intel.com \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=shawnguo@kernel.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.