Trying to use Radeon driver on Apple eMac

Joseph Adams joeyadams3.14159 at gmail.com
Wed Dec 10 21:50:03 PST 2008


Oops, forgot to send to xorg as well


---------- Forwarded message ----------
From: Joseph Adams <joeyadams3.14159 at gmail.com>
Date: Thu, Dec 11, 2008 at 12:49 AM
Subject: Re: Trying to use Radeon driver on Apple eMac
To: Alex Deucher <alexdeucher at gmail.com>


This patch works when my external monitor is unplugged.  When it is
plugged in, X selects the highest resolution the external monitor
supports (1280x1024) and does not turn on the internal monitor (I can
turn it on with xrandr --output VGA-1 --size 1024x768).

I did have to fix a tiny mistake in RADEONeMacNativeMode, however:

new->name       = xnfalloc(strlen("1024x768") + 1);
new->name       = "1024x768";

should be:

new->name       = xnfalloc(strlen("1024x768") + 1);
strcpy(new->name, "1024x768");

This was causing Xorg to crash whenever xrandr was called.

I went ahead and made a function that adds all the modes for my
monitor based on and replacing RADEONeMacNativeMode, in case this
makes things easier for you:

static DisplayModePtr RADEONeMacModes(xf86OutputPtr output)
{
       ScrnInfoPtr pScrn = output->scrn;
       DisplayModePtr last=NULL, new=NULL, first=NULL;
       int i, *modep;
       static const char *modenames[5] = {
               "640x480", "800x600", "1024x768", "1152x864", "1280x960"
       };
       static int modes[9*5] = {
               62120, 640,680,752,864, 480,481,484,521,
               76840, 800,848,936,1072, 600,601,604,640,
               99070, 1024,1088,1200,1376, 768,769,772,809,
               112360, 1152,1224,1352,1552, 864,865,868,905,
               124540, 1280,1368,1504,1728, 960,961,964,1001
       };
       modep = modes;

       for (i=0; i<5; i++) {
               new = xnfcalloc(1, sizeof (DisplayModeRec));
               if (new) {
                       new->name       = xnfalloc(strlen(modenames[i]) + 1);
                       strcpy(new->name, modenames[i]);
                       new->Clock      = *modep++;

                       new->HDisplay   = *modep++;
                       new->HSyncStart = *modep++;
                       new->HSyncEnd   = *modep++;
                       new->HTotal     = *modep++;

                       new->VDisplay   = *modep++;
                       new->VSyncStart = *modep++;
                       new->VSyncEnd   = *modep++;
                       new->VTotal     = *modep++;

                       new->Flags      = 0;
                       new->type       = M_T_DRIVER;
                       if (i==2)
                               new->type |= M_T_PREFERRED;
                       new->next       = NULL;
                       new->prev       = last;
                       if (last) last->next = new;
                       last = new;
                       if (!first) first = new;
                       xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Added
eMac mode %s\n", modenames[i]);
               }
       }

   return first;
}

I tested this on all my screen's resolutions and they all work fine.

By the way, what should be the "preferred" or "native" mode of my
display?  I noticed you used 1024x768 in the patch instead of the
maximum size of 1280x960, so I mirrored that here.  Is this because it
is the maximum size that allows for dual-head with the default
Virtual?

By the way, thanks for responding so quickly and helping get this
resolved :)  Great maintainer, would work with again!  A++++++++



More information about the xorg mailing list