summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drm_crtc.c25
-rw-r--r--linux-core/drm_crtc.h23
2 files changed, 48 insertions, 0 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index faf70df5..f7e7bfa8 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -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
diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h
index b769eb7a..7765afea 100644
--- a/linux-core/drm_crtc.h
+++ b/linux-core/drm_crtc.h
@@ -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;