<div dir="ltr">Hi!<div><br></div><div>An updated version of this patch was submitted last week. Please consider it instead.</div><div><br></div><div><a href="http://lists.x.org/archives/xorg-devel/2014-April/041690.html">http://lists.x.org/archives/xorg-devel/2014-April/041690.html</a><br>

</div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">CANTATE DOMINO CANTICUM NOVUM<div>QUIA MIRABILIA FECIT</div><div><br></div><div>Laércio</div></div></div>
<br><br><div class="gmail_quote">2014-04-07 10:09 GMT-03:00 Floris <span dir="ltr"><<a href="mailto:jkfloris@dds.nl" target="_blank">jkfloris@dds.nl</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

This patch is made by Oleg Samarin and was already mailed in September 2013<br>
(<a href="http://lists.x.org/archives/xorg-devel/2013-September/037946.html" target="_blank">http://lists.x.org/archives/<u></u>xorg-devel/2013-September/<u></u>037946.html</a>)<br>
I hope someone can apply this patch or give me a reason why it isn't.<br>
<br>
Thanks,<br>
<br>
jkfloris<br>
<br>
Added capability of specifying "MatchSeat" option in the ServerLayout, the Device and the Screen sections for selecting default sections for the seat<br>
---<br>
 hw/xfree86/common/xf86Bus.c    |  4 ++--<br>
 hw/xfree86/common/xf86Config.c | 33 +++++++++++++++++++++++++-----<u></u>---<br>
 hw/xfree86/parser/Device.c     |  6 ++++++<br>
 hw/xfree86/parser/Layout.c     |  6 ++++++<br>
 hw/xfree86/parser/Screen.c     |  6 ++++++<br>
 hw/xfree86/parser/xf86Parser.h |  3 +++<br>
 hw/xfree86/parser/xf86tokens.h |  1 +<br>
 7 files changed, 49 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c<br>
index e101537..91af72f 100644<br>
--- a/hw/xfree86/common/xf86Bus.c<br>
+++ b/hw/xfree86/common/xf86Bus.c<br>
@@ -81,7 +81,7 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)<br>
     if (drv->platformProbe != NULL) {<br>
         foundScreen = xf86platformProbeDev(drv);<br>
     }<br>
-    if (ServerIsNotSeat0())<br>
+    if (ServerIsNotSeat0() && foundScreen)<br>
         return foundScreen;<br>
 #endif<br>
<br>
@@ -201,7 +201,7 @@ xf86BusProbe(void)<br>
 {<br>
 #ifdef XSERVER_PLATFORM_BUS<br>
     xf86platformProbe();<br>
-    if (ServerIsNotSeat0())<br>
+    if (ServerIsNotSeat0() && xf86_num_platform_devices > 0)<br>
         return;<br>
 #endif<br>
 #ifdef XSERVER_LIBPCIACCESS<br>
diff --git a/hw/xfree86/common/<u></u>xf86Config.c b/hw/xfree86/common/<u></u>xf86Config.c<br>
index 74d5ed3..9ed8b02 100644<br>
--- a/hw/xfree86/common/<u></u>xf86Config.c<br>
+++ b/hw/xfree86/common/<u></u>xf86Config.c<br>
@@ -232,6 +232,17 @@ xf86ValidateFontPath(char *path)<br>
     return tmp_path;<br>
 }<br>
<br>
+#define FIND_SUITABLE(pointertype, listhead, ptr)                               \<br>
+    {                                                                           \<br>
+        pointertype l, p;                                                       \<br>
+                                                                                \<br>
+        for (l = listhead, p = NULL; !p && l; l = (pointertype) l->list.next) { \<br>
+            if (! l->match_seat || SeatId && xf86nameCompare(l->match_seat, SeatId) == 0) \<br>
+                p = l;                                                          \<br>
+        }                                                                       \<br>
+        ptr = p;                                                                \<br>
+    }<br>
+<br>
 /*<br>
  * use the datastructure that the parser provides and pick out the parts<br>
  * that we need at this point<br>
@@ -1578,8 +1589,11 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,<br>
      * config file, or - if it is NULL - configScreen autogenerates one for<br>
      * us */<br>
     if (!count) {<br>
+        XF86ConfScreenPtr screen;<br>
+<br>
+        FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_<u></u>lst, screen);<br>
         slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));<br>
-        if (!configScreen(slp[0].screen, xf86configptr->conf_screen_<u></u>lst,<br>
+        if (!configScreen(slp[0].screen, screen,<br>
                           0, X_CONFIG)) {<br>
             free(slp[0].screen);<br>
             free(slp);<br>
@@ -1819,7 +1833,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,<br>
      * set it to NULL so that the section can be autoconfigured later */<br>
     screenp->device = xnfcalloc(1, sizeof(GDevRec));<br>
     if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_<u></u>lst)) {<br>
-        conf_screen->scrn_device = xf86configptr->conf_device_<u></u>lst;<br>
+        FIND_SUITABLE (XF86ConfDevicePtr, xf86configptr->conf_device_<u></u>lst, conf_screen->scrn_device);<br>
         xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"<br>
                 "\tUsing the first device section listed.\n", screenp->id);<br>
     }<br>
@@ -2429,12 +2443,15 @@ xf86HandleConfigFile(Bool autoconfig)<br>
     /* First check if a layout section is present, and if it is valid. */<br>
<br>
     if (xf86configptr->conf_layout_<u></u>lst == NULL || xf86ScreenName != NULL) {<br>
+        XF86ConfScreenPtr screen;<br>
+<br>
         if (xf86ScreenName == NULL) {<br>
             xf86Msg(X_DEFAULT,<br>
                     "No Layout section.  Using the first Screen section.\n");<br>
         }<br>
+        FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_<u></u>lst, screen);<br>
         if (!configImpliedLayout(&<u></u>xf86ConfigLayout,<br>
-                                 xf86configptr->conf_screen_<u></u>lst,<br>
+                                 screen,<br>
                                  xf86configptr)) {<br>
             xf86Msg(X_ERROR, "Unable to determine the screen layout\n");<br>
             return CONFIG_PARSE_ERROR;<br>
@@ -2442,6 +2459,9 @@ xf86HandleConfigFile(Bool autoconfig)<br>
         implicit_layout = TRUE;<br>
     }<br>
     else {<br>
+        XF86ConfLayoutPtr layout;<br>
+<br>
+        FIND_SUITABLE(<u></u>XF86ConfLayoutPtr, xf86configptr->conf_layout_<u></u>lst, layout);<br>
         if (xf86configptr->conf_flags != NULL) {<br>
             char *dfltlayout = NULL;<br>
             pointer optlist = xf86configptr->conf_flags-><u></u>flg_option_lst;<br>
@@ -2449,16 +2469,13 @@ xf86HandleConfigFile(Bool autoconfig)<br>
             if (optlist && xf86FindOption(optlist, "defaultserverlayout"))<br>
                 dfltlayout =<br>
                     xf86SetStrOption(optlist, "defaultserverlayout", NULL);<br>
-            if (!configLayout<br>
-                (&xf86ConfigLayout, xf86configptr->conf_layout_<u></u>lst,<br>
-                 dfltlayout)) {<br>
+            if (!configLayout(&<u></u>xf86ConfigLayout, layout, dfltlayout)) {<br>
                 xf86Msg(X_ERROR, "Unable to determine the screen layout\n");<br>
                 return CONFIG_PARSE_ERROR;<br>
             }<br>
         }<br>
         else {<br>
-            if (!configLayout(&<u></u>xf86ConfigLayout, xf86configptr->conf_layout_<u></u>lst,<br>
-                              NULL)) {<br>
+            if (!configLayout(&<u></u>xf86ConfigLayout, layout, NULL)) {<br>
                 xf86Msg(X_ERROR, "Unable to determine the screen layout\n");<br>
                 return CONFIG_PARSE_ERROR;<br>
             }<br>
diff --git a/hw/xfree86/parser/Device.c b/hw/xfree86/parser/Device.c<br>
index bb1ba88..1f7ffdb 100644<br>
--- a/hw/xfree86/parser/Device.c<br>
+++ b/hw/xfree86/parser/Device.c<br>
@@ -72,6 +72,7 @@ xf86ConfigSymTabRec DeviceTab[] = {<br>
     {RAMDAC, "ramdac"},<br>
     {DACSPEED, "dacspeed"},<br>
     {CLOCKS, "clocks"},<br>
+    {MATCHSEAT, "matchseat"},<br>
     {OPTION, "option"},<br>
     {VIDEORAM, "videoram"},<br>
     {BIOSBASE, "biosbase"},<br>
@@ -217,6 +218,11 @@ xf86parseDeviceSection(void)<br>
                 Error(NUMBER_MSG, "TextClockFreq");<br>
             ptr->dev_textclockfreq = (int) (val.realnum * 1000.0 + 0.5);<br>
             break;<br>
+        case MATCHSEAT:<br>
+            if (xf86getSubToken(&(ptr->dev_<u></u>comment)) != STRING)<br>
+                Error(QUOTE_MSG, "MatchSeat");<br>
+            ptr->match_seat = val.str;<br>
+            break;<br>
         case OPTION:<br>
             ptr->dev_option_lst = xf86parseOption(ptr->dev_<u></u>option_lst);<br>
             break;<br>
diff --git a/hw/xfree86/parser/Layout.c b/hw/xfree86/parser/Layout.c<br>
index cbd8d24..e838a7c 100644<br>
--- a/hw/xfree86/parser/Layout.c<br>
+++ b/hw/xfree86/parser/Layout.c<br>
@@ -71,6 +71,7 @@ static xf86ConfigSymTabRec LayoutTab[] = {<br>
     {ENDSECTION, "endsection"},<br>
     {SCREEN, "screen"},<br>
     {IDENTIFIER, "identifier"},<br>
+    {MATCHSEAT, "matchseat"},<br>
     {INACTIVE, "inactive"},<br>
     {INPUTDEVICE, "inputdevice"},<br>
     {OPTION, "option"},<br>
@@ -110,6 +111,11 @@ xf86parseLayoutSection(void)<br>
             ptr->lay_identifier = val.str;<br>
             has_ident = TRUE;<br>
             break;<br>
+        case MATCHSEAT:<br>
+            if (xf86getSubToken(&(ptr->lay_<u></u>comment)) != STRING)<br>
+                Error(QUOTE_MSG, "MatchSeat");<br>
+            ptr->match_seat = val.str;<br>
+            break;<br>
         case INACTIVE:<br>
         {<br>
             XF86ConfInactivePtr iptr;<br>
diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c<br>
index f294ec4..009c4e9 100644<br>
--- a/hw/xfree86/parser/Screen.c<br>
+++ b/hw/xfree86/parser/Screen.c<br>
@@ -199,6 +199,7 @@ xf86parseDisplaySubSection(<u></u>void)<br>
 static xf86ConfigSymTabRec ScreenTab[] = {<br>
     {ENDSECTION, "endsection"},<br>
     {IDENTIFIER, "identifier"},<br>
+    {MATCHSEAT, "matchseat"},<br>
     {OBSDRIVER, "driver"},<br>
     {MDEVICE, "device"},<br>
     {MONITOR, "monitor"},<br>
@@ -237,6 +238,11 @@ xf86parseScreenSection(void)<br>
                 Error(ONLY_ONE_MSG, "Identifier or Driver");<br>
             has_ident = TRUE;<br>
             break;<br>
+        case MATCHSEAT:<br>
+            if (xf86getSubToken(&(ptr->scrn_<u></u>comment)) != STRING)<br>
+                Error(QUOTE_MSG, "MatchSeat");<br>
+            ptr->match_seat = val.str;<br>
+            break;<br>
         case OBSDRIVER:<br>
             if (xf86getSubToken(&(ptr->scrn_<u></u>comment)) != STRING)<br>
                 Error(QUOTE_MSG, "Driver");<br>
diff --git a/hw/xfree86/parser/<u></u>xf86Parser.h b/hw/xfree86/parser/<u></u>xf86Parser.h<br>
index e7210e8..bb41c99 100644<br>
--- a/hw/xfree86/parser/<u></u>xf86Parser.h<br>
+++ b/hw/xfree86/parser/<u></u>xf86Parser.h<br>
@@ -224,6 +224,7 @@ typedef struct {<br>
     int dev_screen;<br>
     XF86OptionPtr dev_option_lst;<br>
     char *dev_comment;<br>
+    char *match_seat;<br>
 } XF86ConfDeviceRec, *XF86ConfDevicePtr;<br>
<br>
 typedef struct {<br>
@@ -275,6 +276,7 @@ typedef struct {<br>
     XF86OptionPtr scrn_option_lst;<br>
     char *scrn_comment;<br>
     int scrn_virtualX, scrn_virtualY;<br>
+    char *match_seat;<br>
 } XF86ConfScreenRec, *XF86ConfScreenPtr;<br>
<br>
 typedef struct {<br>
@@ -366,6 +368,7 @@ typedef struct {<br>
     XF86ConfInactivePtr lay_inactive_lst;<br>
     XF86ConfInputrefPtr lay_input_lst;<br>
     XF86OptionPtr lay_option_lst;<br>
+    char *match_seat;<br>
     char *lay_comment;<br>
 } XF86ConfLayoutRec, *XF86ConfLayoutPtr;<br>
<br>
diff --git a/hw/xfree86/parser/<u></u>xf86tokens.h b/hw/xfree86/parser/<u></u>xf86tokens.h<br>
index f751b7b..5c01ce7 100644<br>
--- a/hw/xfree86/parser/<u></u>xf86tokens.h<br>
+++ b/hw/xfree86/parser/<u></u>xf86tokens.h<br>
@@ -87,6 +87,7 @@ typedef enum {<br>
     VENDOR,<br>
     DASH,<br>
     COMMA,<br>
+    MATCHSEAT,<br>
     OPTION,<br>
     COMMENT,<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
1.8.3.1<br>
<br>
______________________________<u></u>_________________<br>
<a href="mailto:xorg-devel@lists.x.org" target="_blank">xorg-devel@lists.x.org</a>: X.Org development<br>
Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/<u></u>xorg-devel</a><br>
Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/<u></u>listinfo/xorg-devel</a><br>
</font></span></blockquote></div><br></div>