All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [RFC v2 00/20] drm/dp, i915, nouveau: Cleanup nouveau HPD and add DP features from i915
@ 2020-08-20 18:29 ` Lyude Paul
  0 siblings, 0 replies; 104+ messages in thread
From: Lyude Paul @ 2020-08-20 18:29 UTC (permalink / raw)
  To: dri-devel, intel-gfx, nouveau

To start off: this patch series is less work to review then it looks -
most (but not all) of the nouveau related work has already been reviewed
elsewhere. Most of the reason I'm asking for an RFC here is because this
code pulls a lot of code out of i915 and into shared DP helpers.

Anyway-nouveau's HPD related code has been collecting dust for a while.
Other then the occasional runtime PM related and MST related fixes,
we're missing a lot of nice things that have been added to DRM since
this was originally written. Additionally, the code is just really
unoptimized in general:

* We handle connector probing in the same context that we handle short
  IRQs in for DP, which means connector probing could potentially block
  ESI handling for MST
* When we receive a hotplug event from a connector, we reprobe every
  single connector instead of just the connector that was hotplugged
* Additionally because of the above reason, combined with the fact I had
  the bad idea of reusing some of the MST locks when I last rewrote
  nouveau's DP MST detection, trying to handle any other events that
  require short HPD IRQs is a bit awkward to actually implement.
* We don't actually properly check whether EDIDs change or not when
  reprobing, which means we basically send out a hotplug event every
  single time we receive one even if nothing has changed

Additionally, the code for handling DP that we have in nouveau is also
quite unoptimized in general, doesn't use a lot of helpers that have
been added since it was written, and is also missing quite a number of
features:

* Downstream port capability probing
* Extended DPRX cap parsing
* SINK_COUNT handling for hpd on dongles

Luckily for us - all of these are implemented in i915 already. Since
there's no reason for us to reinvent the wheel, and having more shared
code is always nice, I decided to take the opportunity to extract the
code for all of these features from i915 into a set of core DP helpers,
which both i915 and nouveau (and hopefully other drivers in the future)
can use.

As well, this patch series also addesses the other general
connector probing related issues I mentioned above, along with rewriting
how we handle MST probing so we don't hit any surprise locking design
issues in the future.

As a note - most of this work is motivated by the fact that I'm
planning on adding max_bpc/output_bpc prop support, DSC support (for
both MST and SST, along with proper helpers for handling bandwidth
limitations and DSC), and fallback link retraining. I figured I might as
clean this code up and implement missing DP features like the ones
mentioned here before moving on to those tasks.

Also, I'm intending for this patch series to get merged through
drm-misc-next. Once that happens, upstream maintainers will probably
have an easier time with merging if they pull the pending patches for
nouveau from Ben's tree before merging drm-misc-next.

Lyude Paul (20):
  drm/nouveau/kms: Fix some indenting in nouveau_dp_detect()
  drm/nouveau/kms/nv50-: Remove open-coded drm_dp_read_desc()
  drm/nouveau/kms/nv50-: Just use drm_dp_dpcd_read() in nouveau_dp.c
  drm/nouveau/kms/nv50-: Use macros for DP registers in nouveau_dp.c
  drm/nouveau/kms: Don't clear DP_MST_CTRL DPCD in nv50_mstm_new()
  drm/nouveau/kms: Search for encoders' connectors properly
  drm/nouveau/kms/nv50-: Use drm_dp_dpcd_(readb|writeb)() in
    nv50_sor_disable()
  drm/nouveau/kms/nv50-: Refactor and cleanup DP HPD handling
  drm/i915/dp: Extract drm_dp_has_mst()
  drm/nouveau/kms: Use new drm_dp_has_mst() helper for checking MST caps
  drm/nouveau/kms: Move drm_dp_cec_unset_edid() into
    nouveau_connector_detect()
  drm/nouveau/kms: Only use hpd_work for reprobing in HPD paths
  drm/i915/dp: Extract drm_dp_downstream_read_info()
  drm/nouveau/kms/nv50-: Use downstream DP clock limits for mode
    validation
  drm/i915/dp: Extract drm_dp_has_sink_count()
  drm/i915/dp: Extract drm_dp_get_sink_count()
  drm/nouveau/kms/nv50-: Add support for DP_SINK_COUNT
  drm/nouveau/kms: Don't change EDID when it hasn't actually changed
  drm/i915/dp: Extract drm_dp_read_dpcd_caps()
  drm/nouveau/kms: Start using drm_dp_read_dpcd_caps()

 drivers/gpu/drm/drm_dp_helper.c             | 167 +++++++++++
 drivers/gpu/drm/i915/display/intel_dp.c     | 124 ++------
 drivers/gpu/drm/i915/display/intel_dp.h     |   1 -
 drivers/gpu/drm/i915/display/intel_lspcon.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv04/dac.c      |   2 +-
 drivers/gpu/drm/nouveau/dispnv04/dfp.c      |   7 +-
 drivers/gpu/drm/nouveau/dispnv04/disp.c     |  24 +-
 drivers/gpu/drm/nouveau/dispnv04/disp.h     |   4 +
 drivers/gpu/drm/nouveau/dispnv04/tvnv04.c   |   2 +-
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c   |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c     | 306 +++++++++++---------
 drivers/gpu/drm/nouveau/nouveau_connector.c | 132 ++++-----
 drivers/gpu/drm/nouveau/nouveau_connector.h |   1 +
 drivers/gpu/drm/nouveau/nouveau_display.c   |  72 ++++-
 drivers/gpu/drm/nouveau/nouveau_display.h   |   3 +-
 drivers/gpu/drm/nouveau/nouveau_dp.c        | 211 +++++++++++---
 drivers/gpu/drm/nouveau/nouveau_drm.c       |   4 +-
 drivers/gpu/drm/nouveau/nouveau_drv.h       |   2 +
 drivers/gpu/drm/nouveau/nouveau_encoder.h   |  48 ++-
 include/drm/drm_dp_helper.h                 |  15 +-
 include/drm/drm_dp_mst_helper.h             |  22 ++
 21 files changed, 760 insertions(+), 391 deletions(-)

-- 
2.26.2

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

^ permalink raw reply	[flat|nested] 104+ messages in thread
* Re: [Intel-gfx] [RFC v2 08/20] drm/nouveau/kms/nv50-: Refactor and cleanup DP HPD handling
@ 2020-08-21 13:41 kernel test robot
  0 siblings, 0 replies; 104+ messages in thread
From: kernel test robot @ 2020-08-21 13:41 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 5732 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200820183012.288794-9-lyude@redhat.com>
References: <20200820183012.288794-9-lyude@redhat.com>
TO: Lyude Paul <lyude@redhat.com>

Hi Lyude,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on tegra-drm/drm/tegra/for-next linus/master drm-exynos/exynos-drm-next v5.9-rc1 next-20200821]
[cannot apply to drm-intel/for-linux-next drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lyude-Paul/drm-dp-i915-nouveau-Cleanup-nouveau-HPD-and-add-DP-features-from-i915/20200821-023327
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago
config: i386-randconfig-m021-20200820 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/gpu/drm/nouveau/dispnv50/disp.c:1479 nv50_mstm_detect() warn: variable dereferenced before check 'mstm' (see line 1476)

Old smatch warnings:
drivers/gpu/drm/nouveau/dispnv50/disp.c:608 nv50_audio_component_get_eld() error: uninitialized symbol 'nv_connector'.
drivers/gpu/drm/nouveau/dispnv50/disp.c:2368 nv50_disp_outp_atomic_check_clr() warn: passing a valid pointer to 'PTR_ERR'
drivers/gpu/drm/nouveau/dispnv50/disp.c:2397 nv50_disp_outp_atomic_check_set() warn: passing a valid pointer to 'PTR_ERR'

# https://github.com/0day-ci/linux/commit/109d9a087027ecc3ebfe557f16a0efc8a7caa9eb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Lyude-Paul/drm-dp-i915-nouveau-Cleanup-nouveau-HPD-and-add-DP-features-from-i915/20200821-023327
git checkout 109d9a087027ecc3ebfe557f16a0efc8a7caa9eb
vim +/mstm +1479 drivers/gpu/drm/nouveau/dispnv50/disp.c

52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1471  
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1472  int
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1473  nv50_mstm_detect(struct nouveau_encoder *outp)
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1474  {
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1475  	struct nv50_mstm *mstm = outp->dp.mstm;
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20 @1476  	struct drm_dp_aux *aux = mstm->mgr.aux;
b26b4590dd53e01 drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2018-08-09  1477  	int ret;
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1478  
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20 @1479  	if (!mstm || !mstm->can_mst)
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1480  		return 0;
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1481  
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1482  	/* Clear any leftover MST state we didn't set ourselves by first
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1483  	 * disabling MST if it was already enabled
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1484  	 */
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1485  	ret = drm_dp_dpcd_writeb(aux, DP_MSTM_CTRL, 0);
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1486  	if (ret < 0)
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1487  		return ret;
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1488  
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1489  	/* And start enabling */
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1490  	ret = nv50_mstm_enable(mstm, true);
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1491  	if (ret)
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1492  		return ret;
b26b4590dd53e01 drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2018-08-09  1493  
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1494  	ret = drm_dp_mst_topology_mgr_set_mst(&mstm->mgr, true);
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1495  	if (ret) {
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1496  		nv50_mstm_enable(mstm, false);
b26b4590dd53e01 drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2018-08-09  1497  		return ret;
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1498  	}
52aa30f2524d065 drivers/gpu/drm/nouveau/nv50_display.c  Ben Skeggs 2016-11-04  1499  
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1500  	mstm->is_mst = true;
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1501  	return 1;
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1502  }
109d9a087027ecc drivers/gpu/drm/nouveau/dispnv50/disp.c Lyude Paul 2020-08-20  1503  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39208 bytes --]

^ permalink raw reply	[flat|nested] 104+ messages in thread

end of thread, other threads:[~2020-08-24 11:14 UTC | newest]

Thread overview: 104+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-20 18:29 [Intel-gfx] [RFC v2 00/20] drm/dp, i915, nouveau: Cleanup nouveau HPD and add DP features from i915 Lyude Paul
2020-08-20 18:29 ` Lyude Paul
2020-08-20 18:29 ` Lyude Paul
2020-08-20 18:29 ` [Intel-gfx] [RFC v2 01/20] drm/nouveau/kms: Fix some indenting in nouveau_dp_detect() Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29 ` [Intel-gfx] [RFC v2 02/20] drm/nouveau/kms/nv50-: Remove open-coded drm_dp_read_desc() Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29 ` [Intel-gfx] [RFC v2 03/20] drm/nouveau/kms/nv50-: Just use drm_dp_dpcd_read() in nouveau_dp.c Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29 ` [Intel-gfx] [RFC v2 04/20] drm/nouveau/kms/nv50-: Use macros for DP registers " Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29 ` [Intel-gfx] [RFC v2 05/20] drm/nouveau/kms: Don't clear DP_MST_CTRL DPCD in nv50_mstm_new() Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29 ` [Intel-gfx] [RFC v2 06/20] drm/nouveau/kms: Search for encoders' connectors properly Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-21 12:10   ` Dan Carpenter
2020-08-21 12:10     ` Dan Carpenter
2020-08-21 17:48   ` [Intel-gfx] [RFC v3] " Lyude Paul
2020-08-21 17:48     ` Lyude Paul
2020-08-21 17:48     ` Lyude Paul
2020-08-21 17:48     ` Lyude Paul
2020-08-20 18:29 ` [Intel-gfx] [RFC v2 07/20] drm/nouveau/kms/nv50-: Use drm_dp_dpcd_(readb|writeb)() in nv50_sor_disable() Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:29   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 08/20] drm/nouveau/kms/nv50-: Refactor and cleanup DP HPD handling Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-24 11:14   ` [Intel-gfx] " Dan Carpenter
2020-08-24 11:14     ` Dan Carpenter
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 09/20] drm/i915/dp: Extract drm_dp_has_mst() Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 10/20] drm/nouveau/kms: Use new drm_dp_has_mst() helper for checking MST caps Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 11/20] drm/nouveau/kms: Move drm_dp_cec_unset_edid() into nouveau_connector_detect() Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 12/20] drm/nouveau/kms: Only use hpd_work for reprobing in HPD paths Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 13/20] drm/i915/dp: Extract drm_dp_downstream_read_info() Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-21 19:27   ` [Intel-gfx] " Sean Paul
2020-08-21 19:27     ` Sean Paul
2020-08-21 19:27     ` Sean Paul
2020-08-21 19:27     ` Sean Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 14/20] drm/nouveau/kms/nv50-: Use downstream DP clock limits for mode validation Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 15/20] drm/i915/dp: Extract drm_dp_has_sink_count() Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 16/20] drm/i915/dp: Extract drm_dp_get_sink_count() Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 17/20] drm/nouveau/kms/nv50-: Add support for DP_SINK_COUNT Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 18/20] drm/nouveau/kms: Don't change EDID when it hasn't actually changed Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 19/20] drm/i915/dp: Extract drm_dp_read_dpcd_caps() Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30 ` [Intel-gfx] [RFC v2 20/20] drm/nouveau/kms: Start using drm_dp_read_dpcd_caps() Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 18:30   ` Lyude Paul
2020-08-20 19:11 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/dp, i915, nouveau: Cleanup nouveau HPD and add DP features from i915 (rev4) Patchwork
2020-08-20 19:12 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-08-20 19:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-08-21  5:16 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-08-21 17:57 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/dp, i915, nouveau: Cleanup nouveau HPD and add DP features from i915 (rev5) Patchwork
2020-08-21 17:58 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-08-21 18:13 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-08-21 20:38 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2020-08-21 13:41 [Intel-gfx] [RFC v2 08/20] drm/nouveau/kms/nv50-: Refactor and cleanup DP HPD handling kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.