Adds support for ConfigFS to VKMS!

From: Brandon Pollack
Date: Fri Aug 18 2023 - 03:36:02 EST


Since Jim is busy with other work and I'm working on some things that
rely on this, I've taken up the task of doing the iterations. I've
addressed the comments as best I can (those replies are to each
individual change) and here is the patch set to go with those.

I added my own signoff to each commit, but I've left jshargo@ as the
author of all the commits he wrote. I'm sure there is still more to
address and the ICT tests that were writtein parallel to this may also
need some additions, but I'm hoping we're in a good enough state to get
this in and iterate from there soon.

Since V3:
I've added hotplug support in the latest patch. This has been reviewed some
and the notes from that review are addressed here as well.

Original Message:

Usage
=====

After installing these patches, you can create a VKMS device with two
displays and a movable overlay like so (this is documented in the
patches):

$ modprobe vkms enable_overlay=1 enable_cursor=1 enable_writeback=1
$ mkdir -p /config/
$ mount -t configfs none /config

$ export DRM_PLANE_TYPE_PRIMARY=1
$ export DRM_PLANE_TYPE_CURSOR=2
$ export DRM_PLANE_TYPE_OVERLAY=0

$ mkdir /config/vkms/test

$ mkdir /config/vkms/test/planes/primary
$ echo $DRM_PLANE_TYPE_PRIMARY > /config/vkms/test/planes/primary/type

$ mkdir /config/vkms/test/planes/other_primary
$ echo $DRM_PLANE_TYPE_PRIMARY > /config/vkms/test/planes/other_primary/type

$ mkdir /config/vkms/test/planes/cursor
$ echo $DRM_PLANE_TYPE_CURSOR > /config/vkms/test/planes/cursor/type

$ mkdir /config/vkms/test/planes/overlay
$ echo $DRM_PLANE_TYPE_OVERLAY > /config/vkms/test/planes/overlay/type

$ mkdir /config/vkms/test/crtcs/crtc
$ mkdir /config/vkms/test/crtcs/crtc_other
$ mkdir /config/vkms/test/encoders/encoder
$ mkdir /config/vkms/test/connectors/connector

$ ln -s /config/vkms/test/encoders/encoder /config/vkms/test/connectors/connector/possible_encoders
$ ln -s /config/vkms/test/crtcs/crtc /config/vkms/test/encoders/encoder/possible_crtcs/
$ ln -s /config/vkms/test/crtcs/crtc /config/vkms/test/planes/primary/possible_crtcs/
$ ln -s /config/vkms/test/crtcs/crtc /config/vkms/test/planes/cursor/possible_crtcs/
$ ln -s /config/vkms/test/crtcs/crtc /config/vkms/test/planes/overlay/possible_crtcs/
$ ln -s /config/vkms/test/crtcs/crtc_other /config/vkms/test/planes/overlay/possible_crtcs/
$ ln -s /config/vkms/test/crtcs/crtc_other /config/vkms/test/planes/other_primary/possible_crtcs/

$ echo 1 > /config/vkms/test/enabled

Changes within core VKMS
========================

This introduces a few important changes to the overall structure of
VKMS:

- Devices are now memory managed!
- Support for multiple CRTCs and other objects has been added

Since v1
========

- Added DRMM memory management to automatically clean up resources
- Added a param to disable the default device
- Renamed "cards" to "devices" to improve legibility
- Added a lock for the configfs setup handler
- Moved all the new docs into the relevant .c file
- Addressed as many of sean@xxxxxxxxxx as possible

Testing
=======

- New IGT tests (see
gitlab.freedesktop.org/jshargo/igt-gpu-tools/-/merge_requests/1)
- Existing IGT tests (excluding .*suspend.*, including .*kms_flip.*
.*kms_writeback.* .*kms_cursor_crc.*, .*kms_plane.*)

Outro
=====

I'm excited to share these changes, it's my still my first kernel patch
and I've been putting a lot of love into these.