Hi,

steven@ reported that, using xf68-video-nv X server 21.1 is dumping
core on startup.

The following patch fixes it. While here I also fixed another bug on
drivers that don't intialize a private structure. 

If you're using one older graphics card (ie not  inteldrm or radeondrm
based), please test.

These are also:
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/807
and https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/808

ok ?

Index: hw/xfree86/modes/xf86Crtc.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/modes/xf86Crtc.h,v
retrieving revision 1.15
diff -u -p -u -r1.15 xf86Crtc.h
--- hw/xfree86/modes/xf86Crtc.h 11 Nov 2021 09:10:04 -0000      1.15
+++ hw/xfree86/modes/xf86Crtc.h 4 Dec 2021 17:50:33 -0000
@@ -837,11 +837,11 @@ extern _X_EXPORT int xf86CrtcConfigPriva
 static _X_INLINE xf86OutputPtr
 xf86CompatOutput(ScrnInfoPtr pScrn)
 {
-    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+    xf86CrtcConfigPtr config;
 
     if (xf86CrtcConfigPrivateIndex == -1)
-        return NULL;
-
+        return NULL;    
+    config = XF86_CRTC_CONFIG_PTR(pScrn);
     if (config->compat_output < 0)
         return NULL;
     return config->output[config->compat_output];
Index: hw/xfree86/modes/xf86Modes.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/modes/xf86Modes.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 xf86Modes.c
--- hw/xfree86/modes/xf86Modes.c        11 Nov 2021 09:03:08 -0000      1.12
+++ hw/xfree86/modes/xf86Modes.c        5 Dec 2021 18:20:52 -0000
@@ -803,10 +803,14 @@ xf86CVTMode(int HDisplay, int VDisplay, 
 {
     struct libxcvt_mode_info *libxcvt_mode_info;
     DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
+    char *tmp;
 
     libxcvt_mode_info =
         libxcvt_gen_mode_info(HDisplay, VDisplay, VRefresh, Reduced, 
Interlaced);
 
+    XNFasprintf(&tmp, "%dx%d", HDisplay, VDisplay);
+    Mode->name = tmp;
+    
     Mode->VDisplay   = libxcvt_mode_info->vdisplay;
     Mode->HDisplay   = libxcvt_mode_info->hdisplay;
     Mode->Clock      = libxcvt_mode_info->dot_clock;

-- 
Matthieu Herrb

Reply via email to