6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Thu, 21 Oct 2010 14:40:25 -0700
changeset 1018 baa7bc85407b
parent 1017 82e433208135
child 1019 2479b048f8d0
6935429 xorg.conf.vesa should be delivered with X server [PSARC/2010/161]
open-src/driver/xf86-video-vesa/Makefile
open-src/driver/xf86-video-vesa/xorg.conf.vesa
open-src/xserver/xorg/sun-manpage.patch
open-src/xserver/xorg/sun-paths.patch
open-src/xserver/xserver-common/Makefile
open-src/xserver/xserver-common/Xserver
open-src/xserver/xserver-common/x11-server.xml
pkg/manifests/x11-server-xorg-driver-xorg-video-vesa.mf
--- a/open-src/driver/xf86-video-vesa/Makefile	Mon Oct 11 12:14:15 2010 -0700
+++ b/open-src/driver/xf86-video-vesa/Makefile	Thu Oct 21 14:40:25 2010 -0700
@@ -54,3 +54,15 @@
 	-lfb -lpciaccess -lshadow -lvbe
 
 include ../Makefile.inc
+
+# Additional files to install
+CONFDIR = /usr/lib/X11
+CONFFILE = xorg.conf.vesa
+
+install: $(PROTODIR)$(CONFDIR)/$(CONFFILE)
+
+$(PROTODIR)$(CONFDIR)/$(CONFFILE): $(PROTODIR)$(CONFDIR) $(CONFFILE)
+	$(INSTALL_SCRIPT) -c -m 0444 $(CONFFILE) $@
+
+$(PROTODIR)$(CONFDIR):
+	mkdir -p $@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/driver/xf86-video-vesa/xorg.conf.vesa	Thu Oct 21 14:40:25 2010 -0700
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+#
+# This configuration file loads the vesa driver for the default screen.
+#
+# To use it when starting Xorg directly, simply run:
+#	X :0 -config xorg.conf.vesa
+#
+# To have it loaded when Xorg is started via the Xserver script (such as
+# when it is started by gdm or xdm), which reads properties from SMF, run:
+#	svccfg -s svc:/application/x11/x11-server \
+#	 setprop options/config_file=xorg.conf.vesa
+#
+# Do not edit this file - if you wish to provide other configuration,
+# create a new configuration file in /etc/X11 and configure the X server
+# to load it instead.
+#
+
+Section "Device"
+	Identifier  "Card0"
+	Driver      "vesa"
+EndSection
--- a/open-src/xserver/xorg/sun-manpage.patch	Mon Oct 11 12:14:15 2010 -0700
+++ b/open-src/xserver/xorg/sun-manpage.patch	Thu Oct 21 14:40:25 2010 -0700
@@ -125,7 +125,7 @@
  enables(+) or disables(-) AccessX key sequences.
  .TP 8
  .B \-xkbdir \fIdirectory\fP
-@@ -545,6 +614,102 @@ the following font path:
+@@ -545,6 +614,117 @@ the following font path:
      /usr/share/fonts/default/Type1,
      /usr/share/fonts/default/ghostscript
  .fi
@@ -187,6 +187,13 @@
 +\fB/usr/bin/Xvnc\fP
 +.fi
 +.TP
++.B options/config_file
++(Type string) Setting this to a filename causes this file to be used as the
++configuration file for the X server.   Currently this property is only
++available when used with the Xorg server.  The value of this property must
++be a relative path from one of the directories in the Xorg config file
++search path, and not an absolute path.
++.TP
 +.B options/tcp_listen
 +(Type boolean) Setting this to false disables listening for incoming TCP/IP 
 +connections (see \fB-nolisten tcp\fP option above).
@@ -217,7 +224,15 @@
 +Restart the Xserver by either logging out and logging back in, or manually 
 +if the Xserver was started from the command line.
 +.sp
-+.SS "Example: Enables the XINERAMA extension"
++.SS "Example: Use of VESA driver"
++.PP
++The following command overrides the default Xorg driver selection to use the
++/usr/lib/X11/xorg.conf.vesa configuration file to select the "vesa" driver.
++.sp
++.nf
++svccfg -s svc:/application/x11/x11-server setprop options/config_file=xorg.conf.vesa
++.fi
++.SS "Example: Enabling the XINERAMA extension"
 +.PP
 +The following command enables the XINERAMA extension.
 +.sp
--- a/open-src/xserver/xorg/sun-paths.patch	Mon Oct 11 12:14:15 2010 -0700
+++ b/open-src/xserver/xorg/sun-paths.patch	Thu Oct 21 14:40:25 2010 -0700
@@ -1,3 +1,29 @@
+diff -urp -x '*~' -x '*.orig' hw/xfree86/common/xf86Config.c hw/xfree86/common/xf86Config.c
+--- hw/xfree86/common/xf86Config.c	2010-05-03 17:47:58.000000000 -0700
++++ hw/xfree86/common/xf86Config.c	2010-10-20 20:27:00.062592706 -0700
+@@ -77,9 +77,9 @@ extern DeviceAssocRec mouse_assoc;
+  */
+ #ifndef ROOT_CONFIGPATH
+ #define ROOT_CONFIGPATH	"%A," "%R," \
+-			"/etc/X11/%R," "%P/etc/X11/%R," \
++			"/etc/X11/%R," "%P/lib/X11/%R," \
+ 			"%E," "%F," \
+-			"/etc/X11/%F," "%P/etc/X11/%F," \
++			"/etc/X11/%F," "%P/lib/X11/%F," \
+ 			"/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ 			"%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ 			"%P/etc/X11/%X," \
+@@ -87,8 +87,8 @@ extern DeviceAssocRec mouse_assoc;
+ 			"%P/lib/X11/%X"
+ #endif
+ #ifndef USER_CONFIGPATH
+-#define USER_CONFIGPATH	"/etc/X11/%S," "%P/etc/X11/%S," \
+-			"/etc/X11/%G," "%P/etc/X11/%G," \
++#define USER_CONFIGPATH	"/etc/X11/%S," "%P/lib/X11/%S," \
++			"/etc/X11/%G," "%P/lib/X11/%G," \
+ 			"/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ 			"%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ 			"%P/etc/X11/%X," \
 diff -urp -x '*~' -x '*.orig' hw/xfree86/common/xf86Globals.c hw/xfree86/common/xf86Globals.c
 --- hw/xfree86/common/xf86Globals.c	2009-11-22 16:35:01.000000000 -0800
 +++ hw/xfree86/common/xf86Globals.c	2009-12-02 18:57:45.196668578 -0800
@@ -11,3 +37,31 @@
  MessageType xf86ModPathFrom = X_DEFAULT;
  const char *xf86LogFile = DEFAULT_LOGPREFIX;
  MessageType xf86LogFileFrom = X_DEFAULT;
+diff -urp -x '*~' -x '*.orig' hw/xfree86/doc/man/xorg.conf.man.pre hw/xfree86/doc/man/xorg.conf.man.pre
+--- hw/xfree86/doc/man/xorg.conf.man.pre	2010-05-03 17:47:59.000000000 -0700
++++ hw/xfree86/doc/man/xorg.conf.man.pre	2010-10-20 20:27:00.063252935 -0700
+@@ -28,9 +28,9 @@ server is started as a normal user:
+ .RS 4
+ .nf
+ .IR /etc/X11/ <cmdline>
+-.IR __projectroot__/etc/X11/ <cmdline>
++.IR __projectroot__/lib/X11/ <cmdline>
+ .IB /etc/X11/ $XORGCONFIG
+-.IB __projectroot__/etc/X11/ $XORGCONFIG
++.IB __projectroot__/lib/X11/ $XORGCONFIG
+ .I /etc/X11/__xconfigfile__\-4
+ .I /etc/X11/__xconfigfile__
+ .I /etc/__xconfigfile__
+@@ -62,10 +62,10 @@ search locations are as follows:
+ .nf
+ <cmdline>
+ .IR /etc/X11/ <cmdline>
+-.IR __projectroot__/etc/X11/ <cmdline>
++.IR __projectroot__/lib/X11/ <cmdline>
+ .B $XORGCONFIG
+ .IB /etc/X11/ $XORGCONFIG
+-.IB __projectroot__/etc/X11/ $XORGCONFIG
++.IB __projectroot__/lib/X11/ $XORGCONFIG
+ .I /etc/X11/__xconfigfile__\-4
+ .I /etc/X11/__xconfigfile__
+ .I /etc/__xconfigfile__
--- a/open-src/xserver/xserver-common/Makefile	Mon Oct 11 12:14:15 2010 -0700
+++ b/open-src/xserver/xserver-common/Makefile	Thu Oct 21 14:40:25 2010 -0700
@@ -31,6 +31,9 @@
 # ARC cases that covered this module
 # PSARC/2004/752 X Consolidation conversion to SMF
 MODULE_ARC_CASES = PSARC/2004/752
+# PSARC/2010/161 Xorg configuration file for VESA driver selection
+# (addition of SMF property options/config_file)
+MODULE_ARC_CASES += PSARC/2010/161
 
 # No upstream sources for these files, since they're Solaris-specific
 MODULE_VERSION=$(XORGSERVER_VERS)
--- a/open-src/xserver/xserver-common/Xserver	Mon Oct 11 12:14:15 2010 -0700
+++ b/open-src/xserver/xserver-common/Xserver	Thu Oct 21 14:40:25 2010 -0700
@@ -48,6 +48,7 @@
 SERVERARGS=""
 XSERVER="/usr/bin/Xorg"
 CONSOLE=""
+CONFIG_FILE=""
 
 
 while getopts :c: opt; do
@@ -117,6 +118,7 @@
 getprop options/server_args SERVERARGS
 getprop options/tcp_listen TCP_LISTEN
 getprop options/display_0_on_console CONSOLE
+getprop options/config_file CONFIG_FILE
 
 ORIGINAL_XSERVER="${XSERVER}"
 
@@ -205,6 +207,20 @@
     CONSOLE=""
 fi
 
-ALLARGS="${DEPTHARG} ${LISTENARG} ${SERVERARGS} ${CONSOLE} $*"
+# Currently only Xorg accepts a command line flag for choosing config files.
+# If other X servers add such flags in the future, they should be added here.
+# Only filenames without directory paths are allowed (similar to when a 
+# non-root user runs Xorg -config) to avoid security issues.
+CONFIGARG=""
+if [[ ! -z "${CONFIG_FILE}" ]] ; then
+    case ${CONFIG_FILE} in
+	*/*)	fatal_error "Illegal value for config_file property" ;;
+    esac
+    case ${XSERVER} in
+	*Xorg)	CONFIGARG="-config ${CONFIG_FILE}" ;;
+    esac
+fi
+
+ALLARGS="${DEPTHARG} ${LISTENARG} ${SERVERARGS} ${CONSOLE} ${CONFIGARG} $*"
 
 exec ${XSERVER} :${DISPLAY} ${ALLARGS}
--- a/open-src/xserver/xserver-common/x11-server.xml	Mon Oct 11 12:14:15 2010 -0700
+++ b/open-src/xserver/xserver-common/x11-server.xml	Thu Oct 21 14:40:25 2010 -0700
@@ -90,6 +90,7 @@
 			value='solaris.smf.manage.x11' />
                	<propval name='display_0_on_console' type='boolean' 
 		 value='false' />
+               	<propval name='config_file' type='astring' value='' />
 	</property_group> 	
 
 	<stability value='Evolving' />
--- a/pkg/manifests/x11-server-xorg-driver-xorg-video-vesa.mf	Mon Oct 11 12:14:15 2010 -0700
+++ b/pkg/manifests/x11-server-xorg-driver-xorg-video-vesa.mf	Thu Oct 21 14:40:25 2010 -0700
@@ -28,6 +28,7 @@
 set name=variant.arch value=i386
 dir path=usr
 dir path=usr/lib
+dir path=usr/lib/X11
 dir path=usr/lib/xorg
 dir path=usr/lib/xorg/modules
 dir path=usr/lib/xorg/modules/drivers
@@ -35,6 +36,7 @@
 dir path=usr/share
 dir path=usr/share/man
 dir path=usr/share/man/man7
+file path=usr/lib/X11/xorg.conf.vesa
 file path=usr/lib/xorg/modules/drivers/$(ARCH64)/vesa_drv.so
 file path=usr/lib/xorg/modules/drivers/vesa_drv.so
 file path=usr/share/man/man7/vesa.7