Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jan 2024 08:06:27 +0000
From:      bugzilla-noreply@freebsd.org
To:        x11@FreeBSD.org
Subject:   [Bug 267606] x11-drivers/xf86-video-nv: Segmentation Fault post update from 1.20.14,1 to 21.1.4
Message-ID:  <bug-267606-7141-thQV9P0sxO@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-267606-7141@https.bugs.freebsd.org/bugzilla/>
References:  <bug-267606-7141@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267606

--- Comment #49 from Yusuf Khan <yusisamerican@gmail.com> ---
(In reply to Sergiy from comment #48)
I think I will have to work on it myself on hardware as I dont have enough X
knowledge to do this without a high amount of trial and error. Your OpenBSD
logs are showing that your pruning more than just bad panel dimensions(whic=
h I
probably should have expected), so the small hack job diff I sent you last =
time
wont work.

As you seem to have emptied your OpenBSD drive, I have a diff that is simply
just what the intel driver uses to do it but its *simply copied code from t=
he
intel driver* and is by *no means recommended to use on your computer* due =
to
my inexperience with X. I will hopefully get hardware to test this later on=
 and
fix it up.

The bellow is a diff that should, if the above warnings are read, be run
without any other modifications to mode validation.

>From 6f0ec68b9fc4c0f062e483a96665fbcb378408ea Mon Sep 17 00:00:00 2001
From: Yusuf Khan <yusisamerican@gmail.com>
Date: Mon, 29 Jan 2024 23:52:34 -0800
Subject: [PATCH xf86-video-nv] Intel import fix

---
 src/nv_driver.c | 41 +++++++++++++++++++++++++++++++++--------
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/src/nv_driver.c b/src/nv_driver.c
index 134da6a..6c40ebe 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1976,14 +1976,39 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
         if (i > 0)
             VBESetModeParameters(pScrn, pNv->pVbe);
     } else {
-        i =3D xf86ValidateModes(pScrn, pScrn->monitor->Modes,
-                              pScrn->display->modes, clockRanges,
-                              NULL, 256, max_width,
-                              512, 128, max_height,
-                              pScrn->display->virtualX,
-                              pScrn->display->virtualY,
-                              pNv->ScratchBufferStart,
-                              LOOKUP_BEST_REFRESH);
+        DisplayModePtr i, m, p =3D NULL;
+       int max_x =3D 0, max_y =3D 0;
+        float max_vrefresh =3D 0.0;
+
+       for (m =3D pScrn->monitor->Modes; m; m =3D m->next) {
+               if (m->type & M_T_PREFERRED)
+                        p =3D m;
+               max_x =3D max(max_x, m->HDisplay);
+               max_y =3D max(max_y, m->VDisplay);
+               max_vrefresh =3D max(max_vrefresh, xf86ModeVRefresh(m));
+         }
+
+         max_vrefresh =3D max(max_vrefresh, 60.0);
+         max_vrefresh *=3D (1 + SYNC_TOLERANCE);
+#if XORG_VERSION_CURRENT >=3D XORG_VERSION_NUMERIC(1,6,99,0,0)
+        pScrn->modePool =3D xf86GetDefaultModes();
+#else
+        pScrn->modePool =3D xf86GetDefaultModes(0,0);
+#endif
+       xf86ValidateModesSize(pScrn, pScrn->modePool, max_width, max_height,
0);
+
+        for (i =3D m; i; i =3D i->next) {
+               if (xf86ModeVRefresh(i) > max_vrefresh)
+                       i->status =3D MODE_VSYNC;
+               if (p && i->HDisplay >=3D p->HDisplay &&
+                    i->VDisplay >=3D p->VDisplay &&
+                    xf86ModeVRefresh(i) >=3D xf86ModeVRefresh(p))
+                        i->status =3D MODE_VSYNC;
+        }
+
+        xf86PruneInvalidModes(pScrn, &m, FALSE);
+
+        pScrn->monitor->Modes =3D xf86ModesAdd(pScrn->monitor->Modes, m);
     }

     if (i < 1 && pNv->FBDev) {
--
2.43.0




TLDR; Patch wont work on FreeBSD based on your OpenBSD output, potential
diff(probably something wrong with it due to my X experience) that you prob=
ably
shouldnt apply unless your actually desperate, and I will hopefully try to
reproduce the issue myself.

--=20
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-267606-7141-thQV9P0sxO>