--- a/open-src/app/gfx-utils/Makefile Mon Apr 09 19:08:30 2012 -0700
+++ b/open-src/app/gfx-utils/Makefile Tue Apr 10 09:09:50 2012 -0700
@@ -62,11 +62,9 @@
include ../Makefile.inc
# Install metadata for fb-specific packages too
-FB_MODULES = ast efb
-VTS_MODULES = mga
+FB_MODULES = ast efb mga
EXTRA_METADATA_DIRS = $(FB_MODULES:%=$(MODULE_PKG_METADATA_DIR)-fbconfig-%)
-EXTRA_METADATA_DIRS += $(VTS_MODULES:%=$(MODULE_PKG_METADATA_DIR)-sunvts-%)
EXTRA_ATTRDATA_FILES = $(EXTRA_METADATA_DIRS:%=%/$(ATTRDATA_FILE_NAME))
EXTRA_LICENSE_FILES = $(EXTRA_METADATA_DIRS:%=%/$(LICENSE_FILE_NAME))
@@ -84,7 +82,7 @@
# Modules for specific frame buffers are covered only by Oracle copyright
AST_LICENSE_FILE = $(MODULE_PKG_METADATA_DIR)-fbconfig-ast/$(LICENSE_FILE_NAME)
EFB_LICENSE_FILE = $(MODULE_PKG_METADATA_DIR)-fbconfig-efb/$(LICENSE_FILE_NAME)
-MGA_LICENSE_FILE = $(MODULE_PKG_METADATA_DIR)-sunvts-mga/$(LICENSE_FILE_NAME)
+MGA_LICENSE_FILE = $(MODULE_PKG_METADATA_DIR)-fbconfig-mga/$(LICENSE_FILE_NAME)
$(AST_LICENSE_FILE):= LICENSE_FILE = COPYING.ast
$(EFB_LICENSE_FILE):= LICENSE_FILE = COPYING.efb
--- a/open-src/app/gfx-utils/sun-src/fbconf_xorg/Makefile Mon Apr 09 19:08:30 2012 -0700
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/Makefile Tue Apr 10 09:09:50 2012 -0700
@@ -3,7 +3,7 @@
#
#
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2012, 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"),
@@ -97,6 +97,7 @@
$(BIN_DIR) \
$(BIN_DIR)/$(LIB_EFB_SO)$(VERS) \
$(BIN_DIR)/$(LIB_AST_SO)$(VERS) \
+ $(BIN_DIR)/$(LIB_MGA_SO)$(VERS) \
$(BIN_DIR)/$(BIN)
all: init $(TARGETS)
@@ -116,6 +117,9 @@
$(BIN_DIR)/$(LIB_AST_SO)$(VERS): $(BIN_DIR)/$(LIB_FBC_SO)$(VERS) Makefile.ast
$(MAKE) -f Makefile.ast all
+$(BIN_DIR)/$(LIB_MGA_SO)$(VERS): $(BIN_DIR)/$(LIB_FBC_SO)$(VERS) Makefile.mga
+ $(MAKE) -f Makefile.mga all
+
# Component-specific compilation rule
$(FBC_BIN_DIR)/%.o: $(FBC_SRC_DIR)/%.c $(FBC_HDRS)
@@ -126,6 +130,7 @@
$(MAKE) -f Makefile.fbc install
$(MAKE) -f Makefile.efb install
$(MAKE) -f Makefile.ast install
+ $(MAKE) -f Makefile.mga install
$(INSTALL_BIN_DIR)/$(BIN): $(BIN)
$(INSTALL) -m 0555 $? $@
@@ -142,6 +147,7 @@
$(MAKE) -f Makefile.fbc clean
$(MAKE) -f Makefile.efb clean
$(MAKE) -f Makefile.ast clean
+ $(MAKE) -f Makefile.mga clean
-rm -f $(BIN_OBJS) $(FBC_SRC_DIR)/*~ *~
clobber: clean
@@ -150,6 +156,7 @@
$(MAKE) -f Makefile.fbc clobber
$(MAKE) -f Makefile.efb clobber
$(MAKE) -f Makefile.ast clobber
+ $(MAKE) -f Makefile.mga clobber
rm -f $(BIN_DIR)/$(BIN)
rm -rf $(BIN_DIR)
--- a/open-src/app/gfx-utils/sun-src/fbconf_xorg/Makefile.common Mon Apr 09 19:08:30 2012 -0700
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/Makefile.common Tue Apr 10 09:09:50 2012 -0700
@@ -3,7 +3,7 @@
#
#
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2012, 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"),
@@ -59,6 +59,10 @@
LIB_AST = lib$(L_AST)
LIB_AST_SO = $(LIB_AST).so
+L_MGA = SUNWmga_conf
+LIB_MGA = lib$(L_MGA)
+LIB_MGA_SO = $(LIB_MGA).so
+
#
# Environment pathnames
@@ -88,6 +92,9 @@
AST_SRC_DIR = $(SRC_DIR)/ast
AST_BIN_DIR = $(BIN_DIR)/ast
+MGA_SRC_DIR = $(SRC_DIR)/mga
+MGA_BIN_DIR = $(BIN_DIR)/mga
+
INSTALL_BIN_DIR = $(DESTDIR)/usr/lib/fbconfig
INSTALL_LIB_DIR = $(DESTDIR)/usr/lib/fbconfig
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/Makefile.mga Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,144 @@
+#
+# Makefile for libSUNWmga_conf.so
+#
+
+#
+# Copyright (c) 2008, 2012, 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.
+#
+
+
+include Makefile.common
+
+VPATH =$(FBC_SRC_DIR):$(MGA_SRC_DIR)
+
+
+#
+# Preprocessor flags
+#
+
+MGA_DEFINE = $DEFINE
+
+#MGA_INC = -I$(COMMON)/include -I$(COMMON)/lib -I$(OPENWINHOME)/include
+
+MGA_INC = -I$(FBC_SRC_DIR) -I$(XF86_SRC_DIR) -I$(MGA_SRC_DIR)
+MGA_INC += -I$(GFX_COMMON)/include
+# MGA_INC += -I../../staging/mga/common/include -I../../common/lib
+
+
+#
+# Linker flags
+#
+
+LIBS = -L$(BIN_DIR) -l$(L_FBC)
+
+
+#
+# Code modules
+#
+
+FBC_HDRS = \
+ fbc.h \
+ fbc_dev.h \
+ fbc_properties.h \
+ fbc_getargs.h \
+ fbc_keywds.h \
+ fbc_help.h \
+ fbc_open_device.h \
+ fbc_gamma_table.h \
+ fbc_line_er.h \
+ fbc_xorg.h \
+ fbc_edit_config.h \
+ fbc_Device.h \
+ fbc_Screen.h \
+ fbc_Monitor.h \
+ fbc_Option.h \
+ fbc_fields.h \
+ fbc_open_master.h \
+ fbc_prconf.h \
+ fbc_predid.h \
+ fbc_propt.h \
+ fbc_res.h \
+ sun_edid.h \
+ fbc_mode_list.h \
+ fbc_ask.h \
+ fbc_error.h
+
+MGA_HDRS = \
+ mga_properties.h \
+ mga_query_device.h \
+ mga_res_try_now.h \
+ mga_prconf.h \
+ mga_predid.h
+
+MGA_CSRCS = \
+ mga_properties.c \
+ mga_query_device.c \
+ mga_res_try_now.c \
+ mga_prconf.c \
+ mga_predid.c
+
+MGA_OBJ_FILES = $(MGA_CSRCS:.c=.o)
+MGA_OBJS = $(MGA_OBJ_FILES:%=$(MGA_BIN_DIR)/%)
+
+
+all: $(MGA_BIN_DIR) $(BIN_DIR)/$(LIB_MGA_SO)$(VERS)
+
+
+# Library build rules
+
+$(BIN_DIR)/$(LIB_MGA_SO)$(VERS): $(MGA_OBJS) $(BIN_DIR)/$(LIB_FBC_SO)$(VERS)
+ rm -f $(BIN_DIR)/$(LIB_MGA_SO)
+ $(CC) $(LIB_LDFLAGS) $(MGA_OBJS) $(LIBS) $(DYNLIBFLAGS) -o $@
+ ln -s $@ $(BIN_DIR)/$(LIB_MGA_SO)
+
+$(BIN_DIR)/$(LIB_FBC_SO)$(VERS):
+ $(MAKE) -f Makefile.fbc all
+
+# Component-specific compilation rules
+
+$(MGA_BIN_DIR)/%.o: $(MGA_SRC_DIR)/%.c $(FBC_HDRS) $(MGA_HDRS)
+ $(CC) $(MGA_INC) $(CFLAGS) -c -o $@ $<
+
+
+# Directories
+
+$(MGA_BIN_DIR):
+ [ -d $@ ] || mkdir -p $@
+
+
+install: all $(INSTALL_LIB_DIR)/$(LIB_MGA_SO) $(INSTALL_LIB_DIR)/$(LIB_MGA_SO)$(VERS)
+
+$(INSTALL_LIB_DIR)/$(LIB_MGA_SO)$(VERS): $(LIB_MGA_SO)$(VERS)
+ $(INSTALL) -m 0555 $? $@
+
+$(INSTALL_LIB_DIR)/$(LIB_MGA_SO): $(LIB_MGA_SO)$(VERS)
+ -rm -f $@
+ ln -s $(LIB_MGA_SO)$(VERS) $@
+
+clean:
+ rm -f $(MGA_OBJS) $(MGA_SRC_DIR)/*~
+
+clobber: clean
+ rm -f $(BIN_DIR)/$(LIB_MGA_SO)$(VERS) $(BIN_DIR)/$(LIB_MGA_SO)
+
+
+# End of Makefile.mga
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_prconf.c Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_prconf - Display current mga hardware configuration
+ */
+
+#include <sys/int_types.h> /* uint8_t */
+#include <stdio.h> /* printf(), puts() */
+#include <stdlib.h> /* free() */
+
+#include "xf86Parser.h" /* Public function, etc. declarations */
+
+#include "sun_edid.h" /* EDID data parsing */
+
+#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_error.h" /* Error reporting */
+#include "fbc_prconf.h" /* Display current hardware configuration */
+#include "fbc_properties.h" /* fbconf_xorg(1M) program properties */
+
+#include "mga_prconf.h" /* Display current mga hardware config */
+
+
+/*
+ * mga_prconf_stream()
+ *
+ * Display the monitor and resolution information for the indicated
+ * video stream (stream_bit), unless we determine that this stream
+ * isn't in the set of streams (stream_set) the user wants displayed.
+ */
+
+static
+void
+mga_prconf_stream(
+ const fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ int stream_index, /* Video stream index (zero-based) */
+ fbc_mode_elem_t *mode_list) /* Modes from Monitor section of cfg */
+{
+ const int stream_bit[2] = {
+ GFX_EDID_HEAD_ONE, /* Video stream 1 bit */
+ GFX_EDID_HEAD_TWO /* Video stream 2 bit */
+ };
+ gfx_edid_t edid; /* EDID data, etc. */
+ uint8_t edid_data[128]; /* EDID blocks (128 bytes each) */
+
+ /*
+ * Get and display the EDID data for this stream's display device
+ */
+ edid.head = stream_bit[stream_index];
+ edid.length = sizeof(edid_data);
+ edid.data = (caddr_t)edid_data;
+ mga_get_edid_data(device->fd, &edid);
+
+ fbc_prconf_edid((uint8_t *)edid.data, edid.length, mode_list);
+
+ /*
+ * Display the current video mode setting
+ */
+ fbc_prconf_cur_mode(device->fd);
+
+} /* mga_prconf_stream() */
+
+
+/*
+ * mga_prconf()
+ *
+ * Display the current hardware configuration (-prconf).
+ */
+
+void
+mga_prconf(
+ const fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_varient_t *fbvar, /* fbconf_xorg(1M) varient data */
+ XF86ConfigPtr configIR) /* Config file Internal Rep */
+{
+ fbc_mode_elem_t *mode_list; /* Modes from Monitor section of cfg */
+ int stream_index; /* Video stream index (zero-based) */
+
+ /*
+ * Display the frame buffer model name and part number
+ */
+ fbc_prconf_model(device->fd);
+
+ /*
+ * Get the Modes declared by the active Monitor section of the config
+ *
+ * This is an "unintrusive" linked list. Each list element
+ * points to, rather than contains, a ModeLine /
+ * Mode-EndMode entry. The mode entries are independent of
+ * the list.
+ */
+ mode_list = fbc_get_mode_list(configIR,
+ fbvar->active.monitor_sectn,
+ device->type);
+
+ /*
+ * Display the monitor info for each of the indicated streams (-dev)
+ */
+ printf("\nMonitor/Resolution Information:\n");
+
+ for (stream_index = device->stream_lo;
+ stream_index <= device->stream_hi;
+ stream_index += 1) {
+ printf("Monitor %d:\n", stream_index + 1);
+ mga_prconf_stream(device, stream_index, mode_list);
+ }
+
+ fbc_free_mode_list(mode_list); /* Free the list but not the Modes */
+
+} /* mga_prconf() */
+
+
+/* End of mga_prconf.c */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_prconf.h Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_prconf - Display mga hardware configuration
+ */
+
+
+#ifndef _MGA_PRCONF_H
+#define _MGA_PRCONF_H
+
+
+#include "xf86Parser.h" /* Public function, etc. declarations */
+
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_properties.h" /* fbconf_xorg(1M) program properties */
+
+#include "mga_query_device.h" /* Query the mga graphics device */
+
+
+void mga_prconf(
+ const fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_varient_t *fbvar, /* fbconf_xorg(1M) varient data */
+ XF86ConfigPtr configIR); /* Config file Internal Rep */
+
+
+#endif /* _MGA_PRCONF_H */
+
+
+/* End of mga_prconf.h */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_predid.c Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_predid - Display EDID data
+ */
+
+#include <sys/int_types.h> /* uint8_t */
+#include <stdio.h> /* printf() */
+
+#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_predid.h" /* Display EDID data */
+#include "fbc_properties.h" /* fbconf_xorg(1M) program properties */
+#include "fbc_query_device.h" /* Query a frame buffer device */
+
+#include "mga_predid.h" /* Display EDID data */
+#include "mga_query_device.h" /* Query the mga graphics device */
+
+
+/*
+ * mga_predid_stream()
+ *
+ * Display the EDID data for the display device specified by video
+ * stream index (which corresponds to the device name's stream suffix
+ * letter).
+ */
+
+static
+void
+mga_predid_stream(
+ int device_fd, /* Device file descriptor */
+ int stream_index, /* Video stream index (zero-based) */
+ int predid_raw, /* TRUE => Display raw EDID data */
+ int predid_parsed) /* TRUE => Display parsed EDID data */
+{
+ const int edid_stream[2] = {
+ GFX_EDID_HEAD_ONE, /* Video stream 1 bit */
+ GFX_EDID_HEAD_TWO /* Video stream 2 bit */
+ };
+ gfx_edid_t edid; /* EDID data, etc. */
+ uint8_t edid_data[128]; /* EDID blocks (128 bytes each) */
+
+ /*
+ * Get the EDID data for this video stream's display device
+ */
+ edid.head = edid_stream[stream_index];
+ edid.length = sizeof(edid_data);
+ edid.data = (caddr_t)edid_data;
+ mga_get_edid_data(device_fd, &edid);
+
+ /*
+ * Display the EDID information for this display device
+ */
+ fbc_predid((uint8_t *)edid.data, edid.length, predid_raw, predid_parsed);
+
+} /* mga_predid_stream() */
+
+
+/*
+ * mga_predid()
+ *
+ * Display EDID data for each video stream (-predid [raw] [parsed]).
+ */
+
+void
+mga_predid(
+ const fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_varient_t *fbvar) /* fbconf_xorg(1M) varient data */
+{
+ int stream_index; /* Video stream index (zero-based) */
+
+ /*
+ * Display the EDID data for each of the indicated streams (-dev)
+ */
+ for (stream_index = device->stream_lo;
+ stream_index <= device->stream_hi;
+ stream_index += 1) {
+ printf("Monitor %d:\n", stream_index + 1);
+ mga_predid_stream(device->fd,
+ stream_index,
+ fbvar->option_set.predid_raw,
+ fbvar->option_set.predid_parsed);
+ }
+
+} /* mga_predid() */
+
+
+/* End of mga_predid.c */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_predid.h Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_predid - Display EDID data
+ */
+
+
+#ifndef _MGA_PREDID_H
+#define _MGA_PREDID_H
+
+
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_properties.h" /* fbconf_xorg(1M) program properties */
+
+
+void mga_predid(
+ const fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_varient_t *fbvar); /* fbconf_xorg(1M) varient data */
+
+
+#endif /* _MGA_PREDID_H */
+
+
+/* End of mga_predid.h */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_properties.c Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_properties - mga device-specific properties
+ *
+ * Matrox graphics core in Emulex Pilot 3
+ */
+
+#include <stdlib.h> /* free() */
+
+#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_error.h" /* Error reporting */
+#include "fbc_getargs.h" /* Program command line processing */
+#include "fbc_help.h" /* Program usage and help messages */
+#include "fbc_properties.h" /* Establish fbconf_xorg program properties */
+#include "fbc_propt.h" /* Display the current option settings */
+#include "fbc_query_device.h" /* Query a frame buffer device */
+#include "fbc_xorg.h" /* Edit config file data representations */
+
+#include "mga_prconf.h" /* Display mga hardware configuration */
+#include "mga_predid.h" /* Display EDID data */
+#include "mga_properties.h" /* mga device-specific properties */
+#include "mga_query_device.h" /* Query the mga graphics device */
+#include "mga_res_try_now.h" /* Video mode setting (-res try now) */
+
+
+/*
+ * Tell fbconf_xorg(1M) what API version libSUNWmga_conf is using
+ */
+fbc_api_ver_t SUNWmga_api_version = FBC_API_VERSION;
+
+
+/*
+ * Usage (error) message text
+ */
+static const char *mga_usage_text_body =
+ " [-dev device-filename]\n"
+ "\t\t [-file machine | system | config-path]\n"
+ "\t\t [-res video-mode [nocheck | noconfirm] ]\n"
+ "\t\t [-rscreen enable | disable]\n"
+ "\t\t [-defaults]\n"
+ "\t\t [-help]\n"
+ "\t\t [-res \\?]\n"
+ "\t\t [-prconf] [-predid [raw] [parsed]] [-propt]\n"
+ "\n";
+
+
+/*
+ * Command line option descriptors for fbconf_xorg(1M) and mga devices
+ *
+ * These table entries must be in -help display order.
+ *
+ * When fbc_Option_keyword() is the "Option handler function"
+ * (fbopt_descr_t.fbc_getopt_fn member), the "Config Option entry
+ * name(s)" string (fbopt_descr_t.conf_name member) is composed of
+ * contiguous Nul-terminated Option names that are terminated by an
+ * additional Nul, e.g.:
+ * FBC_KEYWD_DoubleWide "\0" FBC_KEYWD_DoubleHigh "\0"
+ * or (nominally):
+ * "DoubleWide\0DoubleHigh\0\0"
+ *
+ * See fbc_getopt.h for the relevant declarations and definitions.
+ */
+
+static fbopt_descr_t mga_option[] = {
+ {
+ /* -defaults */
+ "defaults", /* Command line option name */
+ fbc_help_defaults, /* Help text */
+ 0, /* Min # of option arguments */
+ fbc_opt_defaults, /* Option handler function */
+ NULL, /* Command line option keywords */
+ FBC_SECTION_NONE, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* *** POSITIVELY NO RECURSIVE DEFAULTS! *** */
+ },
+ {
+ /* -dev <device> */
+ "dev", /* Command line option name */
+ fbc_help_dev, /* Help text */
+ 1, /* Min # of option arguments */
+ fbc_opt_dev, /* Option handler function */
+ NULL, /* Command line option keywords */
+ FBC_SECTN_Device, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* argv[] invoked by -defaults */
+ },
+ {
+ /* -file machine|system|<config-path> */
+ "file", /* Command line option name */
+ fbc_help_file, /* Help text */
+ 1, /* Min # of option arguments */
+ fbc_opt_file, /* Option handler function */
+ fbc_keywds_file, /* Command line option keywords */
+ FBC_SECTION_NONE, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* argv[] invoked by -defaults */
+ },
+ {
+ /* -help */
+ "help", /* Command line option name */
+ fbc_help_help, /* Help text */
+ 0, /* Min # of option arguments */
+ fbc_opt_help, /* Option handler function */
+ NULL, /* Command line option keywords */
+ FBC_SECTION_NONE, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* argv[] invoked by -defaults */
+ },
+ {
+ /* -prconf */
+ "prconf", /* Command line option name */
+ fbc_help_prconf, /* Help text */
+ 0, /* Min # of option arguments */
+ fbc_opt_prconf, /* Option handler function */
+ NULL, /* Command line option keywords */
+ FBC_SECTION_NONE, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* argv[] invoked by -defaults */
+ },
+ {
+ /* -predid [raw] [parsed] */
+ "predid", /* Command line option name */
+ fbc_help_predid, /* Help text */
+ 0, /* Min # of option arguments */
+ fbc_opt_predid, /* Option handler function */
+ NULL, /* Command line option keywords */
+ FBC_SECTION_NONE, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* argv[] invoked by -defaults */
+ },
+ {
+ /* -propt */
+ "propt", /* Command line option name */
+ fbc_help_propt, /* Help text */
+ 0, /* Min # of option arguments */
+ fbc_opt_propt, /* Option handler function */
+ NULL, /* Command line option keywords */
+ FBC_SECTION_NONE, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* argv[] invoked by -defaults */
+ },
+ {
+ /* -res ? */
+ /* -res <video-mode> [nocheck|noconfirm] [try] [now] */
+ "res", /* Command line option name */
+ fbc_help_res_nntn, /* Help text */
+ 1, /* Min # of option arguments */
+ fbc_opt_res, /* Option handler function */
+ fbc_keywds_res_nntn, /* Command line option keywords */
+ FBC_SECTN_Res, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* argv[] invoked by -defaults */
+ },
+ {
+ /* -rscreen enable|disable */
+ "rscreen", /* Command line option name */
+ fbc_help_rscreen, /* Help text */
+ 1, /* Min # of option arguments */
+ fbc_Option_keyword, /* Option handler function */
+ fbc_keywds_xable, /* Command line option keywords */
+ FBC_SECTN_RScreen, /* Config section code */
+ FBC_KEYWD_RScreen "\0", /* Config Option entry name(s) */
+ fbc_defargv_rscreen /* argv[] invoked by -defaults */
+ },
+
+ {
+ /* End-of-table marker */
+ NULL, /* Command line option name */
+ NULL, /* Help text */
+ 0, /* Min # of option arguments */
+ NULL, /* Option handler function */
+ NULL, /* Command line option keywords */
+ FBC_SECTION_NONE, /* Config section code */
+ NULL, /* Config Option entry name(s) */
+ NULL /* argv[] invoked by -defaults */
+ }
+};
+
+
+/*
+ * List of functions to display the current option settings (-propt)
+ */
+static fbc_propt_fn_t *mga_propt_fn[] = {
+ fbc_propt_file, /* Configuration file */
+ fbc_propt_video_mode, /* Current video mode name: -res */
+ fbc_propt_screen_title, /* Screen settings title */
+ fbc_propt_rscreen, /* Remote console setting: -rscreen */
+ NULL /* End of table */
+};
+
+
+/*
+ * SUNWmga_get_properties()
+ *
+ * Return the fbconf_xorg(1M) properties for the mga frame buffer
+ * device type.
+ */
+
+int
+SUNWmga_get_properties(
+ fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_varient_t *fbvar) /* Updated fbconf_xorg properties */
+{
+
+ /*
+ * Provide some more frame buffer device information
+ */
+ device->max_streams = 1; /* No 'a'|'b' suffixes */
+
+ /*
+ * Establish the device properties and the fbconf_xorg(1M) behavior
+ */
+ fbvar->usage_text_body = mga_usage_text_body;
+
+ fbvar->gamma_default = FBC_GAMMA_DEFAULT; /* No gamma correction */
+
+ fbvar->lut_size = 0; /* No gamma look-up table w/ mga */
+ fbvar->fbc_option = &mga_option[0];
+
+ fbvar->xf86_entry_mods.Option_mods_size =
+ sizeof (mga_option) / sizeof (fbopt_descr_t);
+
+ fbvar->get_edid_res_info = &mga_get_edid_res_info;
+ fbvar->revise_settings = NULL;
+ fbvar->init_device = NULL;
+ fbvar->prconf = &mga_prconf;
+ fbvar->predid = &mga_predid;
+ fbvar->propt_fn = &mga_propt_fn[0];
+
+#if defined(RES_TRY_NOW)
+ fbvar->res_mode_try = &mga_res_mode_try;
+ fbvar->res_mode_now = &mga_res_mode_now;
+#else
+ fbvar->res_mode_try = NULL;
+ fbvar->res_mode_now = NULL;
+#endif
+
+ return (FBC_SUCCESS);
+
+} /* SUNWmga_get_properties() */
+
+
+/* End of mga_properties.c */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_properties.h Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_properties - mga device-specific properties
+ */
+
+
+#ifndef _MGA_PROPERTIES_H
+#define _MGA_PROPERTIES_H
+
+
+#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_properties.h" /* fbconf_xorg(1M) program properties */
+
+
+extern fbc_api_ver_t SUNWmga_api_version; /* libSUNWmga_conf API version */
+
+
+int SUNWmga_get_properties(
+ fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_varient_t *fbvar); /* Updated fbconf_xorg properties */
+
+
+#endif /* _MGA_PROPERTIES_H */
+
+
+/* End of mga_properties.h */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_query_device.c Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_query_device - Query the mga frame buffer device
+ */
+
+#include <sys/int_types.h> /* uint8_t, uint32_t */
+#include <errno.h> /* errno */
+#include <stdio.h> /* NULL */
+#include <stdlib.h> /* malloc() */
+#include <string.h> /* memset(), strdup(), strerror() */
+#include <unistd.h> /* ioctl(), sleep() */
+
+#include <sys/fbio.h> /* cg6_info, fbgattr */
+
+#include "gfx_common.h" /* Model name, part number, cur video mode */
+
+#include "sun_edid.h" /* EDID data parsing */
+
+#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_error.h" /* Error reporting */
+#include "fbc_mode_list.h" /* List of Modes from the config file */
+#include "fbc_query_device.h" /* Query a frame buffer device */
+
+#include "mga_query_device.h" /* Query the mga frame buffer device */
+
+
+/*
+ * mga_get_edid_data()
+ *
+ * Query the frame buffer device for EDID data. Return zero upon
+ * success, along with the EDID data, etc. In the event of an error,
+ * display an error message and return the errno code and a NULL
+ * data pointer.
+ */
+
+int
+mga_get_edid_data(
+ int device_fd, /* Device file descriptor number */
+ gfx_edid_t *edid) /* EDID data, etc. */
+{
+ int i; /* Retry loop counter */
+
+ /*
+ * Get the EDID data for this video stream's display device
+ *
+ * If the display device had been powered down, it may take a
+ * few seconds to come up (Bug 4962976).
+ */
+#define GET_EDID_RETRIES 3 /* # of ioctl(MGA_GET_EDID) retries */
+ for (i = GET_EDID_RETRIES; ; i -= 1) {
+ if (ioctl(device_fd, GFX_IOCTL_GET_EDID, edid) >= 0) {
+ break;
+ }
+ if (i <= 0) {
+ edid->length = 0;
+ edid->data = NULL;
+ return (errno); /* EDID data is unavailable */
+ }
+ sleep(1);
+ }
+
+ return (0);
+
+} /* mga_get_edid_data() */
+
+
+/*
+ * mga_get_edid_res_info()
+ *
+ * For each video stream indicated by the effective -dev option,
+ * retrieve the EDID data from the display device and return the
+ * following information:
+ * * Manufacturer ID
+ * * Product Code
+ * * Pointer to a dynamically allocated array of supported video
+ * mode name strings w/ preferred video mode in first element
+ * The display device information is returned in the
+ * edid_res_info[FBC_MAX_STREAMS] array.
+ */
+
+void
+mga_get_edid_res_info(
+ const fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_mode_elem_t *mode_list, /* Modes from Monitor section of cfg */
+ fbc_edid_res_t edid_res_info[]) /* Returned display device info */
+{
+ const int mga_stream[2] = {
+ GFX_EDID_HEAD_ONE, /* Video stream 1 bit */
+ GFX_EDID_HEAD_TWO /* Video stream 2 bit */
+ };
+ gfx_edid_t edid; /* EDID data, etc. */
+ uint8_t edid_data[128]; /* EDID blocks (128 bytes each) */
+ uint32_t serial_num; /* ID Serial Number (ignored) */
+ int stream_index; /* Video stream index (zero-based) */
+
+ memset(edid_res_info, 0, sizeof (fbc_edid_res_t) * FBC_MAX_STREAMS);
+
+ /*
+ * Get the EDID -res information for the indicated streams (-dev)
+ */
+ for (stream_index = device->stream_lo;
+ stream_index <= device->stream_hi;
+ stream_index += 1) {
+ /*
+ * Get the EDID data for this video stream's display device
+ */
+ edid.head = mga_stream[stream_index];
+ edid.length = sizeof (edid_data);
+ edid.data = (caddr_t)edid_data;
+ if ((mga_get_edid_data(device->fd, &edid) != 0)
+ || (sun_edid_check_base((uint8_t *)edid.data, edid.length) != 0)) {
+ continue;
+ }
+
+ /*
+ * Extract the -res related data for this display device
+ */
+ sun_edid_vendor((uint8_t *)edid.data,
+ edid_res_info[stream_index].manufacturer_id,
+ &edid_res_info[stream_index].product_code,
+ &serial_num);
+ edid_res_info[stream_index].video_mode =
+ sun_edid_video_modes((uint8_t *)edid.data, edid.length, mode_list);
+ }
+
+} /* mga_get_edid_res_info() */
+
+
+/* End of mga_query_device.c */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_query_device.h Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_query_device - Query the mga frame buffer device
+ */
+
+
+#ifndef _MGA_QUERY_DEVICE_H
+#define _MGA_QUERY_DEVICE_H
+
+#include "gfx_common.h"
+
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_mode_list.h" /* List of Modes from Monitor section of cfg */
+#include "fbc_query_device.h" /* Query a frame buffer device */
+
+
+int mga_get_edid_data(
+ int device_fd, /* Device file descriptor number */
+ gfx_edid_t *edid); /* EDID data, etc. */
+
+void mga_get_edid_res_info(
+ const fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_mode_elem_t *mode_list, /* Modes from Monitor section of cfg */
+ fbc_edid_res_t edid_res_info[]); /* Returned display device info */
+
+
+#endif /* _MGA_QUERY_DEVICE_H */
+
+
+/* End of mga_query_device.h */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_res_try_now.c Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,407 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_res_try_now - Video mode setting (-res try now)
+ */
+
+#include <sys/types.h> /* u_char, uint32_t */
+#include <ctype.h> /* toupper() */
+#include <stdio.h> /* printf(), sscanf() */
+#include <signal.h> /* signal() */
+#include <termios.h> /* tcgetattr(), tcsetattr() */
+#include <unistd.h> /* alarm(), read() */
+
+#include "gfx_common.h"
+
+#if TRY_RES_NOW
+#include "mgaio.h" /* mga I/O, including ioctl() stuff */
+#include "regdef.h" /* CRTC*_PITCH, ... */
+
+/* n-bit register read/write (offset, value) */
+#define regr(o) (*(volatile uint32_t *)(registers + (o)))
+#define regr16(o) (*(volatile uint16_t *)(registers + (o)))
+#define regr8(o) (*(volatile uint8_t *)(registers + (o)))
+#define regw(o,v) (regr(o) = (v))
+#define regw16(o,v) (regr16(o) = (v))
+#define regw8(o,v) (regr8(o) = (v))
+#endif /* TRY_RES_NOW */
+
+#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
+#include "fbc_ask.h" /* User interaction */
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+#include "fbc_error.h" /* Error reporting */
+#include "fbc_res.h" /* Video modes/resolutions (-res option) */
+
+#include "mga_res_try_now.h" /* Video mode setting (-res try now) */
+
+
+#define MGA_MAX_STREAMS 2
+
+#define _LIVE_ 0 /* Live run */
+
+
+static const int mga_stream_bit[MGA_MAX_STREAMS] = {
+ GFX_EDID_HEAD_ONE, /* Video stream 1 bit */
+ GFX_EDID_HEAD_TWO /* Video stream 2 bit */
+};
+
+
+/*
+ * mga_res_mode_try_stop()
+ *
+ * Signal handler for the duration of the video mode trial.
+ */
+
+static
+void
+mga_res_mode_try_stop(
+ int signum) /* Signal number */
+{
+
+ /* Void */
+
+} /* mga_res_mode_try_stop() */
+
+
+/*
+ * mga_res_mode_try()
+ *
+ * Conduct a 10-second trial of the new video mode for the user's
+ * approval (-res <video_mode> try). Return TRUE iff the trial is
+ * successful.
+ */
+
+int
+mga_res_mode_try(
+ fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_video_mode_t *video_mode) /* Video mode (-res <video_mode>) */
+{
+ int rval = TRUE;
+
+#if TRY_RES_NOW
+ const int crtc_pitch_off[MGA_MAX_STREAMS] = {
+ CRTC_PITCH, /* Stream 1 pitch register offset */
+ CRTC2_PITCH /* Stream 2 pitch register offset */
+ };
+ const int crtc_offset_off[MGA_MAX_STREAMS] = {
+ CRTC_OFFSET, /* Stream 1 offset register offset */
+ CRTC2_OFFSET /* Stream 2 offset register offset */
+ };
+ AstInfo *fb_info; /* Frame buffer information */
+ void (*orig_disp[NSIG])(int); /* Original signal disp's */
+ struct termios tparm_old; /* Original terminal parameters */
+ struct termios tparm_new; /* Video trial terminal parameters */
+ int input_size; /* Stdin keystroke count (0 or 1) */
+ char input_buf[4]; /* Stdin keystroke buffer */
+ int rval = TRUE; /* TRUE => Successful trial so far */
+ CRTCInfoBlock video[MGA_MAX_STREAMS];
+ int depth[MGA_MAX_STREAMS];
+ uint32_t crtc_pitch_val[MGA_MAX_STREAMS];
+ uint32_t crtc_offset_val[MGA_MAX_STREAMS];
+ volatile u_char *registers; /* Ptr to registers (regr(), regw()) */
+
+ uint32_t offset[MGA_MAX_STREAMS];
+ int stream_index; /* Video stream index (zero-based) */
+
+ /*
+ * Get the frame buffer information
+ */
+#if (_LIVE_) // ???
+ fb_info = mga_openfd(device->fd);
+ if (fb_info == NULL) {
+ return (FALSE);
+ }
+
+ /*
+ * Point to the (volatle) registers
+ */
+ registers = fb_info->registers;
+
+ /*
+ * Get the current hardware video mode for each applicable stream
+ */
+ for (stream_index = device->stream_lo;
+ stream_index <= device->stream_hi;
+ stream_index += 1) {
+ Radeon_GetMode(fb_info,
+ mga_stream_bit[stream_index],
+ &video[stream_index],
+ &depth[stream_index]);
+ crtc_pitch_val[stream_index] =
+ regr(crtc_pitch_off[stream_index]);
+ crtc_offset_val[stream_index] =
+ regr(crtc_offset_off[stream_index]);
+ }
+
+#endif // ???
+ /*
+ * Ask whether the user is ready to try the new video mode
+ */
+ printf("About to change video resolution to \"%s\" for %d seconds\n",
+ video_mode->name, FBC_TRIAL_TIME);
+ if (!fbc_ask_yes_no("Continue (yes/no) ? ")) {
+ return (FALSE);
+ }
+
+ /*
+ * Set a new signal handler, saving the original signal dispositions
+ *
+ * SIGHUP Hangup
+ * SIGINT Interrupt
+ * SIGQUIT Quit
+ * SIGBUS Bus Error
+ * SIGSEGV Segmentation Fault
+ * SIGPIPE Broken Pipe
+ * SIGALRM Alarm Clock
+ * SIGTERM Terminated
+ * SIGVTALRM Virtual Timer Expired
+ */
+ orig_disp[SIGHUP] = signal(SIGHUP, mga_res_mode_try_stop);
+ orig_disp[SIGINT] = signal(SIGINT, mga_res_mode_try_stop);
+ orig_disp[SIGQUIT] = signal(SIGQUIT, mga_res_mode_try_stop);
+ orig_disp[SIGBUS] = signal(SIGBUS, mga_res_mode_try_stop);
+ orig_disp[SIGSEGV] = signal(SIGSEGV, mga_res_mode_try_stop);
+ orig_disp[SIGPIPE] = signal(SIGPIPE, mga_res_mode_try_stop);
+ orig_disp[SIGALRM] = signal(SIGALRM, mga_res_mode_try_stop);
+ orig_disp[SIGTERM] = signal(SIGTERM, mga_res_mode_try_stop);
+ orig_disp[SIGVTALRM] = signal(SIGVTALRM, mga_res_mode_try_stop);
+
+ /*
+ * Set the new video mode for all applicable display devices
+ */
+ for (stream_index = device->stream_lo;
+ stream_index <= device->stream_hi;
+ stream_index += 1) {
+#if (_LIVE_) // ???
+ fb_info->stream = mga_stream_bit[stream_index];
+ offset[stream_index] = Radeon_GetMemory(device->fd,
+ video_mode->width,
+ video_mode->height,
+ depth[stream_index],
+ 0);
+ if (offset[stream_index] == (uint32_t)-1) {
+ offset[stream_index] = 0;
+ }
+ if (mga_set_named_mode(fb_info,
+ video_mode->name,
+ depth[stream_index],
+ offset[stream_index]) != 0) {
+ char monitor_id[FBC_MAX_MONITOR_ID_LEN];
+
+ fbc_get_monitor_id(
+ device, stream_index, &monitor_id[0]);
+ fbc_errormsg("Cannot set video mode for monitor%s!\n",
+ monitor_id);
+ rval = FALSE;
+ }
+#endif // ???
+ }
+
+ if (rval) {
+ /*
+ * Clear each screen after changing the video mode
+ */
+ for (stream_index = device->stream_lo;
+ stream_index <= device->stream_hi;
+ stream_index += 1) {
+ int pitch;
+#if (_LIVE_) // ???
+ pitch = regr(crtc_pitch_off[stream_index]) * 8;
+ if (offset[stream_index] == 0) {
+ offset[stream_index] =
+ crtc_offset_val[stream_index];
+ }
+ memset((void *)(fb_info->fb_mem + offset[0]/*???*/),
+ 0,
+ pitch * video_mode->height);
+#endif // ???
+ }
+
+ /*
+ * Put the terminal's standard input into raw mode
+ */
+ tcgetattr(0, &tparm_old);
+ tparm_new = tparm_old;
+ tparm_new.c_lflag &= ~(ISIG | ICANON | ECHO | ECHOE |
+ ECHOK | ECHONL | ECHOCTL | ECHOPRT |
+ ECHOKE);
+ tparm_new.c_cc[VMIN] = 0;
+ tparm_new.c_cc[VTIME] = (FBC_TRIAL_TIME * 10);
+ tcsetattr(0, TCSANOW, &tparm_new);
+
+ /*
+ * Wait for a user keystroke or for the timer to expire
+ */
+ alarm(FBC_TRIAL_TIME + 1); /* In case VTIME doesn't work */
+ input_size = read(0, input_buf, 1);
+ alarm(0);
+
+ /*
+ * Restore the terminal's original standard input parameters
+ */
+ tcsetattr(0, TCSANOW, &tparm_old);
+ }
+
+ /*
+ * Restore the original signal dispositions
+ */
+ signal(SIGHUP, orig_disp[SIGHUP]);
+ signal(SIGINT, orig_disp[SIGINT]);
+ signal(SIGQUIT, orig_disp[SIGQUIT]);
+ signal(SIGBUS, orig_disp[SIGBUS]);
+ signal(SIGSEGV, orig_disp[SIGSEGV]);
+ signal(SIGPIPE, orig_disp[SIGPIPE]);
+ signal(SIGALRM, orig_disp[SIGALRM]);
+ signal(SIGTERM, orig_disp[SIGTERM]);
+ signal(SIGVTALRM, orig_disp[SIGVTALRM]);
+
+ /*
+ * Restore the original video mode for the applicable display devices
+ */
+#if (_LIVE_) // ???
+ for (stream_index = device->stream_lo;
+ stream_index <= device->stream_hi;
+ stream_index += 1) {
+ /* For Radeon_SetModeNB*() declarations, see libast.h */
+ typedef int Radeon_SetModeNBi_t(
+ AstInfo *fb_info,
+ int xres,
+ int yres,
+ int depth,
+ const CRTCInfoBlock *paramtable,
+ uint32_t offset);
+ Radeon_SetModeNBi_t *Radeon_SetModeNBi[] = {
+ &Radeon_SetModeNB1,
+ &Radeon_SetModeNB2
+ };
+
+ (void) Radeon_SetModeNBi[stream_index](
+ fb_info,
+ video[stream_index].width,
+ video[stream_index].height,
+ depth[stream_index],
+ &video[stream_index],
+ crtc_offset_val[stream_index]);
+ regw(crtc_pitch_off[0], crtc_pitch_val[0]);
+ }
+
+ mga_closefd(fb_info);
+#endif // ???
+
+ if (rval) {
+ /*
+ * Interpret the user input character or absence thereof
+ *
+ * Treat the absence of user input as noncommittal.
+ * Treat Newline or Carriage Return (but not Space,
+ * etc. by historical precedent) as noncommittal.
+ * Treat 'Y' or 'y' as affirmative.
+ * Treat 'N' or 'n' or anything else (by historical
+ * precedent) as negative.
+ */
+ if ((input_size == 0) ||
+ (input_buf[0] == '\n') || (input_buf[0] == '\r')) {
+ /*
+ * Still need a Yes/No response from the user
+ */
+ rval = fbc_ask_yes_no(
+ "Do you want %s to become the new setting (yes/no) ? ",
+ video_mode->name);
+ } else
+ if (toupper(input_buf[0]) != 'Y') {
+ rval = FALSE; /* Treat as 'N' or 'n' */
+ }
+ }
+
+ /*
+ * Return, indicating whether the trial was successful
+ */
+#endif /* TRY_RES_NOW */
+
+ return (rval);
+
+} /* mga_res_mode_try() */
+
+
+/*
+ * mga_res_mode_now()
+ *
+ * Set the new video mode now (-res <video_mode> now).
+ */
+
+int
+mga_res_mode_now(
+ fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_video_mode_t *video_mode) /* Video mode (-res <video_mode>) */
+{
+/*???*/ const unsigned int depth = 24; /* From nfb & pfb for Solaris 8 & 9 */
+
+#if TRY_RES_NOW
+ AstInfo *fb_info; /* Frame buffer information */
+ int error_code; /* Error code (FBC_ERR_xxxxx) */
+ int stream_index; /* Video stream index (zero-based) */
+
+ error_code = FBC_SUCCESS;
+
+ fb_info = mga_openfd(device->fd);
+ if (fb_info == NULL) {
+ return (FBC_ERR_OPEN);
+ }
+
+ printf("Setting \"%s\"\n", video_mode->name);
+
+ /*
+ * Let the driver know (??? that we've begun setting this mode ???)
+ */
+ (void) ioctl(device->fd, MGA_BEGIN_SETVIDEOMODE, 0);
+
+ /*
+ * Set the video mode for each applicable display device
+ */
+ for (stream_index = device->stream_lo;
+ stream_index <= device->stream_hi;
+ stream_index += 1) {
+ fb_info->stream = mga_stream_bit[stream_index];
+ if (mga_set_named_mode(fb_info, video_mode->name, depth, 0)
+ != 0) {
+ error_code = FBC_ERR_IOCTL;
+ }
+ }
+
+ /*
+ * Let the driver know (??? that we're finished setting this mode ???)
+ */
+ (void) ioctl(device->fd, MGA_SETVIDEOMODE, 0);
+
+ mga_closefd(fb_info);
+
+ return (error_code);
+#endif /* TRY_RES_NOW */
+
+ return (FBC_SUCCESS);
+
+} /* mga_res_mode_now() */
+
+
+/* End of mga_res_try_now.c */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/mga/mga_res_try_now.h Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+/*
+ * mga_res_try_now - Video mode setting (-res try now)
+ */
+
+#ifndef _MGA_RES_TRY_NOW_H
+#define _MGA_RES_TRY_NOW_H
+
+
+#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
+#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
+
+
+int mga_res_mode_try(
+ fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_video_mode_t *video_mode); /* Video mode (-res <video_mode>) */
+
+int mga_res_mode_now(
+ fbc_dev_t *device, /* Frame buffer device info (-dev) */
+ fbc_video_mode_t *video_mode); /* Video mode (-res <video_mode>) */
+
+
+#endif /* _MGA_RES_TRY_NOW_H */
+
+
+/* End of mga_res_try_now.h */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkg/legacy/system-graphics-sunvts-sunvts-mga.p5m Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,31 @@
+#
+# Copyright (c) 2011, 2012, 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.
+#
+
+set name=pkg.fmri \
+ value=pkg:/system/graphics/sunvts/[email protected],5.11-0.175.1.0.0.15.0
+set name=pkg.summary value="MGA Graphics Diagnostics Software"
+set name=pkg.description \
+ value="Plugins for Oracle VTS diagnostics software for MGA graphics"
+set name=pkg.renamed value=true
+set name=variant.arch value=sparc
+depend type=require fmri=pkg:/system/graphics/fbconfig/fbconfig-mga
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkg/manifests/system-graphics-fbconfig-fbconfig-mga.p5m Tue Apr 10 09:09:50 2012 -0700
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2012, 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.
+#
+set name=pkg.fmri value=pkg:/system/graphics/fbconfig/fbconfig-mga@$(OSPKGVERS)
+set name=pkg.summary value="MGA Graphics Configuration and Diagnostics Software"
+set name=pkg.description \
+ value="Plugins for fbconfig configuration and Oracle VTS diagnostics software for MGA graphics"
+set name=variant.arch value=sparc
+link path=usr/lib/fbconfig/libSUNWmga_conf.so target=libSUNWmga_conf.so.1
+file path=usr/lib/fbconfig/libSUNWmga_conf.so.1
+file path=usr/lib/sparcv9/libvtsSUNWmga.so.1
+
+# Requires kernel driver for mgafb
+# depend type=require fmri=pkg:/driver/graphics/mga
--- a/pkg/manifests/system-graphics-sunvts-sunvts-mga.p5m Mon Apr 09 19:08:30 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#
-# Copyright (c) 2011, 2012, 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.
-#
-
-set name=pkg.fmri value=pkg:/system/graphics/sunvts/sunvts-mga@$(OSPKGVERS)
-set name=pkg.summary value="MGA Graphics Diagnostics Software"
-set name=pkg.description \
- value="Plugins for Oracle VTS diagnostics software for MGA graphics"
-set name=variant.arch value=sparc
-file path=usr/lib/sparcv9/libvtsSUNWmga.so.1
-
-# Requires kernel driver for mgafb
-# depend type=require fmri=pkg:/driver/graphics/mga