Commit 660c9c6c authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Tim Gardner

UBUNTU: SAUCE: drm/core: Add drm_encoder_index.

BugLink: http://bugs.launchpad.net/bugs/1540390

This is useful for adding encoder_mask in crtc_state.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1452160762-30487-2-git-send-email-maarten.lankhorst@linux.intel.com
(backported from drm-intel-next commit 47d7777f)

Avoid backporting commits passing *name to drm_encoder_init.
Signed-off-by: default avatarTimo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
parent f3770952
......@@ -1120,6 +1120,29 @@ int drm_encoder_init(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_encoder_init);
/**
* drm_encoder_index - find the index of a registered encoder
* @encoder: encoder to find index for
*
* Given a registered encoder, return the index of that encoder within a DRM
* device's list of encoders.
*/
unsigned int drm_encoder_index(struct drm_encoder *encoder)
{
unsigned int index = 0;
struct drm_encoder *tmp;
drm_for_each_encoder(tmp, encoder->dev) {
if (tmp == encoder)
return index;
index++;
}
BUG();
}
EXPORT_SYMBOL(drm_encoder_index);
/**
* drm_encoder_cleanup - cleans up an initialised encoder
* @encoder: encoder to cleanup
......
......@@ -1242,6 +1242,7 @@ extern int drm_encoder_init(struct drm_device *dev,
struct drm_encoder *encoder,
const struct drm_encoder_funcs *funcs,
int encoder_type);
extern unsigned int drm_encoder_index(struct drm_encoder *encoder);
/**
* drm_encoder_crtc_ok - can a given crtc drive a given encoder?
......
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