[PATCH] multiseat with several videocards

Laércio de Sousa lbsousajr at gmail.com
Tue Apr 8 03:08:39 PDT 2014


Hi!

An updated version of this patch was submitted last week. Please consider
it instead.

http://lists.x.org/archives/xorg-devel/2014-April/041690.html

CANTATE DOMINO CANTICUM NOVUM
QUIA MIRABILIA FECIT

Laércio


2014-04-07 10:09 GMT-03:00 Floris <jkfloris at dds.nl>:

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


More information about the xorg-devel mailing list