All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH xf86-video-intel 1/3] sna: Don't emit sse2 code where not wanted
@ 2022-04-21 12:46 Ville Syrjala
  2022-04-21 12:46 ` [Intel-gfx] [PATCH xf86-video-intel 2/3] sna: Dump fences also on -ENOBUFS Ville Syrjala
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ville Syrjala @ 2022-04-21 12:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: Chris Wilson

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Fix the s/push_options/pop_options/ pragma so that we don't
emit sse2 in the codepaths that run on non-sse2 machines as well.
Seems gcc has become much more aggressive in its sse2 usage
recently and I'm now hitting sse2 instructions in
choose_memcpy_tiled_x() on my non-sse2 P3 machine.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/blt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sna/blt.c b/src/sna/blt.c
index afc719f6dc8c..803c5142c726 100644
--- a/src/sna/blt.c
+++ b/src/sna/blt.c
@@ -631,7 +631,7 @@ memcpy_between_tiled_x__swizzle_0__sse2(const void *src, void *dst, int bpp,
 	}
 }
 
-#pragma GCC push_options
+#pragma GCC pop_options
 #endif
 
 fast void
-- 
2.35.1


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

* [Intel-gfx] [PATCH xf86-video-intel 2/3] sna: Dump fences also on -ENOBUFS
  2022-04-21 12:46 [Intel-gfx] [PATCH xf86-video-intel 1/3] sna: Don't emit sse2 code where not wanted Ville Syrjala
@ 2022-04-21 12:46 ` Ville Syrjala
  2022-04-21 12:46 ` [Intel-gfx] [PATCH xf86-video-intel 3/3] sna: Eliminate sna_mode_wants_tear_free() Ville Syrjala
  2022-04-21 16:11 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [xf86-video-intel,1/3] sna: Don't emit sse2 code where not wanted Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Ville Syrjala @ 2022-04-21 12:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: Chris Wilson

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Since kernel commit 78d2ad7eb4e1 ("drm/i915/gt: Fix
-EDEADLK handling regression") running out of fences
will result in -ENOBUFS instead of -EDEADLK (the latter
having been stolen by ww mutextes for their internal use).
Adjust the fence dumping to expect either errno value.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/kgem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 7b645da8da5f..ac0b61d54ec8 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4263,7 +4263,7 @@ void _kgem_submit(struct kgem *kgem)
 
 		if (ret == -ENOSPC)
 			dump_gtt_info(kgem);
-		if (ret == -EDEADLK)
+		if (ret == -EDEADLK || ret == -ENOBUFS)
 			dump_fence_regs(kgem);
 
 		if (DEBUG_SYNC) {
-- 
2.35.1


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

* [Intel-gfx] [PATCH xf86-video-intel 3/3] sna: Eliminate sna_mode_wants_tear_free()
  2022-04-21 12:46 [Intel-gfx] [PATCH xf86-video-intel 1/3] sna: Don't emit sse2 code where not wanted Ville Syrjala
  2022-04-21 12:46 ` [Intel-gfx] [PATCH xf86-video-intel 2/3] sna: Dump fences also on -ENOBUFS Ville Syrjala
@ 2022-04-21 12:46 ` Ville Syrjala
  2022-04-21 16:11 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [xf86-video-intel,1/3] sna: Don't emit sse2 code where not wanted Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Ville Syrjala @ 2022-04-21 12:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: Chris Wilson

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The modparam checks performed by sna_mode_wants_tear_free() don't
generally work when the server is running as a regular user. Hence
we can't rely on them to indicate whether FBC/PSR/etc is enabled.
Also the "Panel Self-Refresh" connector property doesn't actually
exist so we can nuke that part as well. Let's just nuke the whole
thing and assume we want dirtyfb always when tearfree is not enabled.

I'll anyway want to enable FBC by default across the board soonish
so the check wouldn't really buy us much (would just exclude i830
and a few old desktop chipsets which don't have FBC hardware).

Additionally if we don't have working dirtyfb we really should
enable tearfree by default because otherwise we're going to
get horrible lag due to missing frontbuffer flushes.

Without WC mmaps we could in theory rely on the hw gtt tracking
except the kernel no longer differentiates between GTT/WC/CPU
access in its software frontbuffer tracking code so it'll just
deactivate FBC even for a GTT mmap and potentially never re-enable
it due to the missing frontbuffer flush from dirtyfb. So dirtyfb
is always needed.

v2: Rebase due to ppgtt->tear free logic

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/sna.h         |  1 -
 src/sna/sna_display.c | 59 -------------------------------------------
 src/sna/sna_driver.c  |  9 ++-----
 3 files changed, 2 insertions(+), 67 deletions(-)

diff --git a/src/sna/sna.h b/src/sna/sna.h
index f2bc189624a5..5c92f649d054 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -458,7 +458,6 @@ struct sna {
 
 bool sna_mode_pre_init(ScrnInfoPtr scrn, struct sna *sna);
 bool sna_mode_fake_init(struct sna *sna, int num_fake);
-bool sna_mode_wants_tear_free(struct sna *sna);
 void sna_mode_adjust_frame(struct sna *sna, int x, int y);
 extern void sna_mode_discover(struct sna *sna, bool tell);
 extern void sna_mode_check(struct sna *sna);
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 874292bcab31..966ad9638a2a 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -7951,65 +7951,6 @@ bool sna_mode_pre_init(ScrnInfoPtr scrn, struct sna *sna)
 	return scrn->modes != NULL;
 }
 
-bool
-sna_mode_wants_tear_free(struct sna *sna)
-{
-	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
-	bool found = false;
-	FILE *file;
-	int i;
-
-	file = fopen("/sys/module/i915/parameters/enable_fbc", "r");
-	if (file) {
-		int fbc_enabled = 0;
-		int value;
-
-		if (fscanf(file, "%d", &value) == 1)
-			fbc_enabled = value > 0;
-		fclose(file);
-
-		DBG(("%s: module parameter 'enable_fbc' enabled? %d\n",
-		     __FUNCTION__, fbc_enabled));
-
-		if (fbc_enabled)
-			return true;
-	}
-
-	for (i = 0; i < sna->mode.num_real_output; i++) {
-		struct sna_output *output = to_sna_output(config->output[i]);
-		int id = find_property(sna, output, "Panel Self-Refresh");
-		if (id == -1)
-			continue;
-
-		found = true;
-		if (output->prop_values[id] != -1) {
-			DBG(("%s: Panel Self-Refresh detected on %s\n",
-			     __FUNCTION__, config->output[i]->name));
-			return true;
-		}
-	}
-
-	if (!found) {
-		file = fopen("/sys/module/i915/parameters/enable_psr", "r");
-		if (file) {
-			int psr_enabled = 0;
-			int value;
-
-			if (fscanf(file, "%d", &value) == 1)
-				psr_enabled = value > 0;
-			fclose(file);
-
-			DBG(("%s: module parameter 'enable_psr' enabled? %d\n",
-			     __FUNCTION__, psr_enabled));
-
-			if (psr_enabled)
-				return true;
-		}
-	}
-
-	return false;
-}
-
 void
 sna_mode_set_primary(struct sna *sna)
 {
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index d810b262b452..15c133cfdc02 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -469,12 +469,7 @@ static bool enable_tear_free(struct sna *sna)
 	if (sna->kgem.has_full_ppgtt)
 		return true;
 
-	/*
-	 * Under certain conditions, we should enable TearFree by default,
-	 * for example when the hardware requires pageflipping to run within
-	 * its power/performance budget.
-	 */
-	if (sna_mode_wants_tear_free(sna))
+	if (!sna->kgem.has_dirtyfb)
 		return true;
 
 	return ENABLE_TEAR_FREE;
@@ -674,7 +669,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int probe)
 	}
 	scrn->currentMode = scrn->modes;
 
-	if (!setup_tear_free(sna) && sna_mode_wants_tear_free(sna))
+	if (!setup_tear_free(sna))
 		sna->kgem.needs_dirtyfb = sna->kgem.has_dirtyfb;
 
 	xf86SetGamma(scrn, zeros);
-- 
2.35.1


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

* [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [xf86-video-intel,1/3] sna: Don't emit sse2 code where not wanted
  2022-04-21 12:46 [Intel-gfx] [PATCH xf86-video-intel 1/3] sna: Don't emit sse2 code where not wanted Ville Syrjala
  2022-04-21 12:46 ` [Intel-gfx] [PATCH xf86-video-intel 2/3] sna: Dump fences also on -ENOBUFS Ville Syrjala
  2022-04-21 12:46 ` [Intel-gfx] [PATCH xf86-video-intel 3/3] sna: Eliminate sna_mode_wants_tear_free() Ville Syrjala
@ 2022-04-21 16:11 ` Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2022-04-21 16:11 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: series starting with [xf86-video-intel,1/3] sna: Don't emit sse2 code where not wanted
URL   : https://patchwork.freedesktop.org/series/102925/
State : failure

== Summary ==

Error: patch https://patchwork.freedesktop.org/api/1.0/series/102925/revisions/1/mbox/ not applied
Applying: sna: Don't emit sse2 code where not wanted
error: sha1 information is lacking or useless (src/sna/blt.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 sna: Don't emit sse2 code where not wanted
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".



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

end of thread, other threads:[~2022-04-21 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 12:46 [Intel-gfx] [PATCH xf86-video-intel 1/3] sna: Don't emit sse2 code where not wanted Ville Syrjala
2022-04-21 12:46 ` [Intel-gfx] [PATCH xf86-video-intel 2/3] sna: Dump fences also on -ENOBUFS Ville Syrjala
2022-04-21 12:46 ` [Intel-gfx] [PATCH xf86-video-intel 3/3] sna: Eliminate sna_mode_wants_tear_free() Ville Syrjala
2022-04-21 16:11 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [xf86-video-intel,1/3] sna: Don't emit sse2 code where not wanted Patchwork

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.