From 9239cf511f65a43eb578fbb6a7c5255e05db2101 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 13:31:16 +1000 Subject: drm: add encoder attach/detach --- linux-core/drm_crtc.c | 28 ++++++++++++++++++++++++++++ linux-core/drm_crtc.h | 5 +++++ 2 files changed, 33 insertions(+) (limited to 'linux-core') diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index f6937f44..400df98e 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -2202,3 +2202,31 @@ out: return ret; } + +int drm_mode_output_attach_encoder(struct drm_output *output, + struct drm_encoder *encoder) +{ + int i; + + for (i = 0; i < DRM_OUTPUT_MAX_ENCODER; i++) { + if (output->encoder_ids[i] == 0) { + output->encoder_ids[i] = encoder->id; + return 0; + } + } + return -ENOMEM; +} +EXPORT_SYMBOL(drm_mode_output_attach_encoder); + +void drm_mode_output_detach_encoder(struct drm_output *output, + struct drm_encoder *encoder) +{ + int i; + for (i = 0; i < DRM_OUTPUT_MAX_ENCODER; i++) { + if (output->encoder_ids[i] == encoder->id) { + output->encoder_ids[i] = 0; + break; + } + } +} +EXPORT_SYMBOL(drm_mode_output_detach_encoder); diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h index ed8467e3..04e0d033 100644 --- a/linux-core/drm_crtc.h +++ b/linux-core/drm_crtc.h @@ -629,6 +629,11 @@ extern int drm_property_add_enum(struct drm_property *property, int index, extern bool drm_create_tv_properties(struct drm_device *dev, int num_formats, char *formats[]); +extern int drm_mode_output_attach_encoder(struct drm_output *output, + struct drm_encoder *encoder); +extern void drm_mode_output_detach_encoder(struct drm_output *output, + struct drm_encoder *encoder); + /* IOCTLs */ extern int drm_mode_getresources(struct drm_device *dev, void *data, struct drm_file *file_priv); -- cgit v1.2.3