Commit 6d1b81d8 authored by Shawn Guo's avatar Shawn Guo Committed by Daniel Vetter

drm: add crtc helper drm_crtc_from_index()

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: default avatarShawn Guo <shawn.guo@linaro.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1483015290-16660-2-git-send-email-shawnguo@kernel.org
parent b5c3714f
...@@ -46,6 +46,26 @@ ...@@ -46,6 +46,26 @@
#include "drm_crtc_internal.h" #include "drm_crtc_internal.h"
#include "drm_internal.h" #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.
*/
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 * drm_crtc_force_disable - Forcibly turn off a CRTC
* @crtc: CRTC to turn off * @crtc: CRTC to turn off
......
...@@ -822,6 +822,7 @@ int drm_crtc_force_disable(struct drm_crtc *crtc); ...@@ -822,6 +822,7 @@ int drm_crtc_force_disable(struct drm_crtc *crtc);
int drm_crtc_force_disable_all(struct drm_device *dev); int drm_crtc_force_disable_all(struct drm_device *dev);
int drm_mode_set_config_internal(struct drm_mode_set *set); 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 */ /* Helpers */
static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment