drm: add encoder attach/detach

main
Dave Airlie 2008-05-30 13:31:16 +10:00
parent 4403c59b76
commit 9239cf511f
2 changed files with 33 additions and 0 deletions

View File

@ -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);

View File

@ -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);