drm/vkms: Pass plane_cfg to plane initialization

As plane can have many parameters, directly pass the plane
configuration to the init function.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patch.msgid.link/20251115000237.3561250-15-alex.hung@amd.com
pull/1354/merge
Louis Chauvet 2025-11-14 17:01:39 -07:00 committed by Simon Ser
parent 9cf87f864d
commit 08b651cad2
3 changed files with 8 additions and 9 deletions

View File

@ -225,6 +225,7 @@ struct vkms_output {
};
struct vkms_config;
struct vkms_config_plane;
/**
* struct vkms_device - Description of a VKMS device
@ -298,10 +299,10 @@ int vkms_output_init(struct vkms_device *vkmsdev);
* vkms_plane_init() - Initialize a plane
*
* @vkmsdev: VKMS device containing the plane
* @type: type of plane to initialize
* @plane_cfg: plane configuration
*/
struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
enum drm_plane_type type);
struct vkms_config_plane *plane_cfg);
/* CRC Support */
const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,

View File

@ -20,11 +20,7 @@ int vkms_output_init(struct vkms_device *vkmsdev)
return -EINVAL;
vkms_config_for_each_plane(vkmsdev->config, plane_cfg) {
enum drm_plane_type type;
type = vkms_config_plane_get_type(plane_cfg);
plane_cfg->plane = vkms_plane_init(vkmsdev, type);
plane_cfg->plane = vkms_plane_init(vkmsdev, plane_cfg);
if (IS_ERR(plane_cfg->plane)) {
DRM_DEV_ERROR(dev->dev, "Failed to init vkms plane\n");
return PTR_ERR(plane_cfg->plane);

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0+
#include "vkms_config.h"
#include <linux/iosys-map.h>
#include <drm/drm_atomic.h>
@ -218,7 +219,7 @@ static const struct drm_plane_helper_funcs vkms_plane_helper_funcs = {
};
struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
enum drm_plane_type type)
struct vkms_config_plane *plane_cfg)
{
struct drm_device *dev = &vkmsdev->drm;
struct vkms_plane *plane;
@ -226,7 +227,8 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 0,
&vkms_plane_funcs,
vkms_formats, ARRAY_SIZE(vkms_formats),
NULL, type, NULL);
NULL, vkms_config_plane_get_type(plane_cfg),
NULL);
if (IS_ERR(plane))
return plane;