Skip to contentSkip to conversation

Expanding the basic vkms features

PATCH In review Rodrigo Siqueira 2 participants 5 messages May 22, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover Expanding the basic vkms features

This series of patches add a centralized initialization mechanism, a single CRTC with a plane, an encoder, and extra module information.

Changes in v2:
- Remove unused definitions
- Improve file names
- Improve code separation
- Remove unnecessary formats

Changes in v3:
- Adds drm_crtc_helper_funcs with a simple atomic_check
- Adds extra hooks for drm_connector_funcs hooks (reset, atomic_duplicate_state, atomic_destroy_state)
- Adds drm_connector_helper_funcs
- Adds drm_plane_helper_funcs
- Changes in the commit messages

Changes in v4:
- Associate plane helper with plane

Rodrigo Siqueira (3):
drm/vkms: Add mode_config initialization
drm/vkms: Add basic CRTC initialization
drm/vkms: Add extra information about vkms

 drivers/gpu/drm/Kconfig            |   8 +-
 drivers/gpu/drm/vkms/Makefile      |   2 +-
 drivers/gpu/drm/vkms/vkms_crtc.c   |  47 ++++++++++++
 drivers/gpu/drm/vkms/vkms_drv.c    |  55 +++++---------
 drivers/gpu/drm/vkms/vkms_drv.h    |  33 +++++++-
 drivers/gpu/drm/vkms/vkms_output.c | 118 +++++++++++++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_plane.c  |  64 ++++++++++++++++
 7 files changed, 287 insertions(+), 40 deletions(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_crtc.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_output.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_plane.c
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH v4 1/3 drm/vkms: Add mode_config initialization

Set a frame buffer default size for width and height (minimum and maximum).

---
 drivers/gpu/drm/vkms/vkms_drv.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/gpu/drm/vkms/vkms_drv.c +17 -0
index 35517b09538e..aec3f180f96d 100644
@@ -9,6 +9,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_gem.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_atomic_helper.h>
 #include "vkms_drv.h"
 
 #define DRIVER_NAME	"vkms"
@@ -17,6 +18,12 @@
 #define DRIVER_MAJOR	1
 #define DRIVER_MINOR	0
 
+#define XRES_MIN    32
+#define YRES_MIN    32
+
+#define XRES_MAX  8192
+#define YRES_MAX  8192
+
 static struct vkms_device *vkms_device;
 
 static const struct file_operations vkms_driver_fops = {
@@ -67,6 +74,11 @@ static const struct drm_connector_funcs vkms_connector_funcs = {
 	.destroy = vkms_connector_destroy,
 };
 
+static const struct drm_mode_config_funcs vkms_mode_funcs = {
+	.atomic_check = drm_atomic_helper_check,
+	.atomic_commit = drm_atomic_helper_commit,
+};
+
 static int __init vkms_init(void)
 {
 	int ret;
@@ -87,6 +99,11 @@ static int __init vkms_init(void)
 	}
 
 	drm_mode_config_init(&vkms_device->drm);
+	vkms_device->drm.mode_config.funcs = &vkms_mode_funcs;
+	vkms_device->drm.mode_config.min_width = XRES_MIN;
+	vkms_device->drm.mode_config.min_height = YRES_MIN;
+	vkms_device->drm.mode_config.max_width = XRES_MAX;
+	vkms_device->drm.mode_config.max_height = YRES_MAX;
 
 	ret = drm_connector_init(&vkms_device->drm, &vkms_device->connector,
 				 &vkms_connector_funcs,
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH v4 2/3 drm/vkms: Add basic CRTC initialization

In reply to Rodrigo Siqueira

This commit appends the essential CRTCs infrastructure for VKMS. CRTCs demands other elements to work correctly, in this sense, this patch adds a new data struct that centralizes the data structures related to the output, simple planes management, and single encoder attached to the connector.

---
 drivers/gpu/drm/vkms/Makefile      |   2 +-
 drivers/gpu/drm/vkms/vkms_crtc.c   |  47 ++++++++++++
 drivers/gpu/drm/vkms/vkms_drv.c    |  66 +++++-----------
 drivers/gpu/drm/vkms/vkms_drv.h    |  33 +++++++-
 drivers/gpu/drm/vkms/vkms_output.c | 118 +++++++++++++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_plane.c  |  64 ++++++++++++++++
 6 files changed, 277 insertions(+), 53 deletions(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_crtc.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_output.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_plane.c
drivers/gpu/drm/vkms/Makefile +1 -1
index 2aef948d3a34..3f774a6a9c58 100644
@@ -1,3 +1,3 @@
-vkms-y := vkms_drv.o
+vkms-y := vkms_drv.o vkms_plane.o vkms_output.o vkms_crtc.o
 
 obj-$(CONFIG_DRM_VKMS) += vkms.o
drivers/gpu/drm/vkms/vkms_crtc.c new file +47 -0

47 lines not on this page · raw message

drivers/gpu/drm/vkms/vkms_drv.c +17 -49

109 lines not on this page · raw message

drivers/gpu/drm/vkms/vkms_drv.h +30 -3
index c77c5bf5032a..a9f8b6695683 100644
@@ -1,13 +1,40 @@
 #ifndef _VKMS_DRV_H_
 #define _VKMS_DRV_H_
 
-#include <drm/drm_simple_kms_helper.h>
+#include <drm/drmP.h>
+#include <drm/drm.h>
+#include <drm/drm_encoder.h>
+
+#define XRES_MIN    32
+#define YRES_MIN    32
+
+#define XRES_DEF  1024
+#define YRES_DEF   768
+
+#define XRES_MAX  8192
+#define YRES_MAX  8192
+
+static const u32 vkms_formats[] = {
+	DRM_FORMAT_XRGB8888,
+};
+
+struct vkms_output {
+	struct drm_crtc crtc;
+	struct drm_encoder encoder;
+	struct drm_connector connector;
+};
 
 struct vkms_device {
 	struct drm_device drm;
 	struct platform_device *platform;
-	struct drm_simple_display_pipe pipe;
-	struct drm_connector connector;
+	struct vkms_output output;
 };
 
+int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
+		   struct drm_plane *primary, struct drm_plane *cursor);
+
+int vkms_output_init(struct vkms_device *vkmsdev);
+
+struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev);
+
 #endif /* _VKMS_DRV_H_ */
drivers/gpu/drm/vkms/vkms_output.c new file +118 -0

118 lines not on this page · raw message

drivers/gpu/drm/vkms/vkms_plane.c new file +64 -0

64 lines not on this page · raw message

Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH v4 3/3 drm/vkms: Add extra information about vkms

In reply to Rodrigo Siqueira

Add authors and description in Kconfig.

---
 drivers/gpu/drm/Kconfig         | 8 ++++++--
 drivers/gpu/drm/vkms/vkms_drv.c | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/Kconfig +6 -2
index 0893b1d8ede7..a16efdea00fa 100644
@@ -213,10 +213,14 @@ config DRM_VGEM
 	  If M is selected the module will be called vgem.
 
 config DRM_VKMS
-	tristate "Virtual KMS"
+	tristate "Virtual KMS (EXPERIMENTAL)"
 	depends on DRM
+	default n
 	help
-	  Choose this option to get a virtual kernal mode-setting driver.
+	  Virtual Kernel Mode-Setting (VKMS) is used for testing or for
+	  running GPU in a headless machines. Choose this option to get
+	  a VKMS.
+
 	  If M is selected the module will be called vkms.
 
 source "drivers/gpu/drm/exynos/Kconfig"
drivers/gpu/drm/vkms/vkms_drv.c +2 -0
index eae5f1f293d0..e8730fd72cdf 100644
@@ -127,5 +127,7 @@ static void __exit vkms_exit(void)
 module_init(vkms_init);
 module_exit(vkms_exit);
 
+MODULE_AUTHOR("Haneen Mohammed <[email protected]>");
+MODULE_AUTHOR("Rodrigo Siqueira <[email protected]>");
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
reviewer Reviewed-by on the v4 series
#4 lore raw
In reply to Rodrigo Siqueira
Quoted 25 lines · Rodrigo Siqueira

This series of patches add a centralized initialization mechanism, a single CRTC with a plane, an encoder, and extra module information.

Changes in v2:
- Remove unused definitions
- Improve file names
- Improve code separation
- Remove unnecessary formats

Changes in v3:
- Adds drm_crtc_helper_funcs with a simple atomic_check
- Adds extra hooks for drm_connector_funcs hooks (reset, atomic_duplicate_state, atomic_destroy_state)
- Adds drm_connector_helper_funcs
- Adds drm_plane_helper_funcs
- Changes in the commit messages

Changes in v4:
- Associate plane helper with plane

Rodrigo Siqueira (3):
drm/vkms: Add mode_config initialization
drm/vkms: Add basic CRTC initialization
drm/vkms: Add extra information about vkms

Quoted 15 lines
 drivers/gpu/drm/Kconfig            |   8 +-
 drivers/gpu/drm/vkms/Makefile      |   2 +-
 drivers/gpu/drm/vkms/vkms_crtc.c   |  47 ++++++++++++
 drivers/gpu/drm/vkms/vkms_drv.c    |  55 +++++---------
 drivers/gpu/drm/vkms/vkms_drv.h    |  33 +++++++-
 drivers/gpu/drm/vkms/vkms_output.c | 118 +++++++++++++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_plane.c  |  64 ++++++++++++++++
 7 files changed, 287 insertions(+), 40 deletions(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_crtc.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_output.c
 create mode 100644 drivers/gpu/drm/vkms/vkms_plane.c
Signature · 1 line
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel