diff mbox

drm/dp/mst: change MST detection scheme (v2) - reminder

Message ID BLUPR12MB0401CFFE16A8114A7AE890D7EA510@BLUPR12MB0401.namprd12.prod.outlook.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrey Grodzovsky June 11, 2016, 1:50 p.m. UTC
Hi.

Just a reminder with regard to this patch. Please comment if any changes are required.
Thanks.

-----Original Message-----
From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of dri-devel-request@lists.freedesktop.org
Sent: Wednesday, May 18, 2016 7:10 PM
To: dri-devel@lists.freedesktop.org
Subject: dri-devel Digest, Vol 74, Issue 285

Send dri-devel mailing list submissions to
	dri-devel@lists.freedesktop.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.freedesktop.org/mailman/listinfo/dri-devel
or, via email, send a message with subject or body 'help' to
	dri-devel-request@lists.freedesktop.org

You can reach the person managing the list at
	dri-devel-owner@lists.freedesktop.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of dri-devel digest..."


Today's Topics:

   1. Re: [PATCH] drm: Nuke ->vblank_disable_allowed (Alex Deucher)
   2. Re: [PATCH 1/2] dma-buf/fence: add fence_collection fences
      (Chris Wilson)
   3. drm/dp/mst: change MST detection scheme (v2) (Andrey Grodzovsky)


----------------------------------------------------------------------

Message: 1
Date: Wed, 18 May 2016 17:54:50 -0400
From: Alex Deucher <alexdeucher@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>, Liviu
	Dudau <liviu.dudau@arm.com>, DRI Development
	<dri-devel@lists.freedesktop.org>, Tomi Valkeinen
	<tomi.valkeinen@ti.com>, Russell King <rmk+kernel@arm.linux.org.uk>,
	Alex Deucher <alexander.deucher@amd.com>, Daniel Vetter
	<daniel.vetter@intel.com>
Subject: Re: [PATCH] drm: Nuke ->vblank_disable_allowed
Message-ID:
	<CADnq5_OHpNNN7yr6QB6xf_7eObVE7hdLFJY4cjTWpH0uTsC1Bw@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Wed, May 18, 2016 at 4:29 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> This was added in
>
> commit 0a3e67a4caac273a3bfc4ced3da364830b1ab241
> Author: Jesse Barnes <jbarnes@virtuousgeek.org>
> Date:   Tue Sep 30 12:14:26 2008 -0700
>
>     drm: Rework vblank-wait handling to allow interrupt reduction.
>
> to stay backwards-compatible with old UMS code that didn't even tell 
> the kernel when it did a modeset, so that the kernel could 
> save/restore vblank counters. At worst this means vblanks will be 
> somewhat funky on a setup that very likely no one still runs.
>
> So let's just nuke it.
>
> Plan B would be to set it unconditionally in drm_vblank_init for kms 
> drivers, instead of in each driver separately. So if this patch breaks 
> anything please only restore the hunks in drmP.h and drm_irq.c, plus 
> add a check for DRIVER_MODESET in drm_vblank_init.
>
> Stumbled over this in a discussion on irc with Chris.
>
> v2: Remove leftover debug gunk from psr hacking (Alex).
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Seems reasonable to me.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c     | 1 -
>  drivers/gpu/drm/arm/hdlcd_drv.c             | 1 -
>  drivers/gpu/drm/armada/armada_drv.c         | 1 -
>  drivers/gpu/drm/drm_irq.c                   | 6 ------
>  drivers/gpu/drm/exynos/exynos_drm_drv.c     | 7 -------
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c   | 1 -
>  drivers/gpu/drm/gma500/psb_drv.c            | 1 -
>  drivers/gpu/drm/i915/i915_dma.c             | 3 ---
>  drivers/gpu/drm/imx/imx-drm-core.c          | 7 -------
>  drivers/gpu/drm/radeon/radeon_irq_kms.c     | 1 -
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 7 -------
>  drivers/gpu/drm/tegra/drm.c                 | 1 -
>  drivers/gpu/drm/vc4/vc4_kms.c               | 2 --
>  include/drm/drmP.h                          | 8 --------
>  14 files changed, 47 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index 9266c7b69808..835a3fa8d8df 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -219,7 +219,6 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>         if (r) {
>                 return r;
>         }
> -       adev->ddev->vblank_disable_allowed = true;
>
>         /* enable msi */
>         adev->irq.msi_enabled = false; diff --git 
> a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c 
> index 2112f0b105e3..4f909378d581 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -379,7 +379,6 @@ static int hdlcd_drm_bind(struct device *dev)
>                 DRM_ERROR("failed to initialise vblank\n");
>                 goto err_vblank;
>         }
> -       drm->vblank_disable_allowed = true;
>
>         drm_mode_config_reset(drm);
>         drm_kms_helper_poll_init(drm); diff --git 
> a/drivers/gpu/drm/armada/armada_drv.c 
> b/drivers/gpu/drm/armada/armada_drv.c
> index 531fcb946346..cb21c0b6374a 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -113,7 +113,6 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
>                 goto err_comp;
>
>         dev->irq_enabled = true;
> -       dev->vblank_disable_allowed = 1;
>
>         ret = armada_fbdev_init(dev);
>         if (ret)
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c 
> index d1b5fc20b2f8..1a0ae89087e8 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -348,9 +348,6 @@ static void vblank_disable_fn(unsigned long arg)
>         unsigned int pipe = vblank->pipe;
>         unsigned long irqflags;
>
> -       if (!dev->vblank_disable_allowed)
> -               return;
> -
>         spin_lock_irqsave(&dev->vbl_lock, irqflags);
>         if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) {
>                 DRM_DEBUG("disabling vblank on crtc %u\n", pipe); @@ 
> -437,8 +434,6 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs)
>                          "get_vblank_timestamp == NULL\n");
>         }
>
> -       dev->vblank_disable_allowed = false;
> -
>         return 0;
>
>  err:
> @@ -1555,7 +1550,6 @@ static void 
> drm_legacy_vblank_post_modeset(struct drm_device *dev,
>
>         if (vblank->inmodeset) {
>                 spin_lock_irqsave(&dev->vbl_lock, irqflags);
> -               dev->vblank_disable_allowed = true;
>                 drm_reset_vblank_timestamp(dev, pipe);
>                 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 21c719e8e02b..2dd820e23b0c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -212,13 +212,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
>          */
>         dev->irq_enabled = true;
>
> -       /*
> -        * with vblank_disable_allowed = true, vblank interrupt will be disabled
> -        * by drm timer once a current process gives up ownership of
> -        * vblank event.(after drm_vblank_put function is called)
> -        */
> -       dev->vblank_disable_allowed = true;
> -
>         /* init kms poll for handling hpd */
>         drm_kms_helper_poll_init(dev);
>
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c 
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index 2e58dfd74ae1..33727d5d826a 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -80,7 +80,6 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
>                 dev_err(dev->dev, "failed to initialize vblank\n");
>                 goto done;
>         }
> -       dev->vblank_disable_allowed = true;
>
>         ret = fsl_dcu_drm_irq_init(dev);
>         if (ret < 0)
> diff --git a/drivers/gpu/drm/gma500/psb_drv.c 
> b/drivers/gpu/drm/gma500/psb_drv.c
> index 4e1c6850520e..82b8ce418b27 100644
> --- a/drivers/gpu/drm/gma500/psb_drv.c
> +++ b/drivers/gpu/drm/gma500/psb_drv.c
> @@ -374,7 +374,6 @@ static int psb_driver_load(struct drm_device *dev, 
> unsigned long flags)
>
>         drm_irq_install(dev, dev->pdev->irq);
>
> -       dev->vblank_disable_allowed = true;
>         dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
>         dev->driver->get_vblank_counter = psb_get_vblank_counter;
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c 
> b/drivers/gpu/drm/i915/i915_dma.c index a8c79f6512a4..fd06bff216ff 
> 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -515,9 +515,6 @@ static int i915_load_modeset_init(struct 
> drm_device *dev)
>
>         intel_modeset_gem_init(dev);
>
> -       /* Always safe in the mode setting case. */
> -       /* FIXME: do pre/post-mode set stuff in core KMS code */
> -       dev->vblank_disable_allowed = true;
>         if (INTEL_INFO(dev)->num_pipes == 0)
>                 return 0;
>
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
> b/drivers/gpu/drm/imx/imx-drm-core.c
> index 2453fb1c68a7..1080019e7b17 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -252,13 +252,6 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
>         if (ret)
>                 goto err_kms;
>
> -       /*
> -        * with vblank_disable_allowed = true, vblank interrupt will be
> -        * disabled by drm timer once a current process gives up ownership
> -        * of vblank event. (after drm_vblank_put function is called)
> -        */
> -       drm->vblank_disable_allowed = true;
> -
>         platform_set_drvdata(drm->platformdev, drm);
>
>         /* Now try and bind all our sub-components */ diff --git 
> a/drivers/gpu/drm/radeon/radeon_irq_kms.c 
> b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> index 1e9304d1c88f..c084cadcbf21 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> @@ -291,7 +291,6 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
>         if (r) {
>                 return r;
>         }
> -       rdev->ddev->vblank_disable_allowed = true;
>
>         /* enable msi */
>         rdev->msi_enabled = 0;
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index ced1e5f93cda..09a4d429c0f0 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -217,13 +217,6 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
>         if (ret)
>                 goto err_kms_helper_poll_fini;
>
> -       /*
> -        * with vblank_disable_allowed = true, vblank interrupt will be disabled
> -        * by drm timer once a current process gives up ownership of
> -        * vblank event.(after drm_vblank_put function is called)
> -        */
> -       drm_dev->vblank_disable_allowed = true;
> -
>         drm_mode_config_reset(drm_dev);
>
>         ret = rockchip_drm_fbdev_init(drm_dev); diff --git 
> a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 
> 679905544181..b59c3bf0df44 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -180,7 +180,6 @@ static int tegra_drm_load(struct drm_device *drm, 
> unsigned long flags)
>
>         /* syncpoints are used for full 32-bit hardware VBLANK counters */
>         drm->max_vblank_count = 0xffffffff;
> -       drm->vblank_disable_allowed = true;
>
>         err = drm_vblank_init(drm, drm->mode_config.num_crtc);
>         if (err < 0)
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c 
> b/drivers/gpu/drm/vc4/vc4_kms.c index d423ba10239a..cb37751bc99f 
> 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -207,8 +207,6 @@ int vc4_kms_load(struct drm_device *dev)
>         dev->mode_config.preferred_depth = 24;
>         dev->mode_config.async_page_flip = true;
>
> -       dev->vblank_disable_allowed = true;
> -
>         drm_mode_config_reset(dev);
>
>         vc4->fbdev = drm_fbdev_cma_init(dev, 32, diff --git 
> a/include/drm/drmP.h b/include/drm/drmP.h index 
> f0d1450d4ea5..30dc7d8c403f 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -819,14 +819,6 @@ struct drm_device {
>         int irq;
>
>         /*
> -        * At load time, disabling the vblank interrupt won't be allowed since
> -        * old clients may not call the modeset ioctl and therefore misbehave.
> -        * Once the modeset ioctl *has* been called though, we can safely
> -        * disable them when unused.
> -        */
> -       bool vblank_disable_allowed;
> -
> -       /*
>          * If true, vblank interrupt will be disabled immediately when the
>          * refcount drops to zero, as opposed to via the vblank disable
>          * timer.
> --
> 2.8.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


------------------------------

Message: 2
Date: Wed, 18 May 2016 23:57:10 +0100
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Gustavo Padovan <gustavo@padovan.org>
Cc: marcheu@google.com, Daniel Stone <daniels@collabora.com>,
	seanpaul@google.com, Daniel Vetter <daniel.vetter@ffwll.ch>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	laurent.pinchart@ideasonboard.com, Alex Deucher
	<alexander.deucher@amd.com>, Gustavo Padovan
	<gustavo.padovan@collabora.co.uk>, Christian König
	<christian.koenig@amd.com>, John Harrison <John.C.Harrison@Intel.com>,
	m.chehab@samsung.com
Subject: Re: [PATCH 1/2] dma-buf/fence: add fence_collection fences
Message-ID: <20160518225710.GA32627@nuc-i3427.alporthouse.com>
Content-Type: text/plain; charset=us-ascii

On Wed, May 18, 2016 at 05:59:52PM -0300, Gustavo Padovan wrote:
> +static void collection_check_cb_func(struct fence *fence, struct 
> +fence_cb *cb) {
> +	struct fence_collection_cb *f_cb;
> +	struct fence_collection *collection;
> +
> +	f_cb = container_of(cb, struct fence_collection_cb, cb);
> +	collection = f_cb->collection;
> +
> +	if (atomic_dec_and_test(&collection->num_pending_fences))
> +		fence_signal(&collection->base);
> +}
> +
> +static bool fence_collection_enable_signaling(struct fence *fence) {
> +	struct fence_collection *collection = to_fence_collection(fence);
> +	int i;
> +
> +	for (i = 0 ; i < collection->num_fences ; i++) {
> +		if (fence_add_callback(collection->fences[i].fence,
> +				       &collection->fences[i].cb,
> +				       collection_check_cb_func)) {
> +			atomic_dec(&collection->num_pending_fences);
> +		}
> +	}

We don't always have a convenient means to preallocate an array of fences to use. Keeping a list of fences in addition to the array would be easier to user in many circumstances.

Just means we need a

struct fence_collection_entry {
	struct fence *fence;
	struct list_head link;
};

int fence_collection_add(struct fence *_collection,
			 struct fence *fence)
{
	struct fence_collection *collection =
		to_fence_collection(_collection);
	struct fence_collection_entry *entry;

	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
	if (!entry)
		return -ENOMEM;

	entry->fence = fence_get(fence);
	list_add_tail(&entry->link, &collection->fence_list);
	atomic_inc(&collection->num_pending_fences);

	return 0;
}

and a couple of list iterations as well as walking the arrays.

(This fence_collection_add() needs to be documented to only be valid from the constructing thread before the fence is sealed for export/use.) -Chris

--
Chris Wilson, Intel Open Source Technology Centre
HI.


------------------------------

Message: 3
Date: Wed, 18 May 2016 18:37:10 -0400
From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
To: <dri-devel@lists.freedesktop.org>
Cc: Mykola Lysenko <Mykola.Lysenko@amd.com>
Subject: drm/dp/mst: change MST detection scheme (v2)
Message-ID:
	<1463611030-21448-1-git-send-email-Andrey.Grodzovsky@amd.com>
Content-Type: text/plain; charset="UTF-8"

From: Mykola Lysenko <Mykola.Lysenko@amd.com>

    1. Get edid for all connected MST displays, not only on logical ports,
       in the same thread as MST topology detection is done:
         There are displays that have branches inside w/o logical ports.
         So in case another SST display connected downstream system can
         end-up in situation when 3 DOWN requests sent: two for
        ‘remote i2c read’ and one for ‘enum path resources’, making slots full.

    2. Call notification callback in one place in the end of topology discovery/update:
         This is done to reduce number of events sent to userspace in case complex
         topology discovery is going, adding multiple number of connectors;

    3. Remove notification callback call from short pulse interrupt processing function:
         This is done in order not to block interrupt processing function, in case any
         MST request will be made from it. Notification will be send from topology
         discovery/update work item.

    v2: This change also includes tile property set fix which caused regression
        in i915 driver.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 36 +++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

-- 
1.9.1



------------------------------

Subject: Digest Footer

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


------------------------------

End of dri-devel Digest, Vol 74, Issue 285
******************************************

Comments

Daniel Vetter June 13, 2016, 8:10 a.m. UTC | #1
On Sat, Jun 11, 2016 at 01:50:17PM +0000, Grodzovsky, Andrey wrote:
> Hi.
> 
> Just a reminder with regard to this patch. Please comment if any changes are required.
> Thanks.

When resubmitting please gather all the r-b you've collected and resubmitt
he entire patch using git send-email. If you want to drive the point home,
add the above blurb to the commit message after a line with just --- (git
will cut away anything below that) and add a RESEND to the subject using
--subject-prefix="PATCH RESEND".

Or reply to the orginal patch directly. But this here doesn't work for the
usual flow.

Thanks, Daniel

> 
> -----Original Message-----
> From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of dri-devel-request@lists.freedesktop.org
> Sent: Wednesday, May 18, 2016 7:10 PM
> To: dri-devel@lists.freedesktop.org
> Subject: dri-devel Digest, Vol 74, Issue 285
> 
> Send dri-devel mailing list submissions to
> 	dri-devel@lists.freedesktop.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists.freedesktop.org/mailman/listinfo/dri-devel
> or, via email, send a message with subject or body 'help' to
> 	dri-devel-request@lists.freedesktop.org
> 
> You can reach the person managing the list at
> 	dri-devel-owner@lists.freedesktop.org
> 
> When replying, please edit your Subject line so it is more specific than "Re: Contents of dri-devel digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: [PATCH] drm: Nuke ->vblank_disable_allowed (Alex Deucher)
>    2. Re: [PATCH 1/2] dma-buf/fence: add fence_collection fences
>       (Chris Wilson)
>    3. drm/dp/mst: change MST detection scheme (v2) (Andrey Grodzovsky)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Wed, 18 May 2016 17:54:50 -0400
> From: Alex Deucher <alexdeucher@gmail.com>
> To: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
> 	Intel Graphics Development <intel-gfx@lists.freedesktop.org>, Liviu
> 	Dudau <liviu.dudau@arm.com>, DRI Development
> 	<dri-devel@lists.freedesktop.org>, Tomi Valkeinen
> 	<tomi.valkeinen@ti.com>, Russell King <rmk+kernel@arm.linux.org.uk>,
> 	Alex Deucher <alexander.deucher@amd.com>, Daniel Vetter
> 	<daniel.vetter@intel.com>
> Subject: Re: [PATCH] drm: Nuke ->vblank_disable_allowed
> Message-ID:
> 	<CADnq5_OHpNNN7yr6QB6xf_7eObVE7hdLFJY4cjTWpH0uTsC1Bw@mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
> On Wed, May 18, 2016 at 4:29 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > This was added in
> >
> > commit 0a3e67a4caac273a3bfc4ced3da364830b1ab241
> > Author: Jesse Barnes <jbarnes@virtuousgeek.org>
> > Date:   Tue Sep 30 12:14:26 2008 -0700
> >
> >     drm: Rework vblank-wait handling to allow interrupt reduction.
> >
> > to stay backwards-compatible with old UMS code that didn't even tell 
> > the kernel when it did a modeset, so that the kernel could 
> > save/restore vblank counters. At worst this means vblanks will be 
> > somewhat funky on a setup that very likely no one still runs.
> >
> > So let's just nuke it.
> >
> > Plan B would be to set it unconditionally in drm_vblank_init for kms 
> > drivers, instead of in each driver separately. So if this patch breaks 
> > anything please only restore the hunks in drmP.h and drm_irq.c, plus 
> > add a check for DRIVER_MODESET in drm_vblank_init.
> >
> > Stumbled over this in a discussion on irc with Chris.
> >
> > v2: Remove leftover debug gunk from psr hacking (Alex).
> >
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: Liviu Dudau <liviu.dudau@arm.com>
> > Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Eric Anholt <eric@anholt.net>
> > Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > Cc: Inki Dae <inki.dae@samsung.com>
> > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > Cc: Mark Yao <mark.yao@rock-chips.com>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Philipp Zabel <p.zabel@pengutronix.de>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> 
> Seems reasonable to me.
> 
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c     | 1 -
> >  drivers/gpu/drm/arm/hdlcd_drv.c             | 1 -
> >  drivers/gpu/drm/armada/armada_drv.c         | 1 -
> >  drivers/gpu/drm/drm_irq.c                   | 6 ------
> >  drivers/gpu/drm/exynos/exynos_drm_drv.c     | 7 -------
> >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c   | 1 -
> >  drivers/gpu/drm/gma500/psb_drv.c            | 1 -
> >  drivers/gpu/drm/i915/i915_dma.c             | 3 ---
> >  drivers/gpu/drm/imx/imx-drm-core.c          | 7 -------
> >  drivers/gpu/drm/radeon/radeon_irq_kms.c     | 1 -
> >  drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 7 -------
> >  drivers/gpu/drm/tegra/drm.c                 | 1 -
> >  drivers/gpu/drm/vc4/vc4_kms.c               | 2 --
> >  include/drm/drmP.h                          | 8 --------
> >  14 files changed, 47 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > index 9266c7b69808..835a3fa8d8df 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > @@ -219,7 +219,6 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >         if (r) {
> >                 return r;
> >         }
> > -       adev->ddev->vblank_disable_allowed = true;
> >
> >         /* enable msi */
> >         adev->irq.msi_enabled = false; diff --git 
> > a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c 
> > index 2112f0b105e3..4f909378d581 100644
> > --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> > +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> > @@ -379,7 +379,6 @@ static int hdlcd_drm_bind(struct device *dev)
> >                 DRM_ERROR("failed to initialise vblank\n");
> >                 goto err_vblank;
> >         }
> > -       drm->vblank_disable_allowed = true;
> >
> >         drm_mode_config_reset(drm);
> >         drm_kms_helper_poll_init(drm); diff --git 
> > a/drivers/gpu/drm/armada/armada_drv.c 
> > b/drivers/gpu/drm/armada/armada_drv.c
> > index 531fcb946346..cb21c0b6374a 100644
> > --- a/drivers/gpu/drm/armada/armada_drv.c
> > +++ b/drivers/gpu/drm/armada/armada_drv.c
> > @@ -113,7 +113,6 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
> >                 goto err_comp;
> >
> >         dev->irq_enabled = true;
> > -       dev->vblank_disable_allowed = 1;
> >
> >         ret = armada_fbdev_init(dev);
> >         if (ret)
> > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c 
> > index d1b5fc20b2f8..1a0ae89087e8 100644
> > --- a/drivers/gpu/drm/drm_irq.c
> > +++ b/drivers/gpu/drm/drm_irq.c
> > @@ -348,9 +348,6 @@ static void vblank_disable_fn(unsigned long arg)
> >         unsigned int pipe = vblank->pipe;
> >         unsigned long irqflags;
> >
> > -       if (!dev->vblank_disable_allowed)
> > -               return;
> > -
> >         spin_lock_irqsave(&dev->vbl_lock, irqflags);
> >         if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) {
> >                 DRM_DEBUG("disabling vblank on crtc %u\n", pipe); @@ 
> > -437,8 +434,6 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs)
> >                          "get_vblank_timestamp == NULL\n");
> >         }
> >
> > -       dev->vblank_disable_allowed = false;
> > -
> >         return 0;
> >
> >  err:
> > @@ -1555,7 +1550,6 @@ static void 
> > drm_legacy_vblank_post_modeset(struct drm_device *dev,
> >
> >         if (vblank->inmodeset) {
> >                 spin_lock_irqsave(&dev->vbl_lock, irqflags);
> > -               dev->vblank_disable_allowed = true;
> >                 drm_reset_vblank_timestamp(dev, pipe);
> >                 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> > b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > index 21c719e8e02b..2dd820e23b0c 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > @@ -212,13 +212,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
> >          */
> >         dev->irq_enabled = true;
> >
> > -       /*
> > -        * with vblank_disable_allowed = true, vblank interrupt will be disabled
> > -        * by drm timer once a current process gives up ownership of
> > -        * vblank event.(after drm_vblank_put function is called)
> > -        */
> > -       dev->vblank_disable_allowed = true;
> > -
> >         /* init kms poll for handling hpd */
> >         drm_kms_helper_poll_init(dev);
> >
> > diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c 
> > b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > index 2e58dfd74ae1..33727d5d826a 100644
> > --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > @@ -80,7 +80,6 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
> >                 dev_err(dev->dev, "failed to initialize vblank\n");
> >                 goto done;
> >         }
> > -       dev->vblank_disable_allowed = true;
> >
> >         ret = fsl_dcu_drm_irq_init(dev);
> >         if (ret < 0)
> > diff --git a/drivers/gpu/drm/gma500/psb_drv.c 
> > b/drivers/gpu/drm/gma500/psb_drv.c
> > index 4e1c6850520e..82b8ce418b27 100644
> > --- a/drivers/gpu/drm/gma500/psb_drv.c
> > +++ b/drivers/gpu/drm/gma500/psb_drv.c
> > @@ -374,7 +374,6 @@ static int psb_driver_load(struct drm_device *dev, 
> > unsigned long flags)
> >
> >         drm_irq_install(dev, dev->pdev->irq);
> >
> > -       dev->vblank_disable_allowed = true;
> >         dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
> >         dev->driver->get_vblank_counter = psb_get_vblank_counter;
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c 
> > b/drivers/gpu/drm/i915/i915_dma.c index a8c79f6512a4..fd06bff216ff 
> > 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -515,9 +515,6 @@ static int i915_load_modeset_init(struct 
> > drm_device *dev)
> >
> >         intel_modeset_gem_init(dev);
> >
> > -       /* Always safe in the mode setting case. */
> > -       /* FIXME: do pre/post-mode set stuff in core KMS code */
> > -       dev->vblank_disable_allowed = true;
> >         if (INTEL_INFO(dev)->num_pipes == 0)
> >                 return 0;
> >
> > diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
> > b/drivers/gpu/drm/imx/imx-drm-core.c
> > index 2453fb1c68a7..1080019e7b17 100644
> > --- a/drivers/gpu/drm/imx/imx-drm-core.c
> > +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> > @@ -252,13 +252,6 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
> >         if (ret)
> >                 goto err_kms;
> >
> > -       /*
> > -        * with vblank_disable_allowed = true, vblank interrupt will be
> > -        * disabled by drm timer once a current process gives up ownership
> > -        * of vblank event. (after drm_vblank_put function is called)
> > -        */
> > -       drm->vblank_disable_allowed = true;
> > -
> >         platform_set_drvdata(drm->platformdev, drm);
> >
> >         /* Now try and bind all our sub-components */ diff --git 
> > a/drivers/gpu/drm/radeon/radeon_irq_kms.c 
> > b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> > index 1e9304d1c88f..c084cadcbf21 100644
> > --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> > +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> > @@ -291,7 +291,6 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
> >         if (r) {
> >                 return r;
> >         }
> > -       rdev->ddev->vblank_disable_allowed = true;
> >
> >         /* enable msi */
> >         rdev->msi_enabled = 0;
> > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
> > b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> > index ced1e5f93cda..09a4d429c0f0 100644
> > --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> > @@ -217,13 +217,6 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
> >         if (ret)
> >                 goto err_kms_helper_poll_fini;
> >
> > -       /*
> > -        * with vblank_disable_allowed = true, vblank interrupt will be disabled
> > -        * by drm timer once a current process gives up ownership of
> > -        * vblank event.(after drm_vblank_put function is called)
> > -        */
> > -       drm_dev->vblank_disable_allowed = true;
> > -
> >         drm_mode_config_reset(drm_dev);
> >
> >         ret = rockchip_drm_fbdev_init(drm_dev); diff --git 
> > a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 
> > 679905544181..b59c3bf0df44 100644
> > --- a/drivers/gpu/drm/tegra/drm.c
> > +++ b/drivers/gpu/drm/tegra/drm.c
> > @@ -180,7 +180,6 @@ static int tegra_drm_load(struct drm_device *drm, 
> > unsigned long flags)
> >
> >         /* syncpoints are used for full 32-bit hardware VBLANK counters */
> >         drm->max_vblank_count = 0xffffffff;
> > -       drm->vblank_disable_allowed = true;
> >
> >         err = drm_vblank_init(drm, drm->mode_config.num_crtc);
> >         if (err < 0)
> > diff --git a/drivers/gpu/drm/vc4/vc4_kms.c 
> > b/drivers/gpu/drm/vc4/vc4_kms.c index d423ba10239a..cb37751bc99f 
> > 100644
> > --- a/drivers/gpu/drm/vc4/vc4_kms.c
> > +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> > @@ -207,8 +207,6 @@ int vc4_kms_load(struct drm_device *dev)
> >         dev->mode_config.preferred_depth = 24;
> >         dev->mode_config.async_page_flip = true;
> >
> > -       dev->vblank_disable_allowed = true;
> > -
> >         drm_mode_config_reset(dev);
> >
> >         vc4->fbdev = drm_fbdev_cma_init(dev, 32, diff --git 
> > a/include/drm/drmP.h b/include/drm/drmP.h index 
> > f0d1450d4ea5..30dc7d8c403f 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -819,14 +819,6 @@ struct drm_device {
> >         int irq;
> >
> >         /*
> > -        * At load time, disabling the vblank interrupt won't be allowed since
> > -        * old clients may not call the modeset ioctl and therefore misbehave.
> > -        * Once the modeset ioctl *has* been called though, we can safely
> > -        * disable them when unused.
> > -        */
> > -       bool vblank_disable_allowed;
> > -
> > -       /*
> >          * If true, vblank interrupt will be disabled immediately when the
> >          * refcount drops to zero, as opposed to via the vblank disable
> >          * timer.
> > --
> > 2.8.1
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Wed, 18 May 2016 23:57:10 +0100
> From: Chris Wilson <chris@chris-wilson.co.uk>
> To: Gustavo Padovan <gustavo@padovan.org>
> Cc: marcheu@google.com, Daniel Stone <daniels@collabora.com>,
> 	seanpaul@google.com, Daniel Vetter <daniel.vetter@ffwll.ch>,
> 	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
> 	laurent.pinchart@ideasonboard.com, Alex Deucher
> 	<alexander.deucher@amd.com>, Gustavo Padovan
> 	<gustavo.padovan@collabora.co.uk>, Christian König
> 	<christian.koenig@amd.com>, John Harrison <John.C.Harrison@Intel.com>,
> 	m.chehab@samsung.com
> Subject: Re: [PATCH 1/2] dma-buf/fence: add fence_collection fences
> Message-ID: <20160518225710.GA32627@nuc-i3427.alporthouse.com>
> Content-Type: text/plain; charset=us-ascii
> 
> On Wed, May 18, 2016 at 05:59:52PM -0300, Gustavo Padovan wrote:
> > +static void collection_check_cb_func(struct fence *fence, struct 
> > +fence_cb *cb) {
> > +	struct fence_collection_cb *f_cb;
> > +	struct fence_collection *collection;
> > +
> > +	f_cb = container_of(cb, struct fence_collection_cb, cb);
> > +	collection = f_cb->collection;
> > +
> > +	if (atomic_dec_and_test(&collection->num_pending_fences))
> > +		fence_signal(&collection->base);
> > +}
> > +
> > +static bool fence_collection_enable_signaling(struct fence *fence) {
> > +	struct fence_collection *collection = to_fence_collection(fence);
> > +	int i;
> > +
> > +	for (i = 0 ; i < collection->num_fences ; i++) {
> > +		if (fence_add_callback(collection->fences[i].fence,
> > +				       &collection->fences[i].cb,
> > +				       collection_check_cb_func)) {
> > +			atomic_dec(&collection->num_pending_fences);
> > +		}
> > +	}
> 
> We don't always have a convenient means to preallocate an array of fences to use. Keeping a list of fences in addition to the array would be easier to user in many circumstances.
> 
> Just means we need a
> 
> struct fence_collection_entry {
> 	struct fence *fence;
> 	struct list_head link;
> };
> 
> int fence_collection_add(struct fence *_collection,
> 			 struct fence *fence)
> {
> 	struct fence_collection *collection =
> 		to_fence_collection(_collection);
> 	struct fence_collection_entry *entry;
> 
> 	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
> 	if (!entry)
> 		return -ENOMEM;
> 
> 	entry->fence = fence_get(fence);
> 	list_add_tail(&entry->link, &collection->fence_list);
> 	atomic_inc(&collection->num_pending_fences);
> 
> 	return 0;
> }
> 
> and a couple of list iterations as well as walking the arrays.
> 
> (This fence_collection_add() needs to be documented to only be valid from the constructing thread before the fence is sealed for export/use.) -Chris
> 
> --
> Chris Wilson, Intel Open Source Technology Centre
> HI.
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Wed, 18 May 2016 18:37:10 -0400
> From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
> To: <dri-devel@lists.freedesktop.org>
> Cc: Mykola Lysenko <Mykola.Lysenko@amd.com>
> Subject: drm/dp/mst: change MST detection scheme (v2)
> Message-ID:
> 	<1463611030-21448-1-git-send-email-Andrey.Grodzovsky@amd.com>
> Content-Type: text/plain; charset="UTF-8"
> 
> From: Mykola Lysenko <Mykola.Lysenko@amd.com>
> 
>     1. Get edid for all connected MST displays, not only on logical ports,
>        in the same thread as MST topology detection is done:
>          There are displays that have branches inside w/o logical ports.
>          So in case another SST display connected downstream system can
>          end-up in situation when 3 DOWN requests sent: two for
>         ‘remote i2c read’ and one for ‘enum path resources’, making slots full.
> 
>     2. Call notification callback in one place in the end of topology discovery/update:
>          This is done to reduce number of events sent to userspace in case complex
>          topology discovery is going, adding multiple number of connectors;
> 
>     3. Remove notification callback call from short pulse interrupt processing function:
>          This is done in order not to block interrupt processing function, in case any
>          MST request will be made from it. Notification will be send from topology
>          discovery/update work item.
> 
>     v2: This change also includes tile property set fix which caused regression
>         in i915 driver.
> 
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 36 +++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 27fbd79..9971c46 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1159,13 +1159,9 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
>  			drm_dp_put_port(port);
>  			goto out;
>  		}
> -		if (port->port_num >= DP_MST_LOGICAL_PORT_0) {
> -			port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc);
> -			drm_mode_connector_set_tile_property(port->connector);
> -		}
> +
>  		(*mstb->mgr->cbs->register_connector)(port->connector);
>  	}
> -
>  out:
>  	/* put reference to this port */
>  	drm_dp_put_port(port);
> @@ -1190,8 +1186,8 @@ static void drm_dp_update_port(struct drm_dp_mst_branch *mstb,
>  	port->ddps = conn_stat->displayport_device_plug_status;
>  
>  	if (old_ddps != port->ddps) {
> +		dowork = true;
>  		if (port->ddps) {
> -			dowork = true;
>  		} else {
>  			port->available_pbn = 0;
>  		}
> @@ -1296,8 +1292,13 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m
>  		if (port->input)
>  			continue;
>  
> -		if (!port->ddps)
> +		if (!port->ddps) {
> +			if (port->cached_edid) {
> +				kfree(port->cached_edid);
> +				port->cached_edid = NULL;
> +			}
>  			continue;
> +		}
>  
>  		if (!port->available_pbn)
>  			drm_dp_send_enum_path_resources(mgr, mstb, port);
> @@ -1308,6 +1309,13 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m
>  				drm_dp_check_and_send_link_address(mgr, mstb_child);
>  				drm_dp_put_mst_branch_device(mstb_child);
>  			}
> +		} else if (port->pdt == DP_PEER_DEVICE_SST_SINK ||
> +			port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV) {
> +			if (!port->cached_edid) {
> +				port->cached_edid =
> +					drm_get_edid(port->connector, &port->aux.ddc);
> +				drm_mode_connector_set_tile_property(port->connector);
> +			}
>  		}
>  	}
>  }
> @@ -1327,6 +1335,8 @@ static void drm_dp_mst_link_probe_work(struct work_struct *work)
>  		drm_dp_check_and_send_link_address(mgr, mstb);
>  		drm_dp_put_mst_branch_device(mstb);
>  	}
> +
> +	(*mgr->cbs->hotplug)(mgr);
>  }
>  
>  static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
> @@ -1586,7 +1596,6 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
>  			for (i = 0; i < txmsg->reply.u.link_addr.nports; i++) {
>  				drm_dp_add_port(mstb, mgr->dev, &txmsg->reply.u.link_addr.ports[i]);
>  			}
> -			(*mgr->cbs->hotplug)(mgr);
>  		}
>  	} else {
>  		mstb->link_address_sent = false;
> @@ -2283,8 +2292,6 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
>  			drm_dp_update_port(mstb, &msg.u.conn_stat);
>  
>  			DRM_DEBUG_KMS("Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n", msg.u.conn_stat.port_number, msg.u.conn_stat.legacy_device_plug_status, msg.u.conn_stat.displayport_device_plug_status, msg.u.conn_stat.message_capability_status, msg.u.conn_stat.input_port, msg.u.conn_stat.peer_device_type);
> -			(*mgr->cbs->hotplug)(mgr);
> -
>  		} else if (msg.req_type == DP_RESOURCE_STATUS_NOTIFY) {
>  			drm_dp_send_up_ack_reply(mgr, mgr->mst_primary, msg.req_type, seqno, false);
>  			if (!mstb)
> @@ -2371,10 +2378,6 @@ enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector
>  
>  	case DP_PEER_DEVICE_SST_SINK:
>  		status = connector_status_connected;
> -		/* for logical ports - cache the EDID */
> -		if (port->port_num >= 8 && !port->cached_edid) {
> -			port->cached_edid = drm_get_edid(connector, &port->aux.ddc);
> -		}
>  		break;
>  	case DP_PEER_DEVICE_DP_LEGACY_CONV:
>  		if (port->ldps)
> @@ -2429,10 +2432,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
>  
>  	if (port->cached_edid)
>  		edid = drm_edid_duplicate(port->cached_edid);
> -	else {
> -		edid = drm_get_edid(connector, &port->aux.ddc);
> -		drm_mode_connector_set_tile_property(connector);
> -	}
> +
>  	port->has_audio = drm_detect_monitor_audio(edid);
>  	drm_dp_put_port(port);
>  	return edid;
> -- 
> 1.9.1
> 
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> 
> ------------------------------
> 
> End of dri-devel Digest, Vol 74, Issue 285
> ******************************************
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 27fbd79..9971c46 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1159,13 +1159,9 @@  static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
 			drm_dp_put_port(port);
 			goto out;
 		}
-		if (port->port_num >= DP_MST_LOGICAL_PORT_0) {
-			port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc);
-			drm_mode_connector_set_tile_property(port->connector);
-		}
+
 		(*mstb->mgr->cbs->register_connector)(port->connector);
 	}
-
 out:
 	/* put reference to this port */
 	drm_dp_put_port(port);
@@ -1190,8 +1186,8 @@  static void drm_dp_update_port(struct drm_dp_mst_branch *mstb,
 	port->ddps = conn_stat->displayport_device_plug_status;
 
 	if (old_ddps != port->ddps) {
+		dowork = true;
 		if (port->ddps) {
-			dowork = true;
 		} else {
 			port->available_pbn = 0;
 		}
@@ -1296,8 +1292,13 @@  static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m
 		if (port->input)
 			continue;
 
-		if (!port->ddps)
+		if (!port->ddps) {
+			if (port->cached_edid) {
+				kfree(port->cached_edid);
+				port->cached_edid = NULL;
+			}
 			continue;
+		}
 
 		if (!port->available_pbn)
 			drm_dp_send_enum_path_resources(mgr, mstb, port);
@@ -1308,6 +1309,13 @@  static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m
 				drm_dp_check_and_send_link_address(mgr, mstb_child);
 				drm_dp_put_mst_branch_device(mstb_child);
 			}
+		} else if (port->pdt == DP_PEER_DEVICE_SST_SINK ||
+			port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV) {
+			if (!port->cached_edid) {
+				port->cached_edid =
+					drm_get_edid(port->connector, &port->aux.ddc);
+				drm_mode_connector_set_tile_property(port->connector);
+			}
 		}
 	}
 }
@@ -1327,6 +1335,8 @@  static void drm_dp_mst_link_probe_work(struct work_struct *work)
 		drm_dp_check_and_send_link_address(mgr, mstb);
 		drm_dp_put_mst_branch_device(mstb);
 	}
+
+	(*mgr->cbs->hotplug)(mgr);
 }
 
 static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
@@ -1586,7 +1596,6 @@  static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
 			for (i = 0; i < txmsg->reply.u.link_addr.nports; i++) {
 				drm_dp_add_port(mstb, mgr->dev, &txmsg->reply.u.link_addr.ports[i]);
 			}
-			(*mgr->cbs->hotplug)(mgr);
 		}
 	} else {
 		mstb->link_address_sent = false;
@@ -2283,8 +2292,6 @@  static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
 			drm_dp_update_port(mstb, &msg.u.conn_stat);
 
 			DRM_DEBUG_KMS("Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n", msg.u.conn_stat.port_number, msg.u.conn_stat.legacy_device_plug_status, msg.u.conn_stat.displayport_device_plug_status, msg.u.conn_stat.message_capability_status, msg.u.conn_stat.input_port, msg.u.conn_stat.peer_device_type);
-			(*mgr->cbs->hotplug)(mgr);
-
 		} else if (msg.req_type == DP_RESOURCE_STATUS_NOTIFY) {
 			drm_dp_send_up_ack_reply(mgr, mgr->mst_primary, msg.req_type, seqno, false);
 			if (!mstb)
@@ -2371,10 +2378,6 @@  enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector
 
 	case DP_PEER_DEVICE_SST_SINK:
 		status = connector_status_connected;
-		/* for logical ports - cache the EDID */
-		if (port->port_num >= 8 && !port->cached_edid) {
-			port->cached_edid = drm_get_edid(connector, &port->aux.ddc);
-		}
 		break;
 	case DP_PEER_DEVICE_DP_LEGACY_CONV:
 		if (port->ldps)
@@ -2429,10 +2432,7 @@  struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
 
 	if (port->cached_edid)
 		edid = drm_edid_duplicate(port->cached_edid);
-	else {
-		edid = drm_get_edid(connector, &port->aux.ddc);
-		drm_mode_connector_set_tile_property(connector);
-	}
+
 	port->has_audio = drm_detect_monitor_audio(edid);
 	drm_dp_put_port(port);
 	return edid;