[PATCH v5 06/14] drm/dp_mst: Protect drm_dp_mst_port members with locking

2019-10-21 Thread Lyude Paul
detailed explanation of what problems this is trying to fix, since there's a _lot_ of context here and I honestly forgot some of it myself a couple times. * Don't grab mgr->lock when reading port->mstb in drm_dp_mst_handle_link_address_port(). It's not needed.

[PATCH v5 07/14] drm/dp_mst: Don't forget to update port->input in drm_dp_mst_handle_conn_stat()

2019-10-21 Thread Lyude Paul
ke sure we read the input_port field in connection status notifications in drm_dp_mst_handle_conn_stat() to prevent this from happening once we've implemented suspend/resume reprobing. Cc: Juston Li Cc: Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Cc: Daniel Vetter Signed-off-by:

[PATCH v5 10/14] drm/nouveau: Resume hotplug interrupts earlier

2019-10-21 Thread Lyude Paul
lizing the display. Cc: Juston Li Cc: Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Cc: Daniel Vetter Cc: Sean Paul Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/nouveau_display.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/d

[PATCH v5 08/14] drm/dp_mst: Lessen indenting in drm_dp_mst_topology_mgr_resume()

2019-10-21 Thread Lyude Paul
Does what it says on the tin. Cc: Juston Li Cc: Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Cc: Daniel Vetter Reviewed-by: Sean Paul Signed-off-by: Lyude Paul --- drivers/gpu/drm/drm_dp_mst_topology.c | 59 +-- 1 file changed, 29 insertions(+), 30 deletions

[PATCH v5 12/14] drm/amdgpu/dm: Resume short HPD IRQs before resuming MST topology

2019-10-21 Thread Lyude Paul
Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Cc: Daniel Vetter Signed-off-by: Lyude Paul Acked-by: Alex Deucher --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm

[PATCH v5 11/14] drm/amdgpu: Iterate through DRM connectors correctly

2019-10-21 Thread Lyude Paul
Harry Wentland Cc: Daniel Vetter Signed-off-by: Lyude Paul Reviewed-by: Alex Deucher --- .../gpu/drm/amd/amdgpu/amdgpu_connectors.c| 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 20 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 5 ++- drivers/gpu/drm/amd/a

[PATCH v5 14/14] drm/dp_mst: Add topology ref history tracking for debugging

2019-10-21 Thread Lyude Paul
he memory might have been freed by that point * Don't print message on allocation error failures, the kernel already does this for us Cc: Juston Li Cc: Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Cc: Daniel Vetter Reviewed-by: Sean Paul Signed-off-by: Lyude Paul --- drivers/gpu/d

[PATCH v5 13/14] drm/dp_mst: Add basic topology reprobing when resuming

2019-10-21 Thread Lyude Paul
to change port->connector at all on ports, just throw out ports that need their connectors removed to make things easier. Cc: Juston Li Cc: Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Cc: Daniel Vetter Reviewed-by: Sean Paul Signed-off-by: Lyude Paul --- .../gpu/drm/amd/displ

Re: [PATCH 02/13] drm/dp_mst: Add PBN calculation for DSC modes

2019-11-04 Thread Lyude Paul
arate function for this > > Reviewed-by: Manasi Navare > Reviewed-by: Lyude Paul > Reviewed-by: Harry Wentland > Signed-off-by: David Francis > --- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c| 2 +- > drivers/gpu/drm/drm_dp_mst_topology.c| 16 +

Re: [PATCH 11/13] drm/amd/display: MST DSC compute fair share

2019-11-04 Thread Lyude Paul
text > *res_ctx, > > > #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT > -static enum dc_status add_dsc_to_stream_resource(struct dc *dc, > +enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc, > struct dc_state *dc_ctx, > struct dc_stream_state *dc_stream) > { > @@ -1510,6 +1510,9 @@ static enum dc_status > add_dsc_to_stream_resource(struct dc *dc, > if (pipe_ctx->stream != dc_stream) > continue; > > + if (pipe_ctx->stream_res.dsc) > + continue; > + > acquire_dsc(&dc_ctx->res_ctx, pool, &pipe_ctx- > >stream_res.dsc); > > /* The number of DSCs can be less than the number of pipes */ > @@ -1561,7 +1564,7 @@ enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, > struct dc_state *new_ctx, > #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT > /* Get a DSC if required and available */ > if (result == DC_OK && dc_stream->timing.flags.DSC) > - result = add_dsc_to_stream_resource(dc, new_ctx, dc_stream); > + result = dcn20_add_dsc_to_stream_resource(dc, new_ctx, > dc_stream); > #endif > > if (result == DC_OK) > diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h > b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h > index fef473d68a4a..865f684a500a 100644 > --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h > +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.h > @@ -159,6 +159,7 @@ void dcn20_calculate_dlg_params( > > enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct > dc_state *context, struct dc_stream_state *stream); > enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state > *new_ctx, struct dc_stream_state *dc_stream); > +enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc, struct > dc_state *dc_ctx, struct dc_stream_state *dc_stream); > enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state > *new_ctx, struct dc_stream_state *dc_stream); > enum dc_status dcn20_get_default_swizzle_mode(struct dc_plane_state > *plane_state); > -- Cheers, Lyude Paul ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Re: [PATCH 12/13] drm/dp_mst: Add DSC enablement helpers to DRM

2019-11-04 Thread Lyude Paul
to iterate through all the ports in the topology and set > mode_changed flag on crtc if DSC has been enabled. > > Cc: Harry Wentland > Cc: Lyude Paul > Signed-off-by: Mikita Lipski > --- > drivers/gpu/drm/drm_dp_mst_topology.c | 103 +- > incl

Re: [PATCH] drm/dp_mst: Remove VCPI while disabling topology mgr

2019-12-02 Thread Lyude Paul
} > + mgr->proposed_vcpis[i] = NULL; > + } > mgr->vcpi_mask = 0; > + mutex_unlock(&mgr->payload_lock); bikeshed: I'd just rename tmp_vcpi here to vcpi, but I'll leave that up to you > } > > out_unlock: -- Cheers, Lyude Paul ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Re: [PATCH] drm/dp_mst: Correct the bug in drm_dp_update_payload_part1()

2019-12-02 Thread Lyude Paul
ads; /* do nothing */) { if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL) { i++; continue; } With those changes, this patch is: Reviewed-by: Lyude Paul I can go ahead and push these patches to drm-misc for you once you've sen

Re: [PATCH v2] drm/dp_mst: Correct the bug in drm_dp_update_payload_part1()

2019-12-04 Thread Lyude Paul
> * Amend the commit message to meet the way code is modified now. > > Signed-off-by: Wayne Lin > Reviewed-by: Lyude Paul > --- > drivers/gpu/drm/drm_dp_mst_topology.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm

Re: [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology mgr

2019-12-06 Thread Lyude Paul
Reviewed-by: Lyude Paul I'll go ahead and push this to drm-misc-next-fixes right now, thanks! On Thu, 2019-12-05 at 17:00 +0800, Wayne Lin wrote: > [Why] > > This patch is trying to address the issue observed when hotplug DP > daisy chain monitors. > > e.g. > src-ms

Re: [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology mgr

2019-12-06 Thread Lyude Paul
On Fri, 2019-12-06 at 14:24 -0500, Lyude Paul wrote: > Reviewed-by: Lyude Paul > > I'll go ahead and push this to drm-misc-next-fixes right now, thanks! Whoops-meant to say drm-misc-next here, anyway, pushed! > > On Thu, 2019-12-05 at 17:00 +0800, Wayne Lin wrote: > >

Re: [PATCH v8 01/17] drm/dp_mst: Add PBN calculation for DSC modes

2019-12-06 Thread Lyude Paul
1/16 of a bit per pixel > > v2: Don't add separate function for this > > v3: Keep the calculation in a single equation > > Cc: Lyude Paul > Reviewed-by: Manasi Navare > Reviewed-by: Lyude Paul > Reviewed-by: Harry Wentland > Signed-off-by: David Francis >

Re: [PATCH v8 11/17] drm/dp_mst: Add DSC enablement helpers to DRM

2019-12-06 Thread Lyude Paul
eparate functions into one and call it per > port > > Cc: Harry Wentland > Cc: Lyude Paul > Signed-off-by: Mikita Lipski > --- > drivers/gpu/drm/drm_dp_mst_topology.c | 61 +++ > include/drm/drm_dp_mst_helper.h | 5 +++ > 2 files changed,

Re: [PATCH v8 12/17] drm/dp_mst: Add branch bandwidth validation to MST atomic check

2019-12-06 Thread Lyude Paul
bandwidth needs doesn't exceed available bandwidth. > The funtion is called in drm_dp_mst_atomic_check after > drm_dp_mst_atomic_check_topology_state to fully verify that > the proposed topology is supported. > > Cc: Jerry Zuo > Cc: Harry Wentland > Cc: Lyude Paul >

Re: [PATCH v8 16/17] drm/dp_mst: Add helper to trigger modeset on affected DSC MST CRTCs

2019-12-06 Thread Lyude Paul
> as affected connector > > v2: use drm_dp_mst_dsc_aux_for_port function to verify > if the port is DSC capable > > Cc: Manasi Navare > Cc: Lyude Paul > Signed-off-by: Mikita Lipski > --- > drivers/gpu/drm/drm_dp_mst_topology.c | 62 +++ > include/drm/drm_dp_mst

Re: [PATCH v8 15/17] drm/amd/display: Recalculate VCPI slots for new DSC connectors

2019-12-06 Thread Lyude Paul
Reviewed-by: Lyude Paul On Tue, 2019-12-03 at 09:35 -0500, mikita.lip...@amd.com wrote: > From: Mikita Lipski > > [why] > Since for DSC MST connector's PBN is claculated differently > due to compression, we have to recalculate both PBN and > VCPI slots for that conn

Re: [PATCH v8 17/17] drm/amd/display: Trigger modesets on MST DSC connectors

2019-12-06 Thread Lyude Paul
Reviewed-by: Lyude Paul On Tue, 2019-12-03 at 09:35 -0500, mikita.lip...@amd.com wrote: > From: Mikita Lipski > > Whenever a connector on an MST network is attached, detached, or > undergoes a modeset, the DSC configs for each stream on that > topology will be recalculated.

Re: [PATCH v8 14/17] drm/amd/display: MST DSC compute fair share

2019-12-06 Thread Lyude Paul
f it fails, > fail check; This combination of timings cannot be supported. > > v2: Use drm_dp_mst_atomic_check to validate bw for certain dsc > configurations > > v3: Use dc_dsc_policy structure to get min and max bpp rate > for DSC configuration > > Cc: Lyude Paul &

[PATCH 1/6] drm/dp_mst: Introduce drm_dp_mst_connector_atomic_check()

2018-09-18 Thread Lyude Paul
ling commits fail automatically if the MST port driving the connector no longer exists. We'll also be able to expand upon this later as well once we add MST fallback retraining support. Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org --- drivers/gpu/drm/drm_dp_mst_topology.c | 76

[PATCH 3/6] drm/i915: Leave intel_conn->mst_port set, use mst_port_gone instead

2018-09-18 Thread Lyude Paul
ot the connector has disappeared from the system. Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org --- drivers/gpu/drm/i915/intel_dp_mst.c | 14 +++--- drivers/gpu/drm/i915/intel_drv.h| 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel

[PATCH 0/6] Fix legacy DPMS changes with MST

2018-09-18 Thread Lyude Paul
changes failing with legacy modesetting users after an MST connector's topology has disappeared, which resulted in CRTCs being left on when they shouldn't have been Lyude Paul (6): drm/dp_mst: Introduce drm_dp_mst_connector_atomic_check() drm/nouveau: Unbreak nv50_mstc-&g

[PATCH 2/6] drm/nouveau: Unbreak nv50_mstc->best_encoder()

2018-09-18 Thread Lyude Paul
ble CRTCs on MST connectors after the connector's respective topology has disappeared. So, fix this by instead using the new drm_dp_mst_connector_atomic_check() helper instead while always returning a valid encoder from ->best_encoder(). Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org -

[PATCH 6/6] drm/amdgpu/dm/mst: Use drm_dp_mst_connector_atomic_check()

2018-09-18 Thread Lyude Paul
bug is amdgpu. Congrats AMD! Signed-off-by: Lyude Paul --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_

[PATCH 4/6] drm/i915: Skip vcpi allocation for MSTB ports that are gone

2018-09-18 Thread Lyude Paul
fig() is called on an MST port that's gone. Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org --- drivers/gpu/drm/i915/intel_dp_mst.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_

[PATCH 5/6] drm/i915: Fix intel_dp_mst_best_encoder()

2018-09-18 Thread Lyude Paul
ic_check() to prevent new modesets on no-longer-present MSTB ports. Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org --- drivers/gpu/drm/i915/intel_dp_mst.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/

Re: [PATCH 1/6] drm/dp_mst: Introduce drm_dp_mst_connector_atomic_check() (fwd)

2018-09-19 Thread Lyude Paul
t; drm_dp_mst_connector_atomic_check() > > CC: kbuild-...@01.org > In-Reply-To: <20180918230637.20700-2-ly...@redhat.com> > References: <20180918230637.20700-2-ly...@redhat.com> > TO: Lyude Paul > CC: dri-de...@lists.freedesktop.org, nouv...@lists.freedesktop.or

[PATCH v2 1/6] drm/dp_mst: Introduce drm_dp_mst_connector_atomic_check()

2018-09-19 Thread Lyude Paul
ling commits fail automatically if the MST port driving the connector no longer exists. We'll also be able to expand upon this later as well once we add MST fallback retraining support. Changes since v1: - Use list_for_each_entry_safe in drm_dp_mst_connector_still_exists() - Julia Lawall

[PATCH v2 0/6] Fix legacy DPMS changes with MST

2018-09-19 Thread Lyude Paul
changes failing with legacy modesetting users after an MST connector's topology has disappeared, which resulted in CRTCs being left on when they shouldn't have been Lyude Paul (6): drm/dp_mst: Introduce drm_dp_mst_connector_atomic_check() drm/nouveau: Unbreak nv50_mstc-&g

[PATCH v2 2/6] drm/nouveau: Unbreak nv50_mstc->best_encoder()

2018-09-19 Thread Lyude Paul
ble CRTCs on MST connectors after the connector's respective topology has disappeared. So, fix this by instead using the new drm_dp_mst_connector_atomic_check() helper instead while always returning a valid encoder from ->best_encoder(). Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org -

[PATCH v2 3/6] drm/i915: Leave intel_conn->mst_port set, use mst_port_gone instead

2018-09-19 Thread Lyude Paul
ot the connector has disappeared from the system. Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org --- drivers/gpu/drm/i915/intel_dp_mst.c | 14 +++--- drivers/gpu/drm/i915/intel_drv.h| 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel

[PATCH v2 4/6] drm/i915: Skip vcpi allocation for MSTB ports that are gone

2018-09-19 Thread Lyude Paul
fig() is called on an MST port that's gone. Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org --- drivers/gpu/drm/i915/intel_dp_mst.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_

[PATCH v2 5/6] drm/i915: Fix intel_dp_mst_best_encoder()

2018-09-19 Thread Lyude Paul
ic_check() to prevent new modesets on no-longer-present MSTB ports. Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org --- drivers/gpu/drm/i915/intel_dp_mst.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/

[PATCH v2 6/6] drm/amdgpu/dm/mst: Use drm_dp_mst_connector_atomic_check()

2018-09-19 Thread Lyude Paul
bug is amdgpu. Congrats AMD! Signed-off-by: Lyude Paul --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_

Re: [Intel-gfx] [PATCH 3/6] drm/i915: Leave intel_conn->mst_port set, use mst_port_gone instead

2018-09-21 Thread Lyude Paul
On Fri, 2018-09-21 at 11:27 +0200, Daniel Vetter wrote: > On Tue, Sep 18, 2018 at 07:06:19PM -0400, Lyude Paul wrote: > > Currently we set intel_connector->mst_port to NULL to signify that the > > MST port has been removed from the system so that we can prevent further > >

[PATCH] drm/amdgpu: Suppress keypresses from ACPI_VIDEO events

2018-09-21 Thread Lyude Paul
I event to be propogated to userspace. This is the equivalent of someone pressing the display key on a laptop every time there's a hotplug event. So, check for ACPI_VIDEO_NOTIFY_PROBE events and suppress keypresses from them. Signed-off-by: Lyude Paul Cc: sta...@vger.kernel.org --- driv

Re: [PATCH 1/2] drm/amd/display: Cleanup MST non-atomic code workaround

2018-11-01 Thread Lyude Paul
This patch is Reviewed-by: Lyude Paul On Tue, 2018-10-30 at 18:09 -0400, Jerry (Fangzhi) Zuo wrote: > [why] > It is not correct to touch aconnector within atomic_check. > > [How] > It was added as workaround before, and no longer needed. > > Signed-off-by

Re: [PATCH 2/2] drm/amd/display: Drop reusing drm connector for MST

2018-11-01 Thread Lyude Paul
> - aconnector->mst_connected = false; > + drm_connector_unregister(connector); > + if (adev->mode_info.rfbdev) > + drm_fb_helper_remove_one_connector(&adev->mode_info.rfbdev- > >helper, connector); > + drm_connector_unreference(connector

[PATCH] drm/amd/amdgpu/dm: Fix dm_dp_create_fake_mst_encoder()

2018-11-01 Thread Lyude Paul
w. [how] Since this code isn't used anywhere and seems useless anyway, we can just drop it entirely. This appears to fix the issue on my HP ZBook with an AMD WX4150. Signed-off-by: Lyude Paul --- Hey! This is the patch that I was talking about, feel free to review it-we should make sure this

[PATCH 1/2] drm/amd/dm: Don't forget to attach MST encoders

2018-11-16 Thread Lyude Paul
Drive-by fix, this is bound to cause problems somewhere. Signed-off-by: Lyude Paul Cc: Jerry Zuo --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm

[PATCH 0/2] drm/amd/dm: Misc MST connector fixes

2018-11-16 Thread Lyude Paul
Some fixes for things I spotted after trying to look at a bug Jerry Zuo mentioned to me. Didn't manage to reproduce the bug! But I found these. Cc: Jerry Zuo Lyude Paul (2): drm/amd/dm: Don't forget to attach MST encoders drm/amd/dm: Understand why attaching path/tile properties

[PATCH 2/2] drm/amd/dm: Understand why attaching path/tile properties are needed

2018-11-16 Thread Lyude Paul
Path property is used for userspace to know what MST connector goes to what actual DRM DisplayPort connector, the tiling property is for tiling configurations. Not sure what else there is to figure out. Signed-off-by: Lyude Paul --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

Re: [PATCH 1/2] drm/amd/dm: Don't forget to attach MST encoders

2018-11-19 Thread Lyude Paul
tached encoder in the process of adding MST connector. The > iteration search takes time to push drm_dp_send_enum_path_resources() aux > transaction after the mode probe, and causes conflict to > drm_dp_mst_i2c_xfer(), leading to the aux transaction timeout. > > -Original Message-

Re: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere

2018-11-21 Thread Lyude Paul
For the nouveau and drm core changes Reviewed-by: Lyude Paul On Mon, 2018-11-12 at 16:01 +0100, Maarten Lankhorst wrote: > We already have __drm_atomic_helper_connector_reset() and > __drm_atomic_helper_plane_reset(), extend this to crtc as well. > > Most drivers already have a gp

Re: [PATCH] drm/amdgpu/acpi: NULL check before some freeing functions is not needed

2018-12-05 Thread Lyude Paul
Reviewed-by: Lyude Paul Thanks! On Wed, 2018-12-05 at 15:43 +0800, Wen Yang wrote: > kfree(NULL) is safe, so removes NULL check before freeing the mem. > This patch also fix the ifnullfree.cocci warnings. > > Signed-off-by: Wen Yang > CC: Alex Deucher > CC: christian.k

[WIP PATCH 03/15] drm/dp_mst: Introduce new refcounting scheme for mstbs and ports

2018-12-13 Thread Lyude Paul
refs port in topology(refcount 0->1) Since we now can guarantee memory safety for ports and branches as-needed, we also can make our main reference counting functions fix this problem by using kref_get_unless_zero() internally so that topology refcounts can only ever reach 0 once. Signed-off-by: L

[WIP PATCH 01/15] drm/dp_mst: Remove bogus conditional in drm_dp_update_payload_part1()

2018-12-13 Thread Lyude Paul
There's no reason we need this, it's just confusing looking. Signed-off-by: Lyude Paul Cc: Juston Li --- drivers/gpu/drm/drm_dp_mst_topology.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_

[WIP PATCH 05/15] drm/dp_mst: Fix payload deallocation on hotplugs using malloc refs

2018-12-13 Thread Lyude Paul
t the ports are still valid and in the topology, any port which has an allocated payload will remain allocated in memory until it's payloads have been removed - finally allowing us to actually release said payloads correctly. Signed-off-by: Lyude Paul --- drivers/gpu/drm/drm_dp

[WIP PATCH 04/15] drm/dp_mst: Stop releasing VCPI when removing ports from topology

2018-12-13 Thread Lyude Paul
This has never actually worked, and isn't needed anyway: the driver's always going to try to deallocate VCPI when it tears down the display that the VCPI belongs to. Signed-off-by: Lyude Paul --- drivers/gpu/drm/drm_dp_mst_topology.c | 8 1 file changed, 8 deletions(-) di

[WIP PATCH 00/15] MST refcounting/atomic helpers cleanup

2018-12-13 Thread Lyude Paul
I haven't applied some of the comments from the reviews for the series this is based off of: drm/dp_mst: Improve VCPI helpers, use in nouveau https://patchwork.freedesktop.org/series/51414/ This is just getting put on the ML so I can get some feedback on this. Lyude Paul (15): drm/dp_mst: Rem

[WIP PATCH 06/15] drm/i915: Keep malloc references to MST ports

2018-12-13 Thread Lyude Paul
So that the ports stay around until we've destroyed the connectors, in order to ensure that we don't pass an invalid pointer to any MST helpers once we introduce the new MST VCPI helpers. Signed-off-by: Lyude Paul --- drivers/gpu/drm/i915/intel_connector.c | 4 drivers/gp

[WIP PATCH 11/15] drm/nouveau: Grab payload lock in nv50_msto_payload()

2018-12-13 Thread Lyude Paul
Going through the currently programmed payloads isn't safe without holding mgr->payload_lock, so actually do that and warn if anyone tries calling nv50_msto_payload() in the future without grabbing the right locks. Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/di

[WIP PATCH 02/15] drm/dp_mst: Refactor drm_dp_update_payload_part1()

2018-12-13 Thread Lyude Paul
There should be no functional changes here Signed-off-by: Lyude Paul Cc: Juston Li --- drivers/gpu/drm/drm_dp_mst_topology.c | 71 --- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm

[WIP PATCH 08/15] drm/nouveau: Remove unnecessary VCPI checks in nv50_msto_cleanup()

2018-12-13 Thread Lyude Paul
his code in the future, use msto->disabled instead to check whether or not we need to deallocate VCPI instead. Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/disp

[WIP PATCH 07/15] drm/nouveau: Remove bogus cleanup in nv50_mstm_add_connector()

2018-12-13 Thread Lyude Paul
Trying to destroy the connector using mstc->connector.funcs->destroy() if connector initialization fails is wrong: there is no possible codepath in nv50_mstc_new where nv50_mstm_add_connector() would return <0 and mstc would be non-NULL. Signed-off-by: Lyude Paul --- drivers/gpu/dr

[WIP PATCH 10/15] drm/nouveau: Stop unsetting mstc->port, use malloc refs

2018-12-13 Thread Lyude Paul
Same as we did for i915, but for nouveau this time. Additionally, we grab a malloc reference to the port that lasts for the entire lifetime of nv50_mstc, which gives us the guarantee that mstc->port will always point to valid memory for as long as the mstc stays around. Signed-off-by: Lyude P

[WIP PATCH 15/15] drm/nouveau: Use atomic VCPI helpers for MST

2018-12-13 Thread Lyude Paul
equirements for drm_dp_atomic_find_vcpi_slots() and drm_dp_atomic_release_vcpi_slots() Signed-off-by: Lyude Paul Cc: Daniel Vetter --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 52 ++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dis

[WIP PATCH 09/15] drm/nouveau: Fix potential use-after-frees for MSTCs

2018-12-13 Thread Lyude Paul
mstc->port could technically be pointing at freed memory. Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index 0f7d72518604..982054

[WIP PATCH 14/15] drm/dp_mst: Check payload count in drm_dp_mst_atomic_check()

2018-12-13 Thread Lyude Paul
It occurred to me that we never actually check this! So let's start doing that. Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_dp_mst_topology.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology

[WIP PATCH 12/15] drm/dp_mst: Add some atomic state iterator macros

2018-12-13 Thread Lyude Paul
Changes since v6: - Move EXPORT_SYMBOL() for drm_dp_mst_topology_state_funcs to this commit - Document __drm_dp_mst_state_iter_get() and note that it shouldn't be called directly Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_dp_mst_topology.c

[WIP PATCH 13/15] drm/dp_mst: Start tracking per-port VCPI allocations

2018-12-13 Thread Lyude Paul
atomic_release_vcpi_slots() - danvet - Annotate atomic VCPI and atomic check functions with __must_check - danvet Changes since v1: - Don't use the now-removed ->atomic_check() for private objects hook, just give drivers a function to call themselves Signed-off-by: Lyude Paul Cc: Dan

Re: [WIP PATCH 03/15] drm/dp_mst: Introduce new refcounting scheme for mstbs and ports

2018-12-18 Thread Lyude Paul
On Fri, 2018-12-14 at 10:29 +0100, Daniel Vetter wrote: > On Thu, Dec 13, 2018 at 08:25:32PM -0500, Lyude Paul wrote: > > The current way of handling refcounting in the DP MST helpers is really > > confusing and probably just plain wrong because it's been hacked up many >

Re: [WIP PATCH 06/15] drm/i915: Keep malloc references to MST ports

2018-12-18 Thread Lyude Paul
On Fri, 2018-12-14 at 10:32 +0100, Daniel Vetter wrote: > On Thu, Dec 13, 2018 at 08:25:35PM -0500, Lyude Paul wrote: > > So that the ports stay around until we've destroyed the connectors, in > > order to ensure that we don't pass an invalid pointer to any MST helpers

Re: [WIP PATCH 05/15] drm/dp_mst: Fix payload deallocation on hotplugs using malloc refs

2018-12-18 Thread Lyude Paul
On Fri, 2018-12-14 at 10:38 +0100, Daniel Vetter wrote: > On Thu, Dec 13, 2018 at 08:25:34PM -0500, Lyude Paul wrote: > > Up until now, freeing payloads on remote MST hubs that just had ports > > removed has almost never worked because we've been relying on port > > vali

Re: [WIP PATCH 03/15] drm/dp_mst: Introduce new refcounting scheme for mstbs and ports

2018-12-19 Thread Lyude Paul
On Wed, 2018-12-19 at 13:48 +0100, Daniel Vetter wrote: > On Tue, Dec 18, 2018 at 04:27:58PM -0500, Lyude Paul wrote: > > On Fri, 2018-12-14 at 10:29 +0100, Daniel Vetter wrote: > > > On Thu, Dec 13, 2018 at 08:25:32PM -0500, Lyude Paul wrote: > > > > The current way

[PATCH v2 01/16] drm/dp_mst: Rename drm_dp_mst_get_validated_(port|mstb)_ref and friends

2018-12-19 Thread Lyude Paul
, and will make even more sense once we redesign how the current refcounting scheme here works. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/drm_dp_mst_topology.c | 114 ++ 1 file

[PATCH v2 00/16] MST refcounting/atomic helpers cleanup

2018-12-19 Thread Lyude Paul
good place to start off for now :). Lyude Paul (16): drm/dp_mst: Rename drm_dp_mst_get_validated_(port|mstb)_ref and friends drm/dp_mst: Introduce new refcounting scheme for mstbs and ports drm/dp_mst: Restart last_connected_port_and_mstb() if topology ref fails drm/dp_mst: Stop

[PATCH v2 03/16] drm/dp_mst: Restart last_connected_port_and_mstb() if topology ref fails

2018-12-19 Thread Lyude Paul
ecovery handling for VCPI allocations in the rest of the DP MST helpers. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/drm_dp_mst_topology.c | 55 +-- 1 file changed, 44 insertions(+), 11 d

[PATCH v2 07/16] drm/amdgpu/display: Keep malloc ref to MST port

2018-12-19 Thread Lyude Paul
at assignment that I can see anyway. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/driver

[PATCH v2 02/16] drm/dp_mst: Introduce new refcounting scheme for mstbs and ports

2018-12-19 Thread Lyude Paul
name drm_dp_mst_topology_get_(port|mstb)() -> drm_dp_mst_topology_try_get_(port|mstb)() and drm_dp_mst_topology_ref_(port|mstb)() -> drm_dp_mst_topology_get_(port|mstb)() - danvet * s/should/must in docs - danvet * WARN_ON(refcount == 0) in topology_get_(mstb|port) - danvet * Move kdocs for mstb/port struc

[PATCH v2 15/16] drm/dp_mst: Check payload count in drm_dp_mst_atomic_check()

2018-12-19 Thread Lyude Paul
It occurred to me that we never actually check this! So let's start doing that. Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/drm_dp_mst_topology.c | 11 +++ 1 file changed, 7 inser

[PATCH v2 08/16] drm/nouveau: Remove bogus cleanup in nv50_mstm_add_connector()

2018-12-19 Thread Lyude Paul
Trying to destroy the connector using mstc->connector.funcs->destroy() if connector initialization fails is wrong: there is no possible codepath in nv50_mstc_new where nv50_mstm_add_connector() would return <0 and mstc would be non-NULL. Signed-off-by: Lyude Paul Cc: Daniel Vetter

[PATCH v2 05/16] drm/dp_mst: Fix payload deallocation on hotplugs using malloc refs

2018-12-19 Thread Lyude Paul
t the ports are still valid and in the topology, any port which has an allocated payload will remain allocated in memory until it's payloads have been removed - finally allowing us to actually release said payloads correctly. Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: David Airli

[PATCH v2 14/16] drm/dp_mst: Start tracking per-port VCPI allocations

2018-12-19 Thread Lyude Paul
prevent us from incorrectly considering their bandwidth requirements alongside legitimate new payloads. - Add function references in drm_dp_atomic_release_vcpi_slots() - danvet - Annotate atomic VCPI and atomic check functions with __must_check - danvet Changes since v1: - Don't use the

[PATCH v2 16/16] drm/nouveau: Use atomic VCPI helpers for MST

2018-12-19 Thread Lyude Paul
equirements for drm_dp_atomic_find_vcpi_slots() and drm_dp_atomic_release_vcpi_slots() Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 52 ++--- 1 file changed, 46 i

[PATCH v2 04/16] drm/dp_mst: Stop releasing VCPI when removing ports from topology

2018-12-19 Thread Lyude Paul
This has never actually worked, and isn't needed anyway: the driver's always going to try to deallocate VCPI when it tears down the display that the VCPI belongs to. Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc:

[PATCH v2 13/16] drm/dp_mst: Add some atomic state iterator macros

2018-12-19 Thread Lyude Paul
Changes since v6: - Move EXPORT_SYMBOL() for drm_dp_mst_topology_state_funcs to this commit - Document __drm_dp_mst_state_iter_get() and note that it shouldn't be called directly Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentlan

[PATCH v2 11/16] drm/nouveau: Stop unsetting mstc->port, use malloc refs

2018-12-19 Thread Lyude Paul
Same as we did for i915, but for nouveau this time. Additionally, we grab a malloc reference to the port that lasts for the entire lifetime of nv50_mstc, which gives us the guarantee that mstc->port will always point to valid memory for as long as the mstc stays around. Signed-off-by: Lyude P

[PATCH v2 06/16] drm/i915: Keep malloc references to MST ports

2018-12-19 Thread Lyude Paul
port - danvet Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/i915/intel_connector.c | 4 drivers/gpu/drm/i915/intel_dp_mst.c| 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_c

[PATCH v2 09/16] drm/nouveau: Remove unnecessary VCPI checks in nv50_msto_cleanup()

2018-12-19 Thread Lyude Paul
his code in the future, use msto->disabled instead to check whether or not we need to deallocate VCPI instead. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 15 +-- 1 fi

[PATCH v2 12/16] drm/nouveau: Grab payload lock in nv50_msto_payload()

2018-12-19 Thread Lyude Paul
Going through the currently programmed payloads isn't safe without holding mgr->payload_lock, so actually do that and warn if anyone tries calling nv50_msto_payload() in the future without grabbing the right locks. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry

[PATCH v2 10/16] drm/nouveau: Keep malloc references to MST ports

2018-12-19 Thread Lyude Paul
mstc->port could technically be pointing at freed memory. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/nouveau

[PATCH v3 03/16] drm/dp_mst: Restart last_connected_port_and_mstb() if topology ref fails

2019-01-02 Thread Lyude Paul
ecovery handling for VCPI allocations in the rest of the DP MST helpers. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/drm_dp_mst_topology.c | 54 ++- 1 file changed, 44 insertions(+), 10 d

[PATCH v3 04/16] drm/dp_mst: Stop releasing VCPI when removing ports from topology

2019-01-02 Thread Lyude Paul
This has never actually worked, and isn't needed anyway: the driver's always going to try to deallocate VCPI when it tears down the display that the VCPI belongs to. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- d

[PATCH v3 07/16] drm/amdgpu/display: Keep malloc ref to MST port

2019-01-02 Thread Lyude Paul
at assignment that I can see anyway. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/driver

[PATCH v3 13/16] drm/dp_mst: Add some atomic state iterator macros

2019-01-02 Thread Lyude Paul
Changes since v6: - Move EXPORT_SYMBOL() for drm_dp_mst_topology_state_funcs to this commit - Document __drm_dp_mst_state_iter_get() and note that it shouldn't be called directly Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentlan

[PATCH v3 02/16] drm/dp_mst: Introduce new refcounting scheme for mstbs and ports

2019-01-02 Thread Lyude Paul
n docs - danvet * WARN_ON(refcount == 0) in topology_get_(mstb|port) - danvet * Move kdocs for mstb/port structs inline - danvet * Split drm_dp_get_last_connected_port_and_mstb() changes into their own commit - danvet Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston

[PATCH v3 12/16] drm/nouveau: Grab payload lock in nv50_msto_payload()

2019-01-02 Thread Lyude Paul
Going through the currently programmed payloads isn't safe without holding mgr->payload_lock, so actually do that and warn if anyone tries calling nv50_msto_payload() in the future without grabbing the right locks. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry

[PATCH v3 00/16] MST refcounting/atomic helpers cleanup

2019-01-02 Thread Lyude Paul
good place to start off for now :). Lyude Paul (16): drm/dp_mst: Rename drm_dp_mst_get_validated_(port|mstb)_ref and friends drm/dp_mst: Introduce new refcounting scheme for mstbs and ports drm/dp_mst: Restart last_connected_port_and_mstb() if topology ref fails drm/dp_mst: Stop

[PATCH v3 10/16] drm/nouveau: Keep malloc references to MST ports

2019-01-02 Thread Lyude Paul
mstc->port could technically be pointing at freed memory. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/nouveau

[PATCH v3 11/16] drm/nouveau: Stop unsetting mstc->port, use malloc refs

2019-01-02 Thread Lyude Paul
Same as we did for i915, but for nouveau this time. Additionally, we grab a malloc reference to the port that lasts for the entire lifetime of nv50_mstc, which gives us the guarantee that mstc->port will always point to valid memory for as long as the mstc stays around. Signed-off-by: Lyude P

[PATCH v3 08/16] drm/nouveau: Remove bogus cleanup in nv50_mstm_add_connector()

2019-01-02 Thread Lyude Paul
Trying to destroy the connector using mstc->connector.funcs->destroy() if connector initialization fails is wrong: there is no possible codepath in nv50_mstc_new where nv50_mstm_add_connector() would return <0 and mstc would be non-NULL. Signed-off-by: Lyude Paul Cc: Daniel Vetter

[PATCH v3 05/16] drm/dp_mst: Fix payload deallocation on hotplugs using malloc refs

2019-01-02 Thread Lyude Paul
t the ports are still valid and in the topology, any port which has an allocated payload will remain allocated in memory until it's payloads have been removed - finally allowing us to actually release said payloads correctly. Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: David Airli

[PATCH v3 06/16] drm/i915: Keep malloc references to MST ports

2019-01-02 Thread Lyude Paul
port - danvet Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/i915/intel_connector.c | 4 drivers/gpu/drm/i915/intel_dp_mst.c| 1 + 2 files changed, 5 insertions(+) diff --git a/drivers

[PATCH v3 01/16] drm/dp_mst: Rename drm_dp_mst_get_validated_(port|mstb)_ref and friends

2019-01-02 Thread Lyude Paul
, and will make even more sense once we redesign how the current refcounting scheme here works. Signed-off-by: Lyude Paul Reviewed-by: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/drm_dp_mst_topology.c | 114 ++ 1

[PATCH v3 09/16] drm/nouveau: Remove unnecessary VCPI checks in nv50_msto_cleanup()

2019-01-02 Thread Lyude Paul
his code in the future, use msto->disabled instead to check whether or not we need to deallocate VCPI instead. Signed-off-by: Lyude Paul Cc: Daniel Vetter Cc: David Airlie Cc: Jerry Zuo Cc: Harry Wentland Cc: Juston Li --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 15 +-- 1 fi

<    1   2   3   4   5   6   7   >