All of lore.kernel.org
 help / color / mirror / Atom feed
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 5/6] i915: fail atomic commit when muxed away
Date: Mon, 27 Jul 2020 15:51:11 -0500	[thread overview]
Message-ID: <20200727205112.27698-6-ddadap@nvidia.com> (raw)
In-Reply-To: <20200727205112.27698-1-ddadap@nvidia.com>

Attempting to commit a modeset while mux-switched away can cause
problems due to DisplayPort links being unavailable while they are
physically disconnected. In order to avoid this, bail out of atomic
commit early if attempted while a display mux is switched away.

Signed-off-by: Daniel Dadap <ddadap@nvidia.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 346846609f45..4ad799e4b024 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/dma-resv.h>
 #include <linux/slab.h>
+#include <linux/vga_switcheroo.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -15736,6 +15737,12 @@ static int intel_atomic_commit(struct drm_device *dev,
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	int ret = 0;
 
+	if (!vga_switcheroo_is_client_active(to_pci_dev(dev->dev))) {
+		drm_dbg_atomic(&dev_priv->drm,
+			"Atomic commit attempted while muxed away.\n");
+		return -EINVAL;
+	}
+
 	state->wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
 
 	drm_atomic_state_get(&state->base);
-- 
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 5/6] i915: fail atomic commit when muxed away
Date: Mon, 27 Jul 2020 15:51:11 -0500	[thread overview]
Message-ID: <20200727205112.27698-6-ddadap@nvidia.com> (raw)
In-Reply-To: <20200727205112.27698-1-ddadap@nvidia.com>

Attempting to commit a modeset while mux-switched away can cause
problems due to DisplayPort links being unavailable while they are
physically disconnected. In order to avoid this, bail out of atomic
commit early if attempted while a display mux is switched away.

Signed-off-by: Daniel Dadap <ddadap@nvidia.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 346846609f45..4ad799e4b024 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/dma-resv.h>
 #include <linux/slab.h>
+#include <linux/vga_switcheroo.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -15736,6 +15737,12 @@ static int intel_atomic_commit(struct drm_device *dev,
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	int ret = 0;
 
+	if (!vga_switcheroo_is_client_active(to_pci_dev(dev->dev))) {
+		drm_dbg_atomic(&dev_priv->drm,
+			"Atomic commit attempted while muxed away.\n");
+		return -EINVAL;
+	}
+
 	state->wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
 
 	drm_atomic_state_get(&state->base);
-- 
2.18.4

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

  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   ` [PATCH 4/6] i915: implement vga-switcheroo reprobe() callback 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 5/6] i915: fail atomic commit when muxed away 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-6-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: link
Be 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.