From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties
Date: Tue, 25 Apr 2017 19:03:15 +0300 [thread overview]
Message-ID: <20170425160315.GP30290@intel.com> (raw)
In-Reply-To: <1493121335-18603-3-git-send-email-maarten.lankhorst@linux.intel.com>
On Tue, Apr 25, 2017 at 01:55:26PM +0200, Maarten Lankhorst wrote:
> Some connectors may not allow all scaling mode properties, this function will allow
> creating the scaling mode property with only the supported subset.
>
> This will make it possible to convert i915 connectors to atomic.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: dri-devel@lists.freedesktop.org
> ---
> drivers/gpu/drm/drm_atomic.c | 3 ++-
> drivers/gpu/drm/drm_connector.c | 45 +++++++++++++++++++++++++++++++++++++++++
> include/drm/drm_connector.h | 5 +++++
> 3 files changed, 52 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 25ea6f797a54..21db00d9a933 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1125,7 +1125,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
> state->link_status = val;
> } else if (property == config->aspect_ratio_property) {
> state->picture_aspect_ratio = val;
> - } else if (property == config->scaling_mode_property) {
> + } else if (property == config->scaling_mode_property ||
I would suggest ripping out the global property entirely, like I did for
the plane rotation property.
> + property == connector->scaling_mode_property) {
> state->scaling_mode = val;
> } else if (connector->funcs->atomic_set_property) {
> return connector->funcs->atomic_set_property(connector,
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 9f847615ac74..49baa21b4ce7 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -954,6 +954,7 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
> drm_scaling_mode_enum_list,
> ARRAY_SIZE(drm_scaling_mode_enum_list));
>
> +
> dev->mode_config.scaling_mode_property = scaling_mode;
>
> return 0;
> @@ -961,6 +962,50 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
> EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
>
> /**
> + * drm_mode_connector_attach_custom_scaling_mode_property - TODO
> + */
> +int drm_mode_connector_attach_custom_scaling_mode_property(struct drm_connector *connector,
> + u32 scaling_mode_mask,
> + u32 default_scaler)
> +{
> + struct drm_device *dev = connector->dev;
> + struct drm_property *scaling_mode_property;
> + int i;
> +
> + if (!scaling_mode_mask)
> + scaling_mode_mask = ~0U;
> +
> + scaling_mode_mask &= (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;
> +
> + scaling_mode_property =
> + drm_property_create(dev, 0, "scaling mode",
> + hweight32(scaling_mode_mask));
> +
> + for (i = 0; i < ARRAY_SIZE(drm_scaling_mode_enum_list); i++)
> + if (BIT(i) & scaling_mode_mask) {
> + int ret;
> +
> + ret = drm_property_add_enum(scaling_mode_property, i,
> + drm_scaling_mode_enum_list[i].type,
> + drm_scaling_mode_enum_list[i].name);
> +
> + if (ret) {
> + drm_property_destroy(dev, scaling_mode_property);
> +
> + return ret;
> + }
> + }
> +
> + drm_object_attach_property(&connector->base,
> + scaling_mode_property, default_scaler);
> +
> + connector->scaling_mode_property = scaling_mode_property;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_connector_attach_custom_scaling_mode_property);
> +
> +/**
> * drm_mode_create_aspect_ratio_property - create aspect ratio property
> * @dev: DRM device
> *
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 934143720e5a..f55ae02135c2 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -770,6 +770,8 @@ struct drm_connector {
> struct drm_property_blob *edid_blob_ptr;
> struct drm_object_properties properties;
>
> + struct drm_property *scaling_mode_property;
> +
> /**
> * @path_blob_ptr:
> *
> @@ -969,6 +971,9 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
> unsigned int num_modes,
> const char * const modes[]);
> int drm_mode_create_scaling_mode_property(struct drm_device *dev);
> +int drm_mode_connector_attach_custom_scaling_mode_property(struct drm_connector *connector,
> + u32 scaling_mode_mask,
> + u32 default_value);
> int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
> int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
>
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-04-25 16:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 11:55 [PATCH v5 00/11] drm/i915: Convert connector properties to atomic Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 01/11] drm/atomic: Handle aspect ratio and scaling mode in core, v3 Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties Maarten Lankhorst
2017-04-25 15:14 ` Sean Paul
2017-04-25 16:03 ` Ville Syrjälä [this message]
2017-04-25 11:55 ` [PATCH v5 03/11] drm/i915: Use per-connector scaling mode property Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 04/11] drm/i915: Add plumbing for digital connector state, v3 Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 05/11] drm/i915: Convert DSI connector properties to atomic Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 06/11] drm/i915: Convert LVDS " Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 07/11] drm/i915: Make intel_dp->has_audio reflect hw state only Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 08/11] drm/i915: Convert intel_dp properties to atomic, v2 Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 09/11] drm/i915: Convert intel_hdmi connector properties to atomic Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 10/11] drm/i915: Handle force_audio correctly in intel_sdvo Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 11/11] drm/i915: Convert intel_sdvo connector properties to atomic Maarten Lankhorst
2017-04-25 12:15 ` ✗ Fi.CI.BAT: warning for drm/i915: Convert connector properties to atomic. (rev6) Patchwork
2017-04-26 6:23 ` Patchwork
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=20170425160315.GP30290@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.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