Merge commit 'who/for-keith'

Skipping two unreviewed patches; will mark them reviewed and cherry pick
This commit is contained in:
Keith Packard 2014-05-08 12:58:41 -07:00
commit d60724b752
14 changed files with 87 additions and 28 deletions

View File

@ -250,8 +250,6 @@ config_odev_free_attributes(struct OdevAttributes *attribs)
free(iter); free(iter);
} }
if (fd != -1) { if (fd != -1)
systemd_logind_release_fd(major, minor); systemd_logind_release_fd(major, minor, fd);
close(fd);
}
} }

View File

@ -81,7 +81,7 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
if (drv->platformProbe != NULL) { if (drv->platformProbe != NULL) {
foundScreen = xf86platformProbeDev(drv); foundScreen = xf86platformProbeDev(drv);
} }
if (ServerIsNotSeat0()) if (ServerIsNotSeat0() && foundScreen)
return foundScreen; return foundScreen;
#endif #endif
@ -201,7 +201,7 @@ xf86BusProbe(void)
{ {
#ifdef XSERVER_PLATFORM_BUS #ifdef XSERVER_PLATFORM_BUS
xf86platformProbe(); xf86platformProbe();
if (ServerIsNotSeat0()) if (ServerIsNotSeat0() && xf86_num_platform_devices > 0)
return; return;
#endif #endif
#ifdef XSERVER_LIBPCIACCESS #ifdef XSERVER_LIBPCIACCESS

View File

@ -232,6 +232,17 @@ xf86ValidateFontPath(char *path)
return tmp_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 * use the datastructure that the parser provides and pick out the parts
* that we need at this point * that we need at this point
@ -1580,8 +1591,11 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
* config file, or - if it is NULL - configScreen autogenerates one for * config file, or - if it is NULL - configScreen autogenerates one for
* us */ * us */
if (!count) { if (!count) {
XF86ConfScreenPtr screen;
FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen);
slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); 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)) { 0, X_CONFIG)) {
free(slp[0].screen); free(slp[0].screen);
free(slp); free(slp);
@ -1821,7 +1835,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
* set it to NULL so that the section can be autoconfigured later */ * set it to NULL so that the section can be autoconfigured later */
screenp->device = xnfcalloc(1, sizeof(GDevRec)); screenp->device = xnfcalloc(1, sizeof(GDevRec));
if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) { 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" xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
"\tUsing the first device section listed.\n", screenp->id); "\tUsing the first device section listed.\n", screenp->id);
} }
@ -2429,14 +2443,19 @@ xf86HandleConfigFile(Bool autoconfig)
*/ */
/* First check if a layout section is present, and if it is valid. */ /* First check if a layout section is present, and if it is valid. */
XF86ConfLayoutPtr layout;
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) { if (xf86ScreenName == NULL) {
xf86Msg(X_DEFAULT, xf86Msg(X_DEFAULT,
"No Layout section. Using the first Screen section.\n"); "No Layout section. Using the first Screen section.\n");
} }
FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen);
if (!configImpliedLayout(&xf86ConfigLayout, if (!configImpliedLayout(&xf86ConfigLayout,
xf86configptr->conf_screen_lst, screen,
xf86configptr)) { xf86configptr)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
return CONFIG_PARSE_ERROR; return CONFIG_PARSE_ERROR;
@ -2451,16 +2470,13 @@ xf86HandleConfigFile(Bool autoconfig)
if (optlist && xf86FindOption(optlist, "defaultserverlayout")) if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
dfltlayout = dfltlayout =
xf86SetStrOption(optlist, "defaultserverlayout", NULL); xf86SetStrOption(optlist, "defaultserverlayout", NULL);
if (!configLayout if (!configLayout(&xf86ConfigLayout, layout, dfltlayout)) {
(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
dfltlayout)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
return CONFIG_PARSE_ERROR; return CONFIG_PARSE_ERROR;
} }
} }
else { else {
if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, if (!configLayout(&xf86ConfigLayout, layout, NULL)) {
NULL)) {
xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
return CONFIG_PARSE_ERROR; return CONFIG_PARSE_ERROR;
} }

View File

@ -770,10 +770,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
FreeInputAttributes(pInp->attrs); FreeInputAttributes(pInp->attrs);
if (pInp->flags & XI86_SERVER_FD) { if (pInp->flags & XI86_SERVER_FD)
systemd_logind_release_fd(pInp->major, pInp->minor); systemd_logind_release_fd(pInp->major, pInp->minor, pInp->fd);
close(pInp->fd);
}
/* Remove the entry from the list. */ /* Remove the entry from the list. */
if (pInp == xf86InputDevs) if (pInp == xf86InputDevs)
@ -873,8 +871,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
sizeof(pInfo) * (new_input_devices_count + 1)); sizeof(pInfo) * (new_input_devices_count + 1));
new_input_devices[new_input_devices_count] = pInfo; new_input_devices[new_input_devices_count] = pInfo;
new_input_devices_count++; new_input_devices_count++;
systemd_logind_release_fd(pInfo->major, pInfo->minor); systemd_logind_release_fd(pInfo->major, pInfo->minor, fd);
close(fd);
return BadMatch; return BadMatch;
} }
pInfo->fd = fd; pInfo->fd = fd;

View File

@ -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); fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1);
major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0); major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0);
minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0); minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0);
systemd_logind_release_fd(major, minor); systemd_logind_release_fd(major, minor, fd);
close(fd);
config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1); config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1);
dev->flags &= ~XF86_PDEV_SERVER_FD; dev->flags &= ~XF86_PDEV_SERVER_FD;
} }

View File

@ -1378,6 +1378,14 @@ for the regular text mode.
The frequency is specified in MHz. The frequency is specified in MHz.
This is rarely used. This is rarely used.
.TP 7 .TP 7
.BI "MatchSeat " "seat\-id"
Only apply this
.B Device
section if X server was started with
.B -seat
.I seat\-id
option.
.TP 7
.BI "Option \*qModeDebug\*q \*q" boolean \*q .BI "Option \*qModeDebug\*q \*q" boolean \*q
Enable printing of additional debugging information about modesetting to Enable printing of additional debugging information about modesetting to
the server log. the server log.
@ -1900,6 +1908,14 @@ The only case where there is even a choice in this value is for depth 24,
where some hardware supports both a packed 24 bit framebuffer layout and a where some hardware supports both a packed 24 bit framebuffer layout and a
sparse 32 bit framebuffer layout. sparse 32 bit framebuffer layout.
.TP 7 .TP 7
.BI "MatchSeat " "seat\-id"
Only apply this
.B Screen
section if X server was started with
.B -seat
.I seat\-id
option.
.TP 7
.B Options .B Options
Various Various
.B Option .B Option
@ -2295,6 +2311,14 @@ and the first two should normally be used to indicate the core pointer
and core keyboard devices respectively. and core keyboard devices respectively.
.RE .RE
.TP 7 .TP 7
.BI "MatchSeat " "seat\-id"
Only apply this
.B ServerLayout
section if X server was started with
.B -seat
.I seat\-id
option.
.TP 7
.B Options .B Options
In addition to the following, any option permitted in the In addition to the following, any option permitted in the
.B ServerFlags .B ServerFlags

View File

@ -37,7 +37,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
if (paused) { if (paused) {
LogMessage(X_ERROR, LogMessage(X_ERROR,
"Error systemd-logind returned paused fd for drm node\n"); "Error systemd-logind returned paused fd for drm node\n");
systemd_logind_release_fd(major, minor); systemd_logind_release_fd(major, minor, -1);
return FALSE; return FALSE;
} }
config_odev_add_int_attribute(attribs, ODEV_ATTRIB_FD, fd); config_odev_add_int_attribute(attribs, ODEV_ATTRIB_FD, fd);

View File

@ -162,7 +162,7 @@ cleanup:
} }
void void
systemd_logind_release_fd(int _major, int _minor) systemd_logind_release_fd(int _major, int _minor, int fd)
{ {
struct systemd_logind_info *info = &logind_info; struct systemd_logind_info *info = &logind_info;
InputInfoPtr pInfo; InputInfoPtr pInfo;
@ -174,7 +174,7 @@ systemd_logind_release_fd(int _major, int _minor)
int matches = 0; int matches = 0;
if (!info->session || major == 0) if (!info->session || major == 0)
return; goto close;
/* Only release the fd if there is only 1 InputInfo left for this major /* Only release the fd if there is only 1 InputInfo left for this major
* and minor, otherwise other InputInfo's are still referencing the fd. */ * and minor, otherwise other InputInfo's are still referencing the fd. */
@ -218,6 +218,9 @@ cleanup:
if (reply) if (reply)
dbus_message_unref(reply); dbus_message_unref(reply);
dbus_error_free(&error); dbus_error_free(&error);
close:
if (fd != -1)
close(fd);
} }
int int

View File

@ -71,6 +71,7 @@ xf86ConfigSymTabRec DeviceTab[] = {
{RAMDAC, "ramdac"}, {RAMDAC, "ramdac"},
{DACSPEED, "dacspeed"}, {DACSPEED, "dacspeed"},
{CLOCKS, "clocks"}, {CLOCKS, "clocks"},
{MATCHSEAT, "matchseat"},
{OPTION, "option"}, {OPTION, "option"},
{VIDEORAM, "videoram"}, {VIDEORAM, "videoram"},
{BIOSBASE, "biosbase"}, {BIOSBASE, "biosbase"},
@ -216,6 +217,11 @@ xf86parseDeviceSection(void)
Error(NUMBER_MSG, "TextClockFreq"); Error(NUMBER_MSG, "TextClockFreq");
ptr->dev_textclockfreq = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); ptr->dev_textclockfreq = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
break; break;
case MATCHSEAT:
if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
Error(QUOTE_MSG, "MatchSeat");
ptr->match_seat = xf86_lex_val.str;
break;
case OPTION: case OPTION:
ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst); ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst);
break; break;

View File

@ -70,6 +70,7 @@ static xf86ConfigSymTabRec LayoutTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{SCREEN, "screen"}, {SCREEN, "screen"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{MATCHSEAT, "matchseat"},
{INACTIVE, "inactive"}, {INACTIVE, "inactive"},
{INPUTDEVICE, "inputdevice"}, {INPUTDEVICE, "inputdevice"},
{OPTION, "option"}, {OPTION, "option"},
@ -109,6 +110,11 @@ xf86parseLayoutSection(void)
ptr->lay_identifier = xf86_lex_val.str; ptr->lay_identifier = xf86_lex_val.str;
has_ident = TRUE; has_ident = TRUE;
break; break;
case MATCHSEAT:
if (xf86getSubToken(&(ptr->lay_comment)) != STRING)
Error(QUOTE_MSG, "MatchSeat");
ptr->match_seat = xf86_lex_val.str;
break;
case INACTIVE: case INACTIVE:
{ {
XF86ConfInactivePtr iptr; XF86ConfInactivePtr iptr;

View File

@ -198,6 +198,7 @@ xf86parseDisplaySubSection(void)
static xf86ConfigSymTabRec ScreenTab[] = { static xf86ConfigSymTabRec ScreenTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{MATCHSEAT, "matchseat"},
{OBSDRIVER, "driver"}, {OBSDRIVER, "driver"},
{MDEVICE, "device"}, {MDEVICE, "device"},
{MONITOR, "monitor"}, {MONITOR, "monitor"},
@ -236,6 +237,11 @@ xf86parseScreenSection(void)
Error(ONLY_ONE_MSG, "Identifier or Driver"); Error(ONLY_ONE_MSG, "Identifier or Driver");
has_ident = TRUE; has_ident = TRUE;
break; break;
case MATCHSEAT:
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
Error(QUOTE_MSG, "MatchSeat");
ptr->match_seat = xf86_lex_val.str;
break;
case OBSDRIVER: case OBSDRIVER:
if (xf86getSubToken(&(ptr->scrn_comment)) != STRING) if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
Error(QUOTE_MSG, "Driver"); Error(QUOTE_MSG, "Driver");

View File

@ -224,6 +224,7 @@ typedef struct {
int dev_screen; int dev_screen;
XF86OptionPtr dev_option_lst; XF86OptionPtr dev_option_lst;
char *dev_comment; char *dev_comment;
char *match_seat;
} XF86ConfDeviceRec, *XF86ConfDevicePtr; } XF86ConfDeviceRec, *XF86ConfDevicePtr;
typedef struct { typedef struct {
@ -275,6 +276,7 @@ typedef struct {
XF86OptionPtr scrn_option_lst; XF86OptionPtr scrn_option_lst;
char *scrn_comment; char *scrn_comment;
int scrn_virtualX, scrn_virtualY; int scrn_virtualX, scrn_virtualY;
char *match_seat;
} XF86ConfScreenRec, *XF86ConfScreenPtr; } XF86ConfScreenRec, *XF86ConfScreenPtr;
typedef struct { typedef struct {
@ -366,6 +368,7 @@ typedef struct {
XF86ConfInactivePtr lay_inactive_lst; XF86ConfInactivePtr lay_inactive_lst;
XF86ConfInputrefPtr lay_input_lst; XF86ConfInputrefPtr lay_input_lst;
XF86OptionPtr lay_option_lst; XF86OptionPtr lay_option_lst;
char *match_seat;
char *lay_comment; char *lay_comment;
} XF86ConfLayoutRec, *XF86ConfLayoutPtr; } XF86ConfLayoutRec, *XF86ConfLayoutPtr;

View File

@ -87,6 +87,7 @@ typedef enum {
VENDOR, VENDOR,
DASH, DASH,
COMMA, COMMA,
MATCHSEAT,
OPTION, OPTION,
COMMENT, COMMENT,

View File

@ -30,14 +30,14 @@
int systemd_logind_init(void); int systemd_logind_init(void);
void systemd_logind_fini(void); void systemd_logind_fini(void);
int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus); int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus);
void systemd_logind_release_fd(int major, int minor); void systemd_logind_release_fd(int major, int minor, int fd);
int systemd_logind_controls_session(void); int systemd_logind_controls_session(void);
void systemd_logind_vtenter(void); void systemd_logind_vtenter(void);
#else #else
#define systemd_logind_init() #define systemd_logind_init()
#define systemd_logind_fini() #define systemd_logind_fini()
#define systemd_logind_take_fd(major, minor, path, paus) -1 #define systemd_logind_take_fd(major, minor, path, paus) -1
#define systemd_logind_release_fd(major, minor) #define systemd_logind_release_fd(major, minor, fd) close(fd)
#define systemd_logind_controls_session() 0 #define systemd_logind_controls_session() 0
#define systemd_logind_vtenter() #define systemd_logind_vtenter()
#endif #endif