mbox series

[v2,0/6] Adds support for ConfigFS to VKMS!

Message ID 20230623222353.97283-1-jshargo@chromium.org (mailing list archive)
Headers show
Series Adds support for ConfigFS to VKMS! | expand

Message

Jim Shargo June 23, 2023, 10:23 p.m. UTC
Intro
=====

At long last, we're back!

This patchset adds basic ConfigFS support to VKMS, allowing users to
build new DRM devices with user-defined DRM objects and object
relationships by creating, writing, and symlinking files.

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@poorly.run 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.

Jim Shargo (6):
  drm/vkms: Back VKMS with DRM memory management instead of static
    objects
  drm/vkms: Support multiple DRM objects (crtcs, etc.) per VKMS device
  drm/vkms: Provide platform data when creating VKMS devices
  drm/vkms: Add ConfigFS scaffolding to VKMS
  drm/vkms: Support enabling ConfigFS devices
  drm/vkms: Add a module param to enable/disable the default device

 Documentation/gpu/vkms.rst            |  17 +-
 drivers/gpu/drm/Kconfig               |   1 +
 drivers/gpu/drm/vkms/Makefile         |   1 +
 drivers/gpu/drm/vkms/vkms_composer.c  |  28 +-
 drivers/gpu/drm/vkms/vkms_configfs.c  | 657 ++++++++++++++++++++++++++
 drivers/gpu/drm/vkms/vkms_crtc.c      |  97 ++--
 drivers/gpu/drm/vkms/vkms_drv.c       | 208 +++++---
 drivers/gpu/drm/vkms/vkms_drv.h       | 166 +++++--
 drivers/gpu/drm/vkms/vkms_output.c    | 299 ++++++++++--
 drivers/gpu/drm/vkms/vkms_plane.c     |  44 +-
 drivers/gpu/drm/vkms/vkms_writeback.c |  26 +-
 11 files changed, 1312 insertions(+), 232 deletions(-)
 create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c

Comments

Brandon Ross Pollack Aug. 8, 2023, 2:42 a.m. UTC | #1
Any progress on this?  Is it ok if yixie@chromium.org and I do the
followups on this patch so that we can also submit the Hotplug patch I
wrote (that's now archived?).
Brandon Ross Pollack Aug. 8, 2023, 3:30 a.m. UTC | #2
Some of these comments have been sitting for a while.  Would it be ok if 
yixie@chromium.org and myself picked these up and did an iteration so we 
could also get 
https://patchwork.kernel.org/project/dri-devel/patch/20230711013148.3155572-1-brpol@chromium.org/ 
submitted?  These will enable a lot of virtual multi display testing in 
linux! :)

On 6/24/23 07:23, Jim Shargo wrote:
> Intro
> =====
>
> At long last, we're back!
>
> This patchset adds basic ConfigFS support to VKMS, allowing users to
> build new DRM devices with user-defined DRM objects and object
> relationships by creating, writing, and symlinking files.
>
> Usageubmitted
> =====
>
> 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@poorly.run 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.
>
> Jim Shargo (6):
>    drm/vkms: Back VKMS with DRM memory management instead of static
>      objects
>    drm/vkms: Support multiple DRM objects (crtcs, etc.) per VKMS device
>    drm/vkms: Provide platform data when creating VKMS devices
>    drm/vkms: Add ConfigFS scaffolding to VKMS
>    drm/vkms: Support enabling ConfigFS devices
>    drm/vkms: Add a module param to enable/disable the default device
>
>   Documentation/gpu/vkms.rst            |  17 +-
>   drivers/gpu/drm/Kconfig               |   1 +
>   drivers/gpu/drm/vkms/Makefile         |   1 +
>   drivers/gpu/drm/vkms/vkms_composer.c  |  28 +-
>   drivers/gpu/drm/vkms/vkms_configfs.c  | 657 ++++++++++++++++++++++++++
>   drivers/gpu/drm/vkms/vkms_crtc.c      |  97 ++--
>   drivers/gpu/drm/vkms/vkms_drv.c       | 208 +++++---
>   drivers/gpu/drm/vkms/vkms_drv.h       | 166 +++++--
>   drivers/gpu/drm/vkms/vkms_output.c    | 299 ++++++++++--
>   drivers/gpu/drm/vkms/vkms_plane.c     |  44 +-
>   drivers/gpu/drm/vkms/vkms_writeback.c |  26 +-
>   11 files changed, 1312 insertions(+), 232 deletions(-)
>   create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c
Marius Vlad Aug. 15, 2023, 7:10 a.m. UTC | #3
Hi Brandon,

Is Jim Shargo no longer able to follow-up with these anymore? Can you
reach out to him? Maybe he's on holiday/vacation at this point?

If you decide to follow-up we need a v3 -- and possibly a few more, but
I'd just focus on getting the ConfigFS infrastructure in, addressing
current comments, re-base on top of drm-misc as they do not apply
anymore, and further polishing the patches.

After that gets in, I'd then focus of getting on expanding on it and
getting hot-plug. You'd need also some i-g-t tests for that.

There's also bunch of i-g-t tests sitting in a MR but those need to be 
posted to igt-dev@lists.freedesktop.org rather than on gitlab. We'd need
that in as well.

On Tue, Aug 08, 2023 at 12:30:38PM +0900, Brandon Ross Pollack wrote:
> Some of these comments have been sitting for a while.  Would it be ok if
> yixie@chromium.org and myself picked these up and did an iteration so we
> could also get https://patchwork.kernel.org/project/dri-devel/patch/20230711013148.3155572-1-brpol@chromium.org/
> submitted?  These will enable a lot of virtual multi display testing in
> linux! :)
> 
> On 6/24/23 07:23, Jim Shargo wrote:
> > Intro
> > =====
> > 
> > At long last, we're back!
> > 
> > This patchset adds basic ConfigFS support to VKMS, allowing users to
> > build new DRM devices with user-defined DRM objects and object
> > relationships by creating, writing, and symlinking files.
> > 
> > Usageubmitted
> > =====
> > 
> > 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@poorly.run 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.
> > 
> > Jim Shargo (6):
> >    drm/vkms: Back VKMS with DRM memory management instead of static
> >      objects
> >    drm/vkms: Support multiple DRM objects (crtcs, etc.) per VKMS device
> >    drm/vkms: Provide platform data when creating VKMS devices
> >    drm/vkms: Add ConfigFS scaffolding to VKMS
> >    drm/vkms: Support enabling ConfigFS devices
> >    drm/vkms: Add a module param to enable/disable the default device
> > 
> >   Documentation/gpu/vkms.rst            |  17 +-
> >   drivers/gpu/drm/Kconfig               |   1 +
> >   drivers/gpu/drm/vkms/Makefile         |   1 +
> >   drivers/gpu/drm/vkms/vkms_composer.c  |  28 +-
> >   drivers/gpu/drm/vkms/vkms_configfs.c  | 657 ++++++++++++++++++++++++++
> >   drivers/gpu/drm/vkms/vkms_crtc.c      |  97 ++--
> >   drivers/gpu/drm/vkms/vkms_drv.c       | 208 +++++---
> >   drivers/gpu/drm/vkms/vkms_drv.h       | 166 +++++--
> >   drivers/gpu/drm/vkms/vkms_output.c    | 299 ++++++++++--
> >   drivers/gpu/drm/vkms/vkms_plane.c     |  44 +-
> >   drivers/gpu/drm/vkms/vkms_writeback.c |  26 +-
> >   11 files changed, 1312 insertions(+), 232 deletions(-)
> >   create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c