xf86: Extract screen configuration matching into its own function
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
This commit is contained in:
		
							parent
							
								
									16571b8926
								
							
						
					
					
						commit
						cd567415cc
					
				| 
						 | 
					@ -106,6 +106,28 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
 | 
				
			||||||
    return foundScreen;
 | 
					    return foundScreen;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static screenLayoutPtr
 | 
				
			||||||
 | 
					xf86BusConfigMatch(ScrnInfoPtr scrnInfo) {
 | 
				
			||||||
 | 
					    screenLayoutPtr layout;
 | 
				
			||||||
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
 | 
				
			||||||
 | 
					         layout++) {
 | 
				
			||||||
 | 
					        for (i = 0; i < scrnInfo->numEntities; i++) {
 | 
				
			||||||
 | 
					            GDevPtr dev =
 | 
				
			||||||
 | 
					                xf86GetDevFromEntity(scrnInfo->entityList[i],
 | 
				
			||||||
 | 
					                                     scrnInfo->entityInstanceList[i]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (dev == layout->screen->device) {
 | 
				
			||||||
 | 
					                /* A match has been found */
 | 
				
			||||||
 | 
					                return layout;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @return TRUE if all buses are configured and set up correctly and FALSE
 | 
					 * @return TRUE if all buses are configured and set up correctly and FALSE
 | 
				
			||||||
 * otherwise.
 | 
					 * otherwise.
 | 
				
			||||||
| 
						 | 
					@ -114,7 +136,7 @@ Bool
 | 
				
			||||||
xf86BusConfig(void)
 | 
					xf86BusConfig(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    screenLayoutPtr layout;
 | 
					    screenLayoutPtr layout;
 | 
				
			||||||
    int i, j;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * 3 step probe to (hopefully) ensure that we always find at least 1
 | 
					     * 3 step probe to (hopefully) ensure that we always find at least 1
 | 
				
			||||||
| 
						 | 
					@ -170,27 +192,10 @@ xf86BusConfig(void)
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    for (i = 0; i < xf86NumScreens; i++) {
 | 
					    for (i = 0; i < xf86NumScreens; i++) {
 | 
				
			||||||
        for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
 | 
					        layout = xf86BusConfigMatch(xf86Screens[i]);
 | 
				
			||||||
             layout++) {
 | 
					        if (layout && layout->screen)
 | 
				
			||||||
            Bool found = FALSE;
 | 
					            xf86Screens[i]->confScreen = layout->screen;
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
            for (j = 0; j < xf86Screens[i]->numEntities; j++) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                GDevPtr dev =
 | 
					 | 
				
			||||||
                    xf86GetDevFromEntity(xf86Screens[i]->entityList[j],
 | 
					 | 
				
			||||||
                                         xf86Screens[i]->entityInstanceList[j]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (dev == layout->screen->device) {
 | 
					 | 
				
			||||||
                    /* A match has been found */
 | 
					 | 
				
			||||||
                    xf86Screens[i]->confScreen = layout->screen;
 | 
					 | 
				
			||||||
                    found = TRUE;
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (found)
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (layout->screen == NULL) {
 | 
					 | 
				
			||||||
            /* No match found */
 | 
					            /* No match found */
 | 
				
			||||||
            xf86Msg(X_ERROR,
 | 
					            xf86Msg(X_ERROR,
 | 
				
			||||||
                    "Screen %d deleted because of no matching config section.\n",
 | 
					                    "Screen %d deleted because of no matching config section.\n",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue