diff mbox series

[v5,2/4] drm/vkms: Add overlay_planes config

Message ID 20230508075356.6511-3-marius.vlad@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm/vkms: Add support for multiple pipes | expand

Commit Message

Marius Vlad May 8, 2023, 7:53 a.m. UTC
And init it by default to NUM_OVERLAY_PLANES. This change would allow us
to configure the amount of overlay planes we can have in combination
with multiple pipes, in case we'll exceed the number of planes we can have.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
---
 drivers/gpu/drm/vkms/vkms_drv.c    | 2 ++
 drivers/gpu/drm/vkms/vkms_drv.h    | 1 +
 drivers/gpu/drm/vkms/vkms_output.c | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index e3c9c9571c8d..bd53194f1525 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -99,6 +99,7 @@  static int vkms_config_show(struct seq_file *m, void *data)
 	seq_printf(m, "writeback=%d\n", vkmsdev->config->writeback);
 	seq_printf(m, "cursor=%d\n", vkmsdev->config->cursor);
 	seq_printf(m, "overlay=%d\n", vkmsdev->config->overlay);
+	seq_printf(m, "overlay_planes=%d\n", vkmsdev->config->overlay_planes);
 
 	return 0;
 }
@@ -230,6 +231,7 @@  static int __init vkms_init(void)
 	config->cursor = enable_cursor;
 	config->writeback = enable_writeback;
 	config->overlay = enable_overlay;
+	config->overlay_planes = NUM_OVERLAY_PLANES;
 
 	ret = vkms_create(config);
 	if (ret)
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index f152d54baf76..ae2b38360236 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -112,6 +112,7 @@  struct vkms_config {
 	bool writeback;
 	bool cursor;
 	bool overlay;
+	unsigned int overlay_planes;
 	/* only set when instantiated */
 	struct vkms_device *dev;
 };
diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index 1b8aa3a34e46..f4e67a0ad712 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -63,7 +63,7 @@  int vkms_output_init(struct vkms_device *vkmsdev, int index)
 		return PTR_ERR(primary);
 
 	if (vkmsdev->config->overlay) {
-		for (n = 0; n < NUM_OVERLAY_PLANES; n++) {
+		for (n = 0; n < vkmsdev->config->overlay_planes; n++) {
 			ret = vkms_add_overlay_plane(vkmsdev, index, crtc);
 			if (ret)
 				return ret;