Skip to contentSkip to conversation

sna: Don't emit sse2 code where not wanted

PATCH New Ville Syrjala 2 participants 4 messages Apr 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 sna: Don't emit sse2 code where not wanted

From: Ville Syrjälä <[email protected]>

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.

---
 src/sna/blt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/sna/blt.c +1 -1
index afc719f6dc8c..803c5142c726 100644
@@ -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
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/3 sna: Dump fences also on -ENOBUFS

From: Ville Syrjälä <[email protected]>

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.

---
 src/sna/kgem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/sna/kgem.c +1 -1
index 7b645da8da5f..ac0b61d54ec8 100644
@@ -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) {
Signature · 1 line
2.35.1
#2 lore raw

PATCH 3/3 sna: Eliminate sna_mode_wants_tear_free()

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

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

---
 src/sna/sna.h         |  1 -
 src/sna/sna_display.c | 59 -------------------------------------------
 src/sna/sna_driver.c  |  9 ++-----
 3 files changed, 2 insertions(+), 67 deletions(-)
src/sna/sna.h +0 -1
index f2bc189624a5..5c92f649d054 100644
@@ -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);
src/sna/sna_display.c +0 -59

65 lines not on this page · raw message

src/sna/sna_driver.c +2 -7
index d810b262b452..15c133cfdc02 100644
@@ -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);
Signature · 1 line
2.35.1
#3 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [xf86-video-intel,1/3] sna: Don't emit sse2 code where not wanted

In reply to Ville Syrjala
== Series Details ==

== 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".