drm/vkms: Set device name from vkms_config

In order to be able to create multiple devices, the device name needs to
be unique.

Allow to set it in the VKMS configuration.

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250218101214.5790-7-jose.exposito89@gmail.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
José Expósito
2025-02-18 11:12:06 +01:00
committed by Maxime Ripard
parent 8b059b0c3f
commit 969a3a4e2b
5 changed files with 40 additions and 5 deletions

View File

@@ -10,12 +10,14 @@
/**
* struct vkms_config - General configuration for VKMS driver
*
* @dev_name: Name of the device
* @writeback: If true, a writeback buffer can be attached to the CRTC
* @cursor: If true, a cursor plane is created in the VKMS device
* @overlay: If true, NUM_OVERLAY_PLANES will be created for the VKMS device
* @dev: Used to store the current VKMS device. Only set when the device is instantiated.
*/
struct vkms_config {
const char *dev_name;
bool writeback;
bool cursor;
bool overlay;
@@ -24,12 +26,13 @@ struct vkms_config {
/**
* vkms_config_create() - Create a new VKMS configuration
* @dev_name: Name of the device
*
* Returns:
* The new vkms_config or an error. Call vkms_config_destroy() to free the
* returned configuration.
*/
struct vkms_config *vkms_config_create(void);
struct vkms_config *vkms_config_create(const char *dev_name);
/**
* vkms_config_default_create() - Create the configuration for the default device
@@ -51,6 +54,19 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,
*/
void vkms_config_destroy(struct vkms_config *config);
/**
* vkms_config_get_device_name() - Return the name of the device
* @config: Configuration to get the device name from
*
* Returns:
* The device name. Only valid while @config is valid.
*/
static inline const char *
vkms_config_get_device_name(struct vkms_config *config)
{
return config->dev_name;
}
/**
* vkms_config_register_debugfs() - Register a debugfs file to show the device's
* configuration