[PATCH] Call xf86CrtcConfigInit() from within VIAPreInit()

frankdelange frank at ostrogoth.unternet.org
Tue Dec 30 14:08:15 PST 2008


From: Frank de Lange <freedesktop-f at unternet.org>

I don't have a VIA-equipped machine so I can not test this patch but given that
VIA and Savage are 'quite similar' this should work to fix the segfault on
start caused by use of an unallocated xf86CrtcConfig as well...

If someone with access to a VIA-equipped machine can test this... it might make some VIA users happy...

PS for me the current VIA driver does not even compile - unrelated to this patch - so even if I had a machine I'd have been unable to test...

Cheers//Frank

---
 src/via_driver.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/via_driver.c b/src/via_driver.c
index c2312a8..337f597 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -41,6 +41,7 @@
 #define DPMS_SERVER
 #include <X11/extensions/dpms.h>
 
+#include <xorg/xf86Crtc.h>
 
 #include "via_driver.h"
 #include "via_video.h"
@@ -59,6 +60,7 @@
 
 static void VIAIdentify(int flags);
 static Bool VIAProbe(DriverPtr drv, int flags);
+static void VIAPreInitCrtcConfig(ScrnInfoPtr pScrn);
 static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags);
 static Bool VIAEnterVT(int scrnIndex, int flags);
 static void VIALeaveVT(int scrnIndex, int flags);
@@ -622,6 +624,23 @@ VIAProbeDDC(ScrnInfoPtr pScrn, int index)
     }
 }
 
+static Bool via_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
+{
+    scrn->virtualX = width;
+    scrn->virtualY = height;
+    return TRUE;
+}
+
+static const xf86CrtcConfigFuncsRec via_xf86crtc_config_funcs = {
+    via_xf86crtc_resize
+};
+
+static void VIAPreInitCrtcConfig(ScrnInfoPtr pScrn)
+{
+    /* Allocate xf86CrtcConfig */
+    xf86CrtcConfigInit (pScrn, &via_xf86crtc_config_funcs);
+}
+
 static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags)
 {
     EntityInfoPtr   pEnt;
@@ -2066,6 +2085,8 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Color maps etc. set up\n"));
     pVia->agpDMA = FALSE;
 
+    VIAPreInitCrtcConfig(pScrn);
+
 #ifdef XF86DRI
     if (pVia->directRenderingEnabled)
 	pVia->directRenderingEnabled = VIADRIFinishScreenInit(pScreen);
-- 
1.6.0.4




More information about the xorg mailing list