public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Cc: nicolai.haehnle@amd.com, michel@daenzer.net,
	amd-gfx@lists.freedesktop.org, Christian.Koenig@amd.com,
	manasi.d.navare@intel.com, dri-devel@lists.freedesktop.org,
	Alexander.Deucher@amd.com, Marek.Olsak@amd.com
Subject: Re: [PATCH 1/9] drm: Add variable refresh rate properties to DRM connector
Date: Tue, 11 Sep 2018 19:22:43 +0300	[thread overview]
Message-ID: <20180911162243.GN5565@intel.com> (raw)
In-Reply-To: <20180911161333.5334-2-nicholas.kazlauskas@amd.com>

On Tue, Sep 11, 2018 at 12:13:25PM -0400, Nicholas Kazlauskas wrote:
> Modern monitor hardware is capable of supporting variable refresh rates
> and adaptive sync technologies. The properties for querying and
> controlling these features should be exposed on the DRM connector.
> 
> This patch introduces two new properties for variable refresh rate
> support:
> 
> - variable_refresh_capable
> - variable_refresh_enabled
> 
> These are optional properties that can be added to a DRM connector
> dynamically by using drm_connector_attach_variable_refresh_properties.
> 
> DRM drivers should set variable_refresh_capable as applicable for
> their hardware. The property variable_refresh_enabled as a userspace
> controlled option.
> 
> Change-Id: I5f60f8b57534e1d3dacda4c64c6c9106b42f4439
> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
> ---
>  drivers/gpu/drm/drm_atomic.c    |  9 +++++++++
>  drivers/gpu/drm/drm_connector.c | 35 +++++++++++++++++++++++++++++++++
>  include/drm/drm_connector.h     | 27 +++++++++++++++++++++++++
>  3 files changed, 71 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index d0478abc01bd..2f89ab0fac87 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1403,6 +1403,11 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>  		state->content_type = val;
>  	} else if (property == connector->scaling_mode_property) {
>  		state->scaling_mode = val;
> +	} else if (property == connector->variable_refresh_capable_property) {
> +		DRM_DEBUG_KMS("only drivers can set variable_refresh_capable\n");
> +		return -EINVAL;

Why is that needed? Why not just avoid exposing the vrr_enabled prop
when it's not supported?

> +	} else if (property == connector->variable_refresh_enabled_property) {
> +		state->variable_refresh_enabled = val;

So one thing I already asked long ago is whether there would a point in
exposing some kind of min/max refresh rate range control. Never really
got an answer. Was somehting like that considered and rejected?

>  	} else if (property == connector->content_protection_property) {
>  		if (val == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
>  			DRM_DEBUG_KMS("only drivers can set CP Enabled\n");
> @@ -1508,6 +1513,10 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
>  		*val = state->content_type;
>  	} else if (property == connector->scaling_mode_property) {
>  		*val = state->scaling_mode;
> +	} else if (property == connector->variable_refresh_capable_property) {
> +		*val = state->variable_refresh_capable;
> +	} else if (property == connector->variable_refresh_enabled_property) {
> +		*val = state->variable_refresh_enabled;
>  	} else if (property == connector->content_protection_property) {
>  		*val = state->content_protection;
>  	} else if (property == config->writeback_fb_id_property) {
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 6011d769d50b..37fb33fa77b9 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1250,6 +1250,41 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
>  
> +/**
> + * drm_connector_attach_variable_refresh_properties - creates and attaches
> + * properties for connectors that support adaptive refresh
> + * @connector: connector to create adaptive refresh properties on
> + */
> +int drm_connector_attach_variable_refresh_properties(
> +	struct drm_connector *connector)
> +{
> +	struct drm_device *dev = connector->dev;
> +	struct drm_property *prop;
> +
> +	if (!connector->variable_refresh_capable_property) {
> +		prop = drm_property_create_bool(dev, 0,
> +			"variable_refresh_capable");
> +		if (!prop)
> +			return -ENOMEM;
> +
> +		connector->variable_refresh_capable_property = prop;
> +		drm_object_attach_property(&connector->base, prop, 0);
> +	}
> +
> +	if (!connector->variable_refresh_enabled_property) {
> +		prop = drm_property_create_bool(dev, 0,
> +			"variable_refresh_enabled");
> +		if (!prop)
> +			return -ENOMEM;
> +
> +		connector->variable_refresh_enabled_property = prop;
> +		drm_object_attach_property(&connector->base, prop, 0);
> +	}
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_connector_attach_variable_refresh_properties);
> +
>  /**
>   * drm_connector_attach_scaling_mode_property - attach atomic scaling mode property
>   * @connector: connector to attach scaling mode property on.
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 97ea41dc678f..105a127e9191 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -448,6 +448,18 @@ struct drm_connector_state {
>  	 */
>  	unsigned int content_protection;
>  
> +	/**
> +	 * @variable_refresh_enabled: Connector property used to check
> +	 * if variable refresh is supported on the device.
> +	 */
> +	bool variable_refresh_capable;
> +
> +	/**
> +	 * @variable_refresh_enabled: Connector property used to check
> +	 * if variable refresh is enabled.
> +	 */
> +	bool variable_refresh_enabled;
> +
>  	/**
>  	 * @writeback_job: Writeback job for writeback connectors
>  	 *
> @@ -909,6 +921,19 @@ struct drm_connector {
>  	 */
>  	struct drm_property *scaling_mode_property;
>  
> +	/**
> +	 * @variable_refresh_capable_property: Optional property for
> +	 * querying hardware support for variable refresh.
> +	 */
> +	struct drm_property *variable_refresh_capable_property;
> +
> +	/**
> +	 * @variable_refresh_enabled_property: Optional property for
> +	 * enabling or disabling support for variable refresh
> +	 * on the connector.
> +	 */
> +	struct drm_property *variable_refresh_enabled_property;
> +
>  	/**
>  	 * @content_protection_property: DRM ENUM property for content
>  	 * protection. See drm_connector_attach_content_protection_property().
> @@ -1182,6 +1207,8 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev);
>  int drm_connector_attach_content_type_property(struct drm_connector *dev);
>  int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
>  					       u32 scaling_mode_mask);
> +int drm_connector_attach_variable_refresh_properties(
> +	struct drm_connector *connector);
>  int drm_connector_attach_content_protection_property(
>  		struct drm_connector *connector);
>  int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
> -- 
> 2.17.1

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-09-11 16:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11 16:13 [PATCH 0/9] A DRM API for adaptive sync and variable refresh rate support Nicholas Kazlauskas
2018-09-11 16:13 ` [PATCH 4/9] drm/amd/display: Refactor FreeSync module Nicholas Kazlauskas
2018-09-11 16:13 ` [PATCH 7/9] drm/amd/display: Replace FreeSync props with DRM VRR props Nicholas Kazlauskas
     [not found] ` <20180911161333.5334-1-nicholas.kazlauskas-5C7GfCeVMHo@public.gmane.org>
2018-09-11 16:13   ` [PATCH 1/9] drm: Add variable refresh rate properties to DRM connector Nicholas Kazlauskas
2018-09-11 16:22     ` Ville Syrjälä [this message]
     [not found]       ` <20180911162243.GN5565-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-09-11 16:31         ` Ville Syrjälä
2018-09-11 17:36           ` Kazlauskas, Nicholas
     [not found]             ` <b7b0cff8-3d90-d3e1-0080-e422c1bcac83-5C7GfCeVMHo@public.gmane.org>
2018-09-11 17:56               ` Ville Syrjälä
     [not found]                 ` <20180911175637.GP5565-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-09-11 18:16                   ` Kazlauskas, Nicholas
2018-09-11 18:23                   ` Harry Wentland
2018-09-11 18:09             ` Daniel Vetter
2018-09-11 17:18       ` Manasi Navare
2018-09-11 17:15     ` Manasi Navare
2018-09-11 16:13   ` [PATCH 2/9] drm: Add variable refresh property to DRM CRTC Nicholas Kazlauskas
2018-09-11 16:13   ` [PATCH 3/9] drm/amdgpu: fill in amdgpu_dm_remove_sink_from_freesync_module Nicholas Kazlauskas
2018-09-11 16:13   ` [PATCH 5/9] drm/amdgpu/display: add freesync drm properties Nicholas Kazlauskas
2018-09-11 16:13   ` [PATCH 6/9] drm/amdgpu: add freesync ioctl Nicholas Kazlauskas
2018-09-11 17:51     ` Christian König
2018-09-11 17:57       ` Kazlauskas, Nicholas
2018-09-11 19:17         ` Alex Deucher
     [not found]           ` <CADnq5_PrTj_HaV-gpD5y6B+p7O=R+WxxWA9ytAKBYMQUW-GE7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-12  7:11             ` Christian König
2018-09-11 16:13   ` [PATCH 8/9] drm/amd/display: Drop FreeSync ioctl notification support Nicholas Kazlauskas
2018-09-11 16:13 ` [PATCH 9/9] drm/amdgpu: Drop unneeded freesync properties from amdpgu Nicholas Kazlauskas

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=20180911162243.GN5565@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Marek.Olsak@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=manasi.d.navare@intel.com \
    --cc=michel@daenzer.net \
    --cc=nicholas.kazlauskas@amd.com \
    --cc=nicolai.haehnle@amd.com \
    /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