aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c34
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c9
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.c3
4 files changed, 31 insertions, 19 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c
index 507c57dbc..b3b3f8cc5 100644
--- a/xorg-server/hw/xfree86/common/xf86Bus.c
+++ b/xorg-server/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/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 542d5abf6..2adef44c3 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -232,6 +232,18 @@ xf86ValidateFontPath(char *path)
return tmp_path;
}
+#define FIND_SUITABLE(pointertype, listhead, ptr) \
+ do { \
+ 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; \
+ } while(0)
+
/*
* use the datastructure that the parser provides and pick out the parts
* that we need at this point
@@ -1580,8 +1592,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);
@@ -1821,7 +1836,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);
}
@@ -2354,6 +2369,7 @@ xf86HandleConfigFile(Bool autoconfig)
const char *scanptr;
Bool singlecard = 0;
Bool implicit_layout = FALSE;
+ XF86ConfLayoutPtr layout;
if (!autoconfig) {
char *filename, *dirname, *sysdirname;
@@ -2429,14 +2445,17 @@ xf86HandleConfigFile(Bool autoconfig)
*/
/* First check if a layout section is present, and if it is valid. */
+ FIND_SUITABLE(XF86ConfLayoutPtr, xf86configptr->conf_layout_lst, layout);
+ if (layout == NULL || xf86ScreenName != NULL) {
+ XF86ConfScreenPtr screen;
- if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
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;
@@ -2451,16 +2470,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/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index bc6b73f91..4e8060b0f 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -770,10 +770,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
FreeInputAttributes(pInp->attrs);
- if (pInp->flags & XI86_SERVER_FD) {
- systemd_logind_release_fd(pInp->major, pInp->minor);
- close(pInp->fd);
- }
+ if (pInp->flags & XI86_SERVER_FD)
+ systemd_logind_release_fd(pInp->major, pInp->minor, pInp->fd);
/* Remove the entry from the list. */
if (pInp == xf86InputDevs)
@@ -873,8 +871,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
sizeof(pInfo) * (new_input_devices_count + 1));
new_input_devices[new_input_devices_count] = pInfo;
new_input_devices_count++;
- systemd_logind_release_fd(pInfo->major, pInfo->minor);
- close(fd);
+ systemd_logind_release_fd(pInfo->major, pInfo->minor, fd);
return BadMatch;
}
pInfo->fd = fd;
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c
index 4e80f9ee3..dd118a285 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.c
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.c
@@ -340,8 +340,7 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1);
major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0);
minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0);
- systemd_logind_release_fd(major, minor);
- close(fd);
+ systemd_logind_release_fd(major, minor, fd);
config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1);
dev->flags &= ~XF86_PDEV_SERVER_FD;
}