All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>,
	dri-devel@lists.freedesktop.org
Cc: martin.peres@intel.com, ville.syrjala@intel.com,
	chris@chris-wilson.co.uk, stable@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, daniel@ffwll.ch
Subject: Re: [PATCH v3] Return only active connectors for get_resources ioctl
Date: Thu, 29 Nov 2018 14:06:38 -0500	[thread overview]
Message-ID: <d083c18cc920959865b61fd7335d59df108b3125.camel@redhat.com> (raw)
In-Reply-To: <20181129110921.5832-1-stanislav.lisovskiy@intel.com>

On Thu, 2018-11-29 at 13:09 +0200, Stanislav Lisovskiy wrote:
> Currently kernel might allocate different connector ids
> for the same outputs in case of DP MST, which seems to
> confuse userspace. There are can be different connector
> ids in the list, which could be assigned to the same
> output, while being in different states.
> This results in issues, like external displays staying
> blank after quick unplugging and plugging back(bug #106250).
> Returning only active DP connectors fixes the issue.
> 
> v2: Removed caps from the title
> 
> v3: Refactored initial condition to look more compact.
>     Thanks to Chris Wilson for giving a hint.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106250
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/drm_mode_config.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_mode_config.c
> b/drivers/gpu/drm/drm_mode_config.c
> index ee80788f2c40..3e2cd959a66a 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -143,22 +143,28 @@ int drm_mode_getresources(struct drm_device *dev, void
> *data,
>  	drm_connector_list_iter_begin(dev, &conn_iter);
>  	count = 0;
>  	connector_id = u64_to_user_ptr(card_res->connector_id_ptr);
> +	DRM_DEBUG_KMS("GetResources: writing connectors start");
>  	drm_for_each_connector_iter(connector, &conn_iter) {
>  		/* only expose writeback connectors if userspace understands
> them */
>  		if (!file_priv->writeback_connectors &&
>  		    (connector->connector_type ==
> DRM_MODE_CONNECTOR_WRITEBACK))
>  			continue;
>  
> +		if (READ_ONCE(connector->registration_state) !=
> DRM_CONNECTOR_REGISTERED)
> +			continue;
> +
This conditional should just use drm_connector_is_unregistered() instead I'm
fairly sure.

>  		if (drm_lease_held(file_priv, connector->base.id)) {
>  			if (count < card_res->count_connectors &&
>  			    put_user(connector->base.id, connector_id +
> count)) {
>  				drm_connector_list_iter_end(&conn_iter);
>  				return -EFAULT;
>  			}
> +			DRM_DEBUG_KMS("GetResources: connector %s", connector-
> >name);
>  			count++;
>  		}
>  	}
>  	card_res->count_connectors = count;
> +	DRM_DEBUG_KMS("GetResources: writing connectors end - count %d",
> count);
>  	drm_connector_list_iter_end(&conn_iter);
>  
>  	return ret;
-- 
Cheers,
	Lyude Paul

WARNING: multiple messages have this Message-ID (diff)
From: Lyude Paul <lyude@redhat.com>
To: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>,
	dri-devel@lists.freedesktop.org
Cc: ville.syrjala@intel.com, intel-gfx@lists.freedesktop.org,
	martin.peres@intel.com, stable@vger.kernel.org
Subject: Re: [PATCH v3] Return only active connectors for get_resources ioctl
Date: Thu, 29 Nov 2018 14:06:38 -0500	[thread overview]
Message-ID: <d083c18cc920959865b61fd7335d59df108b3125.camel@redhat.com> (raw)
In-Reply-To: <20181129110921.5832-1-stanislav.lisovskiy@intel.com>

On Thu, 2018-11-29 at 13:09 +0200, Stanislav Lisovskiy wrote:
> Currently kernel might allocate different connector ids
> for the same outputs in case of DP MST, which seems to
> confuse userspace. There are can be different connector
> ids in the list, which could be assigned to the same
> output, while being in different states.
> This results in issues, like external displays staying
> blank after quick unplugging and plugging back(bug #106250).
> Returning only active DP connectors fixes the issue.
> 
> v2: Removed caps from the title
> 
> v3: Refactored initial condition to look more compact.
>     Thanks to Chris Wilson for giving a hint.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106250
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/drm_mode_config.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_mode_config.c
> b/drivers/gpu/drm/drm_mode_config.c
> index ee80788f2c40..3e2cd959a66a 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -143,22 +143,28 @@ int drm_mode_getresources(struct drm_device *dev, void
> *data,
>  	drm_connector_list_iter_begin(dev, &conn_iter);
>  	count = 0;
>  	connector_id = u64_to_user_ptr(card_res->connector_id_ptr);
> +	DRM_DEBUG_KMS("GetResources: writing connectors start");
>  	drm_for_each_connector_iter(connector, &conn_iter) {
>  		/* only expose writeback connectors if userspace understands
> them */
>  		if (!file_priv->writeback_connectors &&
>  		    (connector->connector_type ==
> DRM_MODE_CONNECTOR_WRITEBACK))
>  			continue;
>  
> +		if (READ_ONCE(connector->registration_state) !=
> DRM_CONNECTOR_REGISTERED)
> +			continue;
> +
This conditional should just use drm_connector_is_unregistered() instead I'm
fairly sure.

>  		if (drm_lease_held(file_priv, connector->base.id)) {
>  			if (count < card_res->count_connectors &&
>  			    put_user(connector->base.id, connector_id +
> count)) {
>  				drm_connector_list_iter_end(&conn_iter);
>  				return -EFAULT;
>  			}
> +			DRM_DEBUG_KMS("GetResources: connector %s", connector-
> >name);
>  			count++;
>  		}
>  	}
>  	card_res->count_connectors = count;
> +	DRM_DEBUG_KMS("GetResources: writing connectors end - count %d",
> count);
>  	drm_connector_list_iter_end(&conn_iter);
>  
>  	return ret;
-- 
Cheers,
	Lyude Paul

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-11-30  6:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29 11:09 [PATCH v3] Return only active connectors for get_resources ioctl Stanislav Lisovskiy
2018-11-29 11:21 ` Greg KH
2018-11-29 11:30 ` ✓ Fi.CI.BAT: success for Return only active connectors for get_resources ioctl (rev4) Patchwork
2018-11-29 19:06 ` Lyude Paul [this message]
2018-11-29 19:06   ` [PATCH v3] Return only active connectors for get_resources ioctl Lyude Paul
2018-11-29 21:00 ` ✓ Fi.CI.IGT: success for Return only active connectors for get_resources ioctl (rev4) Patchwork
2018-12-04 12:45 ` [PATCH v3] Return only active connectors for get_resources ioctl Jani Nikula
2018-12-04 12:45   ` Jani Nikula

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=d083c18cc920959865b61fd7335d59df108b3125.camel@redhat.com \
    --to=lyude@redhat.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=martin.peres@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=stanislav.lisovskiy@intel.com \
    --cc=ville.syrjala@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.