src/drm-lease-manager.git
2 months agoAdd gitlab issue/merge request templates master 17.90.0 ricefish/17.90.0 ricefish_17.90.0
Jan-Simon Moeller [Tue, 13 Feb 2024 22:06:20 +0000 (23:06 +0100)]
Add gitlab issue/merge request templates

Add template files for gitlab

Bug-AGL: SPEC-4474
Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Change-Id: I52a6f2a559d5e95ea6bbebc660504eeff5e1b3ce

18 months agolease-manager: Check that DRM device is viable for modesetting 33/28033/1
Damian Hobson-Garcia [Wed, 21 Sep 2022 22:35:45 +0000 (18:35 -0400)]
lease-manager: Check that DRM device is viable for modesetting

Don't try to create leases from any DRM device that doesn't have
at least one connector, CRTC, and encoder.  This allows any such
devices to be skipped when looking for a viable device when one
is not provided on the command line.

Bug-AGL: SPEC-4573

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Change-Id: Ia8cf27127e4d61c13c6d8dfc633282776da74060

20 months agotests: Add missing thread library dependency 11/27911/1
Damian Hobson-Garcia [Wed, 17 Aug 2022 16:59:41 +0000 (01:59 +0900)]
tests: Add missing thread library dependency

The lease manager component uses pthread calls, so the library
needs to be linked for the testcases as well as the main excutable.

Bug-AGL: SPEC-3848

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Change-Id: Ie0d36df57b854836bb6b77f8324fdbf3223c2fef

22 months agoAdd systemd notify support 16/27616/2 13.93.0 needlefish/13.93.0 needlefish_13.93.0
Naoto Yamaguchi [Sun, 5 Jun 2022 14:40:12 +0000 (23:40 +0900)]
Add systemd notify support

The drm-lease-manager create unix domain socket file to provide lease to
lease client.  In typical case, this file must be create before client
boot up.  But existing drm-lease-manager couldn't  keep that sequence
because that support startup ordering only using systemd service dependency.

This patch add systemd notify support to realize more strictly ordaining.

Bug-AGL: SPEC-4427

Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Change-Id: Icaad6c9df0696a48b9534c7586be7949a874f9a5

2 years agoAdd plane setting to connector configuration 83/27383/4
Damian Hobson-Garcia [Fri, 8 Apr 2022 01:40:03 +0000 (10:40 +0900)]
Add plane setting to connector configuration

Provide a setting to override the default DRM plane
alloction for each connector in a lease.

DRM planes that are compatible with multiple CRTCs/
connectors can now be assigned to a lease by
explicity setting the connector that they belong to
in the configuration file.

This can also be used to restrict the planes that
are available to a given connector.

Bug-AGL: SPEC-3815

Change-Id: If4168fc3081213c4ed1df09755cadf042c68d9a3
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoAdd 'optional' property to connector configuration 82/27382/3
Damian Hobson-Garcia [Thu, 14 Apr 2022 06:24:11 +0000 (15:24 +0900)]
Add 'optional' property to connector configuration

All connectors will default to mandatory. i.e. if
any specified connector is in the lease configuration
is not available, that lease will not be created.
Setting a connector as 'optional' lets the lease
creation succeed even if the connector is not
physically present on the system.

Failing to create a lease does not affect the creation
of other leases.  The drm-lease-manager daemon will
run as long as one lease is successfully created.

Bug-AGL: SPEC-3815

Change-Id: I5edf8a97a2a3589e8eb5368c0a5b13adb4cb5c9b
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoRefactor connector in lease config 81/27381/3
Damian Hobson-Garcia [Thu, 14 Apr 2022 06:22:07 +0000 (15:22 +0900)]
Refactor connector in lease config

A connector within a lease configuration can have
more attributes than just a name.  Refactor it into
a connector configuation that can store additional
properties.

Bug-AGL: SPEC-3815

Change-Id: Ied4c767bba914eb64b9e82c600e10162d0232c65
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoDefault to first modesettable DRM device 68/27368/5
Damian Hobson-Garcia [Wed, 6 Apr 2022 09:11:38 +0000 (18:11 +0900)]
Default to first modesettable DRM device

When no DRM device is specified on the command line, try all
available DRM devices until an available modesettable device is
found.

Bug-AGL: SPEC-3815

Change-Id: I72343558fcda755a63aee549767ccc8c00c06724
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoUpdate README to describe configuration file format 66/27366/5
Damian Hobson-Garcia [Tue, 5 Apr 2022 07:49:22 +0000 (16:49 +0900)]
Update README to describe configuration file format

Bug-AGL: SPEC-3815

Change-Id: I61d0fdea053ef1bd4f6b78838590636b6ce0ca6c
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoAdd configuration file loading and parsing 65/27365/5
Damian Hobson-Garcia [Tue, 5 Apr 2022 03:11:38 +0000 (12:11 +0900)]
Add configuration file loading and parsing

Parse the lease configuration information from a configuration file.
Each lease configuration takes a name and list of connectors to
add to the lease.  As long as one connector is found for a given
configuration, the lease will be created.

Bug-AGL: SPEC-3815

Change-Id: Iec4eaf37fba5db17a22e4945de10a06ac94063e4
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoReadme: Correct some spelling mistakes 77/27377/2
duerpei [Thu, 14 Apr 2022 02:01:20 +0000 (10:01 +0800)]
Readme: Correct some spelling mistakes

Bug-AGL:SPEC-4325

Signed-off-by: duerpei <duep.fnst@fujitsu.com>
Change-Id: I3a315c9c17a1745554b08f277399564104f37fac

2 years agotest/lease-manager: Add named lease tests 63/27363/2
Damian Hobson-Garcia [Wed, 13 Apr 2022 08:35:42 +0000 (17:35 +0900)]
test/lease-manager: Add named lease tests

Add tests for named connectors in lease configurations.
Also ensure that the naming convention is not broken when
no lease configuration is given.

Bug-AGL: SPEC-3815

Change-Id: I1e4c591183a2f0c155bedc6b71a37b37a2b01451
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoAdd connector name option 62/27362/2
Damian Hobson-Garcia [Tue, 5 Apr 2022 03:11:35 +0000 (12:11 +0900)]
Add connector name option

Refer to connectors by their human-friendly names in lease
configuration.  The default 1 connector / lease configuration
will continue to use lists of connector_ids to avoid
unnecessary string conversions.

Connector names take precendence over connector_ids in the
configuration.  i.e. if connector names are present all
connector_id values are ignored.

Bug-AGL: SPEC-3815

Change-Id: Idb14c1b6ccc68e327d2d154aac48b44d0c6022a8
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoAdd test cases for multi-connector lease 05/27305/2
Damian Hobson-Garcia [Tue, 15 Mar 2022 08:56:07 +0000 (17:56 +0900)]
Add test cases for multi-connector lease

Bug-AGL: SPEC-3815

Change-Id: I44fa7045980cafd6dbe8d119ee6aee83ea8f6a17
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agotest/drm-lease: Create helper functions to reduce boilerplate 26/27326/1
Damian Hobson-Garcia [Tue, 28 Sep 2021 08:07:32 +0000 (17:07 +0900)]
test/drm-lease: Create helper functions to reduce boilerplate

Most of the test cases use very similar setup code to configure
the test DRM device and leases.  Refactor this out into separate
functions to help keep the focus on the relevant parts of each
test.

The helpers set up a basic DRM device with one 1:1 mapping of
encoders, CRTCs, and connectors, with support for planes.

Tests that don't adhere to this pattern are likely testing for a
specific configuration, so should be open coding their setup.

Bug-AGL: SPEC-3815

Change-Id: I0adbed04246ff6af0060692fa4c1e5897b903237
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoMulti connector lease support 70/27270/2
Damian Hobson-Garcia [Tue, 15 Mar 2022 07:46:49 +0000 (16:46 +0900)]
Multi connector lease support

Add support for having multiple connectors / CTRCs in a single lease.
The lease manager receives a list of lease configurations that
specify the name and list of connectors to include in each lease.

All DRM planes that are not shared between muliple CRTS are added
for each connector contained in the lease.

If the lease manager is initialized without a list of lease
configurations it will fall back to the previous 1 connector
per lease configuration.

Bug-AGL: SPEC-3815

Change-Id: I6699e7c8f426bab9fadbc64fe4ed242a834376bf
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agotest/lease-manager: Create dummy fds for fake lease grants 69/27269/2
Damian Hobson-Garcia [Wed, 16 Mar 2022 01:10:39 +0000 (10:10 +0900)]
test/lease-manager: Create dummy fds for fake lease grants

drmModeCreateLease() should return a new lease fd for every succesful call.
Make sure that our dummy implementation does the same.
Returning 0 will cause stdout to be closed at the end of each test,
which will break the test logging when tests are run without forking
(ie. when CK_FORK=no)

Bug-AGL: SPEC-3815

Change-Id: I6b9436a962fb25b88576ae1c950c4f6f698e949a
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agolog: Add line number to debug log output 68/27268/2
Damian Hobson-Garcia [Thu, 16 Sep 2021 09:07:54 +0000 (18:07 +0900)]
log: Add line number to debug log output

Some debug logging, such as memory allocation failure, uses similar
log messageing in several places.  Add the file line number to
the debug log to help differentiate where notable errors occured.

Bug-AGL: SPEC-3815

Change-Id: I2151e21533716ea0badbb6303b713e644b544e6d
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2 years agoAdd .gitreview file 11.0.3 11.0.5 12.90.1 12.91.0 12.92.0 12.93.0 koi/11.0.3 koi/11.0.5 koi_11.0.3 koi_11.0.5 marlin/12.90.1 marlin/12.91.0 marlin/12.92.0 marlin/12.93.0 marlin_12.90.1 marlin_12.91.0 marlin_12.92.0 marlin_12.93.0
Jan-Simon Möller [Tue, 13 Jul 2021 13:44:34 +0000 (15:44 +0200)]
Add .gitreview file

Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
3 years agoDon't close invalid or uninitialied fds 51/26251/2 10.0.3 11.91.0 11.92.0 11.93.0 12.90.0 jellyfish/10.0.3 jellyfish_10.0.3 lamprey/11.91.0 lamprey/11.92.0 lamprey/11.93.0 lamprey_11.91.0 lamprey_11.92.0 lamprey_11.93.0 marlin/12.90.0 marlin_12.90.0
Damian Hobson-Garcia [Mon, 12 Apr 2021 07:43:57 +0000 (16:43 +0900)]
Don't close invalid or uninitialied fds

Avoid calling close() on file descriptors that have not been intialized,
(or initialized to 0) and descriptors that are known to be invalid.

Closing file descriptors due to handle failing initialization is handled
in the intialization code. In the lease-manager, file descriptors can be
invalid during normal operation, so validity is tested at shutdown.

Bug-AGL: SPEC-3862

Change-Id: I798273195cba297c14c6b97d50c7614164fda7df
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
3 years agoAdd option to hold lease on unexpected disconnect 38/26238/1
Damian Hobson-Garcia [Mon, 22 Mar 2021 02:54:16 +0000 (11:54 +0900)]
Add option to hold lease on unexpected disconnect

If a client application crashes while owning a lease,
the lease will automatically be revoked and all references
freed to make it available for another (or the restarted
original) client to claim and continue display.  This will
cause the screen to blank while the lease is unowned.

Add an option to revoke the lease, but keep the reference to
the lease descriptor, so that the screen does not blank while
unowned.

This only has effect when a client exits without calling the
`dlm_release_lease` function. Otherwise the lease is revoked
and the descriptor dereferenced, just as before.

Bug-AGL: SPEC-3862

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Change-Id: I3fc2c8fde4118b6e298ba31807fd5fa4766a97dd

3 years agoMove lease fd send/receive to dlm-protocol 37/26237/1
Damian Hobson-Garcia [Fri, 19 Feb 2021 04:12:16 +0000 (04:12 +0000)]
Move lease fd send/receive to dlm-protocol

Collect all protocol related functionality in the same
place instead of spreading it around across different
modules.

Bug-AGL: SPEC-3862

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Change-Id: I169a200401e4feaa289d53240a7f5467d6a88bd3

3 years agoAdd lease request and release protocol 36/26236/1
Damian Hobson-Garcia [Fri, 19 Feb 2021 03:52:55 +0000 (03:52 +0000)]
Add lease request and release protocol

Explicitly request / release leases instead of implicitly
by opening and closing the connection.  This will allow the
lease manager to take different action when a client
shuts down gracefully vs when it crashes, holding a lease.

Bug-AGL: SPEC-3862

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Change-Id: Ibc68bee855ce18e56eb6f57e5ad1743248320013

3 years agoFree old lease fd reference after transition 12/26212/3
Damian Hobson-Garcia [Fri, 19 Mar 2021 07:04:35 +0000 (16:04 +0900)]
Free old lease fd reference after transition

After a lease is tranisitined to a new client, the reference to
the previous client's lease fd is no longer needed and should
be released.

Close the old fd after the new client has either updated the
display or its lease is revoked.

Bug-AGL: SPEC-3816

Change-Id: I9612913e2960dce94bcfc6a35c0105a5670a453d
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
3 years agoAdd support for lease transition 11/26211/3
Damian Hobson-Garcia [Tue, 9 Mar 2021 05:58:22 +0000 (14:58 +0900)]
Add support for lease transition

When enabled allow the ownership of a lease to transition from
one client to another.

If a request is made for a lease that is already allocated to
a client, revoke the lease from the old client and issue a new
lease for the same resources to the new client.

This allows the ownership of the leased resources to be transferred
without the display being closed and the screen blanking.

During the tranistion, hold a reference to the old clients lease fd so
that the last frame presented by the old client will remain on screen until
the new client presents its first frame.

Currenly there is no notification or authentication mechanism
implemeted for the transition.  Any client can request a transition
from any other. The only notification that a transfer has happened
is that the previous client's DRM API calls will suddenly fail with
-ENOENT, since all resources will have been removed.
It is up to the client to sensibly handle this condition.

Bug-AGL: SPEC-3816

Change-Id: Iaff87e275f909f3b6ef448df39364d6fe62007b1
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
3 years agolease-server: Allow multiple client connections 10/26210/3
Damian Hobson-Garcia [Tue, 9 Mar 2021 03:05:29 +0000 (12:05 +0900)]
lease-server: Allow multiple client connections

Allow multiple clients to issue lease requests
on a server at the same time. This is
necessary to be able to grant or deny leases,
not just on a first-come-first-served basis.

Future patches will add extra contitions,
such as command-line options and lease configuration
settings to determine when and how lease requests should
be granted.

This update changes the behaviour of the lease-server interface
so that it reports every client connection request, instead of
when a server has accepted a request, so update the test suite to
reflect this.

Bug-AGL: SPEC-3816

Change-Id: I48cc392dd62a8c06ea74178bc52c627032817203
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
3 years agolease-server-test: Destroy server on shutdown 09/26209/1
Damian Hobson-Garcia [Tue, 9 Mar 2021 04:25:41 +0000 (13:25 +0900)]
lease-server-test: Destroy server on shutdown

libcheck tests normally run each test in a separate process
so the server objects will automatically be destroyed after
each test.  If the test suite is run with CK_FORK=no, for
example when debugging the test with gdb, failing to
destory the server object will leave the test sockets
from the previous test open, which will stop the next
test from creating its own sockets.

Bug-AGL: SPEC-3816

Change-Id: I42a0976c392bdc19bb60acc78178aac8ee3e14ce
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
3 years agoAdd initial version 81/26081/2
Damian Hobson-Garcia [Tue, 24 Nov 2020 08:16:39 +0000 (17:16 +0900)]
Add initial version

The initial version implements the basic functionality
of the client/server communication and lease management.

For now, one lease is created per valid connector (dependent
on CRTC availablity).

Bug-AGL: SPEC-3729

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Change-Id: I2b37a892742cc22bdc53a5172c8ad3d8a7bb5e66

3 years agoInitial empty repository 10.0.1 10.0.2 10.91.0 10.92.0 10.93.0 10.93.1 11.0.0 11.0.4 jellyfish/10.0.1 jellyfish/10.0.2 jellyfish_10.0.1 jellyfish_10.0.2 koi/10.91.0 koi/10.92.0 koi/10.93.0 koi/10.93.1 koi/11.0.0 koi/11.0.4 koi_10.91.0 koi_10.92.0 koi_10.93.0 koi_10.93.1 koi_11.0.0 koi_11.0.4
Jan-Simon Moeller [Fri, 4 Dec 2020 01:24:58 +0000 (01:24 +0000)]
Initial empty repository