drm/modesetting: add initial encoder structures and setup functions

main
Dave Airlie 2008-05-30 11:47:57 +10:00
parent 98c5cf7f6f
commit 9654c776fd
2 changed files with 48 additions and 0 deletions

View File

@ -538,6 +538,31 @@ void drm_output_cleanup(struct drm_output *output)
}
EXPORT_SYMBOL(drm_output_cleanup);
void drm_encoder_init(struct drm_device *dev,
struct drm_encoder *encoder,
int encoder_type)
{
encoder->dev = dev;
encoder->id = drm_idr_get(dev, encoder);
encoder->encoder_type = encoder_type;
mutex_lock(&dev->mode_config.mutex);
list_add_tail(&encoder->head, &dev->mode_config.encoder_list);
dev->mode_config.num_encoder++;
mutex_unlock(&dev->mode_config.mutex);
}
EXPORT_SYMBOL(drm_encoder_init);
void drm_encoder_cleanup(struct drm_encoder *encoder)
{
struct drm_device *dev = encoder->dev;
mutex_lock(&dev->mode_config.mutex);
drm_idr_put(dev, encoder->id);
list_del(&encoder->head);
mutex_unlock(&dev->mode_config.mutex);
}
EXPORT_SYMBOL(drm_encoder_cleanup);
/**
* drm_mode_create - create a new display mode

View File

@ -277,6 +277,7 @@ struct drm_property {
struct drm_crtc;
struct drm_output;
struct drm_encoder;
/**
* drm_crtc_funcs - control CRTCs for a given device
@ -396,9 +397,29 @@ struct drm_output_funcs {
};
struct drm_encoder_funcs {
void (*destroy)(struct drm_encoder *encoder);
};
#define DRM_OUTPUT_MAX_UMODES 16
#define DRM_OUTPUT_MAX_PROPERTY 16
#define DRM_OUTPUT_LEN 32
/**
* drm_encoder - central DRM encoder structure
*/
struct drm_encoder {
struct drm_device *dev;
struct list_head head;
int id;
int encoder_type;
uint32_t possible_crtcs;
uint32_t possible_clones;
const struct drm_encoder_funcs *funcs;
};
/**
* drm_output - central DRM output control structure
* @crtc: CRTC this output is currently connected to, NULL if none
@ -496,6 +517,8 @@ struct drm_mode_config {
struct list_head fb_list;
int num_output;
struct list_head output_list;
int num_encoder;
struct list_head encoder_list;
int num_crtc;
struct list_head crtc_list;