summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile311
-rw-r--r--Makefile.inc34
-rw-r--r--dist-files.mk64
-rw-r--r--doc/Makefile.inc42
-rw-r--r--doc/nvidia-settings.1.m458
-rw-r--r--doc/nvidia-settings.desktop30
-rw-r--r--doc/nvidia-settings.pngbin0 -> 3485 bytes
-rw-r--r--doc/src.mk12
-rw-r--r--samples/Makefile.inc40
-rw-r--r--samples/nv-control-dpy.c9
-rw-r--r--samples/nv-control-dvc.c15
-rw-r--r--samples/nv-control-screen.h63
-rw-r--r--samples/nv-control-targets.c11
-rw-r--r--samples/src.mk17
-rw-r--r--src/Makefile.inc51
-rw-r--r--src/XF86Config-parser/Makefile63
-rw-r--r--src/XF86Config-parser/Makefile.inc59
-rw-r--r--src/XF86Config-parser/Scan.c2
-rw-r--r--src/XF86Config-parser/src.mk29
-rw-r--r--src/command-line.c12
-rw-r--r--src/command-line.h1
-rw-r--r--src/glxinfo.c11
-rw-r--r--src/gtk+-2.x/Makefile.inc123
-rw-r--r--src/gtk+-2.x/ctkcolorcorrection.c1
-rw-r--r--src/gtk+-2.x/ctkconfig.c4
-rw-r--r--src/gtk+-2.x/ctkdisplayconfig-utils.c191
-rw-r--r--src/gtk+-2.x/ctkdisplayconfig.c152
-rw-r--r--src/gtk+-2.x/ctkdisplayconfig.h6
-rw-r--r--src/gtk+-2.x/ctkdisplaydevice-crt.c29
-rw-r--r--src/gtk+-2.x/ctkdisplaydevice-dfp.c93
-rw-r--r--src/gtk+-2.x/ctkdisplaydevice-dfp.h3
-rw-r--r--src/gtk+-2.x/ctkdisplaydevice-tv.c30
-rw-r--r--src/gtk+-2.x/ctkdisplaylayout.c9
-rw-r--r--src/gtk+-2.x/ctkdisplaylayout.h3
-rw-r--r--src/gtk+-2.x/ctkditheringcontrols.c563
-rw-r--r--src/gtk+-2.x/ctkditheringcontrols.h93
-rw-r--r--src/gtk+-2.x/ctkevent.c14
-rw-r--r--src/gtk+-2.x/ctkframelock.c2
-rw-r--r--src/gtk+-2.x/ctkgauge.c3
-rw-r--r--src/gtk+-2.x/ctkglx.c2
-rwxr-xr-x[-rw-r--r--]src/gtk+-2.x/ctkgvi.c5
-rwxr-xr-x[-rw-r--r--]src/gtk+-2.x/ctkgvi.h0
-rw-r--r--src/gtk+-2.x/ctkgvo.c23
-rw-r--r--src/gtk+-2.x/ctkscreen.c40
-rw-r--r--src/gtk+-2.x/ctkscreen.h5
-rw-r--r--src/gtk+-2.x/ctkthermal.c598
-rw-r--r--src/gtk+-2.x/ctkthermal.h20
-rw-r--r--src/gtk+-2.x/ctkutils.c79
-rw-r--r--src/gtk+-2.x/ctkutils.h21
-rw-r--r--src/gtk+-2.x/src.mk95
-rw-r--r--src/image_data/Makefile.inc79
-rw-r--r--src/image_data/antialias.pngbin0 -> 13252 bytes
-rw-r--r--src/image_data/background.pngbin0 -> 34616 bytes
-rw-r--r--src/image_data/background_tall.pngbin0 -> 62133 bytes
-rw-r--r--src/image_data/bnc_cable.pngbin0 -> 8839 bytes
-rw-r--r--src/image_data/bsd.pngbin0 -> 15687 bytes
-rw-r--r--src/image_data/clock.pngbin0 -> 14686 bytes
-rw-r--r--src/image_data/color.pngbin0 -> 5360 bytes
-rw-r--r--src/image_data/config.pngbin0 -> 8572 bytes
-rw-r--r--src/image_data/crt.pngbin0 -> 7095 bytes
-rw-r--r--src/image_data/cursor_shadow.pngbin0 -> 12686 bytes
-rw-r--r--src/image_data/dfp.pngbin0 -> 5616 bytes
-rw-r--r--src/image_data/display_config.pngbin0 -> 18524 bytes
-rw-r--r--src/image_data/framelock.pngbin0 -> 6535 bytes
-rw-r--r--src/image_data/glx.pngbin0 -> 5498 bytes
-rw-r--r--src/image_data/gpu.pngbin0 -> 7700 bytes
-rw-r--r--src/image_data/gvi.pngbin0 -> 10075 bytes
-rw-r--r--src/image_data/help.pngbin0 -> 18368 bytes
-rw-r--r--src/image_data/led_green.pngbin0 -> 3651 bytes
-rw-r--r--src/image_data/led_grey.pngbin0 -> 3560 bytes
-rw-r--r--src/image_data/led_red.pngbin0 -> 3658 bytes
-rw-r--r--src/image_data/logo.pngbin0 -> 4894 bytes
-rw-r--r--src/image_data/logo_tall.pngbin0 -> 15668 bytes
-rwxr-xr-xsrc/image_data/nvidia_icon.pngbin0 -> 6903 bytes
-rwxr-xr-x[-rw-r--r--]src/image_data/nvidia_icon_pixdata.h0
-rw-r--r--src/image_data/opengl.pngbin0 -> 8359 bytes
-rw-r--r--src/image_data/penguin.pngbin0 -> 17549 bytes
-rwxr-xr-x[-rw-r--r--]src/image_data/png_to_c_header.sh0
-rw-r--r--src/image_data/rj45_input.pngbin0 -> 484 bytes
-rw-r--r--src/image_data/rj45_output.pngbin0 -> 505 bytes
-rw-r--r--src/image_data/rj45_unused.pngbin0 -> 214 bytes
-rw-r--r--src/image_data/rotate_left_off.pngbin0 -> 373 bytes
-rw-r--r--src/image_data/rotate_left_on.pngbin0 -> 386 bytes
-rw-r--r--src/image_data/rotate_right_off.pngbin0 -> 522 bytes
-rw-r--r--src/image_data/rotate_right_on.pngbin0 -> 526 bytes
-rw-r--r--src/image_data/rotation.pngbin0 -> 12658 bytes
-rw-r--r--src/image_data/rotation_orientation_horz.pngbin0 -> 7318 bytes
-rw-r--r--src/image_data/rotation_orientation_vert.pngbin0 -> 6596 bytes
-rw-r--r--src/image_data/sdi.pngbin0 -> 12628 bytes
-rw-r--r--src/image_data/sdi_shared_sync_bnc.pngbin0 -> 7977 bytes
-rw-r--r--src/image_data/slimm.pngbin0 -> 6149 bytes
-rw-r--r--src/image_data/solaris.pngbin0 -> 16312 bytes
-rw-r--r--src/image_data/src.mk97
-rw-r--r--src/image_data/thermal.pngbin0 -> 15662 bytes
-rw-r--r--src/image_data/tv.pngbin0 -> 6599 bytes
-rw-r--r--src/image_data/vcs.pngbin0 -> 15414 bytes
-rw-r--r--src/image_data/x.pngbin0 -> 10878 bytes
-rw-r--r--src/image_data/xvideo.pngbin0 -> 8595 bytes
-rw-r--r--src/libXNVCtrl/Makefile.inc37
-rw-r--r--src/libXNVCtrl/NVCtrl.c77
-rw-r--r--src/libXNVCtrl/NVCtrl.h163
-rw-r--r--src/libXNVCtrl/nv_control.h7
-rw-r--r--src/libXNVCtrlAttributes/Makefile.inc42
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributesGlx.c109
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h4
-rw-r--r--src/libXNVCtrlAttributes/src.mk14
-rw-r--r--src/parse.c25
-rw-r--r--src/parse.h5
-rw-r--r--src/query-assign.c22
-rw-r--r--src/src.mk23
-rw-r--r--src/xpm_data/Makefile.inc36
-rw-r--r--src/xpm_data/src.mk11
-rw-r--r--utils.mk293
-rw-r--r--version.mk1
114 files changed, 2842 insertions, 1344 deletions
diff --git a/Makefile b/Makefile
index 7a9cf76..1cc5f41 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
# and Linux systems.
#
-# Copyright (C) 2004 NVIDIA Corporation.
+# Copyright (C) 2008 NVIDIA Corporation.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of Version 2 of the GNU General Public
@@ -21,252 +21,171 @@
# Boston, MA 02111-1307, USA
#
-#
-# This is the top level Makefile for the nvidia-settings utility
-#
-# Below are variables that users can override, either here or on the
-# make commandline
-#
-# CC = gcc
-# CFLAGS = -Wall
-# PKG_CONFIG = pkg-config
-# X11R6_DIR = /usr/X11R6
+##############################################################################
+# include common variables and functions
+##############################################################################
-# default build target
+include utils.mk
-default: all
+##############################################################################
+# The calling Makefile may export any of the following variables; we
+# assign default values if they are not exported by the caller
+##############################################################################
-# default definitions; can be overwritten by users
-SHELL = /bin/sh
-INSTALL = install
-BUILD_OS := $(shell uname)
-BUILD_ARCH := $(shell uname -m)
-M4 := m4
-
-ifndef CC
- CC = gcc
-endif
-
-ifndef PKG_CONFIG
- PKG_CONFIG = pkg-config
-endif
-
-ifndef X11_LIB_DIRS
- ifeq ($(BUILD_OS)-$(BUILD_ARCH),Linux-x86_64)
- X11_LIB_DIRS = -L/usr/X11R6/lib64
+ifndef X_LDFLAGS
+ ifeq ($(TARGET_OS)-$(TARGET_ARCH),Linux-x86_64)
+ X_LDFLAGS = -L/usr/X11R6/lib64
else
- X11_LIB_DIRS = -L/usr/X11R6/lib
+ X_LDFLAGS = -L/usr/X11R6/lib
endif
endif
-ifndef X11_INC_DIRS
- X11_INC_DIRS = -I/usr/X11R6/include
-endif
+X_CFLAGS ?=
-# define local variables
+GL_INCLUDE_PATH ?= /usr/include
-LOCAL_CFLAGS = -Wall
+PKG_CONFIG ?= pkg-config
-# the NVDEBUG environment variable controls whether we build debug or retail
-
-ifeq ($(NVDEBUG),1)
- STRIP = true
- LOCAL_CFLAGS += -g -DDEBUG
-else
- ifndef STRIP
- STRIP = strip
- endif
- LOCAL_CFLAGS += -O -DNDEBUG
-endif
-
-# default prefix
-ifdef ROOT
- prefix = $(ROOT)/usr
-else
- prefix = /usr/local
+ifndef GTK_CFLAGS
+ GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-2.0)
endif
-# default echo within SunOS sh does not have -n option. Use /usr/ucb/echo instead.
-# Solaris install has a different argument syntax
-ifeq ($(BUILD_OS),SunOS)
-ECHO=/usr/ucb/echo
-define INSTALL_RULE
- $(INSTALL) -m 755 -f $(bindir) $(NVIDIA_SETTINGS)
- mkdir -p $(mandir)
- $(INSTALL) -m 644 -f $(mandir) doc/$(MANPAGE)
-endef
-LD_RUN_FLAG=-R/usr/X11R6/lib
-else
-ECHO=echo
-define INSTALL_RULE
- $(INSTALL) -m 755 $(NVIDIA_SETTINGS) $(bindir)/$(NVIDIA_SETTINGS)
- mkdir -p $(mandir)
- $(INSTALL) -m 644 doc/$(MANPAGE) $(mandir)
- gzip -9f $(mandir)/$(MANPAGE)
-endef
+ifndef GTK_LDFLAGS
+ GTK_LDFLAGS := $(shell $(PKG_CONFIG) --libs gtk+-2.0)
endif
-exec_prefix = $(prefix)
-bindir = $(exec_prefix)/bin
-mandir = $(exec_prefix)/share/man/man1
-
-X11_CFLAGS = $(X11_INC_DIRS)
-GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-2.0)
-GTK_LDFLAGS := $(shell $(PKG_CONFIG) --libs gtk+-2.0)
+##############################################################################
+# The XF86Config-parser and libXNVCtrl directories may be in one of
+# two places: either elsewhere in the driver source tree when building
+# nvidia-settings as part of the NVIDIA driver build (in which case,
+# XNVCTRL_DIR, XNVCTRL_ARCHIVE, and XCONFIG_PARSER_DIR should be
+# defined by the calling makefile), or directly in the source
+# directory when building from the nvidia-settings source tarball (in
+# which case, the below conditional assignments should be used)
+##############################################################################
-X11_LIBS := $(X11_LIB_DIRS) -Wl,-Bstatic -lXxf86vm -Wl,-Bdynamic -lX11 -lXext
+XNVCTRL_DIR ?= src/libXNVCtrl
+XNVCTRL_ARCHIVE ?= $(XNVCTRL_DIR)/libXNVCtrl.a
+XCONFIG_PARSER_DIR ?= src/XF86Config-parser
-XNVCTRL_LIB := src/libXNVCtrl/libXNVCtrl.a
-XNVCTRL_DIR := src/libXNVCtrl
-XF86PARSER_LIB := src/XF86Config-parser/libXF86Config-parser.a
-XF86PARSER_DIR := src/XF86Config-parser
+##############################################################################
+# assign variables
+##############################################################################
-CURDIR := $(shell pwd)
+NVIDIA_SETTINGS = $(OUTPUTDIR)/nvidia-settings
-RELATIVE_SRCDIRS = \
- doc \
- src \
- src/image_data \
- src/xpm_data \
- src/gtk+-2.x \
- src/libXNVCtrl \
- src/libXNVCtrlAttributes \
- src/XF86Config-parser \
- samples
+NVIDIA_SETTINGS_PROGRAM_NAME = "nvidia-settings"
+NVIDIA_SETTINGS_VERSION := $(NVIDIA_VERSION)
-SRCDIRS := $(addprefix $(CURDIR)/, $(RELATIVE_SRCDIRS))
+CFLAGS += $(X_CFLAGS)
-INC_FLAGS := $(addprefix -I , $(RELATIVE_SRCDIRS))
-
-ALL_CFLAGS = $(CFLAGS) $(LOCAL_CFLAGS) $(X11_CFLAGS) $(GTK_CFLAGS) $(INC_FLAGS)
-ALL_LDFLAGS = $(LD_RUN_FLAG) $(LDFLAGS) $(GTK_LDFLAGS) $(X11_LIBS)
-
-CPPFLAGS = $(ALL_CFLAGS)
-
-
-NVIDIA_SETTINGS = nvidia-settings
-NVIDIA_SETTINGS_VERSION = 1.0
-
-NVIDIA_SETTINGS_DISTDIR = $(NVIDIA_SETTINGS)-$(NVIDIA_SETTINGS_VERSION)
-NVIDIA_SETTINGS_DISTDIR_DIRS := \
- $(addprefix $(NVIDIA_SETTINGS_DISTDIR)/, $(RELATIVE_SRCDIRS))
-
-STAMP_C = g_stamp.c
-
-MANPAGE = nvidia-settings.1
-
-
-# initialize SRC and EXTRA_DIST, then include each of the subdirectory
-# Makefiles so that they can append to SRC and EXTRA_DIST
+ifeq ($(TARGET_OS),SunOS)
+ LDFLAGS += -Wl,-rpath=/usr/X11R6/lib
+endif
-SRC =
-EXTRA_DIST =
+LDFLAGS += $(X_LDFLAGS)
-include $(patsubst %,%/Makefile.inc,$(RELATIVE_SRCDIRS))
+# Some older Linux distributions do not have the dynamic library
+# libXxf86vm.so, though some newer Linux distributions do not have the
+# static library libXxf86vm.a. Statically link against libXxf86vm
+# when building nvidia-settings within the NVIDIA driver build, but
+# dynamically link against libXxf86vm in the public builds.
+ifdef NV_LINK_LIBXXF86VM_STATICALLY
+ LDFLAGS += -Wl,-Bstatic -lXxf86vm -Wl,-Bdynamic
+else
+ LDFLAGS += -lXxf86vm
+endif
+LDFLAGS += -lX11 -lXext
+LDFLAGS += $(GTK_LDFLAGS)
-# set VPATH
+MANPAGE_GZIP ?= 1
-VPATH = $(RELATIVE_SRCDIRS)
+MANPAGE_gzipped = $(OUTPUTDIR)/nvidia-settings.1.gz
+MANPAGE_not_gzipped = $(OUTPUTDIR)/nvidia-settings.1
+ifeq ($(MANPAGE_GZIP),1)
+ MANPAGE = $(MANPAGE_gzipped)
+else
+ MANPAGE = $(MANPAGE_not_gzipped)
+endif
+# Include all the source lists; dist-files.mk will define SRC
+include dist-files.mk
-# additional sources (eg: generated sources) can be appended to ALL_SRC
+include $(XCONFIG_PARSER_DIR)/src.mk
+SRC += $(addprefix $(XCONFIG_PARSER_DIR)/,$(XCONFIG_PARSER_SRC))
-ALL_SRC = $(SRC) $(STAMP_C)
+SRC += $(STAMP_C)
+OBJS = $(call BUILD_OBJECT_LIST,$(SRC))
-# OBJS and DEPS are constructed such that they are placed into special
-# ".objs" and ".deps" subdirectories
+CFLAGS += -I src
+CFLAGS += -I src/image_data
+CFLAGS += -I $(XNVCTRL_DIR)
+CFLAGS += -I $(XCONFIG_PARSER_DIR)/..
+CFLAGS += -I src/libXNVCtrlAttributes
+CFLAGS += -I src/xpm_data
+CFLAGS += -I src/gtk+-2.x
+CFLAGS += -I $(OUTPUTDIR)
-OBJS_DIR = .objs
-DEPS_DIR = .deps
+$(call BUILD_OBJECT_LIST,$(GTK_SRC)): CFLAGS += $(GTK_CFLAGS)
-OBJS := $(patsubst %.c,$(OBJS_DIR)/%.o,$(ALL_SRC))
-DEPS := $(patsubst %.c,$(DEPS_DIR)/%.d,$(SRC))
-# and now, the build rules:
+##############################################################################
+# build rules
+##############################################################################
-all: $(NVIDIA_SETTINGS) doc/$(MANPAGE)
+.PNONY: all install NVIDIA_SETTINGS_install MANPAGE_install clean clobber
-install: all
- $(STRIP) $(NVIDIA_SETTINGS)
- $(INSTALL_RULE)
+all: $(NVIDIA_SETTINGS) $(MANPAGE)
-$(OBJS_DIR)/%.o: %.c
- @ mkdir -p $(OBJS_DIR)
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+install: NVIDIA_SETTINGS_install MANPAGE_install
-# to generate the dependency files, use the compiler's "-MM" option to
-# generate output of the form "foo.o : foo.c foo.h"; then, use sed to
-# replace the target with "$(OBJS_DIR)/foo.o $(DEPS_DIR)/foo.d", and
-# wrap the prerequisites with $(wildcard ...); the wildcard function
-# serves as an existence filter, so that files that are later removed
-# from the build do not cause stale references.
+NVIDIA_SETTINGS_install: $(NVIDIA_SETTINGS)
+ $(MKDIR) $(bindir)
+ $(INSTALL) $(INSTALL_BIN_ARGS) $< $(bindir)/$(notdir $<)
-$(DEPS_DIR)/%.d: %.c
- @ mkdir -p $(DEPS_DIR)
- @ set -e; b=`basename $* .c` ; \
- $(CC) -MM $(CPPFLAGS) $< \
- | sed \
- -e "s%\\($$b\\)\\.o[ :]*%$(OBJS_DIR)/\\1.o $(DEPS_DIR)/\\1.d : $$\(wildcard %g" \
- -e "s,\([^\\]\)$$,\1)," > $@; \
- [ -s $@ ] || rm -f $@
+MANPAGE_install: $(MANPAGE)
+ $(MKDIR) $(mandir)
+ $(INSTALL) $(INSTALL_BIN_ARGS) $< $(mandir)/$(notdir $<)
-$(STAMP_C): $(filter-out $(OBJS_DIR)/$(STAMP_C:.c=.o), $(OBJS))
- @ rm -f $@
- @ $(ECHO) -n "const char NV_ID[] = \"nvidia id: " >> $@
- @ $(ECHO) -n "$(NVIDIA_SETTINGS): " >> $@
- @ $(ECHO) -n "version $(NVIDIA_SETTINGS_VERSION) " >> $@
- @ $(ECHO) -n "($(shell whoami)@$(shell hostname)) " >> $@
- @ echo "$(shell date)\";" >> $@
- @ echo "const char *pNV_ID = NV_ID + 11;" >> $@
+$(NVIDIA_SETTINGS): $(OBJS) $(XNVCTRL_ARCHIVE)
+ $(call quiet_cmd,LINK) -o $@ $(OBJS) $(XNVCTRL_ARCHIVE) \
+ $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS)
+ $(call quiet_cmd,STRIP_CMD) $@
+# define the rule to build each object file
+$(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,CC,$(src))))
-%.i : %.c
- $(CC) $(CPPFLAGS) -E -dD $< | sed -e 's/^ $$//' > $@
- indent -kr -nbbo -l96 -sob $@
+# define the rule to generate $(STAMP_C)
+$(eval $(call DEFINE_STAMP_C_RULE, $(OBJS),$(NVIDIA_SETTINGS_PROGRAM_NAME)))
-$(XF86PARSER_LIB):
- $(MAKE) NV_CFLAGS='$(NV_CFLAGS)' -C $(XF86PARSER_DIR)
+clean clobber:
+ rm -rf $(NVIDIA_SETTINGS) $(MANPAGE) *~ $(STAMP_C) \
+ $(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d
-$(XNVCTRL_LIB):
- $(MAKE) CFLAGS='$(ALL_CFLAGS)' LDFLAGS='$(ALL_LDFLAGS)' -C $(XNVCTRL_DIR)
-$(NVIDIA_SETTINGS): $(OBJS) $(XNVCTRL_LIB) $(XF86PARSER_LIB)
- $(CC) $(OBJS) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(XNVCTRL_LIB) $(XF86PARSER_LIB) -o $@
+##############################################################################
+# Documentation
+##############################################################################
-.PHONY: $(XF86PARSER_LIB) dist clean clobber
+AUTO_TEXT = ".\\\" WARNING: THIS FILE IS AUTO-GENERATED! Edit $< instead."
-dist: $(XNVCTRL_LIB)
- @ if [ -d $(NVIDIA_SETTINGS_DISTDIR) ]; then \
- chmod 755 $(NVIDIA_SETTINGS_DISTDIR); \
- fi
- @ if [ -f $(NVIDIA_SETTINGS_DISTDIR).tar.gz ]; then \
- chmod 644 $(NVIDIA_SETTINGS_DISTDIR).tar.gz; \
- fi
- rm -rf $(NVIDIA_SETTINGS_DISTDIR) $(NVIDIA_SETTINGS_DISTDIR).tar.gz
- mkdir -p $(NVIDIA_SETTINGS_DISTDIR_DIRS)
- @ for inc_dir in $(RELATIVE_SRCDIRS) .; do \
- EXTRA_DIST=; \
- SRC=; \
- mkdir -p $(NVIDIA_SETTINGS_DISTDIR)/$$inc_dir; \
- for inc_file in `$(MAKE) --makefile $$inc_dir/Makefile.inc dist_list`; do \
- file="$$inc_dir/$$inc_file"; \
- cp $$file $(NVIDIA_SETTINGS_DISTDIR)/$$file; \
- chmod 644 $(NVIDIA_SETTINGS_DISTDIR)/$$file; \
- done; \
- done
- tar czf $(NVIDIA_SETTINGS_DISTDIR).tar.gz $(NVIDIA_SETTINGS_DISTDIR)
- rm -rf $(NVIDIA_SETTINGS_DISTDIR)
+doc: $(MANPAGE)
-clean clobber:
- rm -rf $(OBJS_DIR) $(DEPS_DIR) $(STAMP_C) $(NVIDIA_SETTINGS) $(XNVCTRL_LIB)
- find . -name "*~" -exec rm -f \{\} \;
+$(MANPAGE_not_gzipped): doc/nvidia-settings.1.m4
+ $(call quiet_cmd,M4) \
+ -D__HEADER__=$(AUTO_TEXT) \
+ -D__BUILD_OS__=$(TARGET_OS) \
+ -D__VERSION__=$(NVIDIA_VERSION) \
+ -D__DATE__="`$(DATE) +%F`" \
+ $< > $@
--include $(DEPS)
+$(MANPAGE_gzipped): $(MANPAGE_not_gzipped)
+ $(GZIP_CMD) -9f < $< > $@
diff --git a/Makefile.inc b/Makefile.inc
deleted file mode 100644
index e3a8951..0000000
--- a/Makefile.inc
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (C) 2004 NVIDIA Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of Version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
-# of the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the:
-#
-# Free Software Foundation, Inc.
-# 59 Temple Place - Suite 330
-# Boston, MA 02111-1307, USA
-#
-
-#
-# Copyright and makefiles
-#
-
-EXTRA_DIST += \
- Makefile.inc \
- Makefile \
- COPYING
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/dist-files.mk b/dist-files.mk
new file mode 100644
index 0000000..4ca46e2
--- /dev/null
+++ b/dist-files.mk
@@ -0,0 +1,64 @@
+#
+# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
+# and Linux systems.
+#
+# Copyright (C) 2008 NVIDIA Corporation.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of Version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
+# of the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the:
+#
+# Free Software Foundation, Inc.
+# 59 Temple Place - Suite 330
+# Boston, MA 02111-1307, USA
+#
+
+##############################################################################
+# define the list of files that should be distributed in the
+# nvidia-settings tarball; this is used by the NVIDIA driver build
+# when packaging the tarball, and by the nvidia-settings makefile when
+# building nvidia-settings.
+#
+# Defines SRC, EXTRA_DIST, and DIST_FILES
+##############################################################################
+
+SRC :=
+EXTRA_DIST := COPYING dist-files.mk
+
+include src/src.mk
+SRC += $(addprefix src/,$(SRC_SRC))
+EXTRA_DIST += $(addprefix src/,$(SRC_EXTRA_DIST))
+
+include src/image_data/src.mk
+SRC += $(addprefix src/image_data/,$(IMAGE_DATA_SRC))
+EXTRA_DIST += $(addprefix src/image_data/,$(IMAGE_DATA_EXTRA_DIST))
+
+include src/libXNVCtrlAttributes/src.mk
+SRC += $(addprefix src/libXNVCtrlAttributes/,$(LIB_XNVCTRL_ATTRIBUTES_SRC))
+EXTRA_DIST += $(addprefix src/libXNVCtrlAttributes/,$(LIB_XNVCTRL_ATTRIBUTES_EXTRA_DIST))
+
+include src/xpm_data/src.mk
+SRC += $(addprefix src/xpm_data/,$(LIB_XPM_DATA_SRC))
+EXTRA_DIST += $(addprefix src/xpm_data/,$(LIB_XPM_DATA_EXTRA_DIST))
+
+include src/gtk+-2.x/src.mk
+SRC += $(addprefix src/gtk+-2.x/,$(GTK_SRC))
+EXTRA_DIST += $(addprefix src/gtk+-2.x/,$(GTK_EXTRA_DIST))
+
+include doc/src.mk
+SRC += $(addprefix doc/,$(DOC_SRC))
+EXTRA_DIST += $(addprefix doc/,$(DOC_EXTRA_DIST))
+
+include samples/src.mk
+SRC += $(addprefix samples/,$(SAMPLES_SRC))
+EXTRA_DIST += $(addprefix samples/,$(SAMPLES_EXTRA_DIST))
+
+DIST_FILES := $(SRC) $(EXTRA_DIST)
diff --git a/doc/Makefile.inc b/doc/Makefile.inc
deleted file mode 100644
index 59e5b65..0000000
--- a/doc/Makefile.inc
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (C) 2004 NVIDIA Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of Version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
-# of the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the:
-#
-# Free Software Foundation, Inc.
-# 59 Temple Place - Suite 330
-# Boston, MA 02111-1307, USA
-#
-
-#
-# documentation files
-#
-
-EXTRA_DIST += \
- Makefile.inc \
- NV-CONTROL-API.txt \
- FRAMELOCK.txt \
- nvidia-settings.1.m4
-
-AUTO_TEXT = ".\\\" WARNING: THIS FILE IS AUTO-GENERATED! Edit $< instead."
-
-doc/nvidia-settings.1: nvidia-settings.1.m4
- $(M4) -D__HEADER__=$(AUTO_TEXT) \
- -D__BUILD_OS__=$(BUILD_OS) \
- $< > $@
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/doc/nvidia-settings.1.m4 b/doc/nvidia-settings.1.m4
index 3e9eadf..c97e8af 100644
--- a/doc/nvidia-settings.1.m4
+++ b/doc/nvidia-settings.1.m4
@@ -1,7 +1,7 @@
changequote([[[, ]]])dnl
dnl Solaris man chokes on three-letter macros.
ifelse(__BUILD_OS__,SunOS,[[[define(__URL__,UR)]]],[[[define(__URL__,URL)]]])dnl
-.\" Copyright (C) 2006 NVIDIA Corporation.
+.\" Copyright (C) 2010 NVIDIA Corporation.
__HEADER__
.\" Define the .__URL__ macro and then override it with the www.tmac package if it
.\" exists.
@@ -9,7 +9,7 @@ __HEADER__
\\$2 \(la \\$1 \(ra\\$3
..
.if \n[.g] .mso www.tmac
-.TH nvidia\-settings 1 2006-03-17 "nvidia\-settings 1.0"
+.TH nvidia\-settings 1 "__DATE__" "nvidia\-settings __VERSION__"
.SH NAME
nvidia\-settings \- configure the NVIDIA graphics driver
.SH SYNOPSIS
@@ -39,7 +39,7 @@ The
.B nvidia\-settings
utility is a tool for configuring the NVIDIA graphics driver.
It operates by communicating with the NVIDIA X driver, querying and updating state as appropriate.
-This communication is done with the NV-CONTROL X extension.
+This communication is done via the NV-CONTROL, GLX, XVideo, and RandR X extensions.
.PP
Values such as brightness and gamma, XVideo attributes, temperature, and OpenGL settings can be queried and configured via
.B nvidia\-settings.
@@ -71,7 +71,7 @@ rather than the default
Control the specified X display.
If this option is not given, then
.B nvidia\-settings
-will control the display specifed by
+will control the display specified by
.B \-\-display.
If that is not given, then the
.I $DISPLAY
@@ -88,12 +88,13 @@ Load the configuration file, send the values specified therein to the X server,
This mode of operation is useful to place in your .xinitrc file, for example.
.TP
.B \-r, \-\-rewrite\-config\-file
-Write the current X server configuration to the configuration file, and exit without starting
-a grpahical user interface.See Examples section.
+Write the current X server configuration to the configuration file, and exit without starting
+a graphical user interface.
+See the EXAMPLES section.
.TP
.BI "\-V, \-\-verbose=" verbosity
Controls how much information is printed.
-By default, the verbosity is
+By default, the verbosity is
.B errors
and only error messages are printed.
.br
@@ -115,7 +116,7 @@ The
.I assign
argument to the
.B \-\-assign
-commandline option is of the form:
+command line option is of the form:
.nf
{DISPLAY}/{attribute name}[{display devices}]={value}
@@ -175,7 +176,7 @@ The
.I query
argument to the
.B \-\-query
-commandline option is of the form:
+command line option is of the form:
.nf
{DISPLAY}/{attribute name}[{display devices}]
@@ -200,10 +201,10 @@ Specify
to query all attributes.
.TP
.B \-t, \-\-terse
-When querying attribute values with the '--query' commandline option, only print the current value, rather than the more verbose description of the attribute, its valid values, and its current value.
+When querying attribute values with the '--query' command line option, only print the current value, rather than the more verbose description of the attribute, its valid values, and its current value.
.TP
.B \-d, \-\-display\-device\-string
-When printing attribute values in response to the '--query' option, if the attribute value is a display device mask, print the value as a list of display devices (e.g., "CRT-0, DFP-0"), rather than a hexidecimal bitmask (e.g., 0x00010001).
+When printing attribute values in response to the '--query' option, if the attribute value is a display device mask, print the value as a list of display devices (e.g., "CRT-0, DFP-0"), rather than a hexadecimal bit mask (e.g., 0x00010001).
.TP
.B \-g, \-\-glxinfo
Print GLX Information for the X display and exit.
@@ -218,7 +219,7 @@ Prints information about a particular attribute. Specify 'all' to list the desc
.br
3. Loading Settings Automatically
.br
-4. Commandline Interface
+4. Command Line Interface
.br
5. X Display Names in the Config File
.br
@@ -299,7 +300,7 @@ The configuration file is named
.IR ~/.nvidia\-settings\-rc .
You can specify a different configuration file name with the
.B \-\-config
-commandline option.
+command line option.
.PP
After you have run
.B nvidia\-settings
@@ -361,10 +362,10 @@ Please see the
man page for further details of configuring your
.I ~/.xinitrc
file.
-.SS 4. Commandline Interface
+.SS 4. Command Line Interface
.B nvidia\-settings
-has a rich commandline interface: all attributes that can be manipulated with the GUI can also be queried and set from the command line.
-The commandline syntax for querying and assigning attributes matches that of the
+has a rich command line interface: all attributes that can be manipulated with the GUI can also be queried and set from the command line.
+The command line syntax for querying and assigning attributes matches that of the
.I .nvidia\-settings\-rc
configuration file.
.PP
@@ -472,7 +473,7 @@ For example:
nvidia-settings --assign [gpu:0]/DigitalVibrance=0
.fi
.PP
-Multiple queries and assignments may be specified on the commandline for a single invocation of
+Multiple queries and assignments may be specified on the command line for a single invocation of
.B nvidia\-settings.
.PP
If either the
@@ -484,8 +485,17 @@ options are passed to
the GUI will not be presented, and
.B nvidia\-settings
will exit after processing the assignments and/or queries.
+In this case, settings contained within the
+.I ~/.nvidia\-settings-rc
+configuration file will not be automatically uploaded to the X server, nor will the
+.I ~/.nvidia\-settings-rc
+configuration file be automatically updated to reflect attribute assignments made via the
+.B \-\-assign
+option.
.SS 5. X Display Names in the Config File
-In the Commandline Interface section above, it was noted that you can specify an attribute without any X Display qualifiers, with only an X screen qualifier, or with a full X Display name.
+In the Command Line Interface section above, it was noted that you can
+specify an attribute without any X Display qualifiers, with only an X
+screen qualifier, or with a full X Display name.
For example:
.nf
@@ -601,15 +611,15 @@ some of which include:
different toolkits?
The GUI for
.B nvidia\-settings
-is cleanly abstracted from the backend of
+is cleanly abstracted from the back-end of
.B nvidia\-settings
-that parses the configuration file and commandline, communicates with the X server, etc.
-If someone were so inclined, a different frontend GUI could be implemented.
+that parses the configuration file and command line, communicates with the X server, etc.
+If someone were so inclined, a different front-end GUI could be implemented.
.TP
-
write a design document explaining how
.B nvidia\-settings
-is architected; presumably this would make it easier for people to become familiar with the code base.
+is designed; presumably this would make it easier for people to become familiar with the code base.
.PP
If there are other things you would like to see added (or better yet, would like to add yourself), please contact linux-bugs@nvidia.com.
.SH FILES
@@ -628,7 +638,7 @@ Loads the settings stored in
and exits.
.TP
.B nvidia\-settings \-\-rewrite\-config\-file
-Writes the current X server configuration to
+Writes the current X server configuration to
.I ~/.nvidia\-settings\-rc
file and exits.
.TP
@@ -645,4 +655,4 @@ NVIDIA Corporation
.BR nvidia\-xconfig (1)ifelse(__BUILD_OS__,Linux,[[[,
.BR nvidia\-installer (1)]]])
.SH COPYRIGHT
-Copyright \(co 2006 NVIDIA Corporation.
+Copyright \(co 2010 NVIDIA Corporation.
diff --git a/doc/nvidia-settings.desktop b/doc/nvidia-settings.desktop
new file mode 100644
index 0000000..a879422
--- /dev/null
+++ b/doc/nvidia-settings.desktop
@@ -0,0 +1,30 @@
+[Desktop Entry]
+Type=Application
+Encoding=UTF-8
+Name=NVIDIA X Server Settings
+Comment=Configure NVIDIA X Server Settings
+Exec=__UTILS_PATH__/nvidia-settings
+Icon=__PIXMAP_PATH__/nvidia-settings.png
+Categories=__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__
+
+# Translations provided by Sun Microsystems
+Name[de]=NVIDIA X-Server-Einstellungen
+Name[es]=Valores de configuración del servidor NVIDIA X
+Name[fr]=Paramètres du serveur X NVIDIA
+Name[it]=NVIDIA X Server Settings
+Name[ja]=NVIDIA X サーバー設定
+Name[ko]=NVIDIA X 서버 설정
+Name[pt_BR]=Configurações do NVIDIA X Server
+Name[zh_CN]=NVIDIA X 服务器设置
+Name[zh_HK]=NVIDIA X 伺服器設定
+Name[zh_TW]=NVIDIA X 伺服器設定
+Comment[de]=Konfigurieren der NVIDIA X-Server-Einstellungen
+Comment[es]=Establezca los valores de configuración del servidor NVIDIA X
+Comment[fr]=Configurer les paramètres du serveur X NVIDIA
+Comment[it]=Configura NVIDIA X Server Settings
+Comment[ja]=NVIDIA X サーバー設定を構成します
+Comment[ko]=NVIDIA X 서버 설정 구성
+Comment[pt_BR]=Definir &configurações de gerenciamento de usuário...
+Comment[zh_CN]=配置 NVIDIA X 服务器设置
+Comment[zh_HK]=配置 NVIDIA X 伺服器設定
+Comment[zh_TW]=配置 NVIDIA X 伺服器設定
diff --git a/doc/nvidia-settings.png b/doc/nvidia-settings.png
new file mode 100644
index 0000000..b506d99
--- /dev/null
+++ b/doc/nvidia-settings.png
Binary files differ
diff --git a/doc/src.mk b/doc/src.mk
new file mode 100644
index 0000000..84db2ee
--- /dev/null
+++ b/doc/src.mk
@@ -0,0 +1,12 @@
+#
+# files in the doc directory of nvidia-settings
+#
+
+DOC_SRC +=
+
+DOC_EXTRA_DIST += NV-CONTROL-API.txt
+DOC_EXTRA_DIST += FRAMELOCK.txt
+DOC_EXTRA_DIST += nvidia-settings.1.m4
+DOC_EXTRA_DIST += nvidia-settings.desktop
+DOC_EXTRA_DIST += nvidia-settings.png
+DOC_EXTRA_DIST += src.mk
diff --git a/samples/Makefile.inc b/samples/Makefile.inc
deleted file mode 100644
index 26f2a3e..0000000
--- a/samples/Makefile.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# NV-CONTROL samples: Sample tools for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (c) 2004-2008 NVIDIA, Corporation
-#
-# 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.
-#
-
-EXTRA_DIST += \
- Makefile.inc \
- Makefile \
- README \
- nv-control-dvc.c \
- nv-control-dpy.c \
- nv-control-info.c \
- nv-control-events.c \
- nv-control-targets.c \
- nv-control-framelock.c \
- nv-control-gvi.c
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/samples/nv-control-dpy.c b/samples/nv-control-dpy.c
index fc6c9f2..2c18cca 100644
--- a/samples/nv-control-dpy.c
+++ b/samples/nv-control-dpy.c
@@ -40,6 +40,7 @@
#include "NVCtrl.h"
#include "NVCtrlLib.h"
+#include "nv-control-screen.h"
static char *display_device_name(int mask);
static unsigned int display_device_mask(char *str);
@@ -73,13 +74,7 @@ int main(int argc, char *argv[])
return 1;
}
- screen = DefaultScreen(dpy);
-
- if (!XNVCTRLIsNvScreen(dpy, screen)) {
- fprintf(stderr, "The NV-CONTROL X extension is not available on screen "
- "%d of '%s'.\n\n", screen, XDisplayName(NULL));
- return 1;
- }
+ screen = GetNvXScreen(dpy);
ret = XNVCTRLQueryVersion(dpy, &major, &minor);
if (ret != True) {
diff --git a/samples/nv-control-dvc.c b/samples/nv-control-dvc.c
index a022ea8..dde9c0e 100644
--- a/samples/nv-control-dvc.c
+++ b/samples/nv-control-dvc.c
@@ -33,6 +33,9 @@
* an explanation of display devices.
*/
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
#include <stdio.h>
#include <stdlib.h>
@@ -41,6 +44,7 @@
#include "NVCtrl.h"
#include "NVCtrlLib.h"
+#include "nv-control-screen.h"
/*
@@ -112,13 +116,7 @@ int main(int argc, char *argv[])
return 1;
}
- screen = DefaultScreen(dpy);
-
- if (!XNVCTRLIsNvScreen(dpy, screen)) {
- fprintf(stderr, "The NV-CONTROL X not available on screen "
- "%d of '%s'.\n", screen, XDisplayName(NULL));
- return 1;
- }
+ screen = GetNvXScreen(dpy);
/*
@@ -173,7 +171,8 @@ int main(int argc, char *argv[])
/* print the range of valid values */
- printf("Valid values for NV_CTRL_DIGITAL_VIBRANCE: (%d - %d).\n",
+ printf("Valid values for NV_CTRL_DIGITAL_VIBRANCE: "
+ "(%" PRId64 " - %" PRId64 ").\n",
valid_values.u.range.min, valid_values.u.range.max);
/*
diff --git a/samples/nv-control-screen.h b/samples/nv-control-screen.h
new file mode 100644
index 0000000..a74bbf6
--- /dev/null
+++ b/samples/nv-control-screen.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010 NVIDIA Corporation
+ *
+ * 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.
+ */
+
+/*
+ * nv-control-screen.h - trivial helper for NV-CONTROL sample clients: use
+ * the default screen if it is an NVIDIA X screen. If it isn't, then look
+ * for the first NVIDIA X screen. Abort if no NVIDIA X screens are found.
+ */
+
+#ifndef __NV_CONTROL_SCREEN_H__
+#define __NV_CONTROL_SCREEN_H__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <X11/Xlib.h>
+
+#include "NVCtrlLib.h"
+
+static inline int GetNvXScreen(Display *dpy)
+{
+ int defaultScreen, screen;
+
+ defaultScreen = DefaultScreen(dpy);
+
+ if (XNVCTRLIsNvScreen(dpy, defaultScreen)) {
+ return defaultScreen;
+ }
+
+ for (screen = 0; screen < ScreenCount(dpy); screen++) {
+ if (XNVCTRLIsNvScreen(dpy, screen)) {
+ printf("Default X screen %d is not an NVIDIA X screen. "
+ "Using X screen %d instead.\n",
+ defaultScreen, screen);
+ return screen;
+ }
+ }
+
+ fprintf(stderr, "Unable to find any NVIDIA X screens; aborting.\n");
+
+ exit(1);
+}
+
+#endif /* __NV_CONTROL_SCREEN_H__ */
diff --git a/samples/nv-control-targets.c b/samples/nv-control-targets.c
index 1d6c993..bc78462 100644
--- a/samples/nv-control-targets.c
+++ b/samples/nv-control-targets.c
@@ -37,6 +37,7 @@
#include "NVCtrl.h"
#include "NVCtrlLib.h"
+#include "nv-control-screen.h"
@@ -107,16 +108,8 @@ int main(int argc, char *argv[])
fprintf(stderr, "Cannot open display '%s'.\n", XDisplayName(NULL));
return 1;
}
-
- /* XXX Maybe check all screens for the NV-CONTROL X extension? */
-
- screen = DefaultScreen(dpy);
- if (!XNVCTRLIsNvScreen(dpy, screen)) {
- fprintf(stderr, "The NV-CONTROL X not available on screen "
- "%d of '%s'.\n", screen, XDisplayName(NULL));
- return 1;
- }
+ screen = GetNvXScreen(dpy);
ret = XNVCTRLQueryVersion(dpy, &major, &minor);
if (ret != True) {
diff --git a/samples/src.mk b/samples/src.mk
new file mode 100644
index 0000000..930b684
--- /dev/null
+++ b/samples/src.mk
@@ -0,0 +1,17 @@
+#
+# files in the samples directory of nvidia-settings
+#
+
+SAMPLES_SRC +=
+
+SAMPLES_EXTRA_DIST += Makefile
+SAMPLES_EXTRA_DIST += README
+SAMPLES_EXTRA_DIST += nv-control-dvc.c
+SAMPLES_EXTRA_DIST += nv-control-dpy.c
+SAMPLES_EXTRA_DIST += nv-control-info.c
+SAMPLES_EXTRA_DIST += nv-control-events.c
+SAMPLES_EXTRA_DIST += nv-control-gvi.c
+SAMPLES_EXTRA_DIST += nv-control-targets.c
+SAMPLES_EXTRA_DIST += nv-control-framelock.c
+SAMPLES_EXTRA_DIST += nv-control-screen.h
+SAMPLES_EXTRA_DIST += src.mk
diff --git a/src/Makefile.inc b/src/Makefile.inc
deleted file mode 100644
index 2dfee54..0000000
--- a/src/Makefile.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (C) 2004 NVIDIA Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of Version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
-# of the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the:
-#
-# Free Software Foundation, Inc.
-# 59 Temple Place - Suite 330
-# Boston, MA 02111-1307, USA
-#
-
-#
-# src files and headers
-#
-
-SRC += \
- command-line.c \
- config-file.c \
- msg.c \
- nvidia-settings.c \
- parse.c \
- query-assign.c \
- nvgetopt.c \
- glxinfo.c \
- lscf.c
-
-EXTRA_DIST += \
- Makefile.inc \
- command-line.h \
- config-file.h \
- msg.h \
- parse.h \
- query-assign.h \
- nvgetopt.h \
- glxinfo.h \
- lscf.h
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/src/XF86Config-parser/Makefile b/src/XF86Config-parser/Makefile
deleted file mode 100644
index 721945d..0000000
--- a/src/XF86Config-parser/Makefile
+++ /dev/null
@@ -1,63 +0,0 @@
-SRC = \
- DRI.c \
- Device.c \
- Files.c \
- Flags.c \
- Input.c \
- Keyboard.c \
- Layout.c \
- Module.c \
- Monitor.c \
- Pointer.c \
- Screen.c \
- Vendor.c \
- Video.c \
- Read.c \
- Scan.c \
- Write.c \
- Util.c \
- Extensions.c \
- Generate.c \
- Merge.c
-
-OBJS = $(SRC:%.c=%.o)
-DEPS = $(SRC:%.c=%.d)
-
-ifndef CC
- CC = gcc
-endif
-
-CFLAGS = -Wall -g
-
-ifdef NV_CFLAGS
- CFLAGS += $(NV_CFLAGS)
-endif
-
-ifndef RANLIB
- RANLIB = ranlib
-endif
-
-LIB = libXF86Config-parser.a
-LIB_O = $(LIB:%.a=%.o)
-
-default all: $(LIB)
-
-.PHONY: clean clobber
-
-$(LIB): $(OBJS)
- $(LD) -r -o $(LIB_O) $(OBJS)
- $(AR) ruv $(LIB) $(LIB_O)
- $(RANLIB) $(LIB)
-
-%.o: %.c
- $(CC) -c $(CFLAGS) $< -o $@
-
-%.d: %.c
- @set -e; $(CC) -MM $(CPPFLAGS) $< \
- | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
- [ -s $@ ] || rm -f $@
-
-clean clobber:
- rm -rf *.o *~ *.d $(LIB) $(LIB_O)
-
--include $(DEPS)
diff --git a/src/XF86Config-parser/Makefile.inc b/src/XF86Config-parser/Makefile.inc
deleted file mode 100644
index 2215dfb..0000000
--- a/src/XF86Config-parser/Makefile.inc
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (C) 2004 NVIDIA Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of Version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
-# of the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the:
-#
-# Free Software Foundation, Inc.
-# 59 Temple Place - Suite 330
-# Boston, MA 02111-1307, USA
-#
-
-#
-# src files and headers
-#
-
-SRC += \
- Device.c \
- DRI.c \
- Extensions.c \
- Files.c \
- Flags.c \
- Generate.c \
- Input.c \
- Keyboard.c \
- Layout.c \
- Merge.c \
- Module.c \
- Monitor.c \
- Pointer.c \
- Read.c \
- Scan.c \
- Screen.c \
- Util.c \
- Vendor.c \
- Video.c \
- Write.c
-
-EXTRA_DIST += \
- Makefile.inc \
- Configint.h \
- configProcs.h \
- Makefile \
- xf86Parser.h \
- xf86tokens.h
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/src/XF86Config-parser/Scan.c b/src/XF86Config-parser/Scan.c
index d0a4258..19473af 100644
--- a/src/XF86Config-parser/Scan.c
+++ b/src/XF86Config-parser/Scan.c
@@ -188,7 +188,7 @@ static unsigned int xconfigStrToUL (char *str)
* support that.
*/
-static char *xconfigGetNextLine()
+static char *xconfigGetNextLine(void)
{
static int configBufLen = CONFIG_BUF_LEN;
char *tmpConfigBuf, *tmpConfigRBuf;
diff --git a/src/XF86Config-parser/src.mk b/src/XF86Config-parser/src.mk
new file mode 100644
index 0000000..f43afb7
--- /dev/null
+++ b/src/XF86Config-parser/src.mk
@@ -0,0 +1,29 @@
+# makefile fragment included by nvidia-xconfig and nvidia-settings
+
+XCONFIG_PARSER_SRC += DRI.c
+XCONFIG_PARSER_SRC += Device.c
+XCONFIG_PARSER_SRC += Extensions.c
+XCONFIG_PARSER_SRC += Files.c
+XCONFIG_PARSER_SRC += Flags.c
+XCONFIG_PARSER_SRC += Generate.c
+XCONFIG_PARSER_SRC += Input.c
+XCONFIG_PARSER_SRC += Keyboard.c
+XCONFIG_PARSER_SRC += Layout.c
+XCONFIG_PARSER_SRC += Merge.c
+XCONFIG_PARSER_SRC += Module.c
+XCONFIG_PARSER_SRC += Monitor.c
+XCONFIG_PARSER_SRC += Pointer.c
+XCONFIG_PARSER_SRC += Read.c
+XCONFIG_PARSER_SRC += Scan.c
+XCONFIG_PARSER_SRC += Screen.c
+XCONFIG_PARSER_SRC += Util.c
+XCONFIG_PARSER_SRC += Vendor.c
+XCONFIG_PARSER_SRC += Video.c
+XCONFIG_PARSER_SRC += Write.c
+
+XCONFIG_PARSER_EXTRA_DIST += Configint.h
+XCONFIG_PARSER_EXTRA_DIST += configProcs.h
+XCONFIG_PARSER_EXTRA_DIST += xf86Parser.h
+XCONFIG_PARSER_EXTRA_DIST += xf86tokens.h
+XCONFIG_PARSER_EXTRA_DIST += src.mk
+
diff --git a/src/command-line.c b/src/command-line.c
index 37ba1de..7aa1452 100644
--- a/src/command-line.c
+++ b/src/command-line.c
@@ -48,7 +48,6 @@ static void print_assign_help(void);
static void print_query_help(void);
static void print_attribute_help(char *attr);
static void print_help(void);
-static char *tilde_expansion(char *str);
static char *nvstrcat(const char *str, ...);
/*
@@ -74,7 +73,7 @@ static void print_version(void)
nv_msg(TAB, "This program is used to configure the "
"NVIDIA Linux graphics driver.");
nv_msg(NULL, "");
- nv_msg(TAB, "Copyright (C) 2004 - 2008 NVIDIA Corporation.");
+ nv_msg(TAB, "Copyright (C) 2004 - 2010 NVIDIA Corporation.");
nv_msg(NULL, "");
} /* print_version() */
@@ -474,14 +473,15 @@ Options *parse_command_line(int argc, char *argv[], char *dpy)
* user's home directory.
*/
-static char *tilde_expansion(char *str)
+char *tilde_expansion(const char *str)
{
char *prefix = NULL;
- char *replace, *user, *ret;
+ const char *replace;
+ char *user, *ret;
struct passwd *pw;
int len;
- if ((!str) || (str[0] != '~')) return str;
+ if ((!str) || (str[0] != '~')) return strdup(str);
if ((str[1] == '/') || (str[1] == '\0')) {
@@ -514,7 +514,7 @@ static char *tilde_expansion(char *str)
free (user);
}
- if (!prefix) return str;
+ if (!prefix) return strdup(str);
ret = malloc(strlen(prefix) + strlen(replace) + 1);
strcpy(ret, prefix);
diff --git a/src/command-line.h b/src/command-line.h
index c26e1c5..c173524 100644
--- a/src/command-line.h
+++ b/src/command-line.h
@@ -95,5 +95,6 @@ typedef struct {
Options *parse_command_line(int argc, char *argv[], char *dpy);
+char *tilde_expansion(const char *str);
#endif /* __COMMAND_LINE_H__ */
diff --git a/src/glxinfo.c b/src/glxinfo.c
index c6d89e3..0378bda 100644
--- a/src/glxinfo.c
+++ b/src/glxinfo.c
@@ -49,6 +49,7 @@ format_extension_list(const char *ext)
{
int i;
char * extTmp = NULL; /* Actual string to print */
+ const char *extCountTmp;
if ( !ext || !ext[0] )
@@ -56,19 +57,19 @@ format_extension_list(const char *ext)
/* Count number of extensions (to get number of commas needed) */
i = 0;
- extTmp = (char *)ext;
- while ( *extTmp != '\0' ) {
- if ( *extTmp == ' ' ) {
+ extCountTmp = ext;
+ while ( *extCountTmp != '\0' ) {
+ if ( *extCountTmp == ' ' ) {
i++;
}
- extTmp++;
+ extCountTmp++;
}
/*
* Allocate buffer that will hold the extension string with
* commas in it
*/
- extTmp = (char *) malloc( (strlen(ext) +i +1) *sizeof(char) );
+ extTmp = malloc( (strlen(ext) +i +1) *sizeof(char) );
if ( extTmp == NULL ) {
return NULL;
}
diff --git a/src/gtk+-2.x/Makefile.inc b/src/gtk+-2.x/Makefile.inc
deleted file mode 100644
index ac33d9c..0000000
--- a/src/gtk+-2.x/Makefile.inc
+++ /dev/null
@@ -1,123 +0,0 @@
-#
-# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (C) 2004 NVIDIA Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of Version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
-# of the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the:
-#
-# Free Software Foundation, Inc.
-# 59 Temple Place - Suite 330
-# Boston, MA 02111-1307, USA
-#
-
-#
-# GTK+ 2.0 sources and extra files to be included in the distribution
-#
-
-SRC += \
- ctkxvideo.c \
- ctkcursorshadow.c \
- ctkui.c \
- ctkframelock.c \
- ctkgauge.c \
- ctkcurve.c \
- ctkcolorcorrection.c \
- ctkscale.c \
- ctkmultisample.c \
- ctkconfig.c \
- ctkevent.c \
- ctkwindow.c \
- ctkopengl.c \
- ctkglx.c \
- ctkhelp.c \
- ctkimagesliders.c \
- ctkdisplaydevice-crt.c \
- ctkdisplaydevice-tv.c \
- ctkdisplaydevice-dfp.c \
- ctkthermal.c \
- ctkpowermizer.c \
- ctkgvo.c \
- ctkgvo-csc.c \
- ctkdropdownmenu.c \
- ctkrandr.c \
- ctkclocks.c \
- ctkutils.c \
- ctkedid.c \
- ctkserver.c \
- ctkdisplaylayout.c \
- ctkdisplayconfig.c \
- ctkscreen.c \
- ctkslimm.c \
- ctkgpu.c \
- ctkbanner.c \
- ctkvcs.c \
- ctkdisplayconfig-utils.c \
- ctkgvo-banner.c \
- ctkgvo-sync.c \
- ctkgvi.c \
- ctklicense.c \
- ctkpowersavings.c \
- ctkecc.c
-
-
-EXTRA_DIST += \
- Makefile.inc \
- ctkxvideo.h \
- ctkcursorshadow.h \
- ctkui.h \
- ctkframelock.h \
- ctkgauge.h \
- ctkcurve.h \
- ctkcolorcorrection.h \
- ctkscale.h \
- ctkmultisample.h \
- ctkconfig.h \
- ctkevent.h \
- ctkwindow.h \
- ctkopengl.h \
- ctkglx.h \
- ctkhelp.h \
- ctkimagesliders.h \
- ctkdisplaydevice-crt.h \
- ctkdisplaydevice-tv.h \
- ctkdisplaydevice-dfp.h \
- ctkconstants.h \
- ctkthermal.h \
- ctkpowermizer.h \
- ctkgvo.h \
- ctkgvo-csc.h \
- ctkdropdownmenu.h \
- ctkrandr.h \
- ctkclocks.h \
- ctkutils.h \
- ctkedid.h \
- ctkserver.h \
- ctkdisplaylayout.h \
- ctkdisplayconfig.h \
- ctkscreen.h \
- ctkslimm.h \
- ctkgpu.h \
- ctkbanner.h \
- ctkvcs.h \
- ctkdisplayconfig-utils.h \
- ctkpowersavings.h \
- ctkgvo-banner.h \
- ctkgvo-sync.h \
- ctkgvi.h \
- ctklicense.h \
- ctkpowersavings.h \
- ctkecc.h
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/src/gtk+-2.x/ctkcolorcorrection.c b/src/gtk+-2.x/ctkcolorcorrection.c
index b375347..169190e 100644
--- a/src/gtk+-2.x/ctkcolorcorrection.c
+++ b/src/gtk+-2.x/ctkcolorcorrection.c
@@ -380,7 +380,6 @@ GtkWidget* ctk_color_correction_new(NvCtrlAttributeHandle *handle,
(gpointer) ctk_color_correction);
ctk_color_correction->confirm_button = confirm_button;
- gtk_widget_set_size_request(confirm_button, 160, -1);
ctk_config_set_tooltip(ctk_config, eventbox, __confirm_button_help);
ctk_config_set_tooltip(ctk_config, button, __resest_button_help);
diff --git a/src/gtk+-2.x/ctkconfig.c b/src/gtk+-2.x/ctkconfig.c
index f9d0542..1cb58a8 100644
--- a/src/gtk+-2.x/ctkconfig.c
+++ b/src/gtk+-2.x/ctkconfig.c
@@ -333,7 +333,7 @@ GtkWidget* ctk_config_new(ConfigProperties *conf, CtrlHandles *pCtrlHandles)
static void save_rc_clicked(GtkWidget *widget, gpointer user_data)
{
gint result;
- gchar *rc_filename = NULL;
+ const gchar *rc_filename = NULL;
CtkConfig *ctk_config = CTK_CONFIG(user_data);
CtkWindow *ctk_window =
CTK_WINDOW(ctk_get_parent_window(GTK_WIDGET(ctk_config)));
@@ -344,7 +344,7 @@ static void save_rc_clicked(GtkWidget *widget, gpointer user_data)
switch (result) {
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
- rc_filename = (gchar *)gtk_file_selection_get_filename
+ rc_filename = gtk_file_selection_get_filename
(GTK_FILE_SELECTION(ctk_config->rc_file_selector));
break;
default:
diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.c b/src/gtk+-2.x/ctkdisplayconfig-utils.c
index fed2001..81280e6 100644
--- a/src/gtk+-2.x/ctkdisplayconfig-utils.c
+++ b/src/gtk+-2.x/ctkdisplayconfig-utils.c
@@ -25,7 +25,6 @@
#include <stdlib.h> /* malloc */
#include <string.h> /* strlen, strdup */
#include <unistd.h> /* lseek, close */
-#include <locale.h>
#include <errno.h>
#include <fcntl.h>
@@ -38,6 +37,7 @@
#include "msg.h"
#include "parse.h"
+#include "command-line.h"
#include "ctkdisplayconfig-utils.h"
#include "ctkutils.h"
@@ -257,25 +257,16 @@ static nvModeLinePtr modeline_parse(nvDisplayPtr display,
{
nvModeLinePtr modeline = NULL;
const char *str = modeline_str;
- char *tmp, *old_locale;
+ char *tmp;
char *tokens, *nptr;
- double pclk, htotal, vtotal, factor;
+ double htotal, vtotal, factor;
+ gdouble pclk;
if (!str) return NULL;
modeline = (nvModeLinePtr)calloc(1, sizeof(nvModeLine));
if (!modeline) return NULL;
- /* Make sure strtod uses . instead of , as the decimal separator */
- old_locale = setlocale(LC_NUMERIC, NULL);
-
- if (old_locale)
- old_locale = strdup(old_locale);
-
- if (!old_locale || !setlocale(LC_NUMERIC, "C"))
- nv_warning_msg("Error parsing server modeline '%s': could not "
- "set the locale 'C'.", modeline_str);
-
/* Parse the modeline tokens */
tmp = strstr(str, "::");
if (tmp) {
@@ -397,7 +388,12 @@ static nvModeLinePtr modeline_parse(nvDisplayPtr display,
htotal = (double) modeline->data.htotal;
vtotal = (double) modeline->data.vtotal;
- pclk = strtod(modeline->data.clock, &nptr);
+ /*
+ * Use g_ascii_strtod(), so that we do not have to change the locale
+ * to "C".
+ */
+ pclk = g_ascii_strtod((const gchar *)modeline->data.clock,
+ (gchar **)&nptr);
if ((pclk == 0.0) || !nptr || *nptr != '\0' || ((htotal * vtotal) == 0)) {
nv_warning_msg("Failed to compute the refresh rate "
@@ -420,12 +416,6 @@ static nvModeLinePtr modeline_parse(nvDisplayPtr display,
modeline->refresh_rate *= factor;
}
- /* Restore the locale */
- if (old_locale) {
- setlocale(LC_NUMERIC, old_locale);
- free(old_locale);
- }
-
return modeline;
@@ -433,12 +423,6 @@ static nvModeLinePtr modeline_parse(nvDisplayPtr display,
fail:
free(modeline);
- /* Restore the locale */
- if (old_locale) {
- setlocale(LC_NUMERIC, old_locale);
- free(old_locale);
- }
-
return NULL;
} /* modeline_parse() */
@@ -1270,14 +1254,16 @@ static void screen_remove_metamodes(nvScreenPtr screen)
* screen's display devices (at the end of the list)
*
**/
-static Bool screen_add_metamode(nvScreenPtr screen, char *metamode_str,
+static Bool screen_add_metamode(nvScreenPtr screen, const char *metamode_str,
gchar **err_str)
{
- char *mode_str;
+ char *mode_str_itr;
char *str = NULL;
- char *tmp;
+ const char *tmp;
char *tokens;
+ char *metamode_copy;
nvMetaModePtr metamode;
+ int str_offset = 0;
if (!screen || !screen->gpu || !metamode_str) goto fail;
@@ -1287,29 +1273,33 @@ static Bool screen_add_metamode(nvScreenPtr screen, char *metamode_str,
if (!metamode) goto fail;
- /* Copy the string so we can split it up */
- str = strdup(metamode_str);
- if (!str) goto fail;
-
-
/* Read the MetaMode ID */
- tmp = strstr(str, "::");
+ tmp = strstr(metamode_str, "::");
if (tmp) {
- tokens = strdup(str);
- tokens[ tmp-str ] = '\0';
+
+ tokens = strdup(metamode_str);
+ if (!tokens) goto fail;
+
+ tokens[ tmp-metamode_str ] = '\0';
tmp += 2;
parse_token_value_pairs(tokens, apply_metamode_token,
(void *)metamode);
free(tokens);
+ str_offset = tmp - metamode_str;
} else {
/* No tokens? Try the old "ID: METAMODE_STR" syntax */
- tmp = (char *)parse_read_integer(str, &(metamode->id));
+ const char *read_offset;
+ read_offset = parse_read_integer(metamode_str, &(metamode->id));
metamode->source = METAMODE_SOURCE_NVCONTROL;
- if (*tmp == ':') {
- tmp++;
+ if (*read_offset == ':') {
+ read_offset++;
+ str_offset = read_offset - metamode_str;
}
}
+ /* Copy the string so we can split it up */
+ metamode_copy = strdup(metamode_str + str_offset);
+ if (!metamode_copy) goto fail;
/* Add the metamode at the end of the screen's metamode list */
xconfigAddListItem((GenericListPtr *)(&screen->metamodes),
@@ -1317,18 +1307,18 @@ static Bool screen_add_metamode(nvScreenPtr screen, char *metamode_str,
/* Split up the metamode into separate modes */
- for (mode_str = strtok(tmp, ",");
- mode_str;
- mode_str = strtok(NULL, ",")) {
+ for (mode_str_itr = strtok(metamode_copy, ",");
+ mode_str_itr;
+ mode_str_itr = strtok(NULL, ",")) {
nvModePtr mode;
unsigned int device_mask;
nvDisplayPtr display;
- const char *orig_mode_str = parse_skip_whitespace(mode_str);
-
+ const char *orig_mode_str = parse_skip_whitespace(mode_str_itr);
+ const char *mode_str;
/* Parse the display device bitmask from the name */
- mode_str = (char *)parse_read_display_name(mode_str, &device_mask);
+ mode_str = parse_read_display_name(mode_str_itr, &device_mask);
if (!mode_str) {
*err_str = g_strdup_printf("Failed to read a display device name "
"on screen %d (on GPU-%d)\nwhile "
@@ -2663,69 +2653,6 @@ nvScreenPtr layout_get_a_screen(nvLayoutPtr layout, nvGpuPtr preferred_gpu)
/*
- * tilde_expansion() - do tilde expansion on the given path name;
- * based loosely on code snippets found in the comp.unix.programmer
- * FAQ. The tilde expansion rule is: if a tilde ('~') is alone or
- * followed by a '/', then substitute the current user's home
- * directory; if followed by the name of a user, then substitute that
- * user's home directory.
- *
- * Code adapted from nvidia-xconfig
- */
-
-char *tilde_expansion(char *str)
-{
- char *prefix = NULL;
- char *replace, *user, *ret;
- struct passwd *pw;
- int len;
-
- if ((!str) || (str[0] != '~')) return str;
-
- if ((str[1] == '/') || (str[1] == '\0')) {
-
- /* expand to the current user's home directory */
-
- prefix = getenv("HOME");
- if (!prefix) {
-
- /* $HOME isn't set; get the home directory from /etc/passwd */
-
- pw = getpwuid(getuid());
- if (pw) prefix = pw->pw_dir;
- }
-
- replace = str + 1;
-
- } else {
-
- /* expand to the specified user's home directory */
-
- replace = strchr(str, '/');
- if (!replace) replace = str + strlen(str);
-
- len = replace - str;
- user = malloc(len + 1);
- strncpy(user, str+1, len-1);
- user[len] = '\0';
- pw = getpwnam(user);
- if (pw) prefix = pw->pw_dir;
- free (user);
- }
-
- if (!prefix) return str;
-
- ret = malloc(strlen(prefix) + strlen(replace) + 1);
- strcpy(ret, prefix);
- strcat(ret, replace);
-
- return ret;
-
-} /* tilde_expansion() */
-
-
-
-/*
* update_banner() - add our banner at the top of the config, but
* first we need to remove any lines that already include our prefix
* (because presumably they are a banner from an earlier run of
@@ -2800,6 +2727,7 @@ static int save_xconfig_file(SaveXConfDlg *dlg,
FILE *fp = NULL;
size_t size;
gchar *err_msg = NULL;
+ struct stat st;
int ret = 0;
@@ -2811,6 +2739,23 @@ static int save_xconfig_file(SaveXConfDlg *dlg,
/* Backup any existing file */
if ((access(filename, F_OK) == 0)) {
+ /* Verify the file-write permission */
+ if ((access(filename, W_OK) != 0)) {
+ err_msg =
+ g_strdup_printf("You do not have adequate permission to"
+ " open the existing X configuration file '%s' for writing.",
+ filename);
+
+ /* Verify the user permissions */
+ if (stat(filename, &st) == 0) {
+ if ((getuid() != 0) && (st.st_uid == 0) &&
+ !(st.st_mode & (S_IWGRP | S_IWOTH)))
+ err_msg = g_strconcat(err_msg, " You must be 'root'"
+ " to modify the file.", NULL);
+ }
+ goto done;
+ }
+
backup_filename = g_strdup_printf("%s.backup", filename);
nv_info_msg("", "X configuration file '%s' already exists, "
"backing up file as '%s'", filename,
@@ -2907,7 +2852,7 @@ static const char *get_non_regular_file_type_description(mode_t mode)
*/
static void update_xconfig_save_buffer(SaveXConfDlg *dlg)
{
- gchar *filename;
+ const gchar *filename;
XConfigPtr xconfCur = NULL;
XConfigPtr xconfGen = NULL;
@@ -2931,7 +2876,7 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg)
merge = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(dlg->btn_xconfig_merge));
- filename = (gchar *)gtk_entry_get_text(GTK_ENTRY(dlg->txt_xconfig_file));
+ filename = gtk_entry_get_text(GTK_ENTRY(dlg->txt_xconfig_file));
/* Assume we can save until we find out otherwise */
@@ -2944,6 +2889,7 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg)
if (filename && (stat(filename, &st) == 0)) {
const char *non_regular_file_type_description =
get_non_regular_file_type_description(st.st_mode);
+ const char *test_filename;
/* Make sure this is a regular file */
if (non_regular_file_type_description) {
@@ -2959,8 +2905,8 @@ static void update_xconfig_save_buffer(SaveXConfDlg *dlg)
}
/* Must be able to open the file */
- tmp_filename = (char *)xconfigOpenConfigFile(filename, NULL);
- if (!tmp_filename || strcmp(tmp_filename, filename)) {
+ test_filename = xconfigOpenConfigFile(filename, NULL);
+ if (!test_filename || strcmp(test_filename, filename)) {
xconfigCloseConfigFile();
} else {
@@ -3231,7 +3177,7 @@ void run_save_xconfig_dialog(SaveXConfDlg *dlg)
void *buf;
GtkTextIter buf_start, buf_end;
gchar *filename;
- gchar *tmp_filename;
+ const gchar *tmp_filename;
struct stat st;
gint result;
@@ -3263,11 +3209,12 @@ void run_save_xconfig_dialog(SaveXConfDlg *dlg)
case GTK_RESPONSE_ACCEPT:
/* Get the filename to write to */
- tmp_filename =
- (gchar *) gtk_entry_get_text(GTK_ENTRY(dlg->txt_xconfig_file));
+ tmp_filename = gtk_entry_get_text(GTK_ENTRY(dlg->txt_xconfig_file));
filename = tilde_expansion(tmp_filename);
- if (filename == tmp_filename) {
- filename = g_strdup(tmp_filename);
+
+ if (!filename) {
+ nv_error_msg("Failed to get X configuration filename!");
+ break;
}
/* If the file exists, make sure it is a regular file */
@@ -3327,7 +3274,7 @@ SaveXConfDlg *create_save_xconfig_dialog(GtkWidget *parent,
GtkWidget *hbox;
GtkWidget *hbox2;
gchar *filename;
-
+ const char *tmp_filename;
dlg = (SaveXConfDlg *) malloc (sizeof(SaveXConfDlg));
if (!dlg) return NULL;
@@ -3338,9 +3285,9 @@ SaveXConfDlg *create_save_xconfig_dialog(GtkWidget *parent,
dlg->callback_data = callback_data;
/* Setup the default filename */
- filename = (gchar *) xconfigOpenConfigFile(NULL, NULL);
- if (filename) {
- filename = g_strdup(filename);
+ tmp_filename = xconfigOpenConfigFile(NULL, NULL);
+ if (tmp_filename) {
+ filename = g_strdup(tmp_filename);
} else {
filename = g_strdup("");
}
diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c
index 7947005..7e19d33 100644
--- a/src/gtk+-2.x/ctkdisplayconfig.c
+++ b/src/gtk+-2.x/ctkdisplayconfig.c
@@ -138,7 +138,6 @@ typedef struct SwitchModeCallbackInfoRec {
#define VALIDATE_APPLY 0
#define VALIDATE_SAVE 1
-#define SCREEN_DEPTH_COUNT 5
/*** G L O B A L S ***********************************************************/
@@ -3069,6 +3068,30 @@ static void setup_screen_virtual_size(CtkDisplayConfig *ctk_object)
+/** grow_screen_depth_table() **************************************
+ *
+ * realloc the screen_depth_table, if possible.
+ *
+ **/
+
+static gboolean grow_screen_depth_table(CtkDisplayConfig *ctk_object)
+{
+ int *tmp = realloc(ctk_object->screen_depth_table,
+ sizeof(int) *
+ (ctk_object->screen_depth_table_len + 1));
+ if (!tmp) {
+ return False;
+ }
+
+ ctk_object->screen_depth_table = tmp;
+ ctk_object->screen_depth_table_len++;
+
+ return True;
+
+} /* grow_screen_depth_table() */
+
+
+
/** setup_screen_depth_dropdown() ************************************
*
* Generates the color depth dropdown based on the currently selected
@@ -3081,11 +3104,10 @@ static void setup_screen_depth_dropdown(CtkDisplayConfig *ctk_object)
GtkWidget *menu;
GtkWidget *menu_item;
int cur_idx;
- int screen_depth_table_len = 0;
gboolean add_depth_30_option;
nvScreenPtr screen = ctk_display_layout_get_selected_screen
(CTK_DISPLAY_LAYOUT(ctk_object->obj_layout));
-
+
if (!screen) {
gtk_widget_hide(ctk_object->box_screen_depth);
return;
@@ -3093,8 +3115,8 @@ static void setup_screen_depth_dropdown(CtkDisplayConfig *ctk_object)
if (ctk_object->screen_depth_table) {
free(ctk_object->screen_depth_table);
}
- ctk_object->screen_depth_table =
- (char *) malloc(sizeof(char) * SCREEN_DEPTH_COUNT);
+ ctk_object->screen_depth_table = NULL;
+ ctk_object->screen_depth_table_len = 0;
menu = gtk_menu_new();
@@ -3109,33 +3131,45 @@ static void setup_screen_depth_dropdown(CtkDisplayConfig *ctk_object)
}
if (add_depth_30_option) {
- menu_item = gtk_menu_item_new_with_label
- ("1.1 Billion Colors (Depth 30) - Experimental");
+
+ if (grow_screen_depth_table(ctk_object)) {
+ menu_item = gtk_menu_item_new_with_label
+ ("1.1 Billion Colors (Depth 30) - Experimental");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+ gtk_widget_show(menu_item);
+
+ ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 30;
+ }
+ }
+
+ if (grow_screen_depth_table(ctk_object)) {
+ menu_item = gtk_menu_item_new_with_label("16.7 Million Colors (Depth 24)");
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
gtk_widget_show(menu_item);
- ctk_object->screen_depth_table[screen_depth_table_len++] = 30;
+ ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 24;
}
- menu_item = gtk_menu_item_new_with_label("16.7 Million Colors (Depth 24)");
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- gtk_widget_show(menu_item);
- ctk_object->screen_depth_table[screen_depth_table_len++] = 24;
- menu_item = gtk_menu_item_new_with_label("65,536 Colors (Depth 16)");
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- gtk_widget_show(menu_item);
- ctk_object->screen_depth_table[screen_depth_table_len++] = 16;
+ if (grow_screen_depth_table(ctk_object)) {
+ menu_item = gtk_menu_item_new_with_label("65,536 Colors (Depth 16)");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+ gtk_widget_show(menu_item);
+ ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 16;
+ }
- menu_item = gtk_menu_item_new_with_label("32,768 Colors (Depth 15)");
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- gtk_widget_show(menu_item);
- ctk_object->screen_depth_table[screen_depth_table_len++] = 15;
+ if (grow_screen_depth_table(ctk_object)) {
+ menu_item = gtk_menu_item_new_with_label("32,768 Colors (Depth 15)");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+ gtk_widget_show(menu_item);
+ ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 15;
+ }
- menu_item = gtk_menu_item_new_with_label("256 Colors (Depth 8)");
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- gtk_widget_show(menu_item);
- ctk_object->screen_depth_table[screen_depth_table_len++] = 8;
+ if (grow_screen_depth_table(ctk_object)) {
+ menu_item = gtk_menu_item_new_with_label("256 Colors (Depth 8)");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+ gtk_widget_show(menu_item);
+ ctk_object->screen_depth_table[ctk_object->screen_depth_table_len-1] = 8;
+ }
- assert(screen_depth_table_len <= SCREEN_DEPTH_COUNT);
g_signal_handlers_block_by_func(G_OBJECT(ctk_object->mnu_screen_depth),
G_CALLBACK(screen_depth_changed),
(gpointer) ctk_object);
@@ -3143,7 +3177,7 @@ static void setup_screen_depth_dropdown(CtkDisplayConfig *ctk_object)
gtk_option_menu_set_menu
(GTK_OPTION_MENU(ctk_object->mnu_screen_depth), menu);
- for (cur_idx = 0; cur_idx < SCREEN_DEPTH_COUNT; cur_idx++) {
+ for (cur_idx = 0; cur_idx < ctk_object->screen_depth_table_len; cur_idx++) {
if (screen->depth == ctk_object->screen_depth_table[cur_idx]) {
gtk_option_menu_set_history
(GTK_OPTION_MENU(ctk_object->mnu_screen_depth), cur_idx);
@@ -3453,6 +3487,7 @@ static void setup_screen_page(CtkDisplayConfig *ctk_object)
gchar *tmp;
gint page_num;
GtkWidget *tab_label;
+ GParamSpec* param_spec = NULL;
page_num = gtk_notebook_page_num(GTK_NOTEBOOK(ctk_object->notebook),
@@ -3476,8 +3511,21 @@ static void setup_screen_page(CtkDisplayConfig *ctk_object)
/* Setup the screen number */
tmp = g_strdup_printf("%d", screen->scrnum);
- g_object_set(gtk_widget_get_settings(ctk_object->txt_screen_num),
- "gtk-label-select-on-focus", FALSE, NULL);
+
+ param_spec = g_object_class_find_property
+ (G_OBJECT_GET_CLASS(gtk_widget_get_settings(ctk_object->txt_screen_num)),
+ "gtk-label-select-on-focus");
+
+ if (param_spec) {
+ /*
+ * When running against versions of gtk that have the
+ * "gtk-label-select-on-focus" property, set the property to FALSE for
+ * the screen label so that it isn't auto-selected when switching tabs
+ */
+ g_object_set(gtk_widget_get_settings(ctk_object->txt_screen_num),
+ "gtk-label-select-on-focus", FALSE, NULL);
+ }
+
gtk_label_set_text(GTK_LABEL(ctk_object->txt_screen_num), tmp);
g_free(tmp);
@@ -3583,7 +3631,8 @@ static gint validation_fix_crowded_metamodes(CtkDisplayConfig *ctk_object,
/* Delete the metamode */
ctk_display_layout_delete_screen_metamode
- (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), screen, i);
+ (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), screen, i,
+ TRUE);
nv_info_msg(TAB, "Removed MetaMode %d on Screen %d (No "
"active display devices)\n", i,
@@ -3646,7 +3695,8 @@ static gint validation_remove_dupe_metamodes(CtkDisplayConfig *ctk_object,
/* Delete the metamode */
ctk_display_layout_delete_screen_metamode
- (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), screen, i);
+ (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), screen, i,
+ TRUE);
nv_info_msg(TAB, "Removed MetaMode %d on Screen %d (Is "
"Duplicate of MetaMode %d)\n", i+1, screen->scrnum,
@@ -4213,6 +4263,7 @@ static void prepare_gpu_for_twinview(CtkDisplayConfig *ctk_object,
/* Delete implicit metamodes from all screens involved */
for (screen = gpu->screens; screen; screen = screen->next) {
nvMetaModePtr next;
+ Bool updated = FALSE;
m = 0;
metamode = screen->metamodes;
@@ -4223,12 +4274,24 @@ static void prepare_gpu_for_twinview(CtkDisplayConfig *ctk_object,
(metamode != screen->cur_metamode)) {
ctk_display_layout_delete_screen_metamode
- (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), screen, m);
+ (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), screen, m,
+ FALSE);
+ updated = TRUE;
} else {
m++;
}
metamode = next;
}
+
+ /* Now that all the implicit metamodes have been deleted,
+ * we can recalculate and reselect the current mode
+ * for the screen.
+ */
+ if (updated) {
+ ctk_display_layout_set_screen_metamode
+ (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout),
+ screen, screen->cur_metamode_idx);
+ }
}
/* Make all other X screens in the layout relative to the GPU's
@@ -5458,6 +5521,8 @@ static void screen_depth_changed(GtkWidget *widget, gpointer user_data)
if (!screen) return;
+ if (idx >= ctk_object->screen_depth_table_len) return;
+
depth = ctk_object->screen_depth_table[idx];
if (depth == 30) {
@@ -5786,7 +5851,7 @@ static void screen_metamode_delete_clicked(GtkWidget *widget,
ctk_display_layout_delete_screen_metamode
(CTK_DISPLAY_LAYOUT(ctk_object->obj_layout),
- screen, screen->cur_metamode_idx);
+ screen, screen->cur_metamode_idx, TRUE);
/* Update the GUI */
setup_display_page(ctk_object);
@@ -5998,7 +6063,7 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object,
case GTK_RESPONSE_YES:
ctk_display_layout_delete_screen_metamode
(CTK_DISPLAY_LAYOUT(ctk_object->obj_layout),
- screen, screen->cur_metamode_idx);
+ screen, screen->cur_metamode_idx, TRUE);
nv_info_msg(TAB, "Removed MetaMode %d on Screen %d.\n",
screen->cur_metamode_idx+1,
@@ -6085,14 +6150,14 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object,
static char *find_metamode_string(char *metamode_str, char *metamode_strs)
{
char *m;
- char *str;
+ const char *str;
for (m = metamode_strs; m && strlen(m); m += strlen(m) +1) {
/* Skip tokens if any */
str = strstr(m, "::");
if (str) {
- str = (char *)parse_skip_whitespace(str +2);
+ str = parse_skip_whitespace(str +2);
} else {
str = m;
}
@@ -6242,8 +6307,8 @@ static void order_metamodes(nvScreenPtr screen)
static void postprocess_metamodes(nvScreenPtr screen, char *metamode_strs)
{
- char *metamode_str;
- char *str;
+ char *metamode_str, *tmp;
+ const char *str;
ReturnStatus ret;
@@ -6256,16 +6321,19 @@ static void postprocess_metamodes(nvScreenPtr screen, char *metamode_strs)
str = strstr(metamode_str, "::");
if (!str) continue;
- str = (char *)parse_skip_whitespace(str +2);
-
+ str = parse_skip_whitespace(str +2);
+ tmp = strdup(str);
+ if (!tmp) continue;
/* Delete the metamode */
ret = NvCtrlSetStringAttribute(screen->handle,
NV_CTRL_STRING_DELETE_METAMODE,
- str, NULL);
+ tmp, NULL);
if (ret == NvCtrlSuccess) {
nv_info_msg(TAB, "Removed > %s", str);
}
+
+ free(tmp);
}
/* Reorder the list of metamodes */
@@ -6286,7 +6354,7 @@ static int update_screen_metamodes(CtkDisplayConfig *ctk_object,
{
char *metamode_strs = NULL;
char *cur_metamode_str = NULL;
- char *metamode_str;
+ const char *metamode_str;
int len;
int clear_apply = 0; /* Set if we should clear the apply button */
@@ -6334,7 +6402,7 @@ static int update_screen_metamodes(CtkDisplayConfig *ctk_object,
/* Skip tokens */
metamode_str = strstr(cur_metamode_str, "::");
if (metamode_str) {
- metamode_str = (char *)parse_skip_whitespace(metamode_str +2);
+ metamode_str = parse_skip_whitespace(metamode_str +2);
} else {
metamode_str = cur_metamode_str;
}
diff --git a/src/gtk+-2.x/ctkdisplayconfig.h b/src/gtk+-2.x/ctkdisplayconfig.h
index 6a35513..6aacca0 100644
--- a/src/gtk+-2.x/ctkdisplayconfig.h
+++ b/src/gtk+-2.x/ctkdisplayconfig.h
@@ -132,8 +132,10 @@ typedef struct _CtkDisplayConfig
GtkWidget *btn_screen_metamode;
GtkWidget *btn_screen_metamode_add;
GtkWidget *btn_screen_metamode_delete;
-
- char *screen_depth_table;
+
+ int *screen_depth_table;
+ int screen_depth_table_len;
+
/* Dialogs */
GtkWidget *dlg_display_config;
GtkWidget *rad_display_config_disabled;
diff --git a/src/gtk+-2.x/ctkdisplaydevice-crt.c b/src/gtk+-2.x/ctkdisplaydevice-crt.c
index fffa40d..b2f989a 100644
--- a/src/gtk+-2.x/ctkdisplaydevice-crt.c
+++ b/src/gtk+-2.x/ctkdisplaydevice-crt.c
@@ -33,6 +33,7 @@
#include "ctkedid.h"
#include "ctkconfig.h"
#include "ctkhelp.h"
+#include "ctkutils.h"
#include <stdio.h>
static void ctk_display_device_crt_class_init(CtkDisplayDeviceCrtClass *);
@@ -224,6 +225,10 @@ GtkWidget* ctk_display_device_crt_new(NvCtrlAttributeHandle *handle,
/* Update the GUI */
+ update_display_enabled_flag(ctk_display_device_crt->handle,
+ &ctk_display_device_crt->display_enabled,
+ ctk_display_device_crt->display_device_mask);
+
ctk_display_device_crt_setup(ctk_display_device_crt);
/* handle enable/disable events on the display device */
@@ -304,20 +309,6 @@ static void reset_button_clicked(GtkButton *button, gpointer user_data)
static void ctk_display_device_crt_setup(CtkDisplayDeviceCrt
*ctk_display_device_crt)
{
- ReturnStatus ret;
- unsigned int enabled_displays;
-
-
- /* Is display enabled? */
-
- ret = NvCtrlGetAttribute(ctk_display_device_crt->handle,
- NV_CTRL_ENABLED_DISPLAYS,
- (int *)&enabled_displays);
-
- ctk_display_device_crt->display_enabled =
- (ret == NvCtrlSuccess &&
- (enabled_displays & (ctk_display_device_crt->display_device_mask)));
-
/* Update CRT-specific settings */
crt_info_setup(ctk_display_device_crt);
@@ -394,6 +385,16 @@ static void enabled_displays_received(GtkObject *object, gpointer arg1,
{
CtkDisplayDeviceCrt *ctk_object = CTK_DISPLAY_DEVICE_CRT(user_data);
+ /* Requery display information only if display disabled */
+
+ update_display_enabled_flag(ctk_object->handle,
+ &ctk_object->display_enabled,
+ ctk_object->display_device_mask);
+
+ if (ctk_object->display_enabled) {
+ return;
+ }
+
ctk_display_device_crt_setup(ctk_object);
} /* enabled_displays_received() */
diff --git a/src/gtk+-2.x/ctkdisplaydevice-dfp.c b/src/gtk+-2.x/ctkdisplaydevice-dfp.c
index 6cab80f..7829bfb 100644
--- a/src/gtk+-2.x/ctkdisplaydevice-dfp.c
+++ b/src/gtk+-2.x/ctkdisplaydevice-dfp.c
@@ -29,6 +29,7 @@
#include "ctkdisplaydevice-dfp.h"
+#include "ctkditheringcontrols.h"
#include "ctkimagesliders.h"
#include "ctkedid.h"
#include "ctkconfig.h"
@@ -204,6 +205,8 @@ GtkWidget* ctk_display_device_dfp_new(NvCtrlAttributeHandle *handle,
GtkWidget *alignment;
GtkWidget *table;
+ ReturnStatus ret1, ret2;
+ gint val_target, val_method;
object = g_object_new(CTK_TYPE_DISPLAY_DEVICE_DFP, NULL);
if (!object) return NULL;
@@ -215,6 +218,28 @@ GtkWidget* ctk_display_device_dfp_new(NvCtrlAttributeHandle *handle,
ctk_display_device_dfp->display_device_mask = display_device_mask;
ctk_display_device_dfp->name = g_strdup(name);
+ /* cache the default scaling target & method values */
+ ret1 =
+ NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle,
+ ctk_display_device_dfp->display_device_mask,
+ NV_CTRL_GPU_SCALING_DEFAULT_TARGET,
+ &val_target);
+ ret2 =
+ NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle,
+ ctk_display_device_dfp->display_device_mask,
+ NV_CTRL_GPU_SCALING_DEFAULT_METHOD,
+ &val_method);
+
+ if (ret1 != NvCtrlSuccess || ret2 != NvCtrlSuccess ||
+ val_target == NV_CTRL_GPU_SCALING_TARGET_INVALID ||
+ val_method == NV_CTRL_GPU_SCALING_METHOD_INVALID) {
+ val_target = NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT;
+ val_method = NV_CTRL_GPU_SCALING_METHOD_STRETCHED;
+ }
+
+ ctk_display_device_dfp->default_scaling_target = val_target;
+ ctk_display_device_dfp->default_scaling_method = val_method;
+
gtk_box_set_spacing(GTK_BOX(object), 10);
/* banner */
@@ -435,6 +460,21 @@ GtkWidget* ctk_display_device_dfp_new(NvCtrlAttributeHandle *handle,
G_CALLBACK(dfp_update_received),
(gpointer) ctk_display_device_dfp);
+ /* pack the dithering controls */
+
+ ctk_display_device_dfp->dithering_controls =
+ ctk_dithering_controls_new(ctk_display_device_dfp->handle,
+ ctk_display_device_dfp->ctk_config,
+ ctk_display_device_dfp->ctk_event,
+ ctk_display_device_dfp->reset_button,
+ ctk_display_device_dfp->display_device_mask);
+
+ if (ctk_display_device_dfp->dithering_controls) {
+ gtk_box_pack_start(GTK_BOX(object),
+ ctk_display_device_dfp->dithering_controls,
+ FALSE, FALSE, 0);
+ }
+
/* pack the image sliders */
ctk_display_device_dfp->image_sliders =
@@ -459,6 +499,10 @@ GtkWidget* ctk_display_device_dfp_new(NvCtrlAttributeHandle *handle,
/* Update the GUI */
+ update_display_enabled_flag(ctk_display_device_dfp->handle,
+ &ctk_display_device_dfp->display_enabled,
+ ctk_display_device_dfp->display_device_mask);
+
ctk_display_device_dfp_setup(ctk_display_device_dfp);
/* handle enable/disable events on the display device */
@@ -667,16 +711,23 @@ static void reset_button_clicked(GtkButton *button, gpointer user_data)
if (ctk_display_device_dfp->active_attributes & __SCALING) {
value =
- MAKE_SCALING_VALUE(NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT,
- NV_CTRL_GPU_SCALING_METHOD_STRETCHED);
+ MAKE_SCALING_VALUE(ctk_display_device_dfp->default_scaling_target,
+ ctk_display_device_dfp->default_scaling_method);
+
NvCtrlSetDisplayAttribute(ctk_display_device_dfp->handle,
ctk_display_device_dfp->display_device_mask,
NV_CTRL_GPU_SCALING, value);
- dfp_scaling_update_buttons(ctk_display_device_dfp, value);
+ dfp_scaling_setup(ctk_display_device_dfp);
}
-
+
+ /* Reset the dithering configuration */
+ if (ctk_display_device_dfp->dithering_controls) {
+ ctk_dithering_controls_reset
+ (CTK_DITHERING_CONTROLS(ctk_display_device_dfp->dithering_controls));
+ }
+
/* Update the reset button */
gtk_widget_set_sensitive(ctk_display_device_dfp->reset_button, FALSE);
@@ -878,6 +929,11 @@ GtkTextBuffer *ctk_display_device_dfp_create_help(GtkTextTagTable *table,
"aspect ratio) to expand and fit as much of the entire "
"flat panel as possible.");
+ if (ctk_display_device_dfp->dithering_controls) {
+ add_dithering_controls_help
+ (CTK_DITHERING_CONTROLS(ctk_display_device_dfp->dithering_controls), b, &i);
+ }
+
add_image_sliders_help
(CTK_IMAGE_SLIDERS(ctk_display_device_dfp->image_sliders), b, &i);
@@ -1172,21 +1228,6 @@ static void dfp_scaling_setup(CtkDisplayDeviceDfp *ctk_display_device_dfp)
static void ctk_display_device_dfp_setup(CtkDisplayDeviceDfp
*ctk_display_device_dfp)
{
- ReturnStatus ret;
- unsigned int enabled_displays;
-
-
- /* Is display enabled? */
-
- ret = NvCtrlGetAttribute(ctk_display_device_dfp->handle,
- NV_CTRL_ENABLED_DISPLAYS,
- (int *)&enabled_displays);
-
- ctk_display_device_dfp->display_enabled =
- (ret == NvCtrlSuccess &&
- (enabled_displays & (ctk_display_device_dfp->display_device_mask)));
-
-
/* Update DFP-specific settings */
dfp_info_setup(ctk_display_device_dfp);
@@ -1228,6 +1269,10 @@ static void ctk_display_device_dfp_setup(CtkDisplayDeviceDfp
ctk_display_device_dfp->edid, TRUE, TRUE, 0);
}
+ /* Update the dithering setup */
+
+ ctk_dithering_controls_setup
+ (CTK_DITHERING_CONTROLS(ctk_display_device_dfp->dithering_controls));
/* update the reset button */
@@ -1247,6 +1292,16 @@ static void enabled_displays_received(GtkObject *object, gpointer arg1,
{
CtkDisplayDeviceDfp *ctk_object = CTK_DISPLAY_DEVICE_DFP(user_data);
+ /* Requery display information only if display disabled */
+
+ update_display_enabled_flag(ctk_object->handle,
+ &ctk_object->display_enabled,
+ ctk_object->display_device_mask);
+
+ if (ctk_object->display_enabled) {
+ return;
+ }
+
ctk_display_device_dfp_setup(ctk_object);
} /* enabled_displays_received() */
diff --git a/src/gtk+-2.x/ctkdisplaydevice-dfp.h b/src/gtk+-2.x/ctkdisplaydevice-dfp.h
index 03b2051..b8621ba 100644
--- a/src/gtk+-2.x/ctkdisplaydevice-dfp.h
+++ b/src/gtk+-2.x/ctkdisplaydevice-dfp.h
@@ -65,6 +65,7 @@ struct _CtkDisplayDeviceDfp
GtkWidget *reset_button;
GtkWidget *edid_box;
GtkWidget *edid;
+ GtkWidget *dithering_controls;
GtkWidget *txt_chip_location;
GtkWidget *txt_link;
@@ -86,6 +87,8 @@ struct _CtkDisplayDeviceDfp
unsigned int active_attributes;
char *name;
+ gint default_scaling_target;
+ gint default_scaling_method;
};
struct _CtkDisplayDeviceDfpClass
diff --git a/src/gtk+-2.x/ctkdisplaydevice-tv.c b/src/gtk+-2.x/ctkdisplaydevice-tv.c
index 954e980..076227e 100644
--- a/src/gtk+-2.x/ctkdisplaydevice-tv.c
+++ b/src/gtk+-2.x/ctkdisplaydevice-tv.c
@@ -38,6 +38,7 @@
#include "ctkconfig.h"
#include "ctkhelp.h"
#include "ctkscale.h"
+#include "ctkutils.h"
#include <stdio.h>
#define FRAME_PADDING 5
@@ -388,6 +389,10 @@ GtkWidget* ctk_display_device_tv_new(NvCtrlAttributeHandle *handle,
/* update the GUI */
+ update_display_enabled_flag(ctk_display_device_tv->handle,
+ &ctk_display_device_tv->display_enabled,
+ ctk_display_device_tv->display_device_mask);
+
ctk_display_device_tv_setup(ctk_display_device_tv);
/* handle enable/disable events on the display device */
@@ -808,21 +813,6 @@ static void setup_scale(CtkDisplayDeviceTv *ctk_display_device_tv,
static void ctk_display_device_tv_setup(CtkDisplayDeviceTv
*ctk_display_device_tv)
{
- ReturnStatus ret;
- unsigned int enabled_displays;
-
-
- /* Is display enabled? */
-
- ret = NvCtrlGetAttribute(ctk_display_device_tv->handle,
- NV_CTRL_ENABLED_DISPLAYS,
- (int *)&enabled_displays);
-
- ctk_display_device_tv->display_enabled =
- (ret == NvCtrlSuccess &&
- (enabled_displays & (ctk_display_device_tv->display_device_mask)));
-
-
/* Update Information Frame */
tv_info_setup(ctk_display_device_tv);
@@ -949,6 +939,16 @@ static void enabled_displays_received(GtkObject *object, gpointer arg1,
{
CtkDisplayDeviceTv *ctk_object = CTK_DISPLAY_DEVICE_TV(user_data);
+ /* Requery display information only if display disabled */
+
+ update_display_enabled_flag(ctk_object->handle,
+ &ctk_object->display_enabled,
+ ctk_object->display_device_mask);
+
+ if (ctk_object->display_enabled) {
+ return;
+ }
+
ctk_display_device_tv_setup(ctk_object);
} /* enabled_displays_received() */
diff --git a/src/gtk+-2.x/ctkdisplaylayout.c b/src/gtk+-2.x/ctkdisplaylayout.c
index b572a4d..3a119f3 100644
--- a/src/gtk+-2.x/ctkdisplaylayout.c
+++ b/src/gtk+-2.x/ctkdisplaylayout.c
@@ -3721,7 +3721,8 @@ void ctk_display_layout_add_screen_metamode(CtkDisplayLayout *ctk_object,
void ctk_display_layout_delete_screen_metamode(CtkDisplayLayout *ctk_object,
nvScreenPtr screen,
- int metamode_idx)
+ int metamode_idx,
+ Bool reselect)
{
nvDisplayPtr display;
nvMetaModePtr metamode;
@@ -3802,8 +3803,10 @@ void ctk_display_layout_delete_screen_metamode(CtkDisplayLayout *ctk_object,
/* Update which metamode should be selected */
- ctk_display_layout_set_screen_metamode
- (ctk_object, screen, screen->cur_metamode_idx);
+ if (reselect) {
+ ctk_display_layout_set_screen_metamode
+ (ctk_object, screen, screen->cur_metamode_idx);
+ }
} /* ctk_display_layout_delete_screen_metamode() */
diff --git a/src/gtk+-2.x/ctkdisplaylayout.h b/src/gtk+-2.x/ctkdisplaylayout.h
index bd56d7c..10ea728 100644
--- a/src/gtk+-2.x/ctkdisplaylayout.h
+++ b/src/gtk+-2.x/ctkdisplaylayout.h
@@ -519,7 +519,8 @@ void ctk_display_layout_set_screen_metamode (CtkDisplayLayout *,
void ctk_display_layout_add_screen_metamode (CtkDisplayLayout *, nvScreenPtr);
void ctk_display_layout_delete_screen_metamode (CtkDisplayLayout *,
nvScreenPtr,
- int metamode_idx);
+ int metamode_idx,
+ Bool reselect);
void ctk_display_layout_disable_display (CtkDisplayLayout *ctk_object,
nvDisplayPtr display);
diff --git a/src/gtk+-2.x/ctkditheringcontrols.c b/src/gtk+-2.x/ctkditheringcontrols.c
new file mode 100644
index 0000000..3d3f5b6
--- /dev/null
+++ b/src/gtk+-2.x/ctkditheringcontrols.c
@@ -0,0 +1,563 @@
+/*
+ * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
+ * and Linux systems.
+ *
+ * Copyright (C) 2010 NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of Version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
+ * of the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the:
+ *
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ */
+
+#include <gtk/gtk.h>
+#include <NvCtrlAttributes.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+#include "ctkconfig.h"
+#include "ctkhelp.h"
+#include "ctkditheringcontrols.h"
+
+/* function prototypes */
+static gboolean build_dithering_mode_table(CtkDitheringControls *ctk_dithering_controls,
+ NVCTRLAttributeValidValuesRec valid);
+
+static gint map_nvctrl_value_to_table(CtkDitheringControls *ctk_dithering_controls,
+ gint val);
+
+static void enable_dithering_toggled(GtkWidget *widget, gpointer user_data);
+
+static Bool update_dithering_mode_menu_info(gpointer user_data);
+
+static void update_dithering_mode_menu_event(GtkObject *object,
+ gpointer arg1,
+ gpointer user_data);
+
+static void dithering_mode_menu_changed(GtkOptionMenu *dithering_mode_menu,
+ gpointer user_data);
+
+static void dithering_update_received(GtkObject *object, gpointer arg1,
+ gpointer user_data);
+
+/* macros */
+#define FRAME_PADDING 5
+
+/* help text */
+static const char * __dithering_help =
+"The Dithering Controls show the current state of dithering and allow "
+"changing the dithering configuration. Dithering will be performed "
+"when dithering is enabled here, and the flat panel's bitdepth is "
+"less than that of the GPU's internal pixel pipeline.";
+
+GType ctk_dithering_controls_get_type(void)
+{
+ static GType ctk_dithering_controls_type = 0;
+
+ if (!ctk_dithering_controls_type) {
+ static const GTypeInfo ctk_dithering_controls_info = {
+ sizeof (CtkDitheringControlsClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ NULL, /* class_init, */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (CtkDitheringControls),
+ 0, /* n_preallocs */
+ NULL, /* instance_init */
+ };
+
+ ctk_dithering_controls_type =
+ g_type_register_static (GTK_TYPE_VBOX,
+ "CtkDitheringControls",
+ &ctk_dithering_controls_info, 0);
+ }
+
+ return ctk_dithering_controls_type;
+} /* ctk_dithering_controls_get_type() */
+
+GtkWidget* ctk_dithering_controls_new(NvCtrlAttributeHandle *handle,
+ CtkConfig *ctk_config,
+ CtkEvent *ctk_event,
+ GtkWidget *reset_button,
+ unsigned int display_device_mask)
+{
+ GObject *object;
+ CtkDitheringControls *ctk_dithering_controls;
+ GtkWidget *frame, *vbox, *hbox, *label;
+ GtkWidget *menu, *table, *menu_item = NULL;
+ GtkWidget *button, *vseparator;
+ ReturnStatus ret1, ret2;
+ NVCTRLAttributeValidValuesRec valid;
+ gint val, i, dithering_config, dithering_mode;
+
+ /* check if dithering modes are supported */
+ ret1 = NvCtrlGetValidDisplayAttributeValues(handle, display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING_MODE,
+ &valid);
+
+ ret2 = NvCtrlGetDisplayAttribute(handle, display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING_MODE,
+ &val);
+
+ if ((ret1 != NvCtrlSuccess) || (ret2 != NvCtrlSuccess) ||
+ (valid.type != ATTRIBUTE_TYPE_INT_BITS)) {
+ return NULL;
+ }
+
+ /* create the object */
+ object = g_object_new(CTK_TYPE_DITHERING_CONTROLS, NULL);
+ if (!object) {
+ return NULL;
+ }
+
+ ctk_dithering_controls = CTK_DITHERING_CONTROLS(object);
+ ctk_dithering_controls->handle = handle;
+ ctk_dithering_controls->ctk_config = ctk_config;
+ ctk_dithering_controls->reset_button = reset_button;
+ ctk_dithering_controls->display_device_mask = display_device_mask;
+
+ /* build a table holding available dithering modes */
+ if (!build_dithering_mode_table(ctk_dithering_controls, valid)) {
+ return NULL;
+ }
+
+ /* cache the default dithering config & mode values */
+ ret1 =
+ NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DEFAULT_DITHERING,
+ &dithering_config);
+
+ ret2 =
+ NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DEFAULT_DITHERING_MODE,
+ &dithering_mode);
+
+ if (ret1 != NvCtrlSuccess || ret2 != NvCtrlSuccess) {
+ dithering_config = NV_CTRL_FLATPANEL_DITHERING_ENABLED;
+ dithering_mode = NV_CTRL_FLATPANEL_DITHERING_MODE_DYNAMIC_2X2;
+ }
+
+ ctk_dithering_controls->default_dithering_config = dithering_config;
+ ctk_dithering_controls->default_dithering_mode = dithering_mode;
+
+ /* create main dithering box & frame */
+
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, FRAME_PADDING);
+ ctk_dithering_controls->dithering_controls_main = hbox;
+
+ frame = gtk_frame_new("Dithering Controls");
+ gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0);
+
+ hbox = gtk_hbox_new(FALSE, FRAME_PADDING);
+ gtk_container_set_border_width(GTK_CONTAINER(hbox), FRAME_PADDING);
+ gtk_container_add(GTK_CONTAINER(frame), hbox);
+
+ /* add checkbox */
+ button = gtk_check_button_new_with_label("Enable");
+ ctk_dithering_controls->enable_dithering_button = button;
+ gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
+ ctk_config_set_tooltip(ctk_config, button, __dithering_help);
+
+ g_signal_connect(G_OBJECT(button), "toggled",
+ G_CALLBACK(enable_dithering_toggled),
+ (gpointer) ctk_dithering_controls);
+
+ /* add vseparator */
+ vseparator = gtk_vseparator_new();
+ gtk_box_pack_start(GTK_BOX(hbox), vseparator, TRUE, TRUE, 0);
+
+ /* add dropdown menu */
+ vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING);
+ gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
+ ctk_dithering_controls->dithering_mode_box = vbox;
+
+ /* Specifying drop down list */
+ menu = gtk_menu_new();
+
+ for (i = 0; i < ctk_dithering_controls->dithering_mode_table_size; i++) {
+ switch (ctk_dithering_controls->dithering_mode_table[i]) {
+ case NV_CTRL_FLATPANEL_DITHERING_MODE_DYNAMIC_2X2:
+ menu_item = gtk_menu_item_new_with_label("Dynamic 2X2 mode");
+ break;
+ case NV_CTRL_FLATPANEL_DITHERING_MODE_STATIC_2X2:
+ menu_item = gtk_menu_item_new_with_label("Static 2X2 mode");
+ break;
+ }
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+ gtk_widget_show(menu_item);
+ }
+
+ ctk_dithering_controls->dithering_mode_menu = gtk_option_menu_new();
+ gtk_option_menu_set_menu
+ (GTK_OPTION_MENU(ctk_dithering_controls->dithering_mode_menu),
+ menu);
+
+ g_signal_connect(G_OBJECT(ctk_dithering_controls->dithering_mode_menu),
+ "changed", G_CALLBACK(dithering_mode_menu_changed),
+ (gpointer) ctk_dithering_controls);
+
+ /* Packing the drop down list */
+ table = gtk_table_new(1, 2, FALSE);
+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 3);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 15);
+ gtk_container_set_border_width(GTK_CONTAINER(table), 5);
+
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_table_attach(GTK_TABLE(table), hbox, 0, 1, 0, 1,
+ GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0);
+ label = gtk_label_new("Mode:");
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 0, 1,
+ GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0);
+ gtk_box_pack_start(GTK_BOX(hbox),
+ ctk_dithering_controls->dithering_mode_menu,
+ FALSE, FALSE, 0);
+
+ gtk_widget_show_all(GTK_WIDGET(object));
+
+ ctk_dithering_controls_setup(ctk_dithering_controls);
+
+ g_signal_connect(G_OBJECT(ctk_event),
+ CTK_EVENT_NAME(NV_CTRL_FLATPANEL_DITHERING_MODE),
+ G_CALLBACK(update_dithering_mode_menu_event),
+ (gpointer) ctk_dithering_controls);
+ g_signal_connect(G_OBJECT(ctk_event),
+ CTK_EVENT_NAME(NV_CTRL_FLATPANEL_DITHERING),
+ G_CALLBACK(dithering_update_received),
+ (gpointer) ctk_dithering_controls);
+
+ return GTK_WIDGET(object);
+
+} /* ctk_dithering_controls_new() */
+
+
+/*
+ * ctk_dithering_controls_setup() - Setup routine for dithering attributes. Used
+ * in DFP setup stage as well as for updating the GUI when there is change in
+ * dithering mode or config (enabled/disabled).
+ */
+void ctk_dithering_controls_setup(CtkDitheringControls *ctk_dithering_controls)
+{
+ gint val;
+
+ if (!ctk_dithering_controls) {
+ return;
+ }
+
+ /* update flatpanel dithering controls */
+ if (NvCtrlSuccess !=
+ NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING, &val)) {
+ val = NV_CTRL_FLATPANEL_DITHERING_DISABLED;
+ }
+
+ if (val == NV_CTRL_FLATPANEL_DITHERING_ENABLED) {
+ g_signal_handlers_block_by_func
+ (G_OBJECT(ctk_dithering_controls->enable_dithering_button),
+ G_CALLBACK(enable_dithering_toggled),
+ (gpointer) ctk_dithering_controls);
+
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON(ctk_dithering_controls->enable_dithering_button),
+ TRUE);
+
+ g_signal_handlers_unblock_by_func
+ (G_OBJECT(ctk_dithering_controls->enable_dithering_button),
+ G_CALLBACK(enable_dithering_toggled),
+ (gpointer) ctk_dithering_controls);
+
+ gtk_widget_set_sensitive(ctk_dithering_controls->dithering_mode_box,
+ TRUE);
+ } else if (val == NV_CTRL_FLATPANEL_DITHERING_DISABLED) {
+ g_signal_handlers_block_by_func
+ (G_OBJECT(ctk_dithering_controls->enable_dithering_button),
+ G_CALLBACK(enable_dithering_toggled),
+ (gpointer) ctk_dithering_controls);
+
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON(ctk_dithering_controls->enable_dithering_button),
+ FALSE);
+
+ g_signal_handlers_unblock_by_func
+ (G_OBJECT(ctk_dithering_controls->enable_dithering_button),
+ G_CALLBACK(enable_dithering_toggled),
+ (gpointer) ctk_dithering_controls);
+
+ gtk_widget_set_sensitive(ctk_dithering_controls->dithering_mode_box,
+ FALSE);
+ }
+
+ if (!update_dithering_mode_menu_info
+ ((gpointer)ctk_dithering_controls)) {
+ gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_main,
+ FALSE);
+ gtk_widget_hide_all(ctk_dithering_controls->dithering_controls_main);
+ }
+
+} /* ctk_dithering_controls_setup() */
+
+
+static void update_dithering_mode_menu_event(GtkObject *object,
+ gpointer arg1,
+ gpointer user_data)
+{
+ update_dithering_mode_menu_info(user_data);
+} /* update_dithering_mode_menu_event() */
+
+static Bool update_dithering_mode_menu_info(gpointer user_data)
+{
+ CtkDitheringControls *ctk_dithering_controls =
+ CTK_DITHERING_CONTROLS(user_data);
+ gint dithering_mode = NV_CTRL_FLATPANEL_DITHERING_MODE_DYNAMIC_2X2;
+
+ if (NvCtrlSuccess !=
+ NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING_MODE,
+ &dithering_mode)) {
+ free(ctk_dithering_controls->dithering_mode_table);
+ return FALSE;
+ }
+
+ dithering_mode = map_nvctrl_value_to_table(ctk_dithering_controls,
+ dithering_mode);
+
+ g_signal_handlers_block_by_func
+ (G_OBJECT(ctk_dithering_controls->dithering_mode_menu),
+ G_CALLBACK(dithering_mode_menu_changed),
+ (gpointer) ctk_dithering_controls);
+
+ gtk_option_menu_set_history
+ (GTK_OPTION_MENU(ctk_dithering_controls->dithering_mode_menu),
+ dithering_mode);
+
+ g_signal_handlers_unblock_by_func
+ (G_OBJECT(ctk_dithering_controls->dithering_mode_menu),
+ G_CALLBACK(dithering_mode_menu_changed),
+ (gpointer) ctk_dithering_controls);
+
+ gtk_widget_set_sensitive(ctk_dithering_controls->dithering_mode_menu, TRUE);
+ gtk_widget_show(ctk_dithering_controls->dithering_mode_menu);
+
+ return TRUE;
+} /* update_dithering_mode_menu_info() */
+
+static void dithering_mode_menu_changed(GtkOptionMenu *dithering_mode_menu,
+ gpointer user_data)
+{
+ CtkDitheringControls *ctk_dithering_controls =
+ CTK_DITHERING_CONTROLS(user_data);
+ gint history, dithering_mode = NV_CTRL_FLATPANEL_DITHERING_MODE_DYNAMIC_2X2;
+
+ history = gtk_option_menu_get_history(dithering_mode_menu);
+
+ dithering_mode = ctk_dithering_controls->dithering_mode_table[history];
+
+ NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING_MODE,
+ dithering_mode);
+
+ dithering_mode = map_nvctrl_value_to_table(ctk_dithering_controls,
+ dithering_mode);
+ g_signal_handlers_block_by_func
+ (G_OBJECT(ctk_dithering_controls->dithering_mode_menu),
+ G_CALLBACK(dithering_mode_menu_changed),
+ (gpointer) ctk_dithering_controls);
+
+ gtk_option_menu_set_history
+ (GTK_OPTION_MENU(ctk_dithering_controls->dithering_mode_menu),
+ dithering_mode);
+
+ g_signal_handlers_unblock_by_func
+ (G_OBJECT(ctk_dithering_controls->dithering_mode_menu),
+ G_CALLBACK(dithering_mode_menu_changed),
+ (gpointer) ctk_dithering_controls);
+
+ /* reflecting the change in dithering mode to reset button */
+ gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE);
+
+} /* dithering_mode_menu_changed() */
+
+
+/*
+ * enable_dithering_toggled() - Callback routine for Enable Dithering
+ * check box.
+ */
+static void enable_dithering_toggled(GtkWidget *widget, gpointer user_data)
+{
+ gboolean checked = FALSE;
+ CtkDitheringControls *ctk_dithering_controls =
+ CTK_DITHERING_CONTROLS(user_data);
+
+ if (!ctk_dithering_controls) {
+ return;
+ }
+
+ /* Get the checkbox status */
+ checked = gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON(ctk_dithering_controls->enable_dithering_button));
+
+ if (checked) {
+ /* Enable the dithering effects */
+ NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING,
+ NV_CTRL_FLATPANEL_DITHERING_ENABLED);
+ } else {
+ /* Disable the dithering effects. */
+ NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING,
+ NV_CTRL_FLATPANEL_DITHERING_DISABLED);
+ }
+
+ ctk_dithering_controls_setup(ctk_dithering_controls);
+
+ /* Reflecting the change in dithering configuration to reset button */
+ gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE);
+
+} /* enable_dithering_toggled() */
+
+
+/*
+ * ctk_dithering_controls_reset() - Resets the dithering config (enabled/disabled)
+ * & dithering mode when Reset HW Defaults is clicked
+ */
+void ctk_dithering_controls_reset(CtkDitheringControls *ctk_dithering_controls)
+{
+ if (!ctk_dithering_controls) {
+ return;
+ }
+
+ NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING,
+ ctk_dithering_controls->default_dithering_config);
+
+ if (ctk_dithering_controls->default_dithering_config ==
+ NV_CTRL_FLATPANEL_DITHERING_ENABLED) {
+
+ /* Setting dithering mode only makes sense when dithering is
+ * enabled by default
+ */
+ NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle,
+ ctk_dithering_controls->display_device_mask,
+ NV_CTRL_FLATPANEL_DITHERING_MODE,
+ ctk_dithering_controls->default_dithering_mode);
+ }
+
+ ctk_dithering_controls_setup(ctk_dithering_controls);
+} /* ctk_dithering_controls_reset() */
+
+
+/*
+ * add_dithering_controls_help() -
+ */
+void add_dithering_controls_help(CtkDitheringControls *ctk_dithering_controls,
+ GtkTextBuffer *b,
+ GtkTextIter *i)
+{
+ ctk_help_heading(b, i, "Dithering Controls");
+ ctk_help_para(b, i, __dithering_help);
+} /* add_dithering_controls_help() */
+
+
+/*
+ * When DFP dithering configuration is enabled/disabled,
+ * we should update the GUI to reflect the current state.
+ */
+static void dithering_update_received(GtkObject *object, gpointer arg1,
+ gpointer user_data)
+{
+ CtkDitheringControls *ctk_object = CTK_DITHERING_CONTROLS(user_data);
+ CtkEventStruct *event_struct = (CtkEventStruct *) arg1;
+
+ /* if the event is not for this display device, return */
+
+ if (!(event_struct->display_mask & ctk_object->display_device_mask)) {
+ return;
+ }
+
+ ctk_dithering_controls_setup(ctk_object);
+} /* dithering_update_received() */
+
+
+/*
+ * build_dithering_mode_table() - build a table of dithering modes presently
+ * supported by the HW.
+ */
+static gboolean build_dithering_mode_table(CtkDitheringControls *ctk_dithering_controls,
+ NVCTRLAttributeValidValuesRec valid)
+{
+ gint i, n = 0, num_of_modes = 0;
+ gint mask = valid.u.bits.ints;
+
+ if (valid.type != ATTRIBUTE_TYPE_INT_BITS) {
+ return False;
+ }
+
+ /* count no. of supported modes */
+ while(mask) {
+ mask = mask & (mask - 1);
+ num_of_modes++;
+ }
+
+ ctk_dithering_controls->dithering_mode_table_size = num_of_modes;
+ ctk_dithering_controls->dithering_mode_table = calloc(1, num_of_modes);
+ if (!ctk_dithering_controls->dithering_mode_table) {
+ return False;
+ }
+
+ for (i = 0; i <= num_of_modes; i++) {
+ if (valid.u.bits.ints & (1 << i)) {
+ ctk_dithering_controls->dithering_mode_table[n] = i;
+ n++;
+ }
+ }
+
+ return True;
+
+} /* build_dithering_mode_table() */
+
+
+static gint map_nvctrl_value_to_table(CtkDitheringControls *ctk_dithering_controls,
+ gint val)
+{
+ int i;
+ for (i = 0; i < ctk_dithering_controls->dithering_mode_table_size; i++) {
+ if (val == ctk_dithering_controls->dithering_mode_table[i]) {
+ return i;
+ }
+ }
+
+ return 0;
+} /*map_nvctrl_value_to_table() */
diff --git a/src/gtk+-2.x/ctkditheringcontrols.h b/src/gtk+-2.x/ctkditheringcontrols.h
new file mode 100644
index 0000000..4580eba
--- /dev/null
+++ b/src/gtk+-2.x/ctkditheringcontrols.h
@@ -0,0 +1,93 @@
+/*
+ * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
+ * and Linux systems.
+ *
+ * Copyright (C) 2010 NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of Version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
+ * of the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the:
+ *
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ */
+
+#ifndef __CTK_DITHERING_CONTROLS_H__
+#define __CTK_DITHERING_CONTROLS_H__
+
+#include "ctkevent.h"
+#include "ctkconfig.h"
+
+G_BEGIN_DECLS
+
+#define CTK_TYPE_DITHERING_CONTROLS (ctk_dithering_controls_get_type())
+
+#define CTK_DITHERING_CONTROLS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CTK_TYPE_DITHERING_CONTROLS, \
+ CtkDitheringControls))
+
+#define CTK_DITHERING_CONTROLS_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CTK_TYPE_DITHERING_CONTROLS, \
+ CtkDitheringControlsClass))
+
+#define CTK_IS_DITHERING_CONTROLS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CTK_TYPE_DITHERING_CONTROLS))
+
+#define CTK_IS_DITHERING_CONTROLS_CLASS(class) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CTK_TYPE_DITHERING_CONTROLS))
+
+#define CTK_DITHERING_CONTROLS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_DITHERING_CONTROLS, \
+ CtkDitheringControlsClass))
+
+typedef struct _CtkDitheringControls CtkDitheringControls;
+typedef struct _CtkDitheringControlsClass CtkDitheringControlsClass;
+
+struct _CtkDitheringControls
+{
+ GtkVBox parent;
+
+ NvCtrlAttributeHandle *handle;
+ CtkConfig *ctk_config;
+ GtkWidget *reset_button;
+ GtkWidget *dithering_controls_main;
+ GtkWidget *dithering_mode_menu;
+ GtkWidget *dithering_mode_box;
+ GtkWidget *enable_dithering_button;
+
+ gint display_device_mask;
+ gint *dithering_mode_table;
+ gint dithering_mode_table_size;
+ gint default_dithering_config;
+ gint default_dithering_mode;
+};
+
+struct _CtkDitheringControlsClass
+{
+ GtkVBoxClass parent_class;
+};
+
+GType ctk_dithering_controls_get_type (void) G_GNUC_CONST;
+GtkWidget* ctk_dithering_controls_new (NvCtrlAttributeHandle *,
+ CtkConfig *, CtkEvent *,
+ GtkWidget *,
+ unsigned int display_device_mask);
+
+void ctk_dithering_controls_reset (CtkDitheringControls*);
+void ctk_dithering_controls_setup (CtkDitheringControls*);
+void add_dithering_controls_help (CtkDitheringControls*, GtkTextBuffer *b,
+ GtkTextIter *i);
+
+G_END_DECLS
+
+#endif /* __CTK_DITHERING_CONTROLS_H__ */
diff --git a/src/gtk+-2.x/ctkevent.c b/src/gtk+-2.x/ctkevent.c
index babe9e1..8645dcc 100644
--- a/src/gtk+-2.x/ctkevent.c
+++ b/src/gtk+-2.x/ctkevent.c
@@ -235,6 +235,8 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
MAKE_SIGNAL(NV_CTRL_DYNAMIC_TWINVIEW);
MAKE_SIGNAL(NV_CTRL_MULTIGPU_DISPLAY_OWNER);
MAKE_SIGNAL(NV_CTRL_GPU_SCALING);
+ MAKE_SIGNAL(NV_CTRL_GPU_SCALING_DEFAULT_TARGET);
+ MAKE_SIGNAL(NV_CTRL_GPU_SCALING_DEFAULT_METHOD);
MAKE_SIGNAL(NV_CTRL_FRONTEND_RESOLUTION);
MAKE_SIGNAL(NV_CTRL_BACKEND_RESOLUTION);
MAKE_SIGNAL(NV_CTRL_FLATPANEL_NATIVE_RESOLUTION);
@@ -300,6 +302,13 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
MAKE_SIGNAL(NV_CTRL_GPU_CORES);
MAKE_SIGNAL(NV_CTRL_GPU_MEMORY_BUS_WIDTH);
MAKE_SIGNAL(NV_CTRL_GVI_TEST_MODE);
+ MAKE_SIGNAL(NV_CTRL_FLATPANEL_DITHERING);
+ MAKE_SIGNAL(NV_CTRL_FLATPANEL_DITHERING_MODE);
+ MAKE_SIGNAL(NV_CTRL_FLATPANEL_DEFAULT_DITHERING);
+ MAKE_SIGNAL(NV_CTRL_FLATPANEL_DEFAULT_DITHERING_MODE);
+ MAKE_SIGNAL(NV_CTRL_THERMAL_SENSOR_READING);
+ MAKE_SIGNAL(NV_CTRL_THERMAL_SENSOR_PROVIDER);
+ MAKE_SIGNAL(NV_CTRL_THERMAL_SENSOR_TARGET);
#undef MAKE_SIGNAL
@@ -310,7 +319,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
* knows about.
*/
-#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_GVI_TEST_MODE
+#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_THERMAL_SENSOR_TARGET
#warning "There are attributes that do not emit signals!"
#endif
@@ -379,10 +388,11 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class)
MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_VCSCS_USED_BY_GPU);
MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU);
MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_GPUS_USED_BY_LOGICAL_XSCREEN);
+ MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU);
#undef MAKE_BINARY_SIGNAL
-#if NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE != NV_CTRL_BINARY_DATA_GPUS_USED_BY_LOGICAL_XSCREEN
+#if NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE != NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU
#warning "There are attributes that do not emit signals!"
#endif
diff --git a/src/gtk+-2.x/ctkframelock.c b/src/gtk+-2.x/ctkframelock.c
index 204880e..c9e1ad9 100644
--- a/src/gtk+-2.x/ctkframelock.c
+++ b/src/gtk+-2.x/ctkframelock.c
@@ -1171,7 +1171,7 @@ static void list_entry_update_gpu_controls(CtkFramelock *ctk_framelock,
nvListEntryPtr entry)
{
nvGPUDataPtr data = (nvGPUDataPtr)(entry->data);
- unsigned int slaveables;
+ int slaveables;
nvDisplayDataPtr display_data;
nvListEntryPtr child;
ReturnStatus ret;
diff --git a/src/gtk+-2.x/ctkgauge.c b/src/gtk+-2.x/ctkgauge.c
index da36cbe..12c3b59 100644
--- a/src/gtk+-2.x/ctkgauge.c
+++ b/src/gtk+-2.x/ctkgauge.c
@@ -241,7 +241,8 @@ void ctk_gauge_set_current(CtkGauge *ctk_gauge, gint current)
g_return_if_fail(CTK_IS_GAUGE(ctk_gauge));
ctk_gauge->current = current;
- ts = g_strdup_printf("%d\xc2\xb0", current);
+ ts = g_strdup_printf("%d\xc2\xb0" /* split for g_utf8_validate() */ "C",
+ current);
pango_layout_set_text(ctk_gauge->pango_layout, ts, -1);
g_free(ts);
diff --git a/src/gtk+-2.x/ctkglx.c b/src/gtk+-2.x/ctkglx.c
index 8d38188..3cf1c9b 100644
--- a/src/gtk+-2.x/ctkglx.c
+++ b/src/gtk+-2.x/ctkglx.c
@@ -255,7 +255,7 @@ GtkWidget* ctk_glx_new(NvCtrlAttributeHandle *handle,
&glx_info_str);
free(glx_info_str);
if ( ret != NvCtrlSuccess ) {
- err_str = "Fail to query the GLX server vendor.";
+ err_str = "Failed to query the GLX server vendor.";
goto fail;
}
diff --git a/src/gtk+-2.x/ctkgvi.c b/src/gtk+-2.x/ctkgvi.c
index 3356749..1087009 100644..100755
--- a/src/gtk+-2.x/ctkgvi.c
+++ b/src/gtk+-2.x/ctkgvi.c
@@ -125,7 +125,7 @@ typedef struct {
int color_space;
int bpc;
int link_id;
- unsigned int smpte352_id;
+ int smpte352_id;
} ChannelInfo;
@@ -443,7 +443,8 @@ static void update_sdi_input_info_all(CtkGvi *ctk_gvi)
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 5, 6);
- label_str = g_strdup_printf("0x%08x", channel_info.smpte352_id);
+ label_str = g_strdup_printf("0x%08x",
+ (unsigned int) channel_info.smpte352_id);
label = gtk_label_new(label_str);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 5, 6);
diff --git a/src/gtk+-2.x/ctkgvi.h b/src/gtk+-2.x/ctkgvi.h
index cff6e2e..cff6e2e 100644..100755
--- a/src/gtk+-2.x/ctkgvi.h
+++ b/src/gtk+-2.x/ctkgvi.h
diff --git a/src/gtk+-2.x/ctkgvo.c b/src/gtk+-2.x/ctkgvo.c
index f509b15..8969a7c 100644
--- a/src/gtk+-2.x/ctkgvo.c
+++ b/src/gtk+-2.x/ctkgvo.c
@@ -991,7 +991,7 @@ static void fill_output_video_format_menu(CtkGvo *ctk_gvo)
gint num_valid_entries = 0;
gchar *str;
gchar *tmp;
-
+ const gchar *constStr;
ctk_drop_down_menu_reset(CTK_DROP_DOWN_MENU(dmenu));
@@ -1022,7 +1022,8 @@ static void fill_output_video_format_menu(CtkGvo *ctk_gvo)
}
if (valid == GVO_VIDEO_FORMAT_VALID) {
- str = (gchar *)videoFormatNames[i].name;
+ constStr = videoFormatNames[i].name;
+ str = NULL;
} else {
str = g_strconcat(videoFormatNames[i].name, " -", NULL);
@@ -1041,11 +1042,12 @@ static void fill_output_video_format_menu(CtkGvo *ctk_gvo)
g_free(str);
str = tmp;
}
+ constStr = str;
}
- label = ctk_drop_down_menu_append_item(dmenu, str,
+ label = ctk_drop_down_menu_append_item(dmenu, constStr,
videoFormatNames[i].format);
- if (str != videoFormatNames[i].name) {
+ if (str) {
g_free(str);
}
@@ -1123,6 +1125,7 @@ static void fill_output_data_format_menu(CtkGvo *ctk_gvo)
GtkWidget *label;
gboolean valid;
gchar *str;
+ const gchar *constStr;
ctk_drop_down_menu_reset(CTK_DROP_DOWN_MENU(dmenu));
@@ -1134,15 +1137,17 @@ static void fill_output_data_format_menu(CtkGvo *ctk_gvo)
}
if (valid) {
- str = (gchar *)dataFormatNames[i].name;
+ constStr = dataFormatNames[i].name;
+ str = NULL;
} else {
str = g_strconcat(dataFormatNames[i].name,
" - Invalid for Clone Mode", NULL);
+ constStr = str;
}
- label = ctk_drop_down_menu_append_item(dmenu, str,
+ label = ctk_drop_down_menu_append_item(dmenu, constStr,
dataFormatNames[i].format);
- if (str != dataFormatNames[i].name) {
+ if (str) {
g_free(str);
}
@@ -1460,6 +1465,10 @@ static void output_data_format_ui_changed(CtkDropDownMenu *menu,
update_gvo_sensitivity(ctk_gvo);
+ /* Made GVO banner to update current output data format */
+ CTK_GVO_BANNER(ctk_gvo->banner)->output_data_format =
+ ctk_gvo->output_data_format;
+
post_output_data_format_changed(ctk_gvo);
} /* output_data_format_ui_changed() */
diff --git a/src/gtk+-2.x/ctkscreen.c b/src/gtk+-2.x/ctkscreen.c
index 190fb2a..8cb5490 100644
--- a/src/gtk+-2.x/ctkscreen.c
+++ b/src/gtk+-2.x/ctkscreen.c
@@ -39,6 +39,21 @@
#include "ctkutils.h"
#include "ctkbanner.h"
+static const _CtkStereoMode stereoMode[] = {
+ { NV_CTRL_STEREO_OFF, "Stereo Disabled" },
+ { NV_CTRL_STEREO_DDC, "DDC Stereo" },
+ { NV_CTRL_STEREO_BLUELINE, "Blueline Stereo" },
+ { NV_CTRL_STEREO_DIN, "Onboard DIN Stereo" },
+ { NV_CTRL_STEREO_TWINVIEW, "TwinView clone Stereo" },
+ { NV_CTRL_STEREO_VERTICAL_INTERLACED, "Vertical Interlaced Stereo" },
+ { NV_CTRL_STEREO_COLOR_INTERLACED, "Color Interleaved Stereo" },
+ { NV_CTRL_STEREO_HORIZONTAL_INTERLACED, "Horizontal Interlaced Stereo" },
+ { NV_CTRL_STEREO_CHECKERBOARD_PATTERN, "Checkerboard Pattern Stereo" },
+ { NV_CTRL_STEREO_INVERSE_CHECKERBOARD_PATTERN, "Inverse Checkerboard Stereo" },
+ { NV_CTRL_STEREO_3D_VISION, "NVIDIA 3D Vision Stereo" },
+ { -1, NULL},
+};
+
void ctk_screen_event_handler(GtkWidget *widget,
XRRScreenChangeNotifyEvent *ev,
gpointer data);
@@ -49,6 +64,17 @@ static void associated_displays_received(GtkObject *object, gpointer arg1,
static void info_update_gpu_error(GtkObject *object, gpointer arg1,
gpointer user_data);
+static const char *get_stereo_mode_string(int stereo_mode)
+{
+ int i;
+ for (i = 0; stereoMode[i].name; i++) {
+ if (stereoMode[i].stereo_mode == stereo_mode) {
+ return stereoMode[i].name;
+ }
+ }
+ return "Unknown";
+}
+
GType ctk_screen_get_type(
void
)
@@ -192,7 +218,7 @@ GtkWidget* ctk_screen_new(NvCtrlAttributeHandle *handle,
gchar *gpus;
gchar *displays;
gint gpu_errors;
-
+ gint stereo_mode;
char tmp[16];
@@ -299,6 +325,13 @@ GtkWidget* ctk_screen_new(NvCtrlAttributeHandle *handle,
snprintf(tmp, 16, "%d", gpu_errors);
+ /* get the stereo mode set for this X screen */
+ ret = NvCtrlGetDisplayAttribute(handle, 0, NV_CTRL_STEREO,
+ (int *)&stereo_mode);
+ if (ret != NvCtrlSuccess) {
+ stereo_mode = -1;
+ }
+
/* now, create the object */
object = g_object_new(CTK_TYPE_SCREEN, NULL);
@@ -360,6 +393,8 @@ GtkWidget* ctk_screen_new(NvCtrlAttributeHandle *handle,
/* gpu errors */
ctk_screen->gpu_errors =
add_table_row(table, 19, 0, 0, "Recovered GPU Errors:", 0, 0, tmp);
+ add_table_row(table, 20, 0, 0, "Stereo Mode:", 0, 0,
+ get_stereo_mode_string(stereo_mode));
g_free(screen_number);
free(display_name);
@@ -446,6 +481,9 @@ GtkTextBuffer *ctk_screen_create_help(GtkTextTagTable *table,
"GPU received and the NVIDIA X driver successfully recovered "
"from.");
+ ctk_help_heading(b, &i, "Stereo Mode");
+ ctk_help_para(b, &i, "This is the stereo mode set for the X screen.");
+
ctk_help_finish(b);
return b;
diff --git a/src/gtk+-2.x/ctkscreen.h b/src/gtk+-2.x/ctkscreen.h
index f021346..e5b4a71 100644
--- a/src/gtk+-2.x/ctkscreen.h
+++ b/src/gtk+-2.x/ctkscreen.h
@@ -69,6 +69,11 @@ struct _CtkScreenClass
GtkVBoxClass parent_class;
};
+typedef struct {
+ int stereo_mode;
+ const char *name;
+} _CtkStereoMode;
+
GType ctk_screen_get_type (void) G_GNUC_CONST;
GtkWidget* ctk_screen_new (NvCtrlAttributeHandle *handle,
CtkEvent *ctk_event);
diff --git a/src/gtk+-2.x/ctkthermal.c b/src/gtk+-2.x/ctkthermal.c
index fd4c4bd..e2b3e92 100644
--- a/src/gtk+-2.x/ctkthermal.c
+++ b/src/gtk+-2.x/ctkthermal.c
@@ -52,6 +52,13 @@ static void reset_button_clicked(GtkWidget *widget, gpointer user_data);
static void adjustment_value_changed(GtkAdjustment *adjustment,
gpointer user_data);
+static void draw_sensor_gui(GtkWidget *vbox1, CtkThermal *ctk_thermal,
+ gboolean new_target_type, gint cur_sensor_idx,
+ NvCtrlAttributeHandle *sensor_handle,
+ gint reading, gint lower, gint upper,
+ gint target, gint provider);
+static GtkWidget *pack_gauge(GtkWidget *hbox, gint lower, gint upper,
+ CtkConfig *ctk_config, const char *help);
static const char *__core_threshold_help =
"The Core Slowdown Threshold Temperature is the temperature "
@@ -74,6 +81,18 @@ static const char *__temp_level_help =
"temperature relative to the maximum GPU Core Slowdown "
"Threshold temperature.";
+static const char *__thermal_sensor_id_help =
+"This shows the thermal sensor's index.";
+
+static const char *__thermal_sensor_target_help =
+"This shows what hardware component the thermal sensor is measuring.";
+
+static const char *__thermal_sensor_provider_help =
+"This shows the hardware device that provides the thermal sensor.";
+
+static const char *__thermal_sensor_reading_help =
+"This shows the thermal sensor's current reading.";
+
static const char * __enable_button_help =
"The Enable GPU Fan Settings checkbox enables access to control GPU Fan "
"Speed. This option is available after enabling coolbits for GPU Fan control."
@@ -292,37 +311,66 @@ static gboolean update_cooler_info(gpointer user_data)
static gboolean update_thermal_info(gpointer user_data)
{
- gint core, ambient;
+ gint reading, ambient;
CtkThermal *ctk_thermal;
NvCtrlAttributeHandle *handle;
- gint ret;
+ gint ret, i, core;
gchar *s;
ctk_thermal = CTK_THERMAL(user_data);
- handle = ctk_thermal->attribute_handle;
- ret = NvCtrlGetAttribute(handle, NV_CTRL_GPU_CORE_TEMPERATURE, &core);
- if (ret != NvCtrlSuccess) {
- /* thermal information no longer available */
- return FALSE;
- }
+ if (!ctk_thermal->thermal_sensor_target_type_supported) {
+ handle = ctk_thermal->attribute_handle;
- s = g_strdup_printf(" %d C ", core);
- gtk_label_set_text(GTK_LABEL(ctk_thermal->core_label), s);
- g_free(s);
-
- ctk_gauge_set_current(CTK_GAUGE(ctk_thermal->core_gauge), core);
- ctk_gauge_draw(CTK_GAUGE(ctk_thermal->core_gauge));
-
- if (ctk_thermal->ambient_label) {
- ret = NvCtrlGetAttribute(handle, NV_CTRL_AMBIENT_TEMPERATURE, &ambient);
+ ret = NvCtrlGetAttribute(handle, NV_CTRL_GPU_CORE_TEMPERATURE, &core);
if (ret != NvCtrlSuccess) {
/* thermal information no longer available */
return FALSE;
}
- s = g_strdup_printf(" %d C ", ambient);
- gtk_label_set_text(GTK_LABEL(ctk_thermal->ambient_label), s);
+
+ s = g_strdup_printf(" %d C ", core);
+ gtk_label_set_text(GTK_LABEL(ctk_thermal->core_label), s);
g_free(s);
+
+ ctk_gauge_set_current(CTK_GAUGE(ctk_thermal->core_gauge), core);
+ ctk_gauge_draw(CTK_GAUGE(ctk_thermal->core_gauge));
+
+ if (ctk_thermal->ambient_label) {
+ ret = NvCtrlGetAttribute(handle, NV_CTRL_AMBIENT_TEMPERATURE,
+ &ambient);
+ if (ret != NvCtrlSuccess) {
+ /* thermal information no longer available */
+ return FALSE;
+ }
+ s = g_strdup_printf(" %d C ", ambient);
+ gtk_label_set_text(GTK_LABEL(ctk_thermal->ambient_label), s);
+ g_free(s);
+ }
+ } else {
+ for (i = 0; i < ctk_thermal->sensor_count; i++) {
+ handle = ctk_thermal->sensor_info[i].handle;
+
+ ret = NvCtrlGetAttribute(handle, NV_CTRL_THERMAL_SENSOR_READING,
+ &reading);
+ /* querying THERMAL_SENSOR_READING failed: assume the temperature is 0 */
+ if (ret != NvCtrlSuccess) {
+ reading = 0;
+ }
+
+ if (ctk_thermal->sensor_info[i].temp_label) {
+ s = g_strdup_printf(" %d C ", reading);
+ gtk_label_set_text(
+ GTK_LABEL(ctk_thermal->sensor_info[i].temp_label), s);
+ g_free(s);
+ }
+
+ if (ctk_thermal->sensor_info[i].core_gauge) {
+ ctk_gauge_set_current(
+ CTK_GAUGE(ctk_thermal->sensor_info[i].core_gauge),
+ reading);
+ ctk_gauge_draw(CTK_GAUGE(ctk_thermal->sensor_info[i].core_gauge));
+ }
+ }
}
if ( ctk_thermal->cooler_count ) {
update_cooler_info(ctk_thermal);
@@ -814,6 +862,193 @@ static void cooler_control_checkbox_toggled(GtkWidget *widget,
} /* cooler_control_checkbox_toggled() */
+static const nvctrlFormatName targetFormatNames[] = {
+
+ { NV_CTRL_THERMAL_SENSOR_TARGET_NONE, "None" },
+ { NV_CTRL_THERMAL_SENSOR_TARGET_GPU, "GPU" },
+ { NV_CTRL_THERMAL_SENSOR_TARGET_MEMORY, "MEMORY" },
+ { NV_CTRL_THERMAL_SENSOR_TARGET_POWER_SUPPLY, "Power Supply" },
+ { NV_CTRL_THERMAL_SENSOR_TARGET_BOARD, "BOARD" },
+ { -1, NULL },
+};
+
+static const nvctrlFormatName providerFormatNames[] = {
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_NONE, "None" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_GPU_INTERNAL, "GPU Internal" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_ADM1032, "ADM1032" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_ADT7461, "ADT7461" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_MAX6649, "MAX6649" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_MAX1617, "MAX1617" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_LM99, "LM99" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_LM89, "LM89" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_LM64, "LM64" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_G781, "G781" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_ADT7473, "ADT7473" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_SBMAX6649, "SBMAX6649" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_VBIOSEVT, "VBIOSEVT" },
+ { NV_CTRL_THERMAL_SENSOR_PROVIDER_OS, "OS" },
+ { -1, NULL },
+};
+
+
+/*
+ * get_nvctrl_format_name() - return the name of the nvcontrol format
+ */
+static const char *get_nvctrl_format_name(const nvctrlFormatName *nvctrlFormatNames,
+ const gint format)
+{
+ gint i;
+
+ for (i = 0; nvctrlFormatNames[i].name; i++) {
+ if (nvctrlFormatNames[i].format == format) {
+ return nvctrlFormatNames[i].name;
+ }
+ }
+
+ return "Unknown";
+
+} /* get_nvctrl_format_name() */
+
+
+/*
+ * pack_gauge() - pack gauge gui in hbox
+ */
+static GtkWidget *pack_gauge(GtkWidget *hbox, gint lower, gint upper,
+ CtkConfig *ctk_config, const char *help)
+{
+ GtkWidget *vbox, *frame, *eventbox, *gauge;
+
+ /* GPU Core Temperature Gauge */
+
+ vbox = gtk_vbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
+
+ frame = gtk_frame_new("Temperature");
+ gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
+
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(hbox), FRAME_PADDING);
+ gtk_container_add(GTK_CONTAINER(frame), hbox);
+
+ gauge = ctk_gauge_new(lower, upper);
+ eventbox = gtk_event_box_new();
+ gtk_container_add(GTK_CONTAINER(eventbox), gauge);
+ gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, FALSE, 0);
+ ctk_config_set_tooltip(ctk_config, eventbox, help);
+
+ return gauge;
+} /* pack_gauge() */
+
+
+/*****
+ *
+ * draw_sensor_gui() - prints sensor related information
+ *
+ */
+static void draw_sensor_gui(GtkWidget *vbox1, CtkThermal *ctk_thermal,
+ gboolean new_target_type, gint cur_sensor_idx,
+ NvCtrlAttributeHandle *sensor_handle,
+ gint reading, gint lower, gint upper,
+ gint target, gint provider)
+{
+ GtkWidget *hbox, *hbox1, *hbox2, *vbox, *vbox2, *table;
+ GtkWidget *frame, *label, *hsep;
+ GtkWidget *eventbox = NULL;
+ gchar *s;
+
+ hbox = gtk_hbox_new(FALSE, FRAME_PADDING);
+ gtk_container_set_border_width(GTK_CONTAINER(hbox), 10);
+
+ hbox1 = gtk_hbox_new(FALSE, FRAME_PADDING);
+ gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0);
+
+ vbox2 = gtk_vbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox1), vbox2, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ vbox = gtk_vbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
+
+ /* GPU sensor ID */
+
+ hbox2 = gtk_hbox_new(FALSE, 0);
+ s = g_strdup_printf("ID: %d", cur_sensor_idx);
+ label = gtk_label_new(s);
+ g_free(s);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+
+ table = gtk_table_new(4, 4, FALSE);
+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
+
+ gtk_table_set_row_spacings(GTK_TABLE(table), 3);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 15);
+
+ gtk_container_set_border_width(GTK_CONTAINER(table), 5);
+
+ /* sensor target type */
+ if (target) {
+ add_table_row_with_help_text(table, ctk_thermal->ctk_config,
+ __thermal_sensor_target_help,
+ 0, 0, 0, 0.5,
+ "Target:", 0, 0.5,
+ get_nvctrl_format_name(targetFormatNames, target));
+ ctk_thermal->sensor_info[cur_sensor_idx].target_type = label;
+ } else {
+ ctk_thermal->sensor_info[cur_sensor_idx].target_type = NULL;
+ }
+
+ /* sensor provider type */
+ if (provider) {
+ add_table_row_with_help_text(table, ctk_thermal->ctk_config,
+ __thermal_sensor_provider_help,
+ 1, 0, 0, 0.5,
+ "Provider:", 0, 0.5,
+ get_nvctrl_format_name(providerFormatNames, provider));
+ ctk_thermal->sensor_info[cur_sensor_idx].provider_type = label;
+ } else {
+ ctk_thermal->sensor_info[cur_sensor_idx].provider_type = NULL;
+ }
+
+ /* thermal sensor reading */
+ if (reading) {
+ hbox2 = gtk_hbox_new(FALSE, 0);
+ gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 3, 4,
+ GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+
+ label = gtk_label_new("Temperature:");
+ gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+
+ frame = gtk_frame_new(NULL);
+ eventbox = gtk_event_box_new();
+ gtk_container_add(GTK_CONTAINER(eventbox), frame);
+ gtk_table_attach(GTK_TABLE(table), eventbox, 1, 2, 3, 4,
+ GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+
+ label = gtk_label_new(NULL);
+ gtk_container_add(GTK_CONTAINER(frame), label);
+ ctk_thermal->sensor_info[cur_sensor_idx].temp_label = label;
+ ctk_config_set_tooltip(ctk_thermal->ctk_config, eventbox,
+ __thermal_sensor_reading_help);
+ } else {
+ ctk_thermal->sensor_info[cur_sensor_idx].temp_label = NULL;
+ }
+
+ /* GPU Core Temperature Gauge */
+ ctk_thermal->sensor_info[cur_sensor_idx].core_gauge =
+ pack_gauge(hbox, lower, upper,
+ ctk_thermal->ctk_config, __temp_level_help);
+
+ /* add horizontal bar between sensors */
+ if (cur_sensor_idx+1 != ctk_thermal->sensor_count) {
+ hbox1 = gtk_hbox_new(FALSE, 0);
+ hsep = gtk_hseparator_new();
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox1, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox1), hsep, TRUE, TRUE, 10);
+ }
+
+} /* draw_sensor_gui() */
+
GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
@@ -824,20 +1059,22 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
CtkThermal *ctk_thermal;
CtrlHandles *h;
GtkObject *adjustment;
- GtkWidget *gauge;
- GtkWidget *hbox, *hbox2, *vbox, *table;
+ GtkWidget *hbox = NULL, *hbox1, *hbox2, *table, *vbox;
GtkWidget *frame, *banner, *label;
GtkWidget *vbox1;
- GtkWidget *eventbox, *entry;
+ GtkWidget *eventbox = NULL, *entry;
GtkWidget *fan_control_frame;
GtkWidget *hsep;
GtkWidget *scale;
GtkWidget *alignment;
ReturnStatus ret;
+ ReturnStatus ret1;
NvCtrlAttributeHandle *cooler_handle;
+ NvCtrlAttributeHandle *sensor_handle;
NVCTRLAttributeValidValuesRec cooler_range;
- gint trigger, ambient;
- gint core, upper;
+ NVCTRLAttributeValidValuesRec sensor_range;
+ gint trigger, core, ambient;
+ gint upper;
gchar *s;
gint i, j;
gint cooler_level;
@@ -845,31 +1082,61 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
gchar *name = NULL;
int *pData;
int len, value;
+ int major = 0, minor = 0;
Bool can_access_cooler_level;
Bool cooler_control_enabled;
int cur_cooler_idx = 0;
+ int cur_sensor_idx = 0;
+ Bool thermal_sensor_target_type_supported = FALSE;
/* make sure we have a handle */
g_return_val_if_fail(handle != NULL, NULL);
-
- /* check if this screen supports thermal querying */
- ret = NvCtrlGetAttribute(handle, NV_CTRL_GPU_CORE_TEMPERATURE, &core);
- if (ret != NvCtrlSuccess) {
- /* thermal information unavailable */
- return NULL;
+ /*
+ * Check for NV-CONTROL protocol version.
+ * In version 1.23 we added support for querying per sensor information
+ * This used for backward compatibility between new nvidia-settings
+ * and older X driver
+ */
+ ret = NvCtrlGetAttribute(handle,
+ NV_CTRL_ATTR_NV_MAJOR_VERSION, &major);
+ ret1 = NvCtrlGetAttribute(handle,
+ NV_CTRL_ATTR_NV_MINOR_VERSION, &minor);
+
+ if ((ret == NvCtrlSuccess) && (ret1 == NvCtrlSuccess) &&
+ ((major > 1) || ((major == 1) && (minor > 22)))) {
+ thermal_sensor_target_type_supported = TRUE;
}
- ret = NvCtrlGetAttribute(handle, NV_CTRL_GPU_MAX_CORE_THRESHOLD, &upper);
- if (ret != NvCtrlSuccess) {
- /* thermal information unavailable */
- return NULL;
+ if (!thermal_sensor_target_type_supported) {
+ /* check if this screen supports thermal querying */
+
+ ret = NvCtrlGetAttribute(handle, NV_CTRL_GPU_CORE_TEMPERATURE, &core);
+ if (ret != NvCtrlSuccess) {
+ /* thermal information unavailable */
+ return NULL;
+ }
+
+ ret = NvCtrlGetAttribute(handle, NV_CTRL_GPU_MAX_CORE_THRESHOLD, &upper);
+ if (ret != NvCtrlSuccess) {
+ /* thermal information unavailable */
+ return NULL;
+ }
+
+ ret = NvCtrlGetAttribute(handle, NV_CTRL_GPU_CORE_THRESHOLD, &trigger);
+ if (ret != NvCtrlSuccess) {
+ /* thermal information unavailable */
+ return NULL;
+ }
}
+ /* Retrieve CtrlHandles from ctk_config */
- ret = NvCtrlGetAttribute(handle, NV_CTRL_GPU_CORE_THRESHOLD, &trigger);
- if (ret != NvCtrlSuccess) {
- /* thermal information unavailable */
+ h = ctk_config->pCtrlHandles;
+
+ /* return if sensor and Fan information not available */
+ if ((h->targets[THERMAL_SENSOR_TARGET].n == 0) &&
+ (h->targets[COOLER_TARGET].n == 0)) {
return NULL;
}
@@ -883,6 +1150,7 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
ctk_thermal->settings_changed = FALSE;
ctk_thermal->show_fan_control_frame = TRUE;
ctk_thermal->cooler_count = 0;
+ ctk_thermal->thermal_sensor_target_type_supported = thermal_sensor_target_type_supported;
/* set container properties for the CtkThermal widget */
@@ -914,118 +1182,174 @@ GtkWidget* ctk_thermal_new(NvCtrlAttributeHandle *handle,
/* Thermal Information */
- hbox = gtk_hbox_new(FALSE, FRAME_PADDING);
- gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, FRAME_PADDING);
-
vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
-
-
- /* GPU Core Treshold Temperature */
+ gtk_box_pack_start(GTK_BOX(object), vbox, FALSE, FALSE, 0);
+
+ if (thermal_sensor_target_type_supported) {
+ if ( h->targets[THERMAL_SENSOR_TARGET].n == 0 ) {
+ goto sensor_end;
+ }
+ hbox1 = gtk_hbox_new(FALSE, FRAME_PADDING);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0);
+ label = gtk_label_new("Thermal Sensor Information");
+ gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0);
- frame = gtk_frame_new("Slowdown Threshold");
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
+ hsep = gtk_hseparator_new();
+ gtk_box_pack_start(GTK_BOX(hbox1), hsep, TRUE, TRUE, 0);
+
+ /* Query the list of sensors attached to this GPU */
+
+ ret = NvCtrlGetBinaryAttribute(handle, 0,
+ NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU,
+ (unsigned char **)(&pData), &len);
+ if ( ret == NvCtrlSuccess ) {
+ ctk_thermal->sensor_count = pData[0];
+ } else {
+ ctk_thermal->sensor_count = 0;
+ }
- hbox2 = gtk_hbox_new(FALSE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(hbox2), FRAME_PADDING);
- gtk_container_add(GTK_CONTAINER(frame), hbox2);
+ if (ctk_thermal->sensor_count > 0) {
+ ctk_thermal->sensor_info = (SensorInfoPtr)
+ malloc(pData[0] * sizeof(SensorInfoRec));
+ }
- label = gtk_label_new("Degrees: ");
- gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+ for (j = 1; j <= ctk_thermal->sensor_count; j++) {
+ gint reading, target, provider;
+ sensor_handle = h->targets[THERMAL_SENSOR_TARGET].t[pData[j]].h;
- eventbox = gtk_event_box_new();
- gtk_box_pack_start(GTK_BOX(hbox2), eventbox, FALSE, FALSE, 0);
+ if ( !sensor_handle ) {
+ continue;
+ }
- entry = gtk_entry_new_with_max_length(5);
- gtk_container_add(GTK_CONTAINER(eventbox), entry);
- gtk_widget_set_sensitive(entry, FALSE);
- gtk_entry_set_width_chars(GTK_ENTRY(entry), 5);
+ ctk_thermal->sensor_info[cur_sensor_idx].handle = sensor_handle;
- s = g_strdup_printf(" %d ", trigger);
- gtk_entry_set_text(GTK_ENTRY(entry), s);
- g_free(s);
+ /* check if this screen supports thermal querying */
- ctk_config_set_tooltip(ctk_config, eventbox, __core_threshold_help);
+ ret = NvCtrlGetAttribute(sensor_handle, NV_CTRL_THERMAL_SENSOR_READING,
+ &reading);
+ if (ret != NvCtrlSuccess) {
+ /* sensor information unavailable */
+ reading = 0;
+ }
- label = gtk_label_new(" C");
- gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+ ret = NvCtrlGetValidAttributeValues(sensor_handle,
+ NV_CTRL_THERMAL_SENSOR_READING,
+ &sensor_range);
+ if (ret != NvCtrlSuccess) {
+ /* sensor information unavailable */
+ sensor_range.u.range.min = sensor_range.u.range.max = 0;
+ }
+ ret = NvCtrlGetAttribute(sensor_handle, NV_CTRL_THERMAL_SENSOR_TARGET,
+ &target);
+ if (ret != NvCtrlSuccess) {
+ /* sensor information unavailable */
+ target = 0;
+ }
- /* GPU Core Temperature */
+ ret = NvCtrlGetAttribute(sensor_handle, NV_CTRL_THERMAL_SENSOR_PROVIDER,
+ &provider);
+ if (ret != NvCtrlSuccess) {
+ /* sensor information unavailable */
+ provider = 0;
+ }
+ /* print sensor related information */
+ draw_sensor_gui(vbox, ctk_thermal, thermal_sensor_target_type_supported,
+ cur_sensor_idx, sensor_handle,
+ reading, sensor_range.u.range.min,
+ sensor_range.u.range.max, target, provider);
+ cur_sensor_idx++;
+ }
+ XFree(pData);
+ pData = NULL;
+ } else {
+ /* GPU Core Treshold Temperature */
- table = gtk_table_new(2, 2, FALSE);
- gtk_box_pack_end(GTK_BOX(vbox), table, FALSE, FALSE, 0);
+ frame = gtk_frame_new("Slowdown Threshold");
+ gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
- hbox2 = gtk_hbox_new(FALSE, 0);
- gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 0, 1,
- GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0);
+ hbox2 = gtk_hbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(hbox2), FRAME_PADDING);
+ gtk_container_add(GTK_CONTAINER(frame), hbox2);
- label = gtk_label_new("Core Temperature:");
- gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+ label = gtk_label_new("Degrees: ");
+ gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
- frame = gtk_frame_new(NULL);
- eventbox = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(eventbox), frame);
- gtk_table_attach(GTK_TABLE(table), eventbox, 1, 2, 0, 1,
- GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+ eventbox = gtk_event_box_new();
+ gtk_box_pack_start(GTK_BOX(hbox2), eventbox, FALSE, FALSE, 0);
- label = gtk_label_new(NULL);
- gtk_container_add(GTK_CONTAINER(frame), label);
- ctk_thermal->core_label = label;
+ entry = gtk_entry_new_with_max_length(5);
+ gtk_container_add(GTK_CONTAINER(eventbox), entry);
+ gtk_widget_set_sensitive(entry, FALSE);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 5);
- ctk_config_set_tooltip(ctk_config, eventbox, __core_temp_help);
+ s = g_strdup_printf(" %d ", trigger);
+ gtk_entry_set_text(GTK_ENTRY(entry), s);
+ g_free(s);
+ ctk_config_set_tooltip(ctk_config, eventbox, __core_threshold_help);
+ label = gtk_label_new(" C");
+ gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
- /* Ambient Temperature */
+ /* GPU Core Temperature */
- ret = NvCtrlGetAttribute(handle, NV_CTRL_AMBIENT_TEMPERATURE, &ambient);
+ table = gtk_table_new(2, 2, FALSE);
+ gtk_box_pack_end(GTK_BOX(vbox), table, FALSE, FALSE, 0);
- if (ret == NvCtrlSuccess) {
hbox2 = gtk_hbox_new(FALSE, 0);
- gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 1, 2,
- GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0);
-
- label = gtk_label_new("Ambient Temperature:");
+ gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 0, 1,
+ GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0);
+
+ label = gtk_label_new("Core Temperature:");
gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
-
+
frame = gtk_frame_new(NULL);
eventbox = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(eventbox), frame);
- gtk_table_attach(GTK_TABLE(table), eventbox, 1, 2, 1, 2,
- GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
-
+ gtk_table_attach(GTK_TABLE(table), eventbox, 1, 2, 0, 1,
+ GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+
label = gtk_label_new(NULL);
gtk_container_add(GTK_CONTAINER(frame), label);
- ctk_thermal->ambient_label = label;
-
- ctk_config_set_tooltip(ctk_config, eventbox, __ambient_temp_help);
- } else {
- ctk_thermal->ambient_label = NULL;
- }
+ ctk_thermal->core_label = label;
- /* GPU Core Temperature Gauge */
+ ctk_config_set_tooltip(ctk_config, eventbox, __core_temp_help);
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
+ /* Ambient Temperature */
- frame = gtk_frame_new("Level");
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
+ ret = NvCtrlGetAttribute(handle, NV_CTRL_AMBIENT_TEMPERATURE, &ambient);
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(hbox), FRAME_PADDING);
- gtk_container_add(GTK_CONTAINER(frame), hbox);
+ if (ret == NvCtrlSuccess) {
+ hbox2 = gtk_hbox_new(FALSE, 0);
+ gtk_table_attach(GTK_TABLE(table), hbox2, 0, 1, 1, 2,
+ GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0);
- gauge = ctk_gauge_new(25, upper);
- eventbox = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(eventbox), gauge);
- gtk_box_pack_start(GTK_BOX(hbox), eventbox, FALSE, FALSE, 0);
- ctk_thermal->core_gauge = gauge;
+ label = gtk_label_new("Ambient Temperature:");
+ gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
- ctk_config_set_tooltip(ctk_config, eventbox, __temp_level_help);
+ frame = gtk_frame_new(NULL);
+ eventbox = gtk_event_box_new();
+ gtk_container_add(GTK_CONTAINER(eventbox), frame);
+ gtk_table_attach(GTK_TABLE(table), eventbox, 1, 2, 1, 2,
+ GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
- /* Retrieve CtrlHandles from ctk_config */
+ label = gtk_label_new(NULL);
+ gtk_container_add(GTK_CONTAINER(frame), label);
+ ctk_thermal->ambient_label = label;
- h = ctk_config->pCtrlHandles;
+ ctk_config_set_tooltip(ctk_config, eventbox, __ambient_temp_help);
+ } else {
+ ctk_thermal->ambient_label = NULL;
+ }
+
+ /* GPU Core Temperature Gauge */
+
+ ctk_thermal->core_gauge = pack_gauge(hbox, 25, upper,
+ ctk_config, __temp_level_help);
+ }
+sensor_end:
+
+ /* Check for if Fans present on GPU */
if ( h->targets[COOLER_TARGET].n == 0 ) {
goto end;
@@ -1285,17 +1609,46 @@ GtkTextBuffer *ctk_thermal_create_help(GtkTextTagTable *table,
gtk_text_buffer_get_iter_at_offset(b, &i, 0);
- ctk_help_title(b, &i, "Thermal Monitor Help");
-
- ctk_help_heading(b, &i, "Slowdown Threshold");
- ctk_help_para(b, &i, __core_threshold_help);
+ ctk_help_title(b, &i, "Thermal Settings Help");
+
+ /* if sensor not available skip online help */
+ if (!ctk_thermal->sensor_count) {
+ goto next_help;
+ }
+
+ if (!ctk_thermal->thermal_sensor_target_type_supported) {
+ ctk_help_heading(b, &i, "Slowdown Threshold");
+ ctk_help_para(b, &i, __core_threshold_help);
+
+ ctk_help_heading(b, &i, "Core Temperature");
+ ctk_help_para(b, &i, __core_temp_help);
+
+ if (ctk_thermal->ambient_label) {
+ ctk_help_heading(b, &i, "Ambient Temperature");
+ ctk_help_para(b, &i, __ambient_temp_help);
+ }
+ } else {
+ ctk_help_title(b, &i, "Thermal Sensor Information Help");
+
+ ctk_help_heading(b, &i, "ID");
+ ctk_help_para(b, &i, __thermal_sensor_id_help);
- ctk_help_heading(b, &i, "Core Temperature");
- ctk_help_para(b, &i, __core_temp_help);
+ ctk_help_heading(b, &i, "Temperature");
+ ctk_help_para(b, &i, __thermal_sensor_reading_help);
+
+ ctk_help_heading(b, &i, "Target");
+ ctk_help_para(b, &i, __thermal_sensor_target_help);
+
+ ctk_help_heading(b, &i, "Provider");
+ ctk_help_para(b, &i, __thermal_sensor_provider_help);
+ }
+ ctk_help_heading(b, &i, "Level");
+ ctk_help_para(b, &i, __temp_level_help);
- if (ctk_thermal->ambient_label) {
- ctk_help_heading(b, &i, "Ambient Temperature");
- ctk_help_para(b, &i, __ambient_temp_help);
+next_help:
+ /* if Fan not available skip online help */
+ if (!ctk_thermal->cooler_count) {
+ goto done;
}
ctk_help_title(b, &i, "GPU Fan Settings Help");
@@ -1322,6 +1675,7 @@ GtkTextBuffer *ctk_thermal_create_help(GtkTextTagTable *table,
ctk_help_heading(b, &i, "Enable GPU Fan Settings");
ctk_help_para(b, &i, __reset_button_help);
}
+done:
ctk_help_finish(b);
return b;
diff --git a/src/gtk+-2.x/ctkthermal.h b/src/gtk+-2.x/ctkthermal.h
index 37a27f8..2bf2f4b 100644
--- a/src/gtk+-2.x/ctkthermal.h
+++ b/src/gtk+-2.x/ctkthermal.h
@@ -63,6 +63,23 @@ typedef struct _CoolerControl {
CtkEvent *event; /* Receive NV_CONTROL events */
} CoolerControlRec, *CoolerControlPtr;
+typedef struct {
+ int format;
+ const char *name;
+} nvctrlFormatName;
+
+typedef struct _SensorInfo {
+ NvCtrlAttributeHandle *handle;
+ int currentTemp;
+ int minTemp;
+ int maxTemp;
+
+ GtkWidget *target_type;
+ GtkWidget *provider_type;
+ GtkWidget *temp_label;
+ GtkWidget *core_gauge;
+} SensorInfoRec, *SensorInfoPtr;
+
struct _CtkThermal
{
GtkVBox parent;
@@ -91,7 +108,10 @@ struct _CtkThermal
gboolean show_fan_control_frame;
gboolean enable_reset_button;
CoolerControlPtr cooler_control;
+ SensorInfoPtr sensor_info;
int cooler_count;
+ int sensor_count;
+ gboolean thermal_sensor_target_type_supported;
};
struct _CtkThermalClass
diff --git a/src/gtk+-2.x/ctkutils.c b/src/gtk+-2.x/ctkutils.c
index 09665f4..0c6b6b3 100644
--- a/src/gtk+-2.x/ctkutils.c
+++ b/src/gtk+-2.x/ctkutils.c
@@ -29,6 +29,30 @@
+/*
+ * Used to check if current display enabled or disabled.
+ */
+void update_display_enabled_flag(NvCtrlAttributeHandle *handle,
+ gboolean *display_enabled,
+ unsigned int display_device_mask)
+{
+ ReturnStatus ret;
+ unsigned int enabled_displays;
+
+ /* Is display enabled? */
+
+ ret = NvCtrlGetAttribute(handle,
+ NV_CTRL_ENABLED_DISPLAYS,
+ (int *)&enabled_displays);
+
+ *display_enabled =
+ (ret == NvCtrlSuccess &&
+ (enabled_displays & (display_device_mask)));
+
+} /* update_display_enabled_flag() */
+
+
+
gchar* create_gpu_name_string(NvCtrlAttributeHandle *gpu_handle)
{
gchar *gpu_name;
@@ -52,21 +76,26 @@ gchar* create_gpu_name_string(NvCtrlAttributeHandle *gpu_handle)
}
-GtkWidget *add_table_row(GtkWidget *table,
- const gint row,
- const gfloat name_xalign, // 0 = left, 1 = right
- const gfloat name_yalign, // 0 = top, 1 = bottom
- const gchar *name,
- const gfloat value_xalign,
- const gfloat value_yalign,
- const gchar *value)
+GtkWidget *add_table_row_with_help_text(GtkWidget *table,
+ CtkConfig *ctk_config,
+ const char *help,
+ const gint row,
+ const gint col,
+ // 0 = left, 1 = right
+ const gfloat name_xalign,
+ // 0 = top, 1 = bottom
+ const gfloat name_yalign,
+ const gchar *name,
+ const gfloat value_xalign,
+ const gfloat value_yalign,
+ const gchar *value)
{
- GtkWidget *label;
+ GtkWidget *label, *eventbox;
label = gtk_label_new(name);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
gtk_misc_set_alignment(GTK_MISC(label), name_xalign, name_yalign);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1,
+ gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row + 1,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
if (value == NULL)
@@ -74,14 +103,42 @@ GtkWidget *add_table_row(GtkWidget *table,
else
label = gtk_label_new(value);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+ eventbox = gtk_event_box_new();
gtk_misc_set_alignment(GTK_MISC(label), value_xalign, value_yalign);
- gtk_table_attach(GTK_TABLE(table), label, 1, 2, row, row + 1,
+ gtk_container_add(GTK_CONTAINER(eventbox), label);
+ gtk_table_attach(GTK_TABLE(table), eventbox, col+1, col+2, row, row + 1,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ if ((help != NULL) || (ctk_config != NULL)) {
+ ctk_config_set_tooltip(ctk_config, eventbox, help);
+ }
return label;
}
+GtkWidget *add_table_row(GtkWidget *table,
+ const gint row,
+ const gfloat name_xalign, // 0 = left, 1 = right
+ const gfloat name_yalign, // 0 = top, 1 = bottom
+ const gchar *name,
+ const gfloat value_xalign,
+ const gfloat value_yalign,
+ const gchar *value)
+{
+ return add_table_row_with_help_text(table,
+ NULL, /* ctk_config */
+ NULL, /* help */
+ row,
+ 0, /* col */
+ name_xalign,
+ name_yalign,
+ name,
+ value_xalign,
+ value_yalign,
+ value);
+}
+
+
/** ctk_get_parent_window() ******************************************
*
diff --git a/src/gtk+-2.x/ctkutils.h b/src/gtk+-2.x/ctkutils.h
index e052abe..52ea46f 100644
--- a/src/gtk+-2.x/ctkutils.h
+++ b/src/gtk+-2.x/ctkutils.h
@@ -28,10 +28,27 @@
#include <gtk/gtk.h>
#include <NvCtrlAttributes.h>
+#include "ctkconfig.h"
+
G_BEGIN_DECLS
gchar* create_gpu_name_string(NvCtrlAttributeHandle *gpu_handle);
+
+GtkWidget *add_table_row_with_help_text(GtkWidget *table,
+ CtkConfig *ctk_config,
+ const char *help,
+ const gint row,
+ const gint col,
+ // 0 = left, 1 = right
+ const gfloat name_xalign,
+ // 0 = top, 1 = bottom
+ const gfloat name_yalign,
+ const gchar *name,
+ const gfloat value_xalign,
+ const gfloat value_yalign,
+ const gchar *value);
+
GtkWidget *add_table_row(GtkWidget *, const gint,
const gfloat, const gfloat, const gchar *,
const gfloat, const gfloat, const gchar *);
@@ -44,6 +61,10 @@ void ctk_display_warning_msg(GtkWidget *parent, gchar *msg);
void ctk_empty_container(GtkWidget *);
+void update_display_enabled_flag(NvCtrlAttributeHandle *handle,
+ gboolean *display_enabled,
+ unsigned int display_device_mask);
+
G_END_DECLS
#endif /* __CTK_UTILS_H__ */
diff --git a/src/gtk+-2.x/src.mk b/src/gtk+-2.x/src.mk
new file mode 100644
index 0000000..7461b94
--- /dev/null
+++ b/src/gtk+-2.x/src.mk
@@ -0,0 +1,95 @@
+#
+# files in the src/gtk+-2.x directory of nvidia-settings
+#
+
+GTK_SRC += ctkxvideo.c
+GTK_SRC += ctkcursorshadow.c
+GTK_SRC += ctkui.c
+GTK_SRC += ctkframelock.c
+GTK_SRC += ctkgauge.c
+GTK_SRC += ctkcurve.c
+GTK_SRC += ctkcolorcorrection.c
+GTK_SRC += ctkscale.c
+GTK_SRC += ctkmultisample.c
+GTK_SRC += ctkconfig.c
+GTK_SRC += ctkevent.c
+GTK_SRC += ctkwindow.c
+GTK_SRC += ctkopengl.c
+GTK_SRC += ctkglx.c
+GTK_SRC += ctkhelp.c
+GTK_SRC += ctkimagesliders.c
+GTK_SRC += ctkdisplaydevice-crt.c
+GTK_SRC += ctkdisplaydevice-tv.c
+GTK_SRC += ctkdisplaydevice-dfp.c
+GTK_SRC += ctkditheringcontrols.c
+GTK_SRC += ctkthermal.c
+GTK_SRC += ctkpowermizer.c
+GTK_SRC += ctkgvo.c
+GTK_SRC += ctkgvo-csc.c
+GTK_SRC += ctkdropdownmenu.c
+GTK_SRC += ctkrandr.c
+GTK_SRC += ctkclocks.c
+GTK_SRC += ctkutils.c
+GTK_SRC += ctkedid.c
+GTK_SRC += ctkserver.c
+GTK_SRC += ctkdisplaylayout.c
+GTK_SRC += ctkdisplayconfig.c
+GTK_SRC += ctkscreen.c
+GTK_SRC += ctkslimm.c
+GTK_SRC += ctkgpu.c
+GTK_SRC += ctkbanner.c
+GTK_SRC += ctkvcs.c
+GTK_SRC += ctkdisplayconfig-utils.c
+GTK_SRC += ctkgvo-banner.c
+GTK_SRC += ctkgvo-sync.c
+GTK_SRC += ctkpowersavings.c
+GTK_SRC += ctkgvi.c
+GTK_SRC += ctklicense.c
+GTK_SRC += ctkecc.c
+
+GTK_EXTRA_DIST += ctkxvideo.h
+GTK_EXTRA_DIST += ctkcursorshadow.h
+GTK_EXTRA_DIST += ctkui.h
+GTK_EXTRA_DIST += ctkframelock.h
+GTK_EXTRA_DIST += ctkgauge.h
+GTK_EXTRA_DIST += ctkcurve.h
+GTK_EXTRA_DIST += ctkcolorcorrection.h
+GTK_EXTRA_DIST += ctkscale.h
+GTK_EXTRA_DIST += ctkmultisample.h
+GTK_EXTRA_DIST += ctkconfig.h
+GTK_EXTRA_DIST += ctkevent.h
+GTK_EXTRA_DIST += ctkwindow.h
+GTK_EXTRA_DIST += ctkopengl.h
+GTK_EXTRA_DIST += ctkglx.h
+GTK_EXTRA_DIST += ctkhelp.h
+GTK_EXTRA_DIST += ctkimagesliders.h
+GTK_EXTRA_DIST += ctkdisplaydevice-crt.h
+GTK_EXTRA_DIST += ctkdisplaydevice-tv.h
+GTK_EXTRA_DIST += ctkdisplaydevice-dfp.h
+GTK_EXTRA_DIST += ctkditheringcontrols.h
+GTK_EXTRA_DIST += ctkconstants.h
+GTK_EXTRA_DIST += ctkthermal.h
+GTK_EXTRA_DIST += ctkpowermizer.h
+GTK_EXTRA_DIST += ctkgvo.h
+GTK_EXTRA_DIST += ctkgvo-csc.h
+GTK_EXTRA_DIST += ctkdropdownmenu.h
+GTK_EXTRA_DIST += ctkrandr.h
+GTK_EXTRA_DIST += ctkclocks.h
+GTK_EXTRA_DIST += ctkutils.h
+GTK_EXTRA_DIST += ctkedid.h
+GTK_EXTRA_DIST += ctkserver.h
+GTK_EXTRA_DIST += ctkdisplaylayout.h
+GTK_EXTRA_DIST += ctkdisplayconfig.h
+GTK_EXTRA_DIST += ctkscreen.h
+GTK_EXTRA_DIST += ctkslimm.h
+GTK_EXTRA_DIST += ctkgpu.h
+GTK_EXTRA_DIST += ctkbanner.h
+GTK_EXTRA_DIST += ctkvcs.h
+GTK_EXTRA_DIST += ctkdisplayconfig-utils.h
+GTK_EXTRA_DIST += ctkpowersavings.h
+GTK_EXTRA_DIST += ctkgvo-banner.h
+GTK_EXTRA_DIST += ctkgvo-sync.h
+GTK_EXTRA_DIST += ctkgvi.h
+GTK_EXTRA_DIST += ctklicense.h
+GTK_EXTRA_DIST += ctkecc.h
+GTK_EXTRA_DIST += src.mk
diff --git a/src/image_data/Makefile.inc b/src/image_data/Makefile.inc
deleted file mode 100644
index 32b1dc2..0000000
--- a/src/image_data/Makefile.inc
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (C) 2004 NVIDIA Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of Version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
-# of the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the:
-#
-# Free Software Foundation, Inc.
-# 59 Temple Place - Suite 330
-# Boston, MA 02111-1307, USA
-#
-
-#
-# image data sources and extra files to be included in the
-# distribution
-#
-
-EXTRA_DIST += \
- antialias_pixdata.h \
- background_pixdata.h \
- background_tall_pixdata.h \
- bnc_cable_pixdata.h \
- bsd_pixdata.h \
- clock_pixdata.h \
- color_pixdata.h \
- config_pixdata.h \
- crt_pixdata.h \
- cursor_shadow_pixdata.h \
- dfp_pixdata.h \
- display_config_pixdata.h \
- framelock_pixdata.h \
- glx_pixdata.h \
- gpu_pixdata.h \
- help_pixdata.h \
- HOWTO-ADD-IMAGES \
- led_green_pixdata.h \
- led_grey_pixdata.h \
- led_red_pixdata.h \
- logo_pixdata.h \
- logo_tall_pixdata.h \
- Makefile.inc \
- nvidia_icon_pixdata.h \
- opengl_pixdata.h \
- penguin_pixdata.h \
- png_to_c_header.sh \
- gvi_pixdata.h \
- rj45_input_pixdata.h \
- rj45_output_pixdata.h \
- rj45_unused_pixdata.h \
- rotate_left_off_pixdata.h \
- rotate_left_on_pixdata.h \
- rotate_right_off_pixdata.h \
- rotate_right_on_pixdata.h \
- rotation_orientation_horz_pixdata.h \
- rotation_orientation_vert_pixdata.h \
- rotation_pixdata.h \
- sdi_pixdata.h \
- sdi_shared_sync_bnc_pixdata.h \
- slimm_pixdata.h \
- solaris_pixdata.h \
- thermal_pixdata.h \
- tv_pixdata.h \
- vcs_pixdata.h \
- x_pixdata.h \
- xvideo_pixdata.h
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/src/image_data/antialias.png b/src/image_data/antialias.png
new file mode 100644
index 0000000..401976a
--- /dev/null
+++ b/src/image_data/antialias.png
Binary files differ
diff --git a/src/image_data/background.png b/src/image_data/background.png
new file mode 100644
index 0000000..4f6245f
--- /dev/null
+++ b/src/image_data/background.png
Binary files differ
diff --git a/src/image_data/background_tall.png b/src/image_data/background_tall.png
new file mode 100644
index 0000000..93e1030
--- /dev/null
+++ b/src/image_data/background_tall.png
Binary files differ
diff --git a/src/image_data/bnc_cable.png b/src/image_data/bnc_cable.png
new file mode 100644
index 0000000..8f7b9a2
--- /dev/null
+++ b/src/image_data/bnc_cable.png
Binary files differ
diff --git a/src/image_data/bsd.png b/src/image_data/bsd.png
new file mode 100644
index 0000000..5a01458
--- /dev/null
+++ b/src/image_data/bsd.png
Binary files differ
diff --git a/src/image_data/clock.png b/src/image_data/clock.png
new file mode 100644
index 0000000..acf5265
--- /dev/null
+++ b/src/image_data/clock.png
Binary files differ
diff --git a/src/image_data/color.png b/src/image_data/color.png
new file mode 100644
index 0000000..b956adc
--- /dev/null
+++ b/src/image_data/color.png
Binary files differ
diff --git a/src/image_data/config.png b/src/image_data/config.png
new file mode 100644
index 0000000..570efd8
--- /dev/null
+++ b/src/image_data/config.png
Binary files differ
diff --git a/src/image_data/crt.png b/src/image_data/crt.png
new file mode 100644
index 0000000..6b1e559
--- /dev/null
+++ b/src/image_data/crt.png
Binary files differ
diff --git a/src/image_data/cursor_shadow.png b/src/image_data/cursor_shadow.png
new file mode 100644
index 0000000..0ddf799
--- /dev/null
+++ b/src/image_data/cursor_shadow.png
Binary files differ
diff --git a/src/image_data/dfp.png b/src/image_data/dfp.png
new file mode 100644
index 0000000..1a661a5
--- /dev/null
+++ b/src/image_data/dfp.png
Binary files differ
diff --git a/src/image_data/display_config.png b/src/image_data/display_config.png
new file mode 100644
index 0000000..6f36ea3
--- /dev/null
+++ b/src/image_data/display_config.png
Binary files differ
diff --git a/src/image_data/framelock.png b/src/image_data/framelock.png
new file mode 100644
index 0000000..842cbd6
--- /dev/null
+++ b/src/image_data/framelock.png
Binary files differ
diff --git a/src/image_data/glx.png b/src/image_data/glx.png
new file mode 100644
index 0000000..710a5ae
--- /dev/null
+++ b/src/image_data/glx.png
Binary files differ
diff --git a/src/image_data/gpu.png b/src/image_data/gpu.png
new file mode 100644
index 0000000..adc3782
--- /dev/null
+++ b/src/image_data/gpu.png
Binary files differ
diff --git a/src/image_data/gvi.png b/src/image_data/gvi.png
new file mode 100644
index 0000000..d025cd5
--- /dev/null
+++ b/src/image_data/gvi.png
Binary files differ
diff --git a/src/image_data/help.png b/src/image_data/help.png
new file mode 100644
index 0000000..05002cf
--- /dev/null
+++ b/src/image_data/help.png
Binary files differ
diff --git a/src/image_data/led_green.png b/src/image_data/led_green.png
new file mode 100644
index 0000000..4e1a204
--- /dev/null
+++ b/src/image_data/led_green.png
Binary files differ
diff --git a/src/image_data/led_grey.png b/src/image_data/led_grey.png
new file mode 100644
index 0000000..f140b10
--- /dev/null
+++ b/src/image_data/led_grey.png
Binary files differ
diff --git a/src/image_data/led_red.png b/src/image_data/led_red.png
new file mode 100644
index 0000000..2dec661
--- /dev/null
+++ b/src/image_data/led_red.png
Binary files differ
diff --git a/src/image_data/logo.png b/src/image_data/logo.png
new file mode 100644
index 0000000..1b073b1
--- /dev/null
+++ b/src/image_data/logo.png
Binary files differ
diff --git a/src/image_data/logo_tall.png b/src/image_data/logo_tall.png
new file mode 100644
index 0000000..b27b470
--- /dev/null
+++ b/src/image_data/logo_tall.png
Binary files differ
diff --git a/src/image_data/nvidia_icon.png b/src/image_data/nvidia_icon.png
new file mode 100755
index 0000000..7a2b508
--- /dev/null
+++ b/src/image_data/nvidia_icon.png
Binary files differ
diff --git a/src/image_data/nvidia_icon_pixdata.h b/src/image_data/nvidia_icon_pixdata.h
index 4555b18..4555b18 100644..100755
--- a/src/image_data/nvidia_icon_pixdata.h
+++ b/src/image_data/nvidia_icon_pixdata.h
diff --git a/src/image_data/opengl.png b/src/image_data/opengl.png
new file mode 100644
index 0000000..e69fa24
--- /dev/null
+++ b/src/image_data/opengl.png
Binary files differ
diff --git a/src/image_data/penguin.png b/src/image_data/penguin.png
new file mode 100644
index 0000000..6391c58
--- /dev/null
+++ b/src/image_data/penguin.png
Binary files differ
diff --git a/src/image_data/png_to_c_header.sh b/src/image_data/png_to_c_header.sh
index 65f7c26..65f7c26 100644..100755
--- a/src/image_data/png_to_c_header.sh
+++ b/src/image_data/png_to_c_header.sh
diff --git a/src/image_data/rj45_input.png b/src/image_data/rj45_input.png
new file mode 100644
index 0000000..c90313f
--- /dev/null
+++ b/src/image_data/rj45_input.png
Binary files differ
diff --git a/src/image_data/rj45_output.png b/src/image_data/rj45_output.png
new file mode 100644
index 0000000..6959ab4
--- /dev/null
+++ b/src/image_data/rj45_output.png
Binary files differ
diff --git a/src/image_data/rj45_unused.png b/src/image_data/rj45_unused.png
new file mode 100644
index 0000000..b41ac15
--- /dev/null
+++ b/src/image_data/rj45_unused.png
Binary files differ
diff --git a/src/image_data/rotate_left_off.png b/src/image_data/rotate_left_off.png
new file mode 100644
index 0000000..3b609a3
--- /dev/null
+++ b/src/image_data/rotate_left_off.png
Binary files differ
diff --git a/src/image_data/rotate_left_on.png b/src/image_data/rotate_left_on.png
new file mode 100644
index 0000000..4adb3e9
--- /dev/null
+++ b/src/image_data/rotate_left_on.png
Binary files differ
diff --git a/src/image_data/rotate_right_off.png b/src/image_data/rotate_right_off.png
new file mode 100644
index 0000000..3bd9413
--- /dev/null
+++ b/src/image_data/rotate_right_off.png
Binary files differ
diff --git a/src/image_data/rotate_right_on.png b/src/image_data/rotate_right_on.png
new file mode 100644
index 0000000..5a99d55
--- /dev/null
+++ b/src/image_data/rotate_right_on.png
Binary files differ
diff --git a/src/image_data/rotation.png b/src/image_data/rotation.png
new file mode 100644
index 0000000..466812a
--- /dev/null
+++ b/src/image_data/rotation.png
Binary files differ
diff --git a/src/image_data/rotation_orientation_horz.png b/src/image_data/rotation_orientation_horz.png
new file mode 100644
index 0000000..8280377
--- /dev/null
+++ b/src/image_data/rotation_orientation_horz.png
Binary files differ
diff --git a/src/image_data/rotation_orientation_vert.png b/src/image_data/rotation_orientation_vert.png
new file mode 100644
index 0000000..11c163d
--- /dev/null
+++ b/src/image_data/rotation_orientation_vert.png
Binary files differ
diff --git a/src/image_data/sdi.png b/src/image_data/sdi.png
new file mode 100644
index 0000000..abf06ad
--- /dev/null
+++ b/src/image_data/sdi.png
Binary files differ
diff --git a/src/image_data/sdi_shared_sync_bnc.png b/src/image_data/sdi_shared_sync_bnc.png
new file mode 100644
index 0000000..f4b7455
--- /dev/null
+++ b/src/image_data/sdi_shared_sync_bnc.png
Binary files differ
diff --git a/src/image_data/slimm.png b/src/image_data/slimm.png
new file mode 100644
index 0000000..8c1e654
--- /dev/null
+++ b/src/image_data/slimm.png
Binary files differ
diff --git a/src/image_data/solaris.png b/src/image_data/solaris.png
new file mode 100644
index 0000000..59f4037
--- /dev/null
+++ b/src/image_data/solaris.png
Binary files differ
diff --git a/src/image_data/src.mk b/src/image_data/src.mk
new file mode 100644
index 0000000..6cef856
--- /dev/null
+++ b/src/image_data/src.mk
@@ -0,0 +1,97 @@
+#
+# files in the src/image_data directory of nvidia-settings
+#
+
+IMAGE_DATA_SRC +=
+
+IMAGE_DATA_EXTRA_DIST += HOWTO-ADD-IMAGES
+IMAGE_DATA_EXTRA_DIST += antialias.png
+IMAGE_DATA_EXTRA_DIST += antialias_pixdata.h
+IMAGE_DATA_EXTRA_DIST += background.png
+IMAGE_DATA_EXTRA_DIST += background_pixdata.h
+IMAGE_DATA_EXTRA_DIST += background_tall.png
+IMAGE_DATA_EXTRA_DIST += background_tall_pixdata.h
+IMAGE_DATA_EXTRA_DIST += bnc_cable.png
+IMAGE_DATA_EXTRA_DIST += bnc_cable_pixdata.h
+IMAGE_DATA_EXTRA_DIST += bsd.png
+IMAGE_DATA_EXTRA_DIST += bsd_pixdata.h
+IMAGE_DATA_EXTRA_DIST += clock.png
+IMAGE_DATA_EXTRA_DIST += clock_pixdata.h
+IMAGE_DATA_EXTRA_DIST += color.png
+IMAGE_DATA_EXTRA_DIST += color_pixdata.h
+IMAGE_DATA_EXTRA_DIST += config.png
+IMAGE_DATA_EXTRA_DIST += config_pixdata.h
+IMAGE_DATA_EXTRA_DIST += crt.png
+IMAGE_DATA_EXTRA_DIST += crt_pixdata.h
+IMAGE_DATA_EXTRA_DIST += cursor_shadow.png
+IMAGE_DATA_EXTRA_DIST += cursor_shadow_pixdata.h
+IMAGE_DATA_EXTRA_DIST += dfp.png
+IMAGE_DATA_EXTRA_DIST += dfp_pixdata.h
+IMAGE_DATA_EXTRA_DIST += display_config.png
+IMAGE_DATA_EXTRA_DIST += display_config_pixdata.h
+IMAGE_DATA_EXTRA_DIST += framelock.png
+IMAGE_DATA_EXTRA_DIST += framelock_pixdata.h
+IMAGE_DATA_EXTRA_DIST += glx.png
+IMAGE_DATA_EXTRA_DIST += glx_pixdata.h
+IMAGE_DATA_EXTRA_DIST += gpu.png
+IMAGE_DATA_EXTRA_DIST += gpu_pixdata.h
+IMAGE_DATA_EXTRA_DIST += gvi.png
+IMAGE_DATA_EXTRA_DIST += gvi_pixdata.h
+IMAGE_DATA_EXTRA_DIST += help.png
+IMAGE_DATA_EXTRA_DIST += help_pixdata.h
+IMAGE_DATA_EXTRA_DIST += led_green.png
+IMAGE_DATA_EXTRA_DIST += led_green_pixdata.h
+IMAGE_DATA_EXTRA_DIST += led_grey.png
+IMAGE_DATA_EXTRA_DIST += led_grey_pixdata.h
+IMAGE_DATA_EXTRA_DIST += led_red.png
+IMAGE_DATA_EXTRA_DIST += led_red_pixdata.h
+IMAGE_DATA_EXTRA_DIST += logo.png
+IMAGE_DATA_EXTRA_DIST += logo_pixdata.h
+IMAGE_DATA_EXTRA_DIST += logo_tall.png
+IMAGE_DATA_EXTRA_DIST += logo_tall_pixdata.h
+IMAGE_DATA_EXTRA_DIST += nvidia_icon.png
+IMAGE_DATA_EXTRA_DIST += nvidia_icon_pixdata.h
+IMAGE_DATA_EXTRA_DIST += opengl.png
+IMAGE_DATA_EXTRA_DIST += opengl_pixdata.h
+IMAGE_DATA_EXTRA_DIST += penguin.png
+IMAGE_DATA_EXTRA_DIST += penguin_pixdata.h
+IMAGE_DATA_EXTRA_DIST += png_to_c_header.sh
+IMAGE_DATA_EXTRA_DIST += rj45_input.png
+IMAGE_DATA_EXTRA_DIST += rj45_input_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rj45_output.png
+IMAGE_DATA_EXTRA_DIST += rj45_output_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rj45_unused.png
+IMAGE_DATA_EXTRA_DIST += rj45_unused_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rotate_left_off.png
+IMAGE_DATA_EXTRA_DIST += rotate_left_off_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rotate_left_on.png
+IMAGE_DATA_EXTRA_DIST += rotate_left_on_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rotate_right_off.png
+IMAGE_DATA_EXTRA_DIST += rotate_right_off_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rotate_right_on.png
+IMAGE_DATA_EXTRA_DIST += rotate_right_on_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rotation.png
+IMAGE_DATA_EXTRA_DIST += rotation_orientation_horz.png
+IMAGE_DATA_EXTRA_DIST += rotation_orientation_horz_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rotation_orientation_vert.png
+IMAGE_DATA_EXTRA_DIST += rotation_orientation_vert_pixdata.h
+IMAGE_DATA_EXTRA_DIST += rotation_pixdata.h
+IMAGE_DATA_EXTRA_DIST += sdi.png
+IMAGE_DATA_EXTRA_DIST += sdi_pixdata.h
+IMAGE_DATA_EXTRA_DIST += sdi_shared_sync_bnc.png
+IMAGE_DATA_EXTRA_DIST += sdi_shared_sync_bnc_pixdata.h
+IMAGE_DATA_EXTRA_DIST += slimm.png
+IMAGE_DATA_EXTRA_DIST += slimm_pixdata.h
+IMAGE_DATA_EXTRA_DIST += solaris.png
+IMAGE_DATA_EXTRA_DIST += solaris_pixdata.h
+IMAGE_DATA_EXTRA_DIST += src.mk
+IMAGE_DATA_EXTRA_DIST += thermal.png
+IMAGE_DATA_EXTRA_DIST += thermal_pixdata.h
+IMAGE_DATA_EXTRA_DIST += tv.png
+IMAGE_DATA_EXTRA_DIST += tv_pixdata.h
+IMAGE_DATA_EXTRA_DIST += vcs.png
+IMAGE_DATA_EXTRA_DIST += vcs_pixdata.h
+IMAGE_DATA_EXTRA_DIST += x.png
+IMAGE_DATA_EXTRA_DIST += x_pixdata.h
+IMAGE_DATA_EXTRA_DIST += xvideo.png
+IMAGE_DATA_EXTRA_DIST += xvideo_pixdata.h
diff --git a/src/image_data/thermal.png b/src/image_data/thermal.png
new file mode 100644
index 0000000..bb40385
--- /dev/null
+++ b/src/image_data/thermal.png
Binary files differ
diff --git a/src/image_data/tv.png b/src/image_data/tv.png
new file mode 100644
index 0000000..d8ea6b7
--- /dev/null
+++ b/src/image_data/tv.png
Binary files differ
diff --git a/src/image_data/vcs.png b/src/image_data/vcs.png
new file mode 100644
index 0000000..8fe7289
--- /dev/null
+++ b/src/image_data/vcs.png
Binary files differ
diff --git a/src/image_data/x.png b/src/image_data/x.png
new file mode 100644
index 0000000..2a94e42
--- /dev/null
+++ b/src/image_data/x.png
Binary files differ
diff --git a/src/image_data/xvideo.png b/src/image_data/xvideo.png
new file mode 100644
index 0000000..9b79903
--- /dev/null
+++ b/src/image_data/xvideo.png
Binary files differ
diff --git a/src/libXNVCtrl/Makefile.inc b/src/libXNVCtrl/Makefile.inc
deleted file mode 100644
index 0f42108..0000000
--- a/src/libXNVCtrl/Makefile.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# libXNVCtrl: A library for configuring the NVIDIA X driver on Unix and Linux
-# systems using the NV-CONTROL X11 protocol extension.
-#
-# Copyright (c) 2004-2008 NVIDIA, Corporation.
-#
-# 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.
-#
-
-EXTRA_DIST += \
- Makefile \
- Makefile.inc \
- NVCtrl.h \
- NVCtrlLib.h \
- libXNVCtrl.a \
- NVCtrl.c \
- nv_control.h
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/src/libXNVCtrl/NVCtrl.c b/src/libXNVCtrl/NVCtrl.c
index 097909c..c9276c1 100644
--- a/src/libXNVCtrl/NVCtrl.c
+++ b/src/libXNVCtrl/NVCtrl.c
@@ -33,6 +33,7 @@
#define NEED_EVENTS
#define NEED_REPLIES
+#include <stdint.h>
#include <stdlib.h>
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
@@ -41,9 +42,10 @@
#include "NVCtrlLib.h"
#include "nv_control.h"
-#define NVCTRL_EXT_NEED_CHECK (XPointer)(~0)
-#define NVCTRL_EXT_NEED_NOTHING (XPointer)(0)
-#define NVCTRL_EXT_NEED_TARGET_SWAP (XPointer)(1)
+#define NVCTRL_EXT_EXISTS 1
+#define NVCTRL_EXT_NEED_TARGET_SWAP 2
+#define NVCTRL_EXT_64_BIT_ATTRIBUTES 4
+#define NVCTRL_EXT_NEED_CHECK (1 << (sizeof(XPointer) - 1))
static XExtensionInfo _nvctrl_ext_info_data;
static XExtensionInfo *nvctrl_ext_info = &_nvctrl_ext_info_data;
@@ -55,6 +57,7 @@ static /* const */ char *nvctrl_extension_name = NV_CONTROL_NAME;
XextSimpleCheckExtension (dpy, i, nvctrl_extension_name)
static int close_display();
+static uintptr_t version_flags(Display *dpy, XExtDisplayInfo *info);
static Bool wire_to_event();
static /* const */ XExtensionHooks nvctrl_extension_hooks = {
NULL, /* create_gc */
@@ -71,9 +74,10 @@ static /* const */ XExtensionHooks nvctrl_extension_hooks = {
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, nvctrl_ext_info,
- nvctrl_extension_name,
+ nvctrl_extension_name,
&nvctrl_extension_hooks,
- NV_CONTROL_EVENTS, NVCTRL_EXT_NEED_CHECK)
+ NV_CONTROL_EVENTS,
+ (XPointer)NVCTRL_EXT_NEED_CHECK)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, nvctrl_ext_info)
@@ -82,29 +86,14 @@ static XEXT_GENERATE_CLOSE_DISPLAY (close_display, nvctrl_ext_info)
* fields in reversed order. In order to talk to one of these servers,
* we need to swap these fields.
*/
+
static void XNVCTRLCheckTargetData(Display *dpy, XExtDisplayInfo *info,
int *target_type, int *target_id)
{
- /* Find out what the server's NV-CONTROL version is and
- * setup for swapping if we need to.
- */
- if (info->data == NVCTRL_EXT_NEED_CHECK) {
- int major, minor;
-
- if (XNVCTRLQueryVersion(dpy, &major, &minor)) {
- if (major == 1 &&
- (minor == 8 || minor == 9)) {
- info->data = NVCTRL_EXT_NEED_TARGET_SWAP;
- } else {
- info->data = NVCTRL_EXT_NEED_NOTHING;
- }
- } else {
- info->data = NVCTRL_EXT_NEED_NOTHING;
- }
- }
+ uintptr_t flags = version_flags(dpy, info);
/* We need to swap the target_type and target_id */
- if (info->data == NVCTRL_EXT_NEED_TARGET_SWAP) {
+ if (flags & NVCTRL_EXT_NEED_TARGET_SWAP) {
int tmp;
tmp = *target_type;
*target_type = *target_id;
@@ -129,6 +118,34 @@ Bool XNVCTRLQueryExtension (
}
}
+/*
+ * Retrieve any cached flags that depend on the version of the NV-CONTROL
+ * extension.
+ */
+
+static uintptr_t version_flags(Display *dpy, XExtDisplayInfo *info)
+{
+ uintptr_t data = (uintptr_t)info->data;
+
+ /* If necessary, determine the NV-CONTROL version */
+ if (data & NVCTRL_EXT_NEED_CHECK) {
+ int major, minor;
+ data = 0;
+ if (XNVCTRLQueryVersion(dpy, &major, &minor)) {
+ data |= NVCTRL_EXT_EXISTS;
+ if (major == 1 && (minor == 8 || minor == 9)) {
+ data |= NVCTRL_EXT_NEED_TARGET_SWAP;
+ }
+ if ((major > 1) || ((major == 1) && (minor > 20))) {
+ data |= NVCTRL_EXT_64_BIT_ATTRIBUTES;
+ }
+ }
+
+ info->data = (XPointer)data;
+ }
+
+ return data;
+}
Bool XNVCTRLQueryVersion (
Display *dpy,
@@ -676,7 +693,7 @@ Bool XNVCTRLQueryValidTargetAttributeValues (
){
XExtDisplayInfo *info = find_display(dpy);
Bool exists;
- int major, minor;
+ uintptr_t flags;
if (!values) return False;
@@ -686,10 +703,12 @@ Bool XNVCTRLQueryValidTargetAttributeValues (
XNVCTRLCheckExtension(dpy, info, False);
XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
- if (!XNVCTRLQueryVersion(dpy, &major, &minor))
+ flags = version_flags(dpy,info);
+
+ if (!(flags & NVCTRL_EXT_EXISTS))
return False;
- if ((major > 1) || ((major == 1) && (minor > 20))) {
+ if (flags & NVCTRL_EXT_64_BIT_ATTRIBUTES) {
exists = XNVCTRLQueryValidTargetAttributeValues64(dpy, info,
target_type,
target_id,
@@ -712,7 +731,7 @@ Bool XNVCTRLQueryValidAttributeValues (
Display *dpy,
int screen,
unsigned int display_mask,
- unsigned int attribute,
+ unsigned int attribute,
NVCTRLAttributeValidValuesRec *values
){
return XNVCTRLQueryValidTargetAttributeValues(dpy,
@@ -775,7 +794,7 @@ Bool XNVCTRLQueryGvoColorConversion (
XExtDisplayInfo *info = find_display (dpy);
xnvCtrlQueryGvoColorConversionReply rep;
xnvCtrlQueryGvoColorConversionReq *req;
-
+
if(!XextHasExtension(info))
return False;
@@ -1130,7 +1149,7 @@ static Bool wire_to_event (Display *dpy, XEvent *host, xEvent *wire)
default:
return False;
}
-
+
return True;
}
diff --git a/src/libXNVCtrl/NVCtrl.h b/src/libXNVCtrl/NVCtrl.h
index d7cfe4c..fa97d2f 100644
--- a/src/libXNVCtrl/NVCtrl.h
+++ b/src/libXNVCtrl/NVCtrl.h
@@ -39,12 +39,13 @@
* Here are the supported target types:
*/
-#define NV_CTRL_TARGET_TYPE_X_SCREEN 0
-#define NV_CTRL_TARGET_TYPE_GPU 1
-#define NV_CTRL_TARGET_TYPE_FRAMELOCK 2
-#define NV_CTRL_TARGET_TYPE_VCSC 3 /* Visual Computing System */
-#define NV_CTRL_TARGET_TYPE_GVI 4
-#define NV_CTRL_TARGET_TYPE_COOLER 5 /* e.g., fan */
+#define NV_CTRL_TARGET_TYPE_X_SCREEN 0
+#define NV_CTRL_TARGET_TYPE_GPU 1
+#define NV_CTRL_TARGET_TYPE_FRAMELOCK 2
+#define NV_CTRL_TARGET_TYPE_VCSC 3 /* Visual Computing System */
+#define NV_CTRL_TARGET_TYPE_GVI 4
+#define NV_CTRL_TARGET_TYPE_COOLER 5 /* e.g., fan */
+#define NV_CTRL_TARGET_TYPE_THERMAL_SENSOR 6
/**************************************************************************/
@@ -99,6 +100,9 @@
* C: The attribute may be queried using an NV_CTRL_TARGET_TYPE_COOLER target
* type via XNVCTRLQueryTargetAttribute().
*
+ * S: The attribute may be queried using an NV_CTRL_TARGET_TYPE_THERMAL_SENSOR
+ * target type via XNVCTRLQueryTargetAttribute().
+ *
* NOTE: Unless mentioned otherwise, all attributes may be queried using
* an NV_CTRL_TARGET_TYPE_X_SCREEN target type via
* XNVCTRLQueryTargetAttribute().
@@ -151,17 +155,13 @@
* NV_CTRL_FLATPANEL_DITHERING - the current flat panel dithering
* state; possible values are:
*
- * 0: default (the driver will decide when to dither)
+ * 0: disabled (the driver will never dither)
* 1: enabled (the driver will always dither when possible)
- * 2: disabled (the driver will never dither)
- *
- * USAGE NOTE: This attribute had been deprecated.
*/
#define NV_CTRL_FLATPANEL_DITHERING 3 /* RWDG */
-#define NV_CTRL_FLATPANEL_DITHERING_DEFAULT 0
+#define NV_CTRL_FLATPANEL_DITHERING_DISABLED 0
#define NV_CTRL_FLATPANEL_DITHERING_ENABLED 1
-#define NV_CTRL_FLATPANEL_DITHERING_DISABLED 2
/*
@@ -320,7 +320,12 @@
#define NV_CTRL_STEREO_BLUELINE 2
#define NV_CTRL_STEREO_DIN 3
#define NV_CTRL_STEREO_TWINVIEW 4
-
+#define NV_CTRL_STEREO_VERTICAL_INTERLACED 5
+#define NV_CTRL_STEREO_COLOR_INTERLACED 6
+#define NV_CTRL_STEREO_HORIZONTAL_INTERLACED 7
+#define NV_CTRL_STEREO_CHECKERBOARD_PATTERN 8
+#define NV_CTRL_STEREO_INVERSE_CHECKERBOARD_PATTERN 9
+#define NV_CTRL_STEREO_3D_VISION 10
/*
* NV_CTRL_EMULATE - controls OpenGL software emulation of future
@@ -995,6 +1000,12 @@
* of the 32-63 VIDEO_FORMATS are valid, and query the ValidValues of
* NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3 to check which of the 64-95
* VIDEO_FORMATS are valid.
+ *
+ * Note: Setting this attribute on a GVI device may also result in the
+ * following NV-CONTROL attributes being reset on that device (to
+ * ensure the configuration remains valid):
+ * NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT
+ * NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING
*/
#define NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT 70 /* RW--I */
@@ -1763,8 +1774,9 @@
* NV_CTRL_INITIAL_PIXMAP_PLACEMENT - Controls where X pixmaps are initially
* created.
*
- * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_FORCE_SYSMEM causes to pixmaps to stay in
- * system memory.
+ * NV_CTRL_INITIAL_PIXMAP_PLACEMENT_FORCE_SYSMEM causes pixmaps to stay in
+ * system memory. These pixmaps can't be accelerated by the NVIDIA driver; this
+ * will cause blank windows if used with an OpenGL compositing manager.
* NV_CTRL_INITIAL_PIXMAP_PLACEMENT_SYSMEM creates pixmaps in system memory
* initially, but allows them to migrate to video memory.
* NV_CTRL_INITIAL_PIXMAP_PLACEMENT_VIDMEM creates pixmaps in video memory
@@ -2492,6 +2504,11 @@
* NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT - Specify the number of
* bits per component (BPC) of data for the captured stream.
* The stream number should be specified in the "display_mask" parameter.
+ *
+ * Note: Setting this attribute may also result in the following
+ * NV-CONTROL attributes being reset on the GVI device (to ensure
+ * the configuration remains valid):
+ * NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING
*/
#define NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT 310 /* RW-I */
@@ -2526,7 +2543,8 @@
/*
* NV_CTRL_GVI_CHROMA_EXPAND - Enable or disable 4:2:2 -> 4:4:4 chroma
* expansion for the captured stream. This value is ignored when a
- * COMPONENT_SAMPLING format is selected that does not use chroma subsampling.
+ * COMPONENT_SAMPLING format is selected that does not use chroma subsampling,
+ * or if a BITS_PER_COMPONENT value is selected that is not supported.
* The stream number should be specified in the "display_mask" parameter.
*/
@@ -2806,7 +2824,6 @@
*/
#define NV_CTRL_GVI_BOUND_GPU 342 /* R--I */
-
/*
* NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3 - this attribute is only
* intended to be used to query the ValidValues for
@@ -2816,7 +2833,6 @@
#define NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT3 343 /* ---GI */
-
/*
* NV_CTRL_ACCELERATE_TRAPEZOIDS - Toggles RENDER Trapezoid acceleration
*/
@@ -2825,7 +2841,6 @@
#define NV_CTRL_ACCELERATE_TRAPEZOIDS_DISABLE 0
#define NV_CTRL_ACCELERATE_TRAPEZOIDS_ENABLE 1
-
/*
* NV_CTRL_GPU_CORES - Returns number of GPU cores supported by the graphics
* pipeline.
@@ -2833,7 +2848,6 @@
#define NV_CTRL_GPU_CORES 345 /* R--G */
-
/*
* NV_CTRL_GPU_MEMORY_BUS_WIDTH - Returns memory bus bandwidth on the associated
* subdevice.
@@ -2841,7 +2855,6 @@
#define NV_CTRL_GPU_MEMORY_BUS_WIDTH 346 /* R--G */
-
/*
* NV_CTRL_GVI_TEST_MODE - This attribute controls the GVI test mode. When
* enabled, the GVI device will generate fake data as quickly as possible. All
@@ -2855,7 +2868,87 @@
#define NV_CTRL_GVI_TEST_MODE_ENABLE 1
-#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_GVI_TEST_MODE
+/*
+ * NV_CTRL_GPU_SCALING_DEFAULT_TARGET - Returns the default scaling target
+ * for the specified display device.
+ *
+ * NV_CTRL_GPU_SCALING_DEFAULT_METHOD - Returns the default scaling method
+ * for the specified display device.
+ *
+ * The values returned by these attributes are one of the target or method
+ * values defined for the attribute NV_CTRL_GPU_SCALING.
+ */
+#define NV_CTRL_GPU_SCALING_DEFAULT_TARGET 350 /* R-DG */
+#define NV_CTRL_GPU_SCALING_DEFAULT_METHOD 351 /* R-DG */
+
+/*
+ * NV_CTRL_FLATPANEL_DITHERING_MODE - Controls the dithering mode used for
+ * the flatpanel, when NV_CTRL_FLATPANEL_DITHERING is set to ENABLED.
+ *
+ * DYNAMIC_2X2: use a 2x2 matrix to dither from the GPU's pixel
+ * pipeline to the bit depth of the flatpanel. The matrix values
+ * are changed from frame to frame.
+ *
+ * STATIC_2X2: use a 2x2 matrix to dither from the GPU's pixel
+ * pipeline to the bit depth of the flatpanel. The matrix values
+ * do not change from frame to frame.
+ */
+#define NV_CTRL_FLATPANEL_DITHERING_MODE 352 /* RWDG */
+#define NV_CTRL_FLATPANEL_DITHERING_MODE_DYNAMIC_2X2 0
+#define NV_CTRL_FLATPANEL_DITHERING_MODE_STATIC_2X2 1
+
+/*
+ * NV_CTRL_FLATPANEL_DEFAULT_DITHERING - Returns the default dithering
+ * configuration for the flatpanel. Values returned are those described
+ * for NV_CTRL_FLATPANEL_DITHERING.
+ *
+ * NV_CTRL_FLATPANEL_DEFAULT_DITHERING_MODE - Returns the default dithering
+ * mode for the flatpanel. Values returned are those described for
+ * NV_CTRL_FLATPANEL_DITHERING_MODE.
+ */
+#define NV_CTRL_FLATPANEL_DEFAULT_DITHERING 353 /* R-DG */
+#define NV_CTRL_FLATPANEL_DEFAULT_DITHERING_MODE 354 /* R-DG */
+
+/*
+ * NV_CTRL_THERMAL_SENSOR_READING - Returns the thermal sensor's current
+ * reading.
+ */
+#define NV_CTRL_THERMAL_SENSOR_READING 355 /* R--S */
+
+/*
+ * NV_CTRL_THERMAL_SENSOR_PROVIDER - Returns the hardware device that
+ * provides the thermal sensor.
+ */
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER 356 /* R--S */
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_NONE 0
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_GPU_INTERNAL 1
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_ADM1032 2
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_ADT7461 3
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_MAX6649 4
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_MAX1617 5
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_LM99 6
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_LM89 7
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_LM64 8
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_G781 9
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_ADT7473 10
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_SBMAX6649 11
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_VBIOSEVT 12
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_OS 13
+#define NV_CTRL_THERMAL_SENSOR_PROVIDER_UNKNOWN 0xFFFFFFFF
+
+/*
+ * NV_CTRL_THERMAL_SENSOR_TARGET - Returns what hardware component
+ * the thermal sensor is measuring.
+ */
+#define NV_CTRL_THERMAL_SENSOR_TARGET 357 /* R--S */
+#define NV_CTRL_THERMAL_SENSOR_TARGET_NONE 0
+#define NV_CTRL_THERMAL_SENSOR_TARGET_GPU 1
+#define NV_CTRL_THERMAL_SENSOR_TARGET_MEMORY 2
+#define NV_CTRL_THERMAL_SENSOR_TARGET_POWER_SUPPLY 4
+#define NV_CTRL_THERMAL_SENSOR_TARGET_BOARD 8
+#define NV_CTRL_THERMAL_SENSOR_TARGET_UNKNOWN 0xFFFFFFFF
+
+#define NV_CTRL_LAST_ATTRIBUTE NV_CTRL_THERMAL_SENSOR_TARGET
/**************************************************************************/
@@ -3626,8 +3719,24 @@
#define NV_CTRL_BINARY_DATA_GPUS_USED_BY_LOGICAL_XSCREEN 11 /* R--- */
+/*
+ * NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU - Returns the sensors that
+ * are attached to the given GPU.
+ *
+ * The format of the returned data is:
+ *
+ * 4 CARD32 number of SENSOR
+ * 4 * n CARD32 SENSOR indices
+ *
+ * This attribute can only be queried through XNVCTRLQueryTargetBinaryData()
+ * using a NV_CTRL_TARGET_TYPE_GPU target. This attribute cannot be
+ * queried using a NV_CTRL_TARGET_TYPE_X_SCREEN
+ */
+
+#define NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU 12 /* R--G */
+
#define NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE \
- NV_CTRL_BINARY_DATA_GPUS_USED_BY_LOGICAL_XSCREEN
+ NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU
/**************************************************************************/
@@ -3806,6 +3915,13 @@
* Upon successful configuration or querying of this attribute, a string
* representing the current topology for all known streams on the device
* will be returned. On failure, NULL is returned.
+ *
+ * Note: Setting this attribute may also result in the following
+ * NV-CONTROL attributes being reset on the GVI device (to ensure
+ * the configuration remains valid):
+ * NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT
+ * NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT
+ * NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING
*/
#define NV_CTRL_STRING_OPERATION_GVI_CONFIGURE_STREAMS 4 /* RW-I */
@@ -3887,6 +4003,7 @@
#define ATTRIBUTE_TYPE_VCSC 0x080
#define ATTRIBUTE_TYPE_GVI 0x100
#define ATTRIBUTE_TYPE_COOLER 0x200
+#define ATTRIBUTE_TYPE_THERMAL_SENSOR 0x400
typedef struct _NVCTRLAttributeValidValues {
int type;
diff --git a/src/libXNVCtrl/nv_control.h b/src/libXNVCtrl/nv_control.h
index 2755387..97229f9 100644
--- a/src/libXNVCtrl/nv_control.h
+++ b/src/libXNVCtrl/nv_control.h
@@ -47,6 +47,7 @@
* 1.21 Added initial 64-bit integer attribute support (read-only)
* 1.22 Added X_nvCtrlQueryValidStringAttributeValues to check
* string attribute permissions.
+ * 1.23 Added SENSOR TargetType
*/
#ifndef __NVCONTROL_H
@@ -57,7 +58,7 @@
#define NV_CONTROL_NAME "NV-CONTROL"
#define NV_CONTROL_MAJOR 1
-#define NV_CONTROL_MINOR 22
+#define NV_CONTROL_MINOR 23
#define X_nvCtrlQueryExtension 0
#define X_nvCtrlIsNv 1
@@ -66,8 +67,8 @@
#define X_nvCtrlQueryStringAttribute 4
#define X_nvCtrlQueryValidAttributeValues 5
#define X_nvCtrlSelectNotify 6
-#define X_nvCtrlSetGvoColorConversion_deprecated 7
-#define X_nvCtrlQueryGvoColorConversion_deprecated 8
+#define X_nvCtrlSetGvoColorConversionDeprecated 7
+#define X_nvCtrlQueryGvoColorConversionDeprecated 8
#define X_nvCtrlSetStringAttribute 9
/* STUB X_nvCtrlQueryDDCCILutSize 10 */
/* STUB X_nvCtrlQueryDDCCISinglePointLutOperation 11 */
diff --git a/src/libXNVCtrlAttributes/Makefile.inc b/src/libXNVCtrlAttributes/Makefile.inc
deleted file mode 100644
index 7c2a87c..0000000
--- a/src/libXNVCtrlAttributes/Makefile.inc
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (C) 2004 NVIDIA Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of Version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
-# of the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the:
-#
-# Free Software Foundation, Inc.
-# 59 Temple Place - Suite 330
-# Boston, MA 02111-1307, USA
-#
-
-#
-# libXNVCtrlAttributes files
-#
-
-SRC += \
- NvCtrlAttributes.c \
- NvCtrlAttributesNvControl.c \
- NvCtrlAttributesVidMode.c \
- NvCtrlAttributesXv.c \
- NvCtrlAttributesGlx.c \
- NvCtrlAttributesXrandr.c
-
-EXTRA_DIST += \
- Makefile.inc \
- NvCtrlAttributes.h \
- NvCtrlAttributesPrivate.h
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributesGlx.c b/src/libXNVCtrlAttributes/NvCtrlAttributesGlx.c
index 470ab44..0f38ba7 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributesGlx.c
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributesGlx.c
@@ -629,8 +629,8 @@ NvCtrlGlxGetVoidAttribute (NvCtrlAttributePrivateHandle *h,
* OpenGL/GLX function.
*
*
- * But first, the following macros are used to setup a rendering context
- * such that valid information may be retrieved. (Having a context is
+ * But first, the following helper function may be used to set up a rendering
+ * context such that valid information may be retrieved. (Having a context is
* required for getting OpenGL and 'Direct rendering' information.)
*
* NOTE: A seperate display connection is used to avoid the dependence on
@@ -640,35 +640,14 @@ NvCtrlGlxGetVoidAttribute (NvCtrlAttributePrivateHandle *h,
*
****/
-/* Macros to set up/tear down a rendering context */
-
-#define GET_CONTEXT() \
- root = RootWindow(h->dpy, h->target_id); \
- visinfo = __libGL->glXChooseVisual(h->dpy, h->target_id, \
- &(attribListSgl[0])); \
- win_attr.background_pixel = 0; \
- win_attr.border_pixel = 0; \
- win_attr.colormap = XCreateColormap(h->dpy, root, \
- visinfo->visual, AllocNone); \
- win_attr.event_mask = 0; \
- mask = CWBackPixel | CWBorderPixel | CWColormap | \
- CWEventMask; \
- win = XCreateWindow(h->dpy, root, 0, 0, width, height, \
- 0, visinfo->depth, InputOutput, \
- visinfo->visual, mask, &win_attr); \
- ctx = __libGL->glXCreateContext(h->dpy, visinfo, NULL, True ); \
- if ( ctx ) { __libGL->glXMakeCurrent(h->dpy, win, ctx); }
-
-#define CLEAN_CONTEXT() \
- if ( visinfo ) { XFree(visinfo); } \
- if ( ctx ) { __libGL->glXDestroyContext(h->dpy, ctx); } \
- if ( win ) { XDestroyWindow(h->dpy, win); }
-
-
-ReturnStatus
-NvCtrlGlxGetStringAttribute (NvCtrlAttributePrivateHandle *h,
- unsigned int display_mask,
- int attr, char **ptr)
+/*
+ * Helper function for NvCtrlGlxGetStringAttribute for queries that require a
+ * current context. If getDirect is true, then check if we can create a direct
+ * GLX context and return "Yes" or "No". Otherwise, create a context and query
+ * the GLX implementation for the string specified in prop.
+ */
+static const char *getString(NvCtrlAttributePrivateHandle *h,
+ Bool getDirect, GLenum prop)
{
const char *str = NULL;
@@ -687,7 +666,53 @@ NvCtrlGlxGetStringAttribute (NvCtrlAttributePrivateHandle *h,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None };
-
+ root = RootWindow(h->dpy, h->target_id);
+ visinfo = __libGL->glXChooseVisual(h->dpy, h->target_id,
+ &(attribListSgl[0]));
+ if (!visinfo) {
+ return NULL;
+ }
+ win_attr.background_pixel = 0;
+ win_attr.border_pixel = 0;
+ win_attr.colormap = XCreateColormap(h->dpy, root,
+ visinfo->visual, AllocNone);
+ win_attr.event_mask = 0;
+ mask = CWBackPixel | CWBorderPixel | CWColormap |
+ CWEventMask;
+ win = XCreateWindow(h->dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &win_attr);
+ ctx = __libGL->glXCreateContext(h->dpy, visinfo, NULL, True );
+ if ( ctx ) {
+ __libGL->glXMakeCurrent(h->dpy, win, ctx);
+ }
+
+ if (getDirect) {
+ str = ((*(__libGL->glXIsDirect))(h->dpy, ctx)) ? "Yes" : "No";
+ } else {
+ str = (const char *) (* (__libGL->glGetString))(prop);
+ }
+
+ if (visinfo) {
+ XFree(visinfo);
+ }
+ if (ctx) {
+ __libGL->glXDestroyContext(h->dpy, ctx);
+ }
+ if (win) {
+ XDestroyWindow(h->dpy, win);
+ }
+
+ return str;
+}
+
+ReturnStatus
+NvCtrlGlxGetStringAttribute (NvCtrlAttributePrivateHandle *h,
+ unsigned int display_mask,
+ int attr, char **ptr)
+{
+ const char *str = NULL;
+
/* Validate */
if ( !h || !h->dpy || h->target_type != NV_CTRL_TARGET_TYPE_X_SCREEN ) {
return NvCtrlBadHandle;
@@ -704,9 +729,7 @@ NvCtrlGlxGetStringAttribute (NvCtrlAttributePrivateHandle *h,
switch (attr) {
case NV_CTRL_STRING_GLX_DIRECT_RENDERING:
- GET_CONTEXT();
- str = ( (* (__libGL->glXIsDirect))(h->dpy, ctx) ) ? "Yes" : "No";
- CLEAN_CONTEXT();
+ str = getString(h, True, 0);
break;
case NV_CTRL_STRING_GLX_GLX_EXTENSIONS:
str = (* (__libGL->glXQueryExtensionsString))(h->dpy, h->target_id);
@@ -733,24 +756,16 @@ NvCtrlGlxGetStringAttribute (NvCtrlAttributePrivateHandle *h,
str = (* (__libGL->glXGetClientString))(h->dpy, GLX_EXTENSIONS);
break;
case NV_CTRL_STRING_GLX_OPENGL_VENDOR:
- GET_CONTEXT();
- str = (const char *) (* (__libGL->glGetString))(GL_VENDOR);
- CLEAN_CONTEXT();
+ str = getString(h, False, GL_VENDOR);
break;
case NV_CTRL_STRING_GLX_OPENGL_RENDERER:
- GET_CONTEXT();
- str = (const char *) (* (__libGL->glGetString))(GL_RENDERER);
- CLEAN_CONTEXT();
+ str = getString(h, False, GL_RENDERER);
break;
case NV_CTRL_STRING_GLX_OPENGL_VERSION:
- GET_CONTEXT();
- str = (const char *) (* (__libGL->glGetString))(GL_VERSION);
- CLEAN_CONTEXT();
+ str = getString(h, False, GL_VERSION);
break;
case NV_CTRL_STRING_GLX_OPENGL_EXTENSIONS:
- GET_CONTEXT();
- str = (const char *) (* (__libGL->glGetString))(GL_EXTENSIONS);
- CLEAN_CONTEXT();
+ str = getString(h, False, GL_EXTENSIONS);
break;
default:
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h b/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h
index f82089e..ea4a38d 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributesPrivate.h
@@ -136,8 +136,8 @@ struct __NvCtrlXvBlitterAttributes {
};
struct __NvCtrlXvAttributes {
- int major_version;
- int minor_version;
+ unsigned int major_version;
+ unsigned int minor_version;
NvCtrlXvOverlayAttributes *overlay; /* XVideo info (overlay) */
NvCtrlXvTextureAttributes *texture; /* XVideo info (texture) */
NvCtrlXvBlitterAttributes *blitter; /* XVideo info (blitter) */
diff --git a/src/libXNVCtrlAttributes/src.mk b/src/libXNVCtrlAttributes/src.mk
new file mode 100644
index 0000000..e8f9609
--- /dev/null
+++ b/src/libXNVCtrlAttributes/src.mk
@@ -0,0 +1,14 @@
+#
+# files in the src/libXNVCtrlAttributes directory of nvidia-settings
+#
+
+LIB_XNVCTRL_ATTRIBUTES_SRC += NvCtrlAttributes.c
+LIB_XNVCTRL_ATTRIBUTES_SRC += NvCtrlAttributesNvControl.c
+LIB_XNVCTRL_ATTRIBUTES_SRC += NvCtrlAttributesVidMode.c
+LIB_XNVCTRL_ATTRIBUTES_SRC += NvCtrlAttributesXv.c
+LIB_XNVCTRL_ATTRIBUTES_SRC += NvCtrlAttributesGlx.c
+LIB_XNVCTRL_ATTRIBUTES_SRC += NvCtrlAttributesXrandr.c
+
+LIB_XNVCTRL_ATTRIBUTES_EXTRA_DIST += NvCtrlAttributes.h
+LIB_XNVCTRL_ATTRIBUTES_EXTRA_DIST += NvCtrlAttributesPrivate.h
+LIB_XNVCTRL_ATTRIBUTES_EXTRA_DIST += src.mk
diff --git a/src/parse.c b/src/parse.c
index 1fd1912..338b512 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -153,7 +153,7 @@ AttributeTableEntry attributeTable[] = {
{ "PCIDevice", NV_CTRL_PCI_DEVICE, N, "Returns the PCI device number for the specified device." },
{ "PCIFunc", NV_CTRL_PCI_FUNCTION, N, "Returns the PCI function number for the specified device." },
{ "PCIID", NV_CTRL_PCI_ID, N|P, "Returns the PCI vendor and device ID of the specified device." },
- { "PCIEGen", NV_CTRL_GPU_PCIE_GENERATION, N, "Returns the current PCI-E Bus Generation." },
+ { "PCIEGen", NV_CTRL_GPU_PCIE_GENERATION, N, "Returns the current PCI-E Bus Generation." },
{ "GPUErrors", NV_CTRL_NUM_GPU_ERRORS_RECOVERED, N, "Returns the number of GPU errors occurred." },
{ "GPUPowerSource", NV_CTRL_GPU_POWER_SOURCE, N, "Reports the type of power source of the GPU." },
{ "GPUCurrentPerfMode", NV_CTRL_GPU_CURRENT_PERFORMANCE_MODE, N, "Reports the current performance mode of the GPU driving the X screen. Running a 3D app, for example, will change this performance mode if Adaptive Clocking is enabled." },
@@ -173,7 +173,9 @@ AttributeTableEntry attributeTable[] = {
{ "GPUResetFanSpeed", NV_CTRL_THERMAL_COOLER_LEVEL_SET_DEFAULT, N, "Resets the GPU fan's speed to its default." },
{ "GPUFanControlType", NV_CTRL_THERMAL_COOLER_CONTROL_TYPE, N, "Returns how the GPU fan is controlled. '1' means the fan can only be toggled on and off; '2' means the fan has variable speed. '0' means the fan is restricted and cannot be adjusted under end user control." },
{ "GPUFanTarget", NV_CTRL_THERMAL_COOLER_TARGET, N, "Returns the objects the fan cools. '1' means the GPU, '2' means video memory, '4' means the power supply, and '7' means all of the above." },
-
+ { "ThermalSensorReading", NV_CTRL_THERMAL_SENSOR_READING, N, "Returns the thermal sensor's current reading." },
+ { "ThermalSensorProvider", NV_CTRL_THERMAL_SENSOR_PROVIDER, N, "Returns the hardware device that provides the thermal sensor." },
+ { "ThermalSensorTarget", NV_CTRL_THERMAL_SENSOR_TARGET, N, "Returns what hardware component the thermal sensor is measuring." },
/* Framelock */
{ "FrameLockAvailable", NV_CTRL_FRAMELOCK, N|F|G, "Returns whether the underlying GPU supports Frame Lock. All of the other frame lock attributes are only applicable if this attribute is enabled (Supported)." },
{ "FrameLockMaster", NV_CTRL_FRAMELOCK_MASTER, N|F|G|D, "Get/set which display device to use as the frame lock master for the entire sync group. Note that only one node in the sync group should be configured as the master." },
@@ -267,7 +269,8 @@ AttributeTableEntry attributeTable[] = {
{ "RedGamma", GAMMA_VALUE|RED_CHANNEL, C|G, "Controls the gamma of the color red in the display." },
{ "GreenGamma", GAMMA_VALUE|GREEN_CHANNEL, C|G, "Controls the gamma of the color green in the display." },
{ "BlueGamma", GAMMA_VALUE|BLUE_CHANNEL, C|G, "Controls the gamma of the color blue in the display." },
- { "FlatpanelDithering", NV_CTRL_FLATPANEL_DITHERING, 0, "This is the current state of flat panel dithering. This attribute has been deprecated." },
+ { "FlatPanelDithering", NV_CTRL_FLATPANEL_DITHERING, 0, "Controls the FlatPanel dithering: enabled (1), disabled (0)." },
+ { "FlatPanelDitheringMode", NV_CTRL_FLATPANEL_DITHERING_MODE, 0, "Controls the FlatPanel dithering mode when FlatPanelDithering=1; temporally static dithering pattern (1), temporally dynamic dithering pattern (0)." },
{ "DigitalVibrance", NV_CTRL_DIGITAL_VIBRANCE, 0, "Sets the digital vibrance level of the display device." },
{ "ImageSharpening", NV_CTRL_IMAGE_SHARPENING, 0, "Adjusts the sharpness of the display's image quality by amplifying high frequency content." },
{ "ImageSharpeningDefault", NV_CTRL_IMAGE_SHARPENING_DEFAULT, 0, "Returns default value of image sharpening." },
@@ -277,6 +280,8 @@ AttributeTableEntry attributeTable[] = {
{ "FlatpanelBestFitResolution", NV_CTRL_FLATPANEL_BEST_FIT_RESOLUTION, N|P, "Returns the dimensions of the resolution, selected by the X driver, from the DFP's EDID that most closely matches the frontend resolution of the current mode. The best fit resolution is selected on a per-mode basis. This attribute is only valid for flat panel (DFP) display devices. This attribute is a packed integer; the width is packed in the upper 16-bits and the height is packed in the lower 16-bits." },
{ "DFPScalingActive", NV_CTRL_DFP_SCALING_ACTIVE, N, "Returns the current state of DFP scaling. DFP scaling is mode-specific (meaning it may vary depending on which mode is currently set). DFP scaling is active if the GPU is set to scale to the best fit resolution (GPUScaling is set to use FlatpanelBestFitResolution) and the best fit and native resolutions are different." },
{ "GPUScaling", NV_CTRL_GPU_SCALING, P, "Controls what the GPU scales to and how. This attribute is a packed integer; the scaling target (native/best fit) is packed in the upper 16-bits and the scaling method is packed in the lower 16-bits." },
+ { "GPUScalingDefaultTarget", NV_CTRL_GPU_SCALING_DEFAULT_TARGET, 0, "Returns the default gpu scaling target for the Flatpanel." },
+ { "GPUScalingDefaultMethod", NV_CTRL_GPU_SCALING_DEFAULT_METHOD, 0, "Returns the default gpu scaling method for the Flatpanel." },
{ "GPUScalingActive", NV_CTRL_GPU_SCALING_ACTIVE, N, "Returns the current state of GPU scaling. GPU scaling is mode-specific (meaning it may vary depending on which mode is currently set). GPU scaling is active if the frontend timing (current resolution) is different than the target resolution. The target resolution is either the native resolution of the flat panel or the best fit resolution supported by the flat panel. What (and how) the GPU should scale to is controlled through the GPUScaling attribute." },
{ "RefreshRate", NV_CTRL_REFRESH_RATE, N|H, "Returns the refresh rate of the specified display device in cHz (Centihertz) (to get the refresh rate in Hz, divide the returned value by 100)." },
{ "RefreshRate3", NV_CTRL_REFRESH_RATE_3, N|K, "Returns the refresh rate of the specified display device in mHz (Millihertz) (to get the refresh rate in Hz, divide the returned value by 1000)." },
@@ -329,7 +334,7 @@ AttributeTableEntry attributeTable[] = {
* about.
*/
-#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_GVI_TEST_MODE
+#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_THERMAL_SENSOR_TARGET
#warning "Have you forgotten to add a new integer attribute to attributeTable?"
#endif
@@ -390,6 +395,14 @@ TargetTypeEntry targetTypeTable[] = {
NV_FALSE, /* uses_display_devices */
1, 20 }, /* required major,minor protocol rev */
+ { "Thermal Sensor", /* name */
+ "thermalsensor", /* parsed_name */
+ THERMAL_SENSOR_TARGET, /* target_index */
+ NV_CTRL_TARGET_TYPE_THERMAL_SENSOR, /* nvctrl */
+ ATTRIBUTE_TYPE_THERMAL_SENSOR, /* permission_bit */
+ NV_FALSE, /* uses_display_devices */
+ 1, 23 }, /* required major,minor protocol rev */
+
{ NULL, NULL, 0, 0, 0 },
};
@@ -1650,11 +1663,11 @@ const char *parse_read_display_name(const char *str, unsigned int *mask)
* "MIN"
*
**/
-int parse_read_float_range(char *str, float *min, float *max)
+int parse_read_float_range(const char *str, float *min, float *max)
{
if (!str) return 0;
- str = (char *)parse_skip_whitespace(str);
+ str = parse_skip_whitespace(str);
*min = atof(str);
str = strstr(str, "-");
if (!str) {
diff --git a/src/parse.h b/src/parse.h
index 2ae9ff6..403782d 100644
--- a/src/parse.h
+++ b/src/parse.h
@@ -148,7 +148,8 @@ extern AttributeTableEntry attributeTable[];
#define VCS_TARGET 3
#define GVI_TARGET 4
#define COOLER_TARGET 5
-#define MAX_TARGET_TYPES 6
+#define THERMAL_SENSOR_TARGET 6
+#define MAX_TARGET_TYPES 7
@@ -316,7 +317,7 @@ const char *parse_read_integer_pair(const char *str,
const char separator, int *a, int *b);
const char *parse_read_name(const char *str, char **name, char term);
const char *parse_read_display_name(const char *str, unsigned int *mask);
-int parse_read_float_range(char *str, float *min, float *max);
+int parse_read_float_range(const char *str, float *min, float *max);
int count_number_of_bits(unsigned int mask);
/* Token parsing functions */
diff --git a/src/query-assign.c b/src/query-assign.c
index 7502b75..64f6d64 100644
--- a/src/query-assign.c
+++ b/src/query-assign.c
@@ -419,6 +419,11 @@ static int process_attribute_queries(int num, char **queries,
continue;
}
+ if (nv_strcasecmp(queries[query], "thermalsensors")) {
+ query_all_targets(display_name, THERMAL_SENSOR_TARGET);
+ continue;
+ }
+
/* call the parser to parse queries[query] */
ret = nv_parse_attribute_string(queries[query], NV_PARSER_QUERY, &a);
@@ -1238,6 +1243,7 @@ static int print_target_connections(CtrlHandles *h,
get_vcs_name(h->targets[target_index].t[ pData[i] ].h);
break;
+ case THERMAL_SENSOR_TARGET:
case COOLER_TARGET:
case FRAMELOCK_TARGET:
case GVI_TARGET:
@@ -1342,8 +1348,13 @@ static int query_all_targets(const char *display_name, const int target_index)
t = &h->targets[target_index].t[i];
str = NULL;
+ if (target_index == THERMAL_SENSOR_TARGET) {
+ /* for sensor, create the product name */
+
+ product_name = malloc(32);
+ snprintf(product_name, 32, "Thermal Sensor %d", i);
- if (target_index == COOLER_TARGET) {
+ } else if (target_index == COOLER_TARGET) {
/* for cooler, create the product name */
@@ -1418,6 +1429,9 @@ static int query_all_targets(const char *display_name, const int target_index)
print_target_connections
(h, t, NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU,
COOLER_TARGET);
+ print_target_connections
+ (h, t, NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU,
+ THERMAL_SENSOR_TARGET);
break;
case X_SCREEN_TARGET:
@@ -1444,6 +1458,12 @@ static int query_all_targets(const char *display_name, const int target_index)
COOLER_TARGET);
break;
+ case THERMAL_SENSOR_TARGET:
+ print_target_connections
+ (h, t, NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU,
+ THERMAL_SENSOR_TARGET);
+ break;
+
default:
break;
}
diff --git a/src/src.mk b/src/src.mk
new file mode 100644
index 0000000..2711f64
--- /dev/null
+++ b/src/src.mk
@@ -0,0 +1,23 @@
+#
+# files in the src directory of nvidia-settings
+#
+
+SRC_SRC += command-line.c
+SRC_SRC += config-file.c
+SRC_SRC += lscf.c
+SRC_SRC += msg.c
+SRC_SRC += nvidia-settings.c
+SRC_SRC += parse.c
+SRC_SRC += query-assign.c
+SRC_SRC += nvgetopt.c
+SRC_SRC += glxinfo.c
+
+SRC_EXTRA_DIST += src.mk
+SRC_EXTRA_DIST += command-line.h
+SRC_EXTRA_DIST += config-file.h
+SRC_EXTRA_DIST += lscf.h
+SRC_EXTRA_DIST += msg.h
+SRC_EXTRA_DIST += parse.h
+SRC_EXTRA_DIST += query-assign.h
+SRC_EXTRA_DIST += nvgetopt.h
+SRC_EXTRA_DIST += glxinfo.h
diff --git a/src/xpm_data/Makefile.inc b/src/xpm_data/Makefile.inc
deleted file mode 100644
index 3221772..0000000
--- a/src/xpm_data/Makefile.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
-# and Linux systems.
-#
-# Copyright (C) 2004 NVIDIA Corporation.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of Version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Version 2
-# of the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the:
-#
-# Free Software Foundation, Inc.
-# 59 Temple Place - Suite 330
-# Boston, MA 02111-1307, USA
-#
-
-#
-# src files and headers
-#
-
-EXTRA_DIST += \
- Makefile.inc \
- blue_xpm.h \
- green_xpm.h \
- red_xpm.h \
- rgb_xpm.h
-
-dist_list::
- @ echo $(SRC) $(EXTRA_DIST)
diff --git a/src/xpm_data/src.mk b/src/xpm_data/src.mk
new file mode 100644
index 0000000..360d582
--- /dev/null
+++ b/src/xpm_data/src.mk
@@ -0,0 +1,11 @@
+#
+# files in the src/xpm_data directory of nvidia-settings
+#
+
+LIB_XPM_DATA_SRC +=
+
+LIB_XPM_DATA_EXTRA_DIST += blue_xpm.h
+LIB_XPM_DATA_EXTRA_DIST += green_xpm.h
+LIB_XPM_DATA_EXTRA_DIST += red_xpm.h
+LIB_XPM_DATA_EXTRA_DIST += rgb_xpm.h
+LIB_XPM_DATA_EXTRA_DIST += src.mk
diff --git a/utils.mk b/utils.mk
new file mode 100644
index 0000000..f14772c
--- /dev/null
+++ b/utils.mk
@@ -0,0 +1,293 @@
+#
+# Copyright (C) 2008 NVIDIA Corporation
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the:
+#
+# Free Software Foundation, Inc.
+# 59 Temple Place - Suite 330
+# Boston, MA 02111-1307, USA
+#
+#
+# utils.mk: common Makefile fragment used by nvidia-xconfig,
+# nvidia-installer, and nvidia-settings
+#
+
+
+
+##############################################################################
+# The calling Makefile (when building as part of the NVIDIA graphics
+# driver) may export any of the following variables; we assign default
+# values if they are not exported by the caller
+##############################################################################
+
+CC ?= gcc
+LD ?= ld
+CFLAGS ?= -Wall -fno-strict-aliasing
+CFLAGS += -O2 -fno-omit-frame-pointer
+CC_ONLY_CFLAGS ?=
+LDFLAGS ?=
+BIN_LDFLAGS ?=
+
+HOST_CC ?= $(CC)
+HOST_LD ?= $(LD)
+HOST_CFLAGS ?= $(CFLAGS)
+HOST_LDFLAGS ?= $(LDFLAGS)
+HOST_BIN_LDFLAGS ?=
+
+ifeq ($(DEBUG),1)
+ STRIP_CMD ?= true
+ CFLAGS += -O0 -g
+else
+ STRIP_CMD ?= strip
+endif
+
+INSTALL ?= install
+INSTALL_BIN_ARGS ?= -m 755
+INSTALL_DOC_ARGS ?= -m 644
+
+M4 ?= m4
+SED ?= sed
+M4 ?= m4
+ECHO ?= echo
+PRINTF ?= printf
+MKDIR ?= mkdir -p
+RM ?= rm -f
+TOUCH ?= touch
+WHOAMI ?= whoami
+HOSTNAME_CMD ?= hostname
+DATE ?= date
+GZIP_CMD ?= gzip
+
+NV_AUTO_DEPEND ?= 1
+NV_VERBOSE ?= 0
+
+ifndef TARGET_OS
+ TARGET_OS := $(shell uname)
+endif
+
+ifeq ($(TARGET_OS),Linux)
+ CFLAGS += -DNV_LINUX
+endif
+
+ifeq ($(TARGET_OS),FreeBSD)
+ CFLAGS += -DNV_BSD
+endif
+
+ifeq ($(TARGET_OS),SunOS)
+ CFLAGS += -DNV_SUNOS
+endif
+
+ifndef TARGET_ARCH
+ TARGET_ARCH := $(shell uname -m)
+ TARGET_ARCH := $(subst i386,x86,$(TARGET_ARCH))
+ TARGET_ARCH := $(subst i486,x86,$(TARGET_ARCH))
+ TARGET_ARCH := $(subst i586,x86,$(TARGET_ARCH))
+ TARGET_ARCH := $(subst i686,x86,$(TARGET_ARCH))
+endif
+
+OUTPUTDIR ?= _out/$(TARGET_OS)_$(TARGET_ARCH)
+
+NV_QUIET_COMMAND_REMOVED_TARGET_PREFIX ?=
+
+CFLAGS += $(CC_ONLY_CFLAGS)
+
+
+##############################################################################
+# define variables used when installing the open source utilities from
+# the source tarball
+##############################################################################
+
+prefix = /usr/local
+
+exec_prefix = $(prefix)
+bindir = $(exec_prefix)/bin
+mandir = $(exec_prefix)/share/man/man1
+
+
+##############################################################################
+# default build rule, so that nothing here in utils.mk accidentally
+# gets selected as the default rule
+##############################################################################
+
+default build: all
+
+
+##############################################################################
+# get the definition of NVIDIA_VERSION from version.mk
+#
+# version.mk may be in one of two places: either in $(OUTPUTDIR) when
+# building as part of the NVIDIA driver build, or directly in the
+# source directory when building from the source tarball
+##############################################################################
+
+include $(wildcard $(OUTPUTDIR)/version.mk version.mk)
+
+
+##############################################################################
+# to generate the dependency files, use the compiler's "-MM" option to
+# generate output of the form "foo.o : foo.c foo.h"; then, use sed to
+# wrap the prerequisites with $(wildcard ...); the wildcard function
+# serves as an existence filter, so that files that are later removed
+# from the build do not cause stale references. Also, "-MM" will
+# cause the compiler to name the target as if it were in the current
+# directory ("foo.o: "); use sed to rename the target in the output
+# directory ("_out/Linux_x86/foo.o: ") so that the target actually
+# applies to the object files produced in the build.
+#
+# Arguments:
+# $(1): CC command (CC or HOST_CC)
+# $(2): object filename
+##############################################################################
+
+ifeq ($(NV_AUTO_DEPEND),1)
+ AUTO_DEP_CMD = && $($(1)) -MM $$(CFLAGS) $$< | $$(SED) \
+ -e "s,: ,: $$$$\(wildcard ," \
+ -e "s,\([^\\]\)$$$$,\1)," \
+ -e "s;^$$(notdir $(2)): ;$(2): ;" \
+ > $$(@:.o=.d)
+else
+ AUTO_DEP_CMD =
+endif
+
+
+##############################################################################
+# echo minimal compile information in the non-NV_VERBOSE case
+#
+# NV_MODULE_LOGGING_NAME can be set to prepend quiet build output with a
+# label of which build component is being built
+##############################################################################
+
+NV_MODULE_LOGGING_NAME ?=
+
+ifeq ($(NV_VERBOSE),0)
+ quiet_cmd = @$(PRINTF) \
+ " $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ]) $(quiet_$(1))\n" \
+ "$(NV_MODULE_LOGGING_NAME)" && $($(1))
+else
+ quiet_cmd = $($(1))
+endif
+
+# define LINK and HOST_LINK to be the same as CC; this is so that,
+# even though we use CC to link programs, we can have a different
+# quiet rule that uses '$@' as it's arg, rather than '$<'
+LINK = $(CC)
+HOST_LINK = $(HOST_CC)
+
+# strip NV_QUIET_COMMAND_REMOVED_TARGET_PREFIX from the target string
+define_quiet_cmd = $(1) $(patsubst $(NV_QUIET_COMMAND_REMOVED_TARGET_PREFIX)/%,%,$(2))
+
+# define the quiet commands:
+quiet_CC = $(call define_quiet_cmd,CC ,$<)
+quiet_HOST_CC = $(call define_quiet_cmd,HOST_CC ,$<)
+quiet_LINK = $(call define_quiet_cmd,LINK ,$@)
+quiet_HOST_LINK = $(call define_quiet_cmd,HOST_LINK ,$@)
+quiet_M4 = $(call define_quiet_cmd,M4 ,$<)
+quiet_STRIP_CMD = $(call define_quiet_cmd,STRIP ,$@)
+
+##############################################################################
+# Tell gmake to delete the target of a rule if it has changed and its
+# commands exit with a nonzero exit status.
+##############################################################################
+.DELETE_ON_ERROR:
+
+
+##############################################################################
+# function to generate a list of object files from their corresponding
+# source files; example usage:
+#
+# OBJS = $(call BUILD_OBJECT_LIST,$(SRC))
+##############################################################################
+
+BUILD_OBJECT_LIST = \
+ $(addprefix $(OUTPUTDIR)/,$(notdir $(addsuffix .o,$(basename $(1)))))
+
+
+##############################################################################
+# function to generate a list of dependency files from their
+# corresponding source files; example usage:
+#
+# DEPS = $(call BUILD_DEPENDENCY_LIST,$(SRC))
+##############################################################################
+
+BUILD_DEPENDENCY_LIST = \
+ $(addprefix $(OUTPUTDIR)/,$(notdir $(addsuffix .d,$(basename $(1)))))
+
+
+##############################################################################
+# functions to define a rule to build an object file; the first
+# argument is either CC or HOST_CC, the second argument is the source
+# file to compile, and the third argument (_WITH_OBJECT_NAME-only) is
+# the object filename to produce. Example usage:
+#
+# $(eval $(call DEFINE_OBJECT_RULE,CC,foo.c))
+#
+# Note this also attempts to include the dependency file for this
+# source file.
+#
+# The DEFINE_OBJECT_RULE is functionally equivalent to
+# DEFINE_OBJECT_RULE_WITH_OBJECT_NAME, but infers the object file name
+# from the source file name (this is normally what you want).
+##############################################################################
+
+define DEFINE_OBJECT_RULE_WITH_OBJECT_NAME
+ $(3): $(2)
+ @$(MKDIR) $(OUTPUTDIR)
+ $$(call quiet_cmd,$(1)) -c $$< -o $$@ $$(CFLAGS) \
+ $(call AUTO_DEP_CMD,$(1),$(3))
+
+ -include $$(call BUILD_DEPENDENCY_LIST,$(3))
+
+ # declare empty rule for generating dependency file; we generate the
+ # dependency files implicitly when compiling the source file (see
+ # AUTO_DEP_CMD above), so we don't want gmake to spend time searching
+ # for an explicit rule to generate the dependency file
+ $$(call BUILD_DEPENDENCY_LIST,$(3)): ;
+
+endef
+
+define DEFINE_OBJECT_RULE
+ $$(eval $$(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,$(1),$(2),\
+ $$(call BUILD_OBJECT_LIST,$(2))))
+endef
+
+
+##############################################################################
+# STAMP_C - this is a source file that is generated during the build
+# to capture information about the build environment for the utility.
+#
+# The DEFINE_STAMP_C_RULE function is used to define the rule for
+# generating STAMP_C. First argument is a list of dependencies for
+# STAMP_C (g_stamp.o is filtered out of the list); second argument is
+# the name of the program being built.
+#
+# The includer of utils.mk should add $(STAMP_C) to its list of source
+# files
+##############################################################################
+
+STAMP_C = $(OUTPUTDIR)/g_stamp.c
+
+define DEFINE_STAMP_C_RULE
+
+ $$(STAMP_C): $$(filter-out \
+ $$(call BUILD_OBJECT_LIST,$$(STAMP_C)),$(1)) \
+ $$(wildcard version.mk $$(OUTPUTDIR)/version.mk)
+ @ $$(RM) $$@
+ @ $$(PRINTF) "const char NV_ID[] = \"nvidia id: " >> $$@
+ @ $$(PRINTF) "$(2): " >> $$@
+ @ $$(PRINTF) "version $$(NVIDIA_VERSION) " >> $$@
+ @ $$(PRINTF) "($$(shell $$(WHOAMI))@$$(shell $$(HOSTNAME_CMD))) " >> $$@
+ @ $$(PRINTF) "$$(shell $(DATE))\";\n" >> $$@
+ @ $$(PRINTF) "const char *pNV_ID = NV_ID + 11;\n" >> $$@
+
+endef
diff --git a/version.mk b/version.mk
new file mode 100644
index 0000000..de85e42
--- /dev/null
+++ b/version.mk
@@ -0,0 +1 @@
+NVIDIA_VERSION = 256.25