From: Sam Ravnborg <sam@ravnborg.org>
To: "Noralf Trønnes" <noralf@tronnes.org>
Cc: dri-devel@lists.freedesktop.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 05/10] drm/client: Add drm_client_modeset_check()
Date: Sun, 3 May 2020 10:03:30 +0200 [thread overview]
Message-ID: <20200503080330.GC11582@ravnborg.org> (raw)
In-Reply-To: <20200429124830.27475-6-noralf@tronnes.org>
Hi Noralf.
On Wed, Apr 29, 2020 at 02:48:25PM +0200, Noralf Trønnes wrote:
> Add a way for client to check the configuration before comitting.
>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Two small ntis. With these addressed:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
> drivers/gpu/drm/drm_client_modeset.c | 35 ++++++++++++++++++++++++----
> include/drm/drm_client.h | 1 +
> 2 files changed, 32 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
> index 7443114bd713..177158ff2a40 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -966,7 +966,7 @@ bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation)
> }
> EXPORT_SYMBOL(drm_client_rotation);
>
> -static int drm_client_modeset_commit_atomic(struct drm_client_dev *client, bool active)
> +static int drm_client_modeset_commit_atomic(struct drm_client_dev *client, bool active, bool check)
> {
> struct drm_device *dev = client->dev;
> struct drm_plane *plane;
> @@ -1033,7 +1033,10 @@ static int drm_client_modeset_commit_atomic(struct drm_client_dev *client, bool
> }
> }
>
> - ret = drm_atomic_commit(state);
> + if (check)
> + ret = drm_atomic_check_only(state);
> + else
> + ret = drm_atomic_commit(state);
>
> out_state:
> if (ret == -EDEADLK)
> @@ -1094,6 +1097,30 @@ static int drm_client_modeset_commit_legacy(struct drm_client_dev *client)
> return ret;
> }
>
> +/**
> + * drm_client_modeset_check() - Check CRTC configuration
This part of the comment does not match the description below.
> + * @client: DRM client
> + *
> + * Check modeset configuration.
> + *
> + * Returns:
> + * Zero on success or negative error code on failure.
> + */
> +int drm_client_modeset_check(struct drm_client_dev *client)
> +{
> + int ret;
> +
> + if (!drm_drv_uses_atomic_modeset(client->dev))
> + return 0;
If client does not use atomic the check should fail - no?
> +
> + mutex_lock(&client->modeset_mutex);
> + ret = drm_client_modeset_commit_atomic(client, true, true);
> + mutex_unlock(&client->modeset_mutex);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(drm_client_modeset_check);
> +
> /**
> * drm_client_modeset_commit_locked() - Force commit CRTC configuration
> * @client: DRM client
> @@ -1112,7 +1139,7 @@ int drm_client_modeset_commit_locked(struct drm_client_dev *client)
>
> mutex_lock(&client->modeset_mutex);
> if (drm_drv_uses_atomic_modeset(dev))
> - ret = drm_client_modeset_commit_atomic(client, true);
> + ret = drm_client_modeset_commit_atomic(client, true, false);
> else
> ret = drm_client_modeset_commit_legacy(client);
> mutex_unlock(&client->modeset_mutex);
> @@ -1188,7 +1215,7 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode)
>
> mutex_lock(&client->modeset_mutex);
> if (drm_drv_uses_atomic_modeset(dev))
> - ret = drm_client_modeset_commit_atomic(client, mode == DRM_MODE_DPMS_ON);
> + ret = drm_client_modeset_commit_atomic(client, mode == DRM_MODE_DPMS_ON, false);
> else
> drm_client_modeset_dpms_legacy(client, mode);
> mutex_unlock(&client->modeset_mutex);
> diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
> index 6ef5364d6dfb..b6ffa4863e45 100644
> --- a/include/drm/drm_client.h
> +++ b/include/drm/drm_client.h
> @@ -164,6 +164,7 @@ int drm_client_modeset_create(struct drm_client_dev *client);
> void drm_client_modeset_free(struct drm_client_dev *client);
> int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int height);
> bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation);
> +int drm_client_modeset_check(struct drm_client_dev *client);
> int drm_client_modeset_commit_locked(struct drm_client_dev *client);
> int drm_client_modeset_commit(struct drm_client_dev *client);
> int drm_client_modeset_dpms(struct drm_client_dev *client, int mode);
> --
> 2.23.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-05-03 8:03 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 12:48 [PATCH 00/10] Generic USB Display driver Noralf Trønnes
2020-04-29 12:48 ` [PATCH 01/10] backlight: Add backlight_device_get_by_name() Noralf Trønnes
2020-04-30 8:32 ` Lee Jones
2020-04-30 9:20 ` Noralf Trønnes
2020-04-30 10:15 ` Lee Jones
2020-04-30 10:42 ` Noralf Trønnes
2020-04-30 14:02 ` Daniel Vetter
2020-05-04 7:10 ` Lee Jones
2020-05-03 7:13 ` Sam Ravnborg
2020-04-29 12:48 ` [PATCH 02/10] drm: Add backlight helper Noralf Trønnes
2020-04-29 14:13 ` Hans de Goede
2020-04-29 18:40 ` Noralf Trønnes
2020-04-30 15:36 ` Hans de Goede
2020-05-04 12:06 ` Daniel Vetter
2020-05-04 15:54 ` Noralf Trønnes
2020-04-29 12:48 ` [PATCH 03/10] drm/client: Add drm_client_init_from_id() Noralf Trønnes
2020-04-29 12:48 ` [PATCH 04/10] drm/client: Add drm_client_framebuffer_flush() Noralf Trønnes
2020-05-03 7:48 ` Sam Ravnborg
2020-05-03 9:54 ` Noralf Trønnes
2020-04-29 12:48 ` [PATCH 05/10] drm/client: Add drm_client_modeset_check() Noralf Trønnes
2020-05-03 8:03 ` Sam Ravnborg [this message]
2020-05-03 10:02 ` Noralf Trønnes
2020-04-29 12:48 ` [PATCH 06/10] drm/client: Add a way to set modeset, properties and rotation Noralf Trønnes
2020-05-03 8:47 ` Sam Ravnborg
2020-05-03 10:50 ` Noralf Trønnes
2020-04-29 12:48 ` [PATCH 07/10] drm/format-helper: Add drm_fb_swab() Noralf Trønnes
2020-05-03 10:29 ` Sam Ravnborg
2020-05-03 13:38 ` Noralf Trønnes
2020-04-29 12:48 ` [PATCH 08/10] drm: Add Generic USB Display driver Noralf Trønnes
2020-05-02 17:58 ` Noralf Trønnes
2020-04-29 12:48 ` [PATCH 09/10] drm/gud: Add functionality for the USB gadget side Noralf Trønnes
2020-04-29 12:48 ` [PATCH 10/10] usb: gadget: function: Add Generic USB Display support Noralf Trønnes
2020-05-01 13:22 ` [PATCH 00/10] Generic USB Display driver Noralf Trønnes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200503080330.GC11582@ravnborg.org \
--to=sam@ravnborg.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-usb@vger.kernel.org \
--cc=noralf@tronnes.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).