Comment 16 for bug 140051

Revision history for this message
Martin-Éric Racine (q-funk) wrote : Fwd: Ubuntu bug report for AMD driver

AMD's Jordan Crouse proposes the following patch.

Scott, can you apply it to the current package and see if it fixes it for you?

On 17/09/07 14:43 +0300, Martin-Éric Racine wrote:
> Greetings everyone,
>
> Can anyone reproduce the following bug?
>
> https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-amd/+bug/140051

Patch is attached - just a trivial re-arranging of the first few
commands in PreInit.

[LX] Re-arrange PreInit to avoid segfaults in Xorg -configure

Re-arrange the early part of PreInit so that Xorg -configure can run
cleanly.
---

 src/amd_lx_driver.c | 44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/amd_lx_driver.c b/src/amd_lx_driver.c
index c6600d4..7dbed87 100644
--- a/src/amd_lx_driver.c
+++ b/src/amd_lx_driver.c
@@ -471,39 +471,45 @@ LXPreInit(ScrnInfoPtr pScrni, int flags)
 {
     GeodePtr pGeode;
     ClockRangePtr GeodeClockRange;
+ EntityInfoPtr pEnt;
     OptionInfoRec *GeodeOptions = &LX_GeodeOptions[0];
     rgb defaultWeight = { 0, 0, 0 };
     int modecnt;
     char *s, *panelgeo = NULL;
+ Bool useVGA;

- pGeode = pScrni->driverPrivate = xnfcalloc(sizeof(GeodeRec), 1);
+ if (pScrni->numEntities != 1)
+ return FALSE;

- if (pGeode == NULL)
- return FALSE;
+ pEnt = xf86GetEntityInfo(pScrni->entityList[0]);

- /* Probe for VGA */
- pGeode->useVGA = TRUE;
- pGeode->VGAActive = FALSE;
+ if (pEnt->resources)
+ return FALSE;
+
+ useVGA = LXCheckVGA(pScrni);
+
+ if (flags & PROBE_DETECT) {
+ if (useVGA)
+ GeodeProbeDDC(pScrni, pEnt->index);

- if (xf86LoadSubModule(pScrni, "vgahw")) {
- if (vgaHWGetHWRec(pScrni))
- pGeode->useVGA = LXCheckVGA(pScrni);
+ return TRUE;
     }

- if (pGeode->useVGA)
- pGeode->vesa = xcalloc(sizeof(VESARec), 1);
+ pGeode = pScrni->driverPrivate = xnfcalloc(sizeof(GeodeRec), 1);

- if (pScrni->numEntities != 1)
- return FALSE;
+ if (pGeode == NULL)
+ return FALSE;

- pGeode->pEnt = xf86GetEntityInfo(pScrni->entityList[0]);
+ pGeode->useVGA = useVGA;
+ pGeode->VGAActive = FALSE;
+ pGeode->pEnt = pEnt;

- if (pGeode->pEnt->resources)
- return FALSE;
+ if (pGeode->useVGA) {
+ if (!xf86LoadSubModule(pScrni, "vgahw") ||
+ !vgaHWGetHWRec(pScrni))
+ pGeode->useVGA = FALSE;

- if (pGeode->useVGA && (flags & PROBE_DETECT)) {
- GeodeProbeDDC(pScrni, pGeode->pEnt->index);
- return TRUE;
+ pGeode->vesa = xcalloc(sizeof(VESARec), 1);
     }

     cim_rdmsr = LXReadMSR;

--
Martin-Éric Racine
http://q-funk.iki.fi