Alex Deucher writes:
 > I'm working on integrating my radeon mergedfb code with xfree86 cvs. 
 > so far it's working, but now I'm trying to integrate the current clone
 > code with the mergedfb clone mode.  so far so good.  I'm trying to use
 > the modes defined for the 1st head as clone modes for the second head
 > in the even that no metamodes are defined in the XF86Config file
 > (default behavior).  I just can't seem to get it to work!  How do you
 > iterate through a mode list?  It seems to be circular.  I'm probably
 > missing something basic, but my code seems to get stuck in an endless
 > loop.  Here's what I'm trying to do.  The function
 > RADEONGenerateModeList() normally takes the list of userdefined
 > "metamodes" (mode combinations for both heads, ie, 1024x768-800x600
 > would be the metamode for 1024x768 on the first head and 800x600 on the
 > second) and parses them, then looks up the equivalent modes names in
 > the validated modes for each head and then links them into a metamode. 
 > I have a check at the top to see if metamodes is NULL, if it is then it
 > iterates over the validated modes for head 1 (i) and looks up the
 > corresponding mode for head 2 (j) based on the name, then sets the
 > metamode.  What is the best way to iterate through a mode list?  Am I
 > even on the right track here?  shouldn't tempmode->next be NULL at the
 > end of the list?  If not then how do you know how many iterations you
 > need?

The mode list is a ring. Therefore tempmode->next will never be NULL.

Why don't you try this?

 > 
 >     /* default case if no metamodes specified */
 >     if (str == NULL) {
 >      sr = radeonClone;
       if ((tempmode = i) != NULL) 
          while (1) {
 >             /* look up the mode for each head based on the name */
 >          mode1 = RADEONGetModeFromName(tempmode->name, i);
 >          mode2 = RADEONGetModeFromName(mode1->name, j);
 >          if(!mode2) {
 >              xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 >      "Mode: \"%s\" is not a supported mode for CRT2\n", mode1->name);
 >              xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 >                  "Skipping metamode \"%s\".\n");
 >              mode1 = NULL;
 >          } else {
 >         /* link the modes into a "metamode" */
 >      result = RADEONCopyModeNLink(pScrn, result, mode1, mode2, sr);
 >              mode1 = NULL;
 >              mode2 = NULL;
 >          }  
            tempmode = tempmode->next;
            if (tempmode == i || tempmode == NULL)
                break;
 >      }
 >         return result;
 >     }
 > 
 > 

Egbert.
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to