From: "Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>
To: "airlied@gmail.com" <airlied@gmail.com>
Cc: "alexander.deucher@amd.com" <alexander.deucher@amd.com>,
"daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"bskeggs@redhat.com" <bskeggs@redhat.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v2 3/9] drm/dp: Split drm_dp_mst_allocate_vcpi
Date: Wed, 25 Jan 2017 20:34:38 +0000 [thread overview]
Message-ID: <1485377552.15309.0.camel@dk-H97M-D3H> (raw)
In-Reply-To: <CAPM=9tyrokNz78tkanhy+wModpRMCcTz3tZ=EQsfh0pxmKJmWQ@mail.gmail.com>
On Wed, 2017-01-25 at 10:31 +1000, Dave Airlie wrote:
> On 25 January 2017 at 09:49, Dhinakaran Pandiyan
> <dhinakaran.pandiyan@intel.com> wrote:
> > drm_dp_mst_allocate_vcpi() apart from setting up the vcpi structure,
> > also finds if there are enough slots available. This check is a duplicate
> > of that implemented in drm_dp_mst_find_vcpi_slots(). Let's move this check
> > out and reuse the existing drm_dp_mst_find_vcpi_slots() function to check
> > if there are enough vcpi slots before allocating them.
> >
> > This brings the check to one place. Additionally drivers that will use MST
> > state tracking for atomic modesets can use the atomic version of
> > find_vcpi_slots() and reuse drm_dp_mst_allocate_vcpi()
> >
>
> Also seem sane, at least for the core bits,
>
> Reviewed-by: Dave Airlie <airlied@redhat.com>
>
Thanks for the review.
-DK
> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > ---
> > drivers/gpu/drm/drm_dp_mst_topology.c | 20 +++++++++-----------
> > drivers/gpu/drm/i915/intel_dp_mst.c | 4 ++--
> > drivers/gpu/drm/nouveau/nv50_display.c | 3 ++-
> > drivers/gpu/drm/radeon/radeon_dp_mst.c | 4 +++-
> > include/drm/drm_dp_mst_helper.h | 2 +-
> > 5 files changed, 17 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> > index d9edd84..b871d4e 100644
> > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > @@ -2479,20 +2479,17 @@ int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
> > EXPORT_SYMBOL(drm_dp_find_vcpi_slots);
> >
> > static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr,
> > - struct drm_dp_vcpi *vcpi, int pbn)
> > + struct drm_dp_vcpi *vcpi, int pbn, int slots)
> > {
> > - int num_slots;
> > int ret;
> >
> > - num_slots = DIV_ROUND_UP(pbn, mgr->pbn_div);
> > -
> > /* max. time slots - one slot for MTP header */
> > - if (num_slots > 63)
> > + if (slots > 63)
> > return -ENOSPC;
> >
> > vcpi->pbn = pbn;
> > - vcpi->aligned_pbn = num_slots * mgr->pbn_div;
> > - vcpi->num_slots = num_slots;
> > + vcpi->aligned_pbn = slots * mgr->pbn_div;
> > + vcpi->num_slots = slots;
> >
> > ret = drm_dp_mst_assign_payload_id(mgr, vcpi);
> > if (ret < 0)
> > @@ -2507,7 +2504,7 @@ static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr,
> > * @pbn: payload bandwidth number to request
> > * @slots: returned number of slots for this PBN.
> > */
> > -bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots)
> > +bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int slots)
> > {
> > int ret;
> >
> > @@ -2515,16 +2512,18 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp
> > if (!port)
> > return false;
> >
> > + if (slots < 0)
> > + return false;
> > +
> > if (port->vcpi.vcpi > 0) {
> > DRM_DEBUG_KMS("payload: vcpi %d already allocated for pbn %d - requested pbn %d\n", port->vcpi.vcpi, port->vcpi.pbn, pbn);
> > if (pbn == port->vcpi.pbn) {
> > - *slots = port->vcpi.num_slots;
> > drm_dp_put_port(port);
> > return true;
> > }
> > }
> >
> > - ret = drm_dp_init_vcpi(mgr, &port->vcpi, pbn);
> > + ret = drm_dp_init_vcpi(mgr, &port->vcpi, pbn, slots);
> > if (ret) {
> > DRM_DEBUG_KMS("failed to init vcpi slots=%d max=63 ret=%d\n",
> > DIV_ROUND_UP(pbn, mgr->pbn_div), ret);
> > @@ -2532,7 +2531,6 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp
> > }
> > DRM_DEBUG_KMS("initing vcpi for pbn=%d slots=%d\n",
> > pbn, port->vcpi.num_slots);
> > - *slots = port->vcpi.num_slots;
> >
> > drm_dp_put_port(port);
> > return true;
> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> > index 38e3ca2..f51574f 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > @@ -147,7 +147,6 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder,
> > to_intel_connector(conn_state->connector);
> > int ret;
> > uint32_t temp;
> > - int slots;
> >
> > /* MST encoders are bound to a crtc, not to a connector,
> > * force the mapping here for get_hw_state.
> > @@ -177,7 +176,8 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder,
> >
> > ret = drm_dp_mst_allocate_vcpi(&intel_dp->mst_mgr,
> > connector->port,
> > - pipe_config->pbn, &slots);
> > + pipe_config->pbn,
> > + pipe_config->dp_m_n.tu);
> > if (ret == false) {
> > DRM_ERROR("failed to allocate vcpi\n");
> > return;
> > diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> > index 452da48..91a4875 100644
> > --- a/drivers/gpu/drm/nouveau/nv50_display.c
> > +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> > @@ -2959,7 +2959,8 @@ nv50_msto_enable(struct drm_encoder *encoder)
> > if (WARN_ON(!mstc))
> > return;
> >
> > - r = drm_dp_mst_allocate_vcpi(&mstm->mgr, mstc->port, mstc->pbn, &slots);
> > + slots = drm_dp_find_vcpi_slots(&mstm->mgr, mstc->pbn);
> > + r = drm_dp_mst_allocate_vcpi(&mstm->mgr, mstc->port, mstc->pbn, slots);
> > WARN_ON(!r);
> >
> > if (mstm->outp->dcb->sorconf.link & 1)
> > diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> > index 7d5ada3..6598306 100644
> > --- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
> > +++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> > @@ -453,9 +453,11 @@ radeon_mst_encoder_dpms(struct drm_encoder *encoder, int mode)
> > DRM_DEBUG_KMS("dig encoder is %d %d %d\n", dig_enc->dig_encoder,
> > dig_enc->linkb, radeon_crtc->crtc_id);
> >
> > + slots = drm_dp_find_vcpi_slots(&radeon_connector->mst_port->mst_mgr,
> > + mst_enc->pbn);
> > ret = drm_dp_mst_allocate_vcpi(&radeon_connector->mst_port->mst_mgr,
> > radeon_connector->port,
> > - mst_enc->pbn, &slots);
> > + mst_enc->pbn, slots);
> > ret = drm_dp_update_payload_part1(&radeon_connector->mst_port->mst_mgr);
> >
> > radeon_dp_mst_set_be_cntl(primary, mst_enc,
> > diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
> > index b0f4a09..98d3c73 100644
> > --- a/include/drm/drm_dp_mst_helper.h
> > +++ b/include/drm/drm_dp_mst_helper.h
> > @@ -568,7 +568,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
> > int drm_dp_calc_pbn_mode(int clock, int bpp);
> >
> >
> > -bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots);
> > +bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int slots);
> >
> > int drm_dp_mst_get_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
> >
> > --
> > 2.7.4
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-01-25 20:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 23:49 [PATCH v2 0/9] Adding private objects to atomic state Dhinakaran Pandiyan
2017-01-24 23:49 ` [PATCH v2 1/9] drm/dp: Store drm_device in MST topology manager Dhinakaran Pandiyan
2017-01-25 0:30 ` [Intel-gfx] " Dave Airlie
2017-01-24 23:49 ` [PATCH v2 2/9] drm/dp: Kill unused MST vcpi slot availability tracking Dhinakaran Pandiyan
2017-01-25 5:43 ` Daniel Vetter
2017-01-25 20:36 ` Pandiyan, Dhinakaran
2017-01-24 23:49 ` [PATCH v2 3/9] drm/dp: Split drm_dp_mst_allocate_vcpi Dhinakaran Pandiyan
2017-01-25 0:31 ` Dave Airlie
2017-01-25 20:34 ` Pandiyan, Dhinakaran [this message]
2017-01-24 23:49 ` [PATCH v2 4/9] drm: Add driver private objects to atomic state Dhinakaran Pandiyan
2017-01-25 5:59 ` Daniel Vetter
2017-01-25 20:47 ` Pandiyan, Dhinakaran
2017-01-26 8:38 ` [Intel-gfx] " Daniel Vetter
2017-01-25 21:33 ` Harry Wentland
2017-01-26 8:40 ` Daniel Vetter
2017-01-24 23:49 ` [PATCH v2 5/9] drm/dp: Introduce MST topology state Dhinakaran Pandiyan
2017-01-25 6:05 ` Daniel Vetter
2017-01-24 23:49 ` [PATCH v2 6/9] drm/dp: Add DP MST helpers to atomically find and release vcpi slots Dhinakaran Pandiyan
2017-01-24 23:49 ` [PATCH v2 7/9] drm: Connector helper function to release atomic state Dhinakaran Pandiyan
2017-01-25 6:18 ` Daniel Vetter
2017-01-25 21:01 ` Pandiyan, Dhinakaran
2017-01-31 0:14 ` Pandiyan, Dhinakaran
2017-01-24 23:49 ` [PATCH v2 8/9] drm/dp: Release DP MST shared link bandwidth Dhinakaran Pandiyan
2017-01-25 6:16 ` Daniel Vetter
2017-01-25 20:53 ` Pandiyan, Dhinakaran
2017-01-26 8:41 ` [Intel-gfx] " Daniel Vetter
2017-01-24 23:49 ` [PATCH v2 9/9] drm/dp: Track MST " Dhinakaran Pandiyan
2017-01-25 6:15 ` Daniel Vetter
2017-01-25 21:00 ` Pandiyan, Dhinakaran
2017-01-26 8:42 ` [Intel-gfx] " Daniel Vetter
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=1485377552.15309.0.camel@dk-H97M-D3H \
--to=dhinakaran.pandiyan@intel.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=bskeggs@redhat.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.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).