Skip to content

Commit

Permalink
Add patch fixing resultion enumeration on NovaCustom V54
Browse files Browse the repository at this point in the history
Dasharo/dasharo-issues#949

This also needs a backport to correctly calculate refresh rate.
  • Loading branch information
marmarek committed Dec 7, 2024
1 parent b7bf9b3 commit 7e2976f
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
44 changes: 44 additions & 0 deletions 0001-xfree86-fix-enumerating-resolutions-on-NovaCustom-V5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From d0979779c748ac0846c69f25b1381160a736ea6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
<[email protected]>
Date: Sat, 7 Dec 2024 03:06:08 +0100
Subject: [PATCH] xfree86: fix enumerating resolutions on NovaCustom V54
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With EDID present on NovaCustom V54 causes Xorg list _only_ the native
resolution. Wayland (gnome-shell) and Windows lists them all. I'm not
exactly sure what is wrong, especially whether it's buggy EDID or its
interpretation by Xorg, but given it works fine on other
implementations, it's likely Xorg issue. The simple change that seems to
fix it is pretending the display doesn't support GTF. So, do that, but
only for this specific display to limit impact on other displays (in
case it would break handling other GTF-supporting displays).

Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
hw/xfree86/ddc/interpret_edid.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index 19630471c..8fef90f4a 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -766,6 +766,13 @@ gtf_supported(xf86MonPtr mon)
if (mon->features.msc & 0x1)
return TRUE;
} else {
+ /*
+ * quirk for NovaCustom V54 laptop, see
+ * https://github.com/Dasharo/dasharo-issues/issues/949
+ */
+ if (strcmp(mon->vendor.name, "TMX") == 0 && mon->vendor.prod_id == 8196)
+ return FALSE;
+
for (i = 0; i < DET_TIMINGS; i++) {
struct detailed_monitor_section *det_timing_des = &(mon->det_mon[i]);
if (det_timing_des && (det_timing_des->type == DS_RANGES) &&
--
2.46.0

89 changes: 89 additions & 0 deletions 0002-hw-xfree86-re-calculate-the-clock-and-refresh-rate.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
From b8e5d0216c51cc7878635db5c9d2103fd872b5d2 Mon Sep 17 00:00:00 2001
From: "Chia-Lin Kao (AceLan)" <[email protected]>
Date: Tue, 8 Nov 2022 08:11:50 +0800
Subject: [PATCH] hw/xfree86: re-calculate the clock and refresh rate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

xserver fails to generate useable resolutions with 90Hz framerate
panels(encounter the same issue with 3 different 2.5k resolution
panels). All the resolutions shown by xrandr lead to blank screen except
the one written in EDID.
Ville Syrjälä from Intel provides a method to calculate the preferred
clock and refresh rate from the existing resolution table and this
works for the issue.

v2. xf86ModeVRefresh might return 0, need to check it before use it.
v3. reported by Markus on launchpad that the issue is not devided by 0,
it's the "preferred" being accessed unconditionally.
BugLink: https://launchpad.net/bugs/1999852

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1388
Signed-off-by: Chia-Lin Kao (AceLan) <[email protected]>
(cherry picked from commit f59871587ea678d4c498874895f4b97687764ee1)
---
hw/xfree86/common/xf86Mode.c | 2 ++
hw/xfree86/drivers/modesetting/drmmode_display.c | 13 ++++++++++++-
include/displaymode.h | 1 +
3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 484cde7ab..134ac5c49 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -230,6 +230,8 @@ xf86ModeStatusToString(ModeStatus status)
return "monitor doesn't support reduced blanking";
case MODE_BANDWIDTH:
return "mode requires too much memory bandwidth";
+ case MODE_DUPLICATE:
+ return "the same mode has been added";
case MODE_BAD:
return "unknown reason";
case MODE_ERROR:
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 6f5f8caf6..938773a07 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -2435,7 +2435,7 @@ static DisplayModePtr
drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes)
{
xf86MonPtr mon = output->MonInfo;
- DisplayModePtr i, m, preferred = NULL;
+ DisplayModePtr i, j, m, preferred = NULL;
int max_x = 0, max_y = 0;
float max_vrefresh = 0.0;

@@ -2467,6 +2467,17 @@ drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes)
i->VDisplay >= preferred->VDisplay &&
xf86ModeVRefresh(i) >= xf86ModeVRefresh(preferred))
i->status = MODE_VSYNC;
+ if (preferred && xf86ModeVRefresh(i) > 0.0) {
+ i->Clock = i->Clock * xf86ModeVRefresh(preferred) / xf86ModeVRefresh(i);
+ i->VRefresh = xf86ModeVRefresh(preferred);
+ }
+ for (j = m; j != i; j = j->next) {
+ if (!strcmp(i->name, j->name) &&
+ xf86ModeVRefresh(i) * (1 + SYNC_TOLERANCE) >= xf86ModeVRefresh(j) &&
+ xf86ModeVRefresh(i) * (1 - SYNC_TOLERANCE) <= xf86ModeVRefresh(j)) {
+ i->status = MODE_DUPLICATE;
+ }
+ }
}

xf86PruneInvalidModes(output->scrn, &m, FALSE);
diff --git a/include/displaymode.h b/include/displaymode.h
index ad01b87ec..561087717 100644
--- a/include/displaymode.h
+++ b/include/displaymode.h
@@ -47,6 +47,7 @@ typedef enum {
MODE_ONE_SIZE, /* only one resolution is supported */
MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
MODE_BANDWIDTH, /* mode requires too much memory bandwidth */
+ MODE_DUPLICATE, /* mode is duplicated */
MODE_BAD = -2, /* unspecified reason */
MODE_ERROR = -1 /* error condition */
} ModeStatus;
--
2.46.0

5 changes: 5 additions & 0 deletions xorg-x11-server.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ Patch6: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
# https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1001`
Patch7: 0001-configure.ac-search-for-the-fontrootdir-ourselves.patch

# quirk for Novacustom V54
Patch8: 0001-xfree86-fix-enumerating-resolutions-on-NovaCustom-V5.patch
# backport necessary for the above patch to be effective
Patch9: 0002-hw-xfree86-re-calculate-the-clock-and-refresh-rate.patch

# Backports from current stable "server-1.20-branch":
# <empty>

Expand Down

0 comments on commit 7e2976f

Please sign in to comment.