xserver: Branch 'master'
Alan Coopersmith
alanc at kemper.freedesktop.org
Tue Aug 18 20:20:50 PDT 2009
hw/xfree86/common/xf86AutoConfig.c | 19 ++++++++++++++++++-
hw/xfree86/os-support/solaris/sun_init.c | 26 +++++++++++++++-----------
2 files changed, 33 insertions(+), 12 deletions(-)
New commits:
commit 2d34eace13c2016048c627c4e96c3b2399901078
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Tue Aug 18 20:11:23 2009 -0700
Sun bug 6872917: Xorg not querying /dev/fb when no xorg.conf exists
commit 48ee5558333bd324463b6994735cabb23de262ec (OpenSolaris VT support)
broke the autoconfiguration code in xf86AutoConfig.c that uses the
Solaris-specific VIS_GETIDENTIFIER ioctl on a frame buffer device like
/dev/fb by changing xf86Info.consoleFd from /dev/fb to a /dev/vt/*
device.
This fixes it by reworking the code to split the console device
(/dev/vt/*, the vtXX CLI option) from the frame buffer device
(/dev/fb, -dev option) to allow both VT and autoconfig to work.
It also fixes the console device to use /dev/fb when VT's are not
supported instead of throwing a Fatal Error because it can't open
/dev/vt/0.
Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index ac40ab3..c6c839a 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -410,8 +410,25 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
if (xf86Info.consoleFd >= 0) {
struct vis_identifier visid;
const char *cp;
+ extern char xf86SolarisFbDev[PATH_MAX];
+ int iret;
- if (ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid) >= 0) {
+ SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
+ if (iret < 0) {
+ int fbfd;
+
+ fbfd = open(xf86SolarisFbDev, O_RDONLY);
+ if (fbfd >= 0) {
+ SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
+ close(fbfd);
+ }
+ }
+
+ if (iret < 0) {
+ xf86Msg(X_WARNING,
+ "could not get frame buffer identifier from %s\n",
+ xf86SolarisFbDev);
+ } else {
xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
/* Special case from before the general case was set */
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 44588dd..2c569f0 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -39,11 +39,15 @@ static Bool Protect0 = FALSE;
static int VTnum = -1;
static int xf86StartVT = -1;
static int vtEnabled = 0;
-static char fb_dev[PATH_MAX] = "/dev/vt/0";
-#else
-static char fb_dev[PATH_MAX] = "/dev/fb";
#endif
+/* Device to open as xf86Info.consoleFd */
+static char consoleDev[PATH_MAX] = "/dev/fb";
+
+/* Set by -dev argument on CLI
+ Used by hw/xfree86/common/xf86AutoConfig.c for VIS_GETIDENTIFIER */
+_X_HIDDEN char xf86SolarisFbDev[PATH_MAX] = "/dev/fb";
+
void
xf86OpenConsole(void)
{
@@ -116,6 +120,7 @@ xf86OpenConsole(void)
xf86StartVT = 0;
xf86Info.vtno = 0;
+ strlcpy(consoleDev, xf86SolarisFbDev, sizeof(consoleDev));
}
else
{
@@ -138,7 +143,7 @@ xf86OpenConsole(void)
}
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
- snprintf(fb_dev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
+ snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
}
if (fd != -1) {
@@ -150,14 +155,14 @@ xf86OpenConsole(void)
if (!KeepTty)
setpgrp();
- if (((xf86Info.consoleFd = open(fb_dev, O_RDWR | O_NDELAY, 0)) < 0))
+ if (((xf86Info.consoleFd = open(consoleDev, O_RDWR | O_NDELAY, 0)) < 0))
FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
- fb_dev, strerror(errno));
+ consoleDev, strerror(errno));
#ifdef HAS_USL_VTS
/* Change ownership of the vt */
- chown(fb_dev, getuid(), getgid());
+ chown(consoleDev, getuid(), getgid());
if (vtEnabled)
{
@@ -192,7 +197,7 @@ xf86OpenConsole(void)
if (i < 0) {
xf86Msg(X_WARNING,
"xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n",
- fb_dev, strerror(errno));
+ consoleDev, strerror(errno));
}
#endif
}
@@ -241,7 +246,7 @@ xf86CloseConsole(void)
* at this point whether this should be done for all framebuffers in
* the system, rather than only the console.
*/
- if ((fd = open("/dev/fb", O_RDWR, 0)) < 0) {
+ if ((fd = open(xf86SolarisFbDev, O_RDWR, 0)) < 0) {
xf86Msg(X_WARNING,
"xf86CloseConsole(): unable to open framebuffer (%s)\n",
strerror(errno));
@@ -336,8 +341,7 @@ xf86ProcessArgument(int argc, char **argv, int i)
if ((i + 1) < argc) {
if (!strcmp(argv[i], "-dev")) {
- strncpy(fb_dev, argv[i+1], PATH_MAX);
- fb_dev[PATH_MAX - 1] = '\0';
+ strlcpy(xf86SolarisFbDev, argv[i+1], sizeof(xf86SolarisFbDev));
return 2;
}
}
More information about the xorg-commit
mailing list