From: Daniel Dadap <ddadap@nvidia.com> To: <dri-devel@lists.freedesktop.org>, <lukas@wunner.de>, <intel-gfx@lists.freedesktop.org>, <jani.nikula@linux.intel.com>, <joonas.lahtinen@linux.intel.com>, <rodrigo.vivi@intel.com> Cc: Daniel Dadap <ddadap@nvidia.com> Subject: [PATCH 4/6] i915: implement vga-switcheroo reprobe() callback Date: Mon, 27 Jul 2020 15:51:10 -0500 [thread overview] Message-ID: <20200727205112.27698-5-ddadap@nvidia.com> (raw) In-Reply-To: <20200727205112.27698-1-ddadap@nvidia.com> Add a vga-switcheroo callback for reprobing displays. Use this new callback to retrain the link on all DP encoders after a mux switch. Signed-off-by: Daniel Dadap <ddadap@nvidia.com> --- drivers/gpu/drm/i915/i915_switcheroo.c | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_switcheroo.c b/drivers/gpu/drm/i915/i915_switcheroo.c index ed69b5d4a375..fa388de03cf6 100644 --- a/drivers/gpu/drm/i915/i915_switcheroo.c +++ b/drivers/gpu/drm/i915/i915_switcheroo.c @@ -7,6 +7,8 @@ #include "i915_drv.h" #include "i915_switcheroo.h" +#include "display/intel_display_types.h" +#include "display/intel_dp.h" static void i915_switcheroo_set_state(struct pci_dev *pdev, enum vga_switcheroo_state state) @@ -46,9 +48,32 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev) return i915 && atomic_read(&i915->drm.open_count) == 0; } +static void i915_switcheroo_reprobe(struct pci_dev *pdev) +{ + struct drm_i915_private *i915 = pdev_to_i915(pdev); + struct intel_encoder *encoder; + + for_each_intel_dp(&i915->drm, encoder) { + int ret = -EDEADLK; + struct drm_modeset_acquire_ctx ctx; + + drm_modeset_acquire_init(&ctx, 0); + + while (ret == -EDEADLK) { + ret = intel_dp_retrain_link(encoder, &ctx); + + if (ret == -EDEADLK) + drm_modeset_backoff(&ctx); + } + + drm_modeset_drop_locks(&ctx); + drm_modeset_acquire_fini(&ctx); + } +} + static const struct vga_switcheroo_client_ops i915_switcheroo_ops = { .set_gpu_state = i915_switcheroo_set_state, - .reprobe = NULL, + .reprobe = i915_switcheroo_reprobe, .can_switch = i915_switcheroo_can_switch, }; -- 2.18.4 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Dadap <ddadap@nvidia.com> To: <dri-devel@lists.freedesktop.org>, <lukas@wunner.de>, <intel-gfx@lists.freedesktop.org>, <jani.nikula@linux.intel.com>, <joonas.lahtinen@linux.intel.com>, <rodrigo.vivi@intel.com> Cc: Daniel Dadap <ddadap@nvidia.com> Subject: [Intel-gfx] [PATCH 4/6] i915: implement vga-switcheroo reprobe() callback Date: Mon, 27 Jul 2020 15:51:10 -0500 [thread overview] Message-ID: <20200727205112.27698-5-ddadap@nvidia.com> (raw) In-Reply-To: <20200727205112.27698-1-ddadap@nvidia.com> Add a vga-switcheroo callback for reprobing displays. Use this new callback to retrain the link on all DP encoders after a mux switch. Signed-off-by: Daniel Dadap <ddadap@nvidia.com> --- drivers/gpu/drm/i915/i915_switcheroo.c | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_switcheroo.c b/drivers/gpu/drm/i915/i915_switcheroo.c index ed69b5d4a375..fa388de03cf6 100644 --- a/drivers/gpu/drm/i915/i915_switcheroo.c +++ b/drivers/gpu/drm/i915/i915_switcheroo.c @@ -7,6 +7,8 @@ #include "i915_drv.h" #include "i915_switcheroo.h" +#include "display/intel_display_types.h" +#include "display/intel_dp.h" static void i915_switcheroo_set_state(struct pci_dev *pdev, enum vga_switcheroo_state state) @@ -46,9 +48,32 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev) return i915 && atomic_read(&i915->drm.open_count) == 0; } +static void i915_switcheroo_reprobe(struct pci_dev *pdev) +{ + struct drm_i915_private *i915 = pdev_to_i915(pdev); + struct intel_encoder *encoder; + + for_each_intel_dp(&i915->drm, encoder) { + int ret = -EDEADLK; + struct drm_modeset_acquire_ctx ctx; + + drm_modeset_acquire_init(&ctx, 0); + + while (ret == -EDEADLK) { + ret = intel_dp_retrain_link(encoder, &ctx); + + if (ret == -EDEADLK) + drm_modeset_backoff(&ctx); + } + + drm_modeset_drop_locks(&ctx); + drm_modeset_acquire_fini(&ctx); + } +} + static const struct vga_switcheroo_client_ops i915_switcheroo_ops = { .set_gpu_state = i915_switcheroo_set_state, - .reprobe = NULL, + .reprobe = i915_switcheroo_reprobe, .can_switch = i915_switcheroo_can_switch, }; -- 2.18.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-07-27 23:33 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <ba78cd19-45ad-b17e-5174-256cc11f36c2%40nvidia.com> 2020-07-27 20:51 ` [PATCH 0/6] vga-switcheroo: initial dynamic mux switch support Daniel Dadap 2020-07-27 20:51 ` [Intel-gfx] " Daniel Dadap 2020-07-27 20:51 ` [PATCH 1/6] vga-switcheroo: add new "immediate" switch event type Daniel Dadap 2020-07-27 20:51 ` [Intel-gfx] " Daniel Dadap 2020-07-27 20:51 ` [PATCH 2/6] vga-switcheroo: Add a way to test for the active client Daniel Dadap 2020-07-27 20:51 ` [Intel-gfx] " Daniel Dadap 2020-07-27 20:51 ` [PATCH 3/6] vga-switcheroo: notify clients of pending/completed switch events Daniel Dadap 2020-07-27 20:51 ` [Intel-gfx] " Daniel Dadap 2020-07-27 20:51 ` Daniel Dadap [this message] 2020-07-27 20:51 ` [Intel-gfx] [PATCH 4/6] i915: implement vga-switcheroo reprobe() callback Daniel Dadap 2020-07-27 20:51 ` [PATCH 5/6] i915: fail atomic commit when muxed away Daniel Dadap 2020-07-27 20:51 ` [Intel-gfx] " Daniel Dadap 2020-07-27 20:51 ` [PATCH 6/6] i915: bail out of eDP link training while mux-switched away Daniel Dadap 2020-07-27 20:51 ` [Intel-gfx] " Daniel Dadap 2020-07-28 9:32 ` [Intel-gfx] [PATCH 0/6] vga-switcheroo: initial dynamic mux switch support daniel 2020-07-28 9:32 ` daniel 2020-07-27 22:05 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] vga-switcheroo: add new "immediate" switch event type Patchwork 2020-07-27 22:06 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork 2020-07-27 22:36 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork 2020-07-28 0:45 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
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=20200727205112.27698-5-ddadap@nvidia.com \ --to=ddadap@nvidia.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=intel-gfx@lists.freedesktop.org \ --cc=jani.nikula@linux.intel.com \ --cc=joonas.lahtinen@linux.intel.com \ --cc=lukas@wunner.de \ --cc=rodrigo.vivi@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.