aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vkms/vkms_config.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/vkms/vkms_config.h')
-rw-r--r--drivers/gpu/drm/vkms/vkms_config.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
index ad303b34ee03..024cbed0e439 100644
--- a/drivers/gpu/drm/vkms/vkms_config.h
+++ b/drivers/gpu/drm/vkms/vkms_config.h
@@ -15,12 +15,14 @@
* @dev_name: Name of the device
* @planes: List of planes configured for the device
* @crtcs: List of CRTCs configured for the device
+ * @encoders: List of encoders configured for the device
* @dev: Used to store the current VKMS device. Only set when the device is instantiated.
*/
struct vkms_config {
const char *dev_name;
struct list_head planes;
struct list_head crtcs;
+ struct list_head encoders;
struct vkms_device *dev;
};
@@ -70,6 +72,24 @@ struct vkms_config_crtc {
};
/**
+ * struct vkms_config_encoder
+ *
+ * @link: Link to the others encoders in vkms_config
+ * @config: The vkms_config this CRTC belongs to
+ * @encoder: Internal usage. This pointer should never be considered as valid.
+ * It can be used to store a temporary reference to a VKMS encoder
+ * during device creation. This pointer is not managed by the
+ * configuration and must be managed by other means.
+ */
+struct vkms_config_encoder {
+ struct list_head link;
+ struct vkms_config *config;
+
+ /* Internal usage */
+ struct drm_encoder *encoder;
+};
+
+/**
* vkms_config_for_each_plane - Iterate over the vkms_config planes
* @config: &struct vkms_config pointer
* @plane_cfg: &struct vkms_config_plane pointer used as cursor
@@ -86,6 +106,14 @@ struct vkms_config_crtc {
list_for_each_entry((crtc_cfg), &(config)->crtcs, link)
/**
+ * vkms_config_for_each_encoder - Iterate over the vkms_config encoders
+ * @config: &struct vkms_config pointer
+ * @encoder_cfg: &struct vkms_config_encoder pointer used as cursor
+ */
+#define vkms_config_for_each_encoder(config, encoder_cfg) \
+ list_for_each_entry((encoder_cfg), &(config)->encoders, link)
+
+/**
* vkms_config_plane_for_each_possible_crtc - Iterate over the vkms_config_plane
* possible CRTCs
* @plane_cfg: &struct vkms_config_plane pointer
@@ -286,4 +314,22 @@ struct vkms_config_plane *vkms_config_crtc_primary_plane(const struct vkms_confi
struct vkms_config_plane *vkms_config_crtc_cursor_plane(const struct vkms_config *config,
struct vkms_config_crtc *crtc_cfg);
+/**
+ * vkms_config_create_encoder() - Add a new encoder configuration
+ * @config: Configuration to add the encoder to
+ *
+ * Returns:
+ * The new encoder configuration or an error. Call vkms_config_destroy_encoder()
+ * to free the returned encoder configuration.
+ */
+struct vkms_config_encoder *vkms_config_create_encoder(struct vkms_config *config);
+
+/**
+ * vkms_config_destroy_encoder() - Remove and free a encoder configuration
+ * @config: Configuration to remove the encoder from
+ * @encoder_cfg: Encoder configuration to destroy
+ */
+void vkms_config_destroy_encoder(struct vkms_config *config,
+ struct vkms_config_encoder *encoder_cfg);
+
#endif /* _VKMS_CONFIG_H_ */