summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorZoltán Böszörményi <zboszor@gmail.com>2021-07-08 06:09:44 +0200
committerPovilas Kanapickas <povilas@radix.lt>2021-07-30 00:27:39 +0000
commitcd567415cc5645f8cdc78e85e8887e5cce76e6d7 (patch)
tree5523f325e165e1e6f28685be804b9acb450affcf /hw
parent16571b8926a5a7ba5a1885b36a16857addbe8f41 (diff)
xf86: Extract screen configuration matching into its own function
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/common/xf86Bus.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 8a7fc4327..6dc1aebf0 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -106,6 +106,28 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
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
* otherwise.
@@ -114,7 +136,7 @@ Bool
xf86BusConfig(void)
{
screenLayoutPtr layout;
- int i, j;
+ int i;
/*
* 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 (layout = xf86ConfigLayout.screens; layout->screen != NULL;
- layout++) {
- Bool found = FALSE;
-
- 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) {
+ layout = xf86BusConfigMatch(xf86Screens[i]);
+ if (layout && layout->screen)
+ xf86Screens[i]->confScreen = layout->screen;
+ else {
/* No match found */
xf86Msg(X_ERROR,
"Screen %d deleted because of no matching config section.\n",