diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-10-10 18:17:45 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-10-10 18:17:45 +0000 |
commit | 7b2e233a1aad79e446c429576b90e408aa183921 (patch) | |
tree | c38058180347e7afd416f0b8e6607719884c6c44 /driver | |
parent | 9bb462321e220f71af510f09ed719d142dbe0363 (diff) |
update to xf86-video-nv 2.1.15. Tested by espie@ (not better,
but not worse either on his hardware).
Diffstat (limited to 'driver')
37 files changed, 1313 insertions, 728 deletions
diff --git a/driver/xf86-video-nv/ChangeLog b/driver/xf86-video-nv/ChangeLog index 6cef69e66..f055e22e1 100644 --- a/driver/xf86-video-nv/ChangeLog +++ b/driver/xf86-video-nv/ChangeLog @@ -1,3 +1,113 @@ +commit 0250f0d7ebe30368c5a63809ed1f58673493627c +Author: Peter Hutterer <peter.hutterer@who-t.net> +Date: Fri Sep 11 12:24:18 2009 +1000 + + nv 2.1.15 + + Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> + +commit 5486e55c9feb5734b967c2618e0c96cd4a2322ce +Author: Dave Airlie <airlied@redhat.com> +Date: Tue Jul 28 18:37:42 2009 +1000 + + abi: fixup so the define is picked up + +commit 85b5ff3fdf3141ef01604bd7eb8e71e30d24717f +Author: Dave Airlie <airlied@redhat.com> +Date: Tue Jul 28 15:22:40 2009 +1000 + + nv: change to using ABI version check + +commit 445498d2cc977b8c4f22fca881c75637dc7b058a +Author: Dave Airlie <airlied@redhat.com> +Date: Tue Jul 28 13:32:32 2009 +1000 + + nv: update for resources/RAC API removal + +commit 957b8c1a240884b26ee5b91856c251622cc0b2a7 +Author: Peter Hutterer <peter.hutterer@who-t.net> +Date: Thu Jul 16 11:49:24 2009 +1000 + + Update to xextproto 7.1 support. + + DPMS header was split into dpms.h (client) and dpmsconst.h (server). Drivers + need to include dpmsconst.h if xextproto 7.1 is available. + + Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> + +commit e8d4dd85de02c689d3e0cc86a99aae6e61a7d17e +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Thu Jul 9 14:07:09 2009 -0400 + + xf86-video-nv: use XORG_CHANGELOG macro to create ChangeLog. #22611 + + Adding the macro in configure.ac and use it in Makefile.am + Refer to: https://bugs.freedesktop.org/show_bug.cgi?id=22611 + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> + +commit c56b92149c6291e7ef96b30a4fc7bee30073b90c +Author: Aaron Plattner <aplattner@nvidia.com> +Date: Thu Jul 2 12:03:13 2009 -0700 + + Bump to 2.1.14 + +commit 05d2b851b96c2f1b3223f8d5f40b8ee074e5f23f +Author: Aaron Plattner <aplattner@nvidia.com> +Date: Fri Jun 26 17:53:53 2009 -0700 + + More new chips + +commit 68c2914f1775541784e6cf88019960342d8433bc +Author: Aaron Plattner <aplattner@nvidia.com> +Date: Fri Jun 12 17:34:43 2009 -0700 + + Fix modesets on certain GPUs that were broken by the previous commit. + +commit 36eb96854b34bee6b65a2b2d4df25f53b47194e4 +Author: Aaron Plattner <aplattner@nvidia.com> +Date: Wed Jun 10 18:49:32 2009 -0700 + + New chip support. + + Part of the G80DispPreInit change suggested by <shenyn321@hotmail.com>. + +commit 23ca1b0d4324ae65a0c2a39cc877d318063988b1 +Author: Adam Jackson <ajax@redhat.com> +Date: Thu May 28 15:11:20 2009 -0400 + + Remove useless loader symbol lists. + +commit c8d6f7aa7c99a1b71289f8e8e07becc10f61f379 +Author: Aaron Plattner <aplattner@nvidia.com> +Date: Fri May 15 16:24:57 2009 -0700 + + More chip names. + + Add support for the following previously unsupported chips: + * 0x0658 - Quadro FX 380 + * 0x0659 - Quadro FX 580 + * 0x065C - Quadro FX 770M + +commit 29acf7c970d12c1dfd7bf6c7a42fe2448aa7f3d7 +Author: Yinan Shen <shenyn321@gmail.com> +Date: Wed May 6 19:14:33 2009 -0700 + + G80: Fix incorrect I2C port access for ports above 3. + +commit bf18cd4842c33df61b03c3d4e0f00e34485fb957 +Author: Aaron Plattner <aplattner@nvidia.com> +Date: Tue May 5 01:29:08 2009 -0700 + + Fix a dumb typo in the chip name entry for the GeForce 9800 GTX+ + +commit df87eaf191209b0f1619ea74dc9fb0314b6fd288 +Author: Adam Jackson <ajax@redhat.com> +Date: Tue Apr 7 13:40:36 2009 -0400 + + nv 2.1.13 + commit c0cc7d1247798867c695aeddcffe88edacbb6c7c Author: Adam Jackson <ajax@redhat.com> Date: Tue Apr 7 13:34:26 2009 -0400 diff --git a/driver/xf86-video-nv/Makefile.am b/driver/xf86-video-nv/Makefile.am index cdce83e83..089133845 100644 --- a/driver/xf86-video-nv/Makefile.am +++ b/driver/xf86-video-nv/Makefile.am @@ -27,6 +27,6 @@ CLEANFILES = ChangeLog .PHONY: ChangeLog ChangeLog: - (GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) + $(CHANGELOG_CMD) dist-hook: ChangeLog diff --git a/driver/xf86-video-nv/Makefile.in b/driver/xf86-video-nv/Makefile.in index 6f730f033..62ee2dc16 100644 --- a/driver/xf86-video-nv/Makefile.in +++ b/driver/xf86-video-nv/Makefile.in @@ -90,7 +90,6 @@ am__remove_distdir = \ DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ @@ -109,6 +108,7 @@ BUILD_XMODES_TRUE = @BUILD_XMODES_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -133,6 +133,8 @@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ GREP = @GREP@ +HAVE_XEXTPROTO_71_FALSE = @HAVE_XEXTPROTO_71_FALSE@ +HAVE_XEXTPROTO_71_TRUE = @HAVE_XEXTPROTO_71_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -169,6 +171,8 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +XEXT_CFLAGS = @XEXT_CFLAGS@ +XEXT_LIBS = @XEXT_LIBS@ XMODES_CFLAGS = @XMODES_CFLAGS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ @@ -192,6 +196,7 @@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ @@ -667,7 +672,7 @@ uninstall-info: uninstall-info-recursive .PHONY: ChangeLog ChangeLog: - (GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) + $(CHANGELOG_CMD) dist-hook: ChangeLog # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/driver/xf86-video-nv/aclocal.m4 b/driver/xf86-video-nv/aclocal.m4 index 3ec9c2c92..f5c20ec3e 100644 --- a/driver/xf86-video-nv/aclocal.m4 +++ b/driver/xf86-video-nv/aclocal.m4 @@ -7631,7 +7631,7 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -dnl xorg-macros.m4. Generated from xorg-macros.m4.in:xorgversion.m4 by configure. +dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl dnl Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved. dnl @@ -7668,27 +7668,24 @@ dnl of the copyright holder. # your configure.ac with the minimum required version, such as: # XORG_MACROS_VERSION(1.1) # -# To force at least a version with this macro defined, also add: -# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])]) +# To ensure that this macro is defined, also add: +# m4_ifndef([XORG_MACROS_VERSION], +# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])]) # # # See the "minimum version" comment for each macro you use to see what # version you require. -AC_DEFUN([XORG_MACROS_VERSION],[ - [XORG_MACROS_needed_version=$1 - XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'` - XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`] - AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}]) - [XORG_MACROS_version=1.2.1 - XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'` - XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`] - if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then - AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x]) - fi - if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then - AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer]) - fi - AC_MSG_RESULT([yes, $XORG_MACROS_version]) +m4_defun([XORG_MACROS_VERSION],[ +m4_define([vers_have], [1.3.0]) +m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) +m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) +m4_if(m4_cmp(maj_have, maj_needed), 0,, + [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])]) +m4_if(m4_version_compare(vers_have, [$1]), -1, + [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])]) +m4_undefine([vers_have]) +m4_undefine([maj_have]) +m4_undefine([maj_needed]) ]) # XORG_MACROS_VERSION # XORG_PROG_RAWCPP() @@ -7955,7 +7952,7 @@ AC_SUBST(MAKE_HTML) # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ AC_ARG_ENABLE(malloc0returnsnull, - AC_HELP_STRING([--enable-malloc0returnsnull], + AS_HELP_STRING([--enable-malloc0returnsnull], [malloc(0) returns NULL (default: auto)]), [MALLOC_ZERO_RETURNS_NULL=$enableval], [MALLOC_ZERO_RETURNS_NULL=auto]) @@ -8007,7 +8004,7 @@ AC_SUBST([XTMALLOC_ZERO_CFLAGS]) AC_DEFUN([XORG_WITH_LINT],[ # Allow checking code with lint, sparse, etc. -AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint], +AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint], [Use a lint-style source code checker (default: disabled)])], [use_lint=$withval], [use_lint=no]) if test "x$use_lint" = "xyes" ; then @@ -8048,7 +8045,7 @@ AM_CONDITIONAL(LINT, [test x$LINT != xno]) AC_DEFUN([XORG_LINT_LIBRARY],[ AC_REQUIRE([XORG_WITH_LINT]) # Build lint "library" for more indepth checks of programs calling this library -AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library], +AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library], [Create lint library (default: disabled)])], [make_lint_lib=$enableval], [make_lint_lib=no]) if test "x$make_lint_lib" != "xno" ; then @@ -8078,9 +8075,9 @@ if test "x$GCC" = xyes ; then CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ -Wbad-function-cast" - case `gcc -dumpversion` in + case `$CC -dumpversion` in 3.4.* | 4.*) - CWARNFLAGS+=" -Wold-style-definition -Wdeclaration-after-statement" + CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement" ;; esac else @@ -8090,7 +8087,51 @@ else fi fi AC_SUBST(CWARNFLAGS) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) ]) # XORG_CWARNFLAGS + +# XORG_STRICT_OPTION +# ----------------------- +# Minimum version: 1.3.0 +# +# Add configure option to enable strict compilation +AC_DEFUN([XORG_STRICT_OPTION], [ +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_CC_C99]) +AC_REQUIRE([XORG_CWARNFLAGS]) + +AC_ARG_ENABLE(strict-compilation, + AS_HELP_STRING([--enable-strict-compilation], + [Enable all warnings from compiler and make them errors (default: disabled)]), + [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) +if test "x$STRICT_COMPILE" = "xyes"; then + AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) + AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) + if test "x$GCC" = xyes ; then + STRICT_CFLAGS="-pedantic -Werror" + elif test "x$SUNCC" = "xyes"; then + STRICT_CFLAGS="-errwarn" + elif test "x$INTELCC" = "xyes"; then + STRICT_CFLAGS="-Werror" + fi +fi +CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" +AC_SUBST([CWARNFLAGS]) +]) # XORG_STRICT_OPTION + +# XORG_DEFAULT_OPTIONS +# -------------------- +# Minimum version: 1.3.0 +# +# Defines default options for X.Org modules. +# +AC_DEFUN([XORG_DEFAULT_OPTIONS], [ +XORG_CWARNFLAGS +XORG_STRICT_OPTION +XORG_RELEASE_VERSION +XORG_CHANGELOG +XORG_MANPAGE_SECTIONS +]) # XORG_DEFAULT_OPTIONS dnl Copyright 2005 Red Hat, Inc dnl dnl Permission to use, copy, modify, distribute, and sell this software and its @@ -8125,7 +8166,7 @@ dnl AC_DEFUN([XORG_RELEASE_VERSION],[ AC_ARG_WITH(release-version, - AC_HELP_STRING([--with-release-version=STRING], + AS_HELP_STRING([--with-release-version=STRING], [Use release version string in package name]), [RELEASE_VERSION="$withval"], [RELEASE_VERSION=""]) diff --git a/driver/xf86-video-nv/compat/Makefile.in b/driver/xf86-video-nv/compat/Makefile.in index dba8b5923..6f37b3108 100644 --- a/driver/xf86-video-nv/compat/Makefile.in +++ b/driver/xf86-video-nv/compat/Makefile.in @@ -65,6 +65,7 @@ BUILD_XMODES_TRUE = @BUILD_XMODES_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -89,6 +90,8 @@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ GREP = @GREP@ +HAVE_XEXTPROTO_71_FALSE = @HAVE_XEXTPROTO_71_FALSE@ +HAVE_XEXTPROTO_71_TRUE = @HAVE_XEXTPROTO_71_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -125,6 +128,8 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +XEXT_CFLAGS = @XEXT_CFLAGS@ +XEXT_LIBS = @XEXT_LIBS@ XMODES_CFLAGS = @XMODES_CFLAGS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ @@ -148,6 +153,7 @@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ diff --git a/driver/xf86-video-nv/compat/modes/xf86Crtc.c b/driver/xf86-video-nv/compat/modes/xf86Crtc.c index ad6ca9876..8d636af48 100644 --- a/driver/xf86-video-nv/compat/modes/xf86Crtc.c +++ b/driver/xf86-video-nv/compat/modes/xf86Crtc.c @@ -40,8 +40,7 @@ #include "xf86Priv.h" #include "xf86RandR12.h" #include "X11/extensions/render.h" -#define DPMS_SERVER -#include "X11/extensions/dpms.h" +#include "X11/extensions/dpmsconst.h" #include "X11/Xatom.h" #ifdef RENDER #include "picturestr.h" @@ -55,7 +54,7 @@ int xf86CrtcConfigPrivateIndex = -1; -_X_EXPORT void +void xf86CrtcConfigInit (ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec *funcs) { @@ -70,7 +69,7 @@ xf86CrtcConfigInit (ScrnInfoPtr scrn, scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config; } -_X_EXPORT void +void xf86CrtcSetSizeRange (ScrnInfoPtr scrn, int minWidth, int minHeight, int maxWidth, int maxHeight) @@ -86,7 +85,7 @@ xf86CrtcSetSizeRange (ScrnInfoPtr scrn, /* * Crtc functions */ -_X_EXPORT xf86CrtcPtr +xf86CrtcPtr xf86CrtcCreate (ScrnInfoPtr scrn, const xf86CrtcFuncsRec *funcs) { @@ -117,6 +116,16 @@ xf86CrtcCreate (ScrnInfoPtr scrn, crtc->desiredTransformPresent = FALSE; memset (&crtc->bounds, '\0', sizeof (crtc->bounds)); + /* Preallocate gamma at a sensible size. */ + crtc->gamma_size = 256; + crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof (CARD16)); + if (!crtc->gamma_red) { + xfree (crtc); + return NULL; + } + crtc->gamma_green = crtc->gamma_red + crtc->gamma_size; + crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size; + if (xf86_config->crtc) crtcs = xrealloc (xf86_config->crtc, (xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr)); @@ -132,7 +141,7 @@ xf86CrtcCreate (ScrnInfoPtr scrn, return crtc; } -_X_EXPORT void +void xf86CrtcDestroy (xf86CrtcPtr crtc) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); @@ -150,6 +159,7 @@ xf86CrtcDestroy (xf86CrtcPtr crtc) } if (crtc->params) xfree (crtc->params); + free(crtc->gamma_red); xfree (crtc); } @@ -158,7 +168,7 @@ xf86CrtcDestroy (xf86CrtcPtr crtc) * Return whether any outputs are connected to the specified pipe */ -_X_EXPORT Bool +Bool xf86CrtcInUse (xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; @@ -171,7 +181,7 @@ xf86CrtcInUse (xf86CrtcPtr crtc) return FALSE; } -_X_EXPORT void +void xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen) { #ifdef RENDER @@ -239,7 +249,7 @@ xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen) /** * Sets the given video mode on the given crtc */ -_X_EXPORT Bool +Bool xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, RRTransformPtr transform, int x, int y) { @@ -255,20 +265,18 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati RRTransformRec saved_transform; Bool saved_transform_present; - if (crtc->funcs->set_mode_major) - return crtc->funcs->set_mode_major(crtc, mode, rotation, x, y); - crtc->enabled = xf86CrtcInUse (crtc); + /* We only hit this if someone explicitly sends a "disabled" modeset. */ if (!crtc->enabled) { - /* XXX disable crtc? */ + /* Check everything for stuff that should be off. */ + xf86DisableUnusedFunctions(scrn); return TRUE; } adjusted_mode = xf86DuplicateMode(mode); - didLock = crtc->funcs->lock (crtc); saved_mode = crtc->mode; saved_x = crtc->x; @@ -293,19 +301,12 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati } else crtc->transformPresent = FALSE; - if (crtc->funcs->set_origin && - memcmp (mode, &saved_mode, sizeof(saved_mode)) == 0 && - saved_rotation == rotation && - saved_transform_present == crtc->transformPresent && - (!crtc->transformPresent || RRTransformEqual(&saved_transform, &crtc->transform))) - { - if (!xf86CrtcRotate (crtc)) - goto done; - crtc->funcs->set_origin (crtc, crtc->x, crtc->y); - ret = TRUE; + if (crtc->funcs->set_mode_major) { + ret = crtc->funcs->set_mode_major(crtc, mode, rotation, x, y); goto done; } + didLock = crtc->funcs->lock (crtc); /* Pass our mode to the outputs and the CRTC to give them a chance to * adjust it according to limitations or output properties, and also * a chance to reject the mode entirely. @@ -352,6 +353,11 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati output->funcs->mode_set(output, mode, adjusted_mode); } + /* Only upload when needed, to avoid unneeded delays. */ + if (!crtc->active) + crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green, + crtc->gamma_blue, crtc->gamma_size); + /* Now, enable the clocks, plane, pipe, and outputs that we set up. */ crtc->funcs->commit(crtc); for (i = 0; i < xf86_config->num_output; i++) @@ -361,13 +367,14 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati output->funcs->commit(output); } - /* XXX free adjustedmode */ ret = TRUE; - if (scrn->pScreen) - xf86CrtcSetScreenSubpixelOrder (scrn->pScreen); done: - if (!ret) { + if (ret) { + crtc->active = TRUE; + if (scrn->pScreen) + xf86CrtcSetScreenSubpixelOrder (scrn->pScreen); + } else { crtc->x = saved_x; crtc->y = saved_y; crtc->rotation = saved_rotation; @@ -377,6 +384,8 @@ done: crtc->transformPresent = saved_transform_present; } + free(adjusted_mode); + if (didLock) crtc->funcs->unlock (crtc); @@ -387,7 +396,7 @@ done: * Sets the given video mode on the given crtc, but without providing * a transform */ -_X_EXPORT Bool +Bool xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int x, int y) { @@ -397,7 +406,7 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, /** * Pans the screen, does not change the mode */ -_X_EXPORT void +void xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y) { crtc->x = x; @@ -431,6 +440,7 @@ typedef enum { OPTION_IGNORE, OPTION_ROTATE, OPTION_PANNING, + OPTION_PRIMARY, } OutputOpts; static OptionInfoRec xf86OutputOptions[] = { @@ -447,6 +457,7 @@ static OptionInfoRec xf86OutputOptions[] = { {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE }, {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE }, {OPTION_PANNING, "Panning", OPTV_STRING, {0}, FALSE }, + {OPTION_PRIMARY, "Primary", OPTV_BOOLEAN, {0}, FALSE }, {-1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -455,7 +466,7 @@ enum { }; static OptionInfoRec xf86DeviceOptions[] = { - {OPTION_MODEDEBUG, "ModeDebug", OPTV_STRING, {0}, FALSE }, + {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE }, {-1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -571,7 +582,7 @@ xf86OutputInitialRotation (xf86OutputPtr output) return RR_Rotate_0; } -_X_EXPORT xf86OutputPtr +xf86OutputPtr xf86OutputCreate (ScrnInfoPtr scrn, const xf86OutputFuncsRec *funcs, const char *name) @@ -579,6 +590,7 @@ xf86OutputCreate (ScrnInfoPtr scrn, xf86OutputPtr output, *outputs; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int len; + Bool primary; if (name) len = strlen (name) + 1; @@ -624,14 +636,26 @@ xf86OutputCreate (ScrnInfoPtr scrn, xfree (output); return NULL; } - + xf86_config->output = outputs; - xf86_config->output[xf86_config->num_output++] = output; - + + if (xf86GetOptValBool (output->options, OPTION_PRIMARY, &primary) && primary) + { + memmove(xf86_config->output + 1, xf86_config->output, + xf86_config->num_output * sizeof (xf86OutputPtr)); + xf86_config->output[0] = output; + } + else + { + xf86_config->output[xf86_config->num_output] = output; + } + + xf86_config->num_output++; + return output; } -_X_EXPORT Bool +Bool xf86OutputRename (xf86OutputPtr output, const char *name) { int len = strlen(name) + 1; @@ -650,7 +674,7 @@ xf86OutputRename (xf86OutputPtr output, const char *name) return TRUE; } -_X_EXPORT void +void xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor) { if (use_screen_monitor != output->use_screen_monitor) @@ -660,7 +684,7 @@ xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor) } } -_X_EXPORT void +void xf86OutputDestroy (xf86OutputPtr output) { ScrnInfoPtr scrn = output->scrn; @@ -736,7 +760,6 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen) /* * Called at ScreenInit time to set up */ -_X_EXPORT #ifdef RANDR_13_INTERFACE int #else @@ -1044,15 +1067,6 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp, if (crtc_height > height) height = crtc_height; } - - /* Make room for an external monitor if we have enough video ram */ - if (scrn->videoRam >= 65536) - width += 1920; - else if (scrn->videoRam >= 32768) - width += 1280; - else if (scrn->videoRam >= 16384) - width += 1024; - if (config->maxWidth && width > config->maxWidth) width = config->maxWidth; if (config->maxHeight && height > config->maxHeight) height = config->maxHeight; if (config->minWidth && width < config->minWidth) width = config->minWidth; @@ -1504,7 +1518,7 @@ GuessRangeFromModes(MonPtr mon, DisplayModePtr mode) mon->vrefresh[0].lo = 58.0; } -_X_EXPORT void +void xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); @@ -1650,8 +1664,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) } if (add_default_modes) - default_modes = xf86GetDefaultModes (output->interlaceAllowed, - output->doubleScanAllowed); + default_modes = xf86GetDefaultModes (); /* * If this is not an RB monitor, remove RB modes from the default @@ -1688,11 +1701,17 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) output->probed_modes = xf86ModesAdd (output->probed_modes, default_modes); /* - * Check all modes against max size + * Check all modes against max size, interlace, and doublescan */ if (maxX && maxY) xf86ValidateModesSize (scrn, output->probed_modes, maxX, maxY, 0); + + { + int flags = (output->interlaceAllowed ? V_INTERLACE : 0) | + (output->doubleScanAllowed ? V_DBLSCAN : 0); + xf86ValidateModesFlags (scrn, output->probed_modes, flags); + } /* * Check all modes against output @@ -1765,7 +1784,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) */ /* XXX where does this function belong? Here? */ -_X_EXPORT void +void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y); static DisplayModePtr @@ -1860,7 +1879,7 @@ SetCompatOutput(xf86CrtcConfigPtr config) return output; } -_X_EXPORT void +void xf86SetScrnInfoModes (ScrnInfoPtr scrn) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); @@ -1905,7 +1924,8 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) } static void -xf86EnableOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, Bool *enabled) +xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + Bool *enabled) { Bool any_enabled = FALSE; int o; @@ -2201,6 +2221,99 @@ xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, return FALSE; } +static Bool +xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green, + float gamma_blue) +{ + int i, size = 256; + CARD16 *red, *green, *blue; + + red = malloc(3 * size * sizeof(CARD16)); + green = red + size; + blue = green + size; + + /* Only cause warning if user wanted gamma to be set. */ + if (!crtc->funcs->gamma_set && (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0)) { + free(red); + return FALSE; + } else if (!crtc->funcs->gamma_set) { + free(red); + return TRUE; + } + + /* At this early stage none of the randr-interface stuff is up. + * So take the default gamma size for lack of something better. + */ + for (i = 0; i < size; i++) { + if (gamma_red == 1.0) + red[i] = i << 8; + else + red[i] = (CARD16)(pow((double)i/(double)(size - 1), + 1. / (double)gamma_red) * (double)(size - 1) * 256); + + if (gamma_green == 1.0) + green[i] = i << 8; + else + green[i] = (CARD16)(pow((double)i/(double)(size - 1), + 1. / (double)gamma_green) * (double)(size - 1) * 256); + + if (gamma_blue == 1.0) + blue[i] = i << 8; + else + blue[i] = (CARD16)(pow((double)i/(double)(size - 1), + 1. / (double)gamma_blue) * (double)(size - 1) * 256); + } + + /* Default size is 256, so anything else is failure. */ + if (size != crtc->gamma_size) { + free(red); + return FALSE; + } + + crtc->gamma_size = size; + memcpy (crtc->gamma_red, red, crtc->gamma_size * sizeof (CARD16)); + memcpy (crtc->gamma_green, green, crtc->gamma_size * sizeof (CARD16)); + memcpy (crtc->gamma_blue, blue, crtc->gamma_size * sizeof (CARD16)); + + /* Do not set gamma now, delay until the crtc is activated. */ + + free(red); + + return TRUE; +} + +static Bool +xf86OutputSetInitialGamma(xf86OutputPtr output) +{ + XF86ConfMonitorPtr mon = output->conf_monitor; + float gamma_red = 1.0, gamma_green = 1.0, gamma_blue = 1.0; + + if (!mon) + return TRUE; + + if (!output->crtc) + return FALSE; + + /* Get configured values, where they exist. */ + if (mon->mon_gamma_red >= GAMMA_MIN && + mon->mon_gamma_red <= GAMMA_MAX) + gamma_red = mon->mon_gamma_red; + + if (mon->mon_gamma_green >= GAMMA_MIN && + mon->mon_gamma_green <= GAMMA_MAX) + gamma_green = mon->mon_gamma_green; + + if (mon->mon_gamma_blue >= GAMMA_MIN && + mon->mon_gamma_blue <= GAMMA_MAX) + gamma_blue = mon->mon_gamma_blue; + + /* This avoids setting gamma 1.0 in case another cloned output on this crtc has a specific gamma. */ + if (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0) { + xf86DrvMsg(output->scrn->scrnIndex, X_INFO, "Output %s wants gamma correction (%.1f, %.1f, %.1f)\n", output->name, gamma_red, gamma_green, gamma_blue); + return xf86CrtcSetInitialGamma(output->crtc, gamma_red, gamma_green, gamma_blue); + }else + return TRUE; +} /** * Construct default screen configuration @@ -2216,7 +2329,7 @@ xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, * accordingly. */ -_X_EXPORT Bool +Bool xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); @@ -2233,7 +2346,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) xf86ProcessOptions (scrn->scrnIndex, scrn->options, config->options); - config->debug_modes = TRUE; + config->debug_modes = xf86ReturnOptValBool (config->options, + OPTION_MODEDEBUG, FALSE); if (scrn->display->virtualX) width = scrn->display->virtualX; @@ -2250,7 +2364,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr)); enabled = xnfcalloc (config->num_output, sizeof (Bool)); - xf86EnableOutputs(scrn, config, enabled); + xf86CollectEnabledOutputs(scrn, config, enabled); if (xf86TargetUserpref(scrn, config, modes, enabled, width, height)) xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n"); @@ -2310,8 +2424,14 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) crtc->enabled = FALSE; memset (&crtc->desiredMode, '\0', sizeof (crtc->desiredMode)); + /* Set default gamma for all crtc's. */ + /* This is done to avoid problems later on with cloned outputs. */ + xf86CrtcSetInitialGamma(crtc, 1.0, 1.0, 1.0); } - + + if (xf86_crtc_supports_gamma(scrn)) + xf86DrvMsg(scrn->scrnIndex, X_INFO, "Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.\n"); + /* * Set initial configuration */ @@ -2329,17 +2449,17 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) crtc->desiredY = output->initial_y; crtc->desiredTransformPresent = FALSE; crtc->enabled = TRUE; - crtc->x = output->initial_x; - crtc->y = output->initial_y; memcpy (&crtc->panningTotalArea, &output->initialTotalArea, sizeof(BoxRec)); memcpy (&crtc->panningTrackingArea, &output->initialTrackingArea, sizeof(BoxRec)); memcpy (crtc->panningBorder, output->initialBorder, 4*sizeof(INT16)); output->crtc = crtc; + if (!xf86OutputSetInitialGamma(output)) + xf86DrvMsg (scrn->scrnIndex, X_WARNING, "Initial gamma correction for output %s: failed.\n", output->name); } else { output->crtc = NULL; } } - + if (scrn->display->virtualX == 0) { /* @@ -2448,22 +2568,27 @@ xf86PrepareCrtcs (ScrnInfoPtr scrn) * modes (used in EnterVT functions, or at server startup) */ -_X_EXPORT Bool +Bool xf86SetDesiredModes (ScrnInfoPtr scrn) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcPtr crtc = config->crtc[0]; int c; - xf86PrepareOutputs(scrn); - xf86PrepareCrtcs(scrn); + /* A driver with this hook will take care of this */ + if (!crtc->funcs->set_mode_major) { + xf86PrepareOutputs(scrn); + xf86PrepareCrtcs(scrn); + } for (c = 0; c < config->num_crtc; c++) { - xf86CrtcPtr crtc = config->crtc[c]; xf86OutputPtr output = NULL; int o; RRTransformPtr transform; + crtc = config->crtc[c]; + /* Skip disabled CRTCs */ if (!crtc->enabled) continue; @@ -2521,7 +2646,7 @@ xf86SetDesiredModes (ScrnInfoPtr scrn) * - Closer in refresh rate to the requested mode. */ -_X_EXPORT DisplayModePtr +DisplayModePtr xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired) { DisplayModePtr best = NULL, scan = NULL; @@ -2584,7 +2709,7 @@ xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired) * mode across all outputs that are currently active. */ -_X_EXPORT Bool +Bool xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -2657,7 +2782,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) * If the new mode is off, it will turn off outputs and then CRTCs. * Otherwise, it will affect CRTCs before outputs. */ -_X_EXPORT void +void xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); @@ -2695,7 +2820,7 @@ xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags) * Even for monitors with no DPMS support, by the definition of our DPMS hooks, * the outputs will still get disabled (blanked). */ -_X_EXPORT Bool +Bool xf86SaveScreen(ScreenPtr pScreen, int mode) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -2711,7 +2836,7 @@ xf86SaveScreen(ScreenPtr pScreen, int mode) /** * Disable all inactive crtcs and outputs */ -_X_EXPORT void +void xf86DisableUnusedFunctions(ScrnInfoPtr pScrn) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -2733,6 +2858,7 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn) crtc->funcs->dpms(crtc, DPMSModeOff); memset(&crtc->mode, 0, sizeof(crtc->mode)); xf86RotateDestroy(crtc); + crtc->active = FALSE; } } if (pScrn->pScreen) @@ -2741,7 +2867,7 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn) #ifdef RANDR_12_INTERFACE -#define EDID_ATOM_NAME "EDID_DATA" +#define EDID_ATOM_NAME "EDID" /** * Set the RandR EDID property @@ -2768,7 +2894,7 @@ xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len) /** * Set the EDID information for the specified output */ -_X_EXPORT void +void xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon) { ScrnInfoPtr scrn = output->scrn; @@ -2836,7 +2962,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon) * Return the list of modes supported by the EDID information * stored in 'output' */ -_X_EXPORT DisplayModePtr +DisplayModePtr xf86OutputGetEDIDModes (xf86OutputPtr output) { ScrnInfoPtr scrn = output->scrn; @@ -2848,7 +2974,7 @@ xf86OutputGetEDIDModes (xf86OutputPtr output) } /* maybe we should care about DDC1? meh. */ -_X_EXPORT xf86MonPtr +xf86MonPtr xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus) { ScrnInfoPtr scrn = output->scrn; @@ -2867,7 +2993,7 @@ static char *_xf86ConnectorNames[] = { "Component", "LFP", "Proprietary", "HDMI", "DisplayPort", }; -_X_EXPORT char * +char * xf86ConnectorGetName(xf86ConnectorType connector) { return _xf86ConnectorNames[connector]; @@ -2952,7 +3078,7 @@ xf86_covering_crtc(ScrnInfoPtr pScrn, * not that the video shouldn't be displayed */ -_X_EXPORT Bool +Bool xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn, xf86CrtcPtr *crtc_ret, xf86CrtcPtr desired_crtc, @@ -3029,3 +3155,23 @@ xf86_crtc_notify(ScreenPtr screen) if (config->xf86_crtc_notify) config->xf86_crtc_notify(screen); } + +Bool +xf86_crtc_supports_gamma(ScrnInfoPtr pScrn) +{ + if (xf86CrtcConfigPrivateIndex != -1) { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcPtr crtc; + + /* for multiple drivers loaded we need this */ + if (!xf86_config) + return FALSE; + if (xf86_config->num_crtc == 0) + return FALSE; + crtc = xf86_config->crtc[0]; + + return (crtc->funcs->gamma_set != NULL); + } + + return FALSE; +} diff --git a/driver/xf86-video-nv/compat/modes/xf86Crtc.h b/driver/xf86-video-nv/compat/modes/xf86Crtc.h index 0a596bc49..69afaa5d1 100644 --- a/driver/xf86-video-nv/compat/modes/xf86Crtc.h +++ b/driver/xf86-video-nv/compat/modes/xf86Crtc.h @@ -216,13 +216,14 @@ typedef struct _xf86CrtcFuncs { /** * Callback for panning. Doesn't change the mode. + * Added in ABI version 2 */ void (*set_origin)(xf86CrtcPtr crtc, int x, int y); } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; -#define XF86_CRTC_VERSION 2 +#define XF86_CRTC_VERSION 3 struct _xf86Crtc { /** @@ -236,9 +237,9 @@ struct _xf86Crtc { ScrnInfoPtr scrn; /** - * Active state of this CRTC + * Desired state of this CRTC * - * Set when this CRTC is driving one or more outputs + * Set when this CRTC should be driving one or more outputs */ Bool enabled; @@ -312,18 +313,19 @@ struct _xf86Crtc { * Current transformation matrix */ PictTransform crtc_to_framebuffer; - struct pict_f_transform f_crtc_to_framebuffer; - struct pict_f_transform f_framebuffer_to_crtc; - PictFilterPtr filter; - xFixed *params; - int nparams; - int filter_width; - int filter_height; + /* framebuffer_to_crtc was removed in ABI 2 */ + struct pict_f_transform f_crtc_to_framebuffer; /* ABI 2 */ + struct pict_f_transform f_framebuffer_to_crtc; /* ABI 2 */ + PictFilterPtr filter; /* ABI 2 */ + xFixed *params; /* ABI 2 */ + int nparams; /* ABI 2 */ + int filter_width; /* ABI 2 */ + int filter_height; /* ABI 2 */ Bool transform_in_use; - RRTransformRec transform; - Bool transformPresent; - RRTransformRec desiredTransform; - Bool desiredTransformPresent; + RRTransformRec transform; /* ABI 2 */ + Bool transformPresent; /* ABI 2 */ + RRTransformRec desiredTransform; /* ABI 2 */ + Bool desiredTransformPresent; /* ABI 2 */ /** * Bounding box in screen space */ @@ -333,10 +335,28 @@ struct _xf86Crtc { * TotalArea: total panning area, larger than CRTC's size * TrackingArea: Area of the pointer for which the CRTC is panned * border: Borders of the displayed CRTC area which induces panning if the pointer reaches them + * Added in ABI version 2 */ BoxRec panningTotalArea; BoxRec panningTrackingArea; INT16 panningBorder[4]; + + /** + * Current gamma, especially useful after initial config. + * Added in ABI version 3 + */ + CARD16 *gamma_red; + CARD16 *gamma_green; + CARD16 *gamma_blue; + int gamma_size; + + /** + * Actual state of this CRTC + * + * Set to TRUE after modesetting, set to FALSE if no outputs are connected + * Added in ABI version 3 + */ + Bool active; /** * Clear the shadow */ @@ -578,7 +598,10 @@ struct _xf86Output { #else void *randr_output; #endif - /** Desired initial panning */ + /** + * Desired initial panning + * Added in ABI version 2 + */ BoxRec initialTotalArea; BoxRec initialTrackingArea; INT16 initialBorder[4]; @@ -662,7 +685,7 @@ typedef struct _xf86CrtcConfig { } xf86CrtcConfigRec, *xf86CrtcConfigPtr; -extern int xf86CrtcConfigPrivateIndex; +extern _X_EXPORT int xf86CrtcConfigPrivateIndex; #define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr)) @@ -670,11 +693,11 @@ extern int xf86CrtcConfigPrivateIndex; * Initialize xf86CrtcConfig structure */ -void +extern _X_EXPORT void xf86CrtcConfigInit (ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec *funcs); -void +extern _X_EXPORT void xf86CrtcSetSizeRange (ScrnInfoPtr scrn, int minWidth, int minHeight, int maxWidth, int maxHeight); @@ -682,11 +705,11 @@ xf86CrtcSetSizeRange (ScrnInfoPtr scrn, /* * Crtc functions */ -xf86CrtcPtr +extern _X_EXPORT xf86CrtcPtr xf86CrtcCreate (ScrnInfoPtr scrn, const xf86CrtcFuncsRec *funcs); -void +extern _X_EXPORT void xf86CrtcDestroy (xf86CrtcPtr crtc); @@ -694,138 +717,142 @@ xf86CrtcDestroy (xf86CrtcPtr crtc); * Sets the given video mode on the given crtc */ -Bool +extern _X_EXPORT Bool xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, RRTransformPtr transform, int x, int y); -Bool +extern _X_EXPORT Bool xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int x, int y); -void +extern _X_EXPORT void xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y); /* * Assign crtc rotation during mode set */ -Bool +extern _X_EXPORT Bool xf86CrtcRotate (xf86CrtcPtr crtc); /* * Clean up any rotation data, used when a crtc is turned off * as well as when rotation is disabled. */ -void +extern _X_EXPORT void xf86RotateDestroy (xf86CrtcPtr crtc); /* * free shadow memory allocated for all crtcs */ -void +extern _X_EXPORT void xf86RotateFreeShadow(ScrnInfoPtr pScrn); /* * Clean up rotation during CloseScreen */ -void +extern _X_EXPORT void xf86RotateCloseScreen (ScreenPtr pScreen); /** * Return whether any output is assigned to the crtc */ -Bool +extern _X_EXPORT Bool xf86CrtcInUse (xf86CrtcPtr crtc); /* * Output functions */ -xf86OutputPtr +extern _X_EXPORT xf86OutputPtr xf86OutputCreate (ScrnInfoPtr scrn, const xf86OutputFuncsRec *funcs, const char *name); -void +extern _X_EXPORT void xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor); -Bool +extern _X_EXPORT Bool xf86OutputRename (xf86OutputPtr output, const char *name); -void +extern _X_EXPORT void xf86OutputDestroy (xf86OutputPtr output); -void +extern _X_EXPORT void xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY); -void +extern _X_EXPORT void xf86SetScrnInfoModes (ScrnInfoPtr pScrn); #ifdef RANDR_13_INTERFACE -int +# define ScreenInitRetType int #else -Bool +# define ScreenInitRetType Bool #endif + +extern _X_EXPORT ScreenInitRetType xf86CrtcScreenInit (ScreenPtr pScreen); -Bool +extern _X_EXPORT Bool xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow); -void +extern _X_EXPORT void xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -Bool +extern _X_EXPORT Bool xf86SaveScreen(ScreenPtr pScreen, int mode); -void +extern _X_EXPORT void xf86DisableUnusedFunctions(ScrnInfoPtr pScrn); -DisplayModePtr +extern _X_EXPORT DisplayModePtr xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired); -Bool +extern _X_EXPORT Bool xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation); /** * Set the EDID information for the specified output */ -void +extern _X_EXPORT void xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon); /** * Return the list of modes supported by the EDID information * stored in 'output' */ -DisplayModePtr +extern _X_EXPORT DisplayModePtr xf86OutputGetEDIDModes (xf86OutputPtr output); -xf86MonPtr +extern _X_EXPORT xf86MonPtr xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus); /** * Initialize dga for this screen */ -Bool +#ifdef XFreeXDGA +extern _X_EXPORT Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address); /** * Re-initialize dga for this screen (as when the set of modes changes) */ -Bool +extern _X_EXPORT Bool xf86DiDGAReInit (ScreenPtr pScreen); +#endif /* * Set the subpixel order reported for the screen using * the information from the outputs */ -void +extern _X_EXPORT void xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen); /* * Get a standard string name for a connector type */ -char * +extern _X_EXPORT char * xf86ConnectorGetName(xf86ConnectorType connector); /* @@ -833,7 +860,7 @@ xf86ConnectorGetName(xf86ConnectorType connector); * modes (used in EnterVT functions, or at server startup) */ -Bool +extern _X_EXPORT Bool xf86SetDesiredModes (ScrnInfoPtr pScrn); /** @@ -842,7 +869,7 @@ xf86SetDesiredModes (ScrnInfoPtr pScrn); * * Driver should call this from ScreenInit function */ -Bool +extern _X_EXPORT Bool xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags); /** @@ -852,25 +879,25 @@ xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags); * * Driver should call this from crtc commit function. */ -void +extern _X_EXPORT void xf86_reload_cursors (ScreenPtr screen); /** * Called from EnterVT to turn the cursors back on */ -void +extern _X_EXPORT void xf86_show_cursors (ScrnInfoPtr scrn); /** * Called by the driver to turn cursors off */ -void +extern _X_EXPORT void xf86_hide_cursors (ScrnInfoPtr scrn); /** * Clean up CRTC-based cursor code. Driver must call this at CloseScreen time. */ -void +extern _X_EXPORT void xf86_cursors_fini (ScreenPtr screen); /* @@ -879,7 +906,7 @@ xf86_cursors_fini (ScreenPtr screen); * wraps xf86XVClipVideoHelper() */ -Bool +extern _X_EXPORT Bool xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn, xf86CrtcPtr *crtc_ret, xf86CrtcPtr desired_crtc, @@ -892,28 +919,20 @@ xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn, INT32 width, INT32 height); -xf86_crtc_notify_proc_ptr +extern _X_EXPORT xf86_crtc_notify_proc_ptr xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new); -void +extern _X_EXPORT void xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old); -void +extern _X_EXPORT void xf86_crtc_notify(ScreenPtr pScreen); /** - * Panning + * Gamma */ -Bool -xf86_crtc_get_panning(ScrnInfoPtr pScrn, - BoxPtr totalArea, - BoxPtr TrackingArea, - INT16 *border); - -Bool -xf86_crtc_set_panning(ScrnInfoPtr pScrn, - BoxPtr totalArea, - BoxPtr TrackingArea, - INT16 *border); + +extern _X_EXPORT Bool +xf86_crtc_supports_gamma(ScrnInfoPtr pScrn); #endif /* _XF86CRTC_H_ */ diff --git a/driver/xf86-video-nv/compat/modes/xf86Cursors.c b/driver/xf86-video-nv/compat/modes/xf86Cursors.c index 3106f051b..fc4df8477 100644 --- a/driver/xf86-video-nv/compat/modes/xf86Cursors.c +++ b/driver/xf86-video-nv/compat/modes/xf86Cursors.c @@ -39,8 +39,7 @@ #include "xf86RandR12.h" #include "xf86CursorPriv.h" #include "X11/extensions/render.h" -#define DPMS_SERVER -#include "X11/extensions/dpms.h" +#include "X11/extensions/dpmsconst.h" #include "X11/Xatom.h" #ifdef RENDER #include "picturestr.h" @@ -265,7 +264,7 @@ xf86_crtc_hide_cursor (xf86CrtcPtr crtc) } } -_X_EXPORT void +void xf86_hide_cursors (ScrnInfoPtr scrn) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); @@ -291,7 +290,7 @@ xf86_crtc_show_cursor (xf86CrtcPtr crtc) } } -_X_EXPORT void +void xf86_show_cursors (ScrnInfoPtr scrn) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); @@ -543,7 +542,7 @@ xf86_load_cursor_argb (ScrnInfoPtr scrn, CursorPtr cursor) } } -_X_EXPORT Bool +Bool xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags) { ScrnInfoPtr scrn = xf86Screens[screen->myNum]; @@ -594,7 +593,7 @@ xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags) * Reloads cursor images as needed, then adjusts cursor positions */ -_X_EXPORT void +void xf86_reload_cursors (ScreenPtr screen) { ScrnInfoPtr scrn; @@ -640,16 +639,18 @@ xf86_reload_cursors (ScreenPtr screen) (*cursor_info->LoadCursorARGB) (scrn, cursor); else if (src) #endif - (*cursor_info->LoadCursorImage)(cursor_info->pScrn, src); + (*cursor_info->LoadCursorImage)(scrn, src); - (*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y); + x += scrn->frameX0 + cursor_screen_priv->HotX; + y += scrn->frameY0 + cursor_screen_priv->HotY; + (*cursor_info->SetCursorPosition)(scrn, x, y); } } /** * Clean up CRTC-based cursor code */ -_X_EXPORT void +void xf86_cursors_fini (ScreenPtr screen) { ScrnInfoPtr scrn = xf86Screens[screen->myNum]; diff --git a/driver/xf86-video-nv/compat/modes/xf86DiDGA.c b/driver/xf86-video-nv/compat/modes/xf86DiDGA.c index f40d0abef..0964cefa7 100644 --- a/driver/xf86-video-nv/compat/modes/xf86DiDGA.c +++ b/driver/xf86-video-nv/compat/modes/xf86DiDGA.c @@ -255,7 +255,7 @@ static DGAFunctionRec xf86_dga_funcs = { NULL }; -_X_EXPORT Bool +Bool xf86DiDGAReInit (ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; @@ -267,7 +267,7 @@ xf86DiDGAReInit (ScreenPtr pScreen) return DGAReInitModes (pScreen, xf86_config->dga_modes, xf86_config->dga_nmode); } -_X_EXPORT Bool +Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address) { ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; diff --git a/driver/xf86-video-nv/compat/modes/xf86EdidModes.c b/driver/xf86-video-nv/compat/modes/xf86EdidModes.c index 5ed61c1d0..6e11f9a3d 100644 --- a/driver/xf86-video-nv/compat/modes/xf86EdidModes.c +++ b/driver/xf86-video-nv/compat/modes/xf86EdidModes.c @@ -155,6 +155,16 @@ static Bool quirk_detailed_v_in_cm (int scrnIndex, xf86MonPtr DDC) DDC->vendor.prod_id == 13600) return TRUE; + /* Bug #21000: LGPhilipsLCD LP154W01-TLAJ */ + if (memcmp (DDC->vendor.name, "LPL", 4) == 0 && + DDC->vendor.prod_id == 47360) + return TRUE; + + /* Bug #21750: Samsung Syncmaster 2333HD */ + if (memcmp (DDC->vendor.name, "SAM", 4) == 0 && + DDC->vendor.prod_id == 1157) + return TRUE; + return FALSE; } @@ -165,6 +175,11 @@ static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC) (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00)) return TRUE; + /* Bug #21324: Iiyama Vision Master 450 */ + if (memcmp (DDC->vendor.name, "IVM", 4) == 0 && + DDC->vendor.prod_id == 6400) + return TRUE; + return FALSE; } @@ -195,6 +210,11 @@ static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC) DDC->vendor.prod_id == 2423) return TRUE; + /* Peacock Ergovision 19. See rh#492359 */ + if (memcmp (DDC->vendor.name, "PEA", 4) == 0 && + DDC->vendor.prod_id == 9003) + return TRUE; + return FALSE; } @@ -318,7 +338,7 @@ DDCModesFromEstablished(int scrnIndex, struct established_timings *timing, } /* Autogenerated from the DMT spec */ -static const DisplayModeRec DMTModes[] = { +const DisplayModeRec DMTModes[] = { { MODEPREFIX, 31500, 640, 672, 736, 832, 0, 350, 382, 385, 445, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x350@85Hz */ { MODEPREFIX, 31500, 640, 672, 736, 832, 0, 400, 401, 404, 445, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 640x400@85Hz */ { MODEPREFIX, 35500, 720, 756, 828, 936, 0, 400, 401, 404, 446, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@85Hz */ @@ -428,7 +448,7 @@ ModeRefresh(const DisplayModeRec *mode) * part of the DMT pool. For the 'standard' EDID mode descriptor there's * no way to specify whether the mode should be RB or not. */ -static DisplayModePtr +DisplayModePtr FindDMTMode(int hsize, int vsize, int refresh, Bool rb) { int i; @@ -471,29 +491,37 @@ DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks, int timing_level, Bool rb) { DisplayModePtr Modes = NULL, Mode = NULL; - int i; + int i, hsize, vsize, refresh; for (i = 0; i < STD_TIMINGS; i++) { - if (timing[i].hsize && timing[i].vsize && timing[i].refresh) { - Mode = FindDMTMode(timing[i].hsize, timing[i].vsize, - timing[i].refresh, rb); + hsize = timing[i].hsize; + vsize = timing[i].vsize; + refresh = timing[i].refresh; + + /* HDTV hack. Hooray. */ + if (hsize == 1360 && vsize == 765 && refresh == 60) { + Mode = xf86CVTMode(1366, 768, 60, FALSE, FALSE); + Mode->HDisplay = 1366; + Mode->VSyncStart--; + Mode->VSyncEnd--; + } else if (hsize && vsize && refresh) { + Mode = FindDMTMode(hsize, vsize, refresh, rb); if (!Mode) { if (timing_level == LEVEL_CVT) /* pass rb here too? */ - Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize, - timing[i].refresh, FALSE, FALSE); + Mode = xf86CVTMode(hsize, vsize, refresh, FALSE, FALSE); else if (timing_level == LEVEL_GTF) - Mode = xf86GTFMode(timing[i].hsize, timing[i].vsize, - timing[i].refresh, FALSE, FALSE); + Mode = xf86GTFMode(hsize, vsize, refresh, FALSE, FALSE); } - if (!Mode) - continue; + } + if (Mode) { Mode->type = M_T_DRIVER; - Modes = xf86ModesAdd(Modes, Mode); - } + Modes = xf86ModesAdd(Modes, Mode); + } + Mode = NULL; } return Modes; @@ -618,6 +646,85 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) } #endif +static const struct { + short w; + short h; + short r; + short rb; +} EstIIIModes[] = { + /* byte 6 */ + { 640, 350, 85, 0 }, + { 640, 400, 85, 0 }, + { 720, 400, 85, 0 }, + { 640, 480, 85, 0 }, + { 848, 480, 60, 0 }, + { 800, 600, 85, 0 }, + { 1024, 768, 85, 0 }, + { 1152, 864, 75, 0 }, + /* byte 7 */ + { 1280, 768, 60, 1 }, + { 1280, 768, 60, 0 }, + { 1280, 768, 75, 0 }, + { 1280, 768, 85, 0 }, + { 1280, 960, 60, 0 }, + { 1280, 960, 85, 0 }, + { 1280, 1024, 60, 0 }, + { 1280, 1024, 85, 0 }, + /* byte 8 */ + { 1360, 768, 60, 0 }, + { 1440, 900, 60, 1 }, + { 1440, 900, 60, 0 }, + { 1440, 900, 75, 0 }, + { 1440, 900, 85, 0 }, + { 1400, 1050, 60, 1 }, + { 1400, 1050, 60, 0 }, + { 1400, 1050, 75, 0 }, + /* byte 9 */ + { 1400, 1050, 85, 0 }, + { 1680, 1050, 60, 1 }, + { 1680, 1050, 60, 0 }, + { 1680, 1050, 75, 0 }, + { 1680, 1050, 85, 0 }, + { 1600, 1200, 60, 0 }, + { 1600, 1200, 65, 0 }, + { 1600, 1200, 70, 0 }, + /* byte 10 */ + { 1600, 1200, 75, 0 }, + { 1600, 1200, 85, 0 }, + { 1792, 1344, 60, 0 }, + { 1792, 1344, 85, 0 }, + { 1856, 1392, 60, 0 }, + { 1856, 1392, 75, 0 }, + { 1920, 1200, 60, 1 }, + { 1920, 1200, 60, 0 }, + /* byte 11 */ + { 1920, 1200, 75, 0 }, + { 1920, 1200, 85, 0 }, + { 1920, 1440, 60, 0 }, + { 1920, 1440, 75, 0 }, +}; + +static DisplayModePtr +DDCModesFromEstIII(unsigned char *est) +{ + DisplayModePtr modes = NULL; + int i, j, m; + + for (i = 0; i < 6; i++) { + for (j = 7; j > 0; j--) { + if (est[i] & (1 << j)) { + m = (i * 8) + (7 - j); + modes = xf86ModesAdd(modes, + FindDMTMode(EstIIIModes[m].w, + EstIIIModes[m].h, + EstIIIModes[m].r, + EstIIIModes[m].rb)); + } + } + } + + return modes; +} /* * This is only valid when the sink claims to be continuous-frequency @@ -759,7 +866,7 @@ xf86DDCSetPreferredRefresh(int scrnIndex, DisplayModePtr modes, best->type |= M_T_PREFERRED; } -_X_EXPORT DisplayModePtr +DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) { int i; @@ -788,6 +895,7 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) for (i = 0; i < DET_TIMINGS; i++) { struct detailed_monitor_section *det_mon = &DDC->det_mon[i]; + Mode = NULL; switch (det_mon->type) { case DT: Mode = DDCModeFromDetailedTiming(scrnIndex, @@ -795,22 +903,23 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) preferred, quirks); preferred = FALSE; - Modes = xf86ModesAdd(Modes, Mode); break; case DS_STD_TIMINGS: Mode = DDCModesFromStandardTiming(det_mon->section.std_t, quirks, timing_level, rb); - Modes = xf86ModesAdd(Modes, Mode); break; #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) case DS_CVT: Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt); - Modes = xf86ModesAdd(Modes, Mode); break; #endif + case DS_EST_III: + Mode = DDCModesFromEstIII(det_mon->section.est_iii); + break; default: break; } + Modes = xf86ModesAdd(Modes, Mode); } /* Add established timings */ @@ -833,8 +942,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) /* * Fill out MonPtr with xf86MonPtr information. */ -_X_EXPORT void -xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC) +void +xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC) { DisplayModePtr Modes = NULL, Mode; int i, clock; diff --git a/driver/xf86-video-nv/compat/modes/xf86Modes.c b/driver/xf86-video-nv/compat/modes/xf86Modes.c index 1522fa731..d105b48ab 100644 --- a/driver/xf86-video-nv/compat/modes/xf86Modes.c +++ b/driver/xf86-video-nv/compat/modes/xf86Modes.c @@ -48,10 +48,8 @@ extern XF86ConfigPtr xf86configptr; /** * Calculates the horizontal sync rate of a mode. - * - * Exact copy of xf86Mode.c's. */ -_X_EXPORT double +double xf86ModeHSync(const DisplayModeRec *mode) { double hsync = 0.0; @@ -66,10 +64,8 @@ xf86ModeHSync(const DisplayModeRec *mode) /** * Calculates the vertical refresh rate of a mode. - * - * Exact copy of xf86Mode.c's. */ -_X_EXPORT double +double xf86ModeVRefresh(const DisplayModeRec *mode) { double refresh = 0.0; @@ -88,7 +84,7 @@ xf86ModeVRefresh(const DisplayModeRec *mode) return refresh; } -_X_EXPORT int +int xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation) { switch (rotation & 0xf) { @@ -103,7 +99,7 @@ xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation) } } -_X_EXPORT int +int xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation) { switch (rotation & 0xf) { @@ -119,11 +115,11 @@ xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation) } /** Calculates the memory bandwidth (in MiB/sec) of a mode. */ -_X_EXPORT unsigned int +unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth) { float a_active, a_total, active_percent, pixels_per_second; - int bytes_per_pixel = (depth + 7) / 8; + int bytes_per_pixel = bits_to_bytes(depth); if (!mode->HTotal || !mode->VTotal || !mode->Clock) return 0; @@ -137,7 +133,7 @@ xf86ModeBandwidth(DisplayModePtr mode, int depth) } /** Sets a default mode name of <width>x<height> on a mode. */ -_X_EXPORT void +void xf86SetModeDefaultName(DisplayModePtr mode) { if (mode->name != NULL) @@ -151,10 +147,8 @@ xf86SetModeDefaultName(DisplayModePtr mode) * * Initialises the Crtc parameters for a mode. The initialisation includes * adjustments for interlaced and double scan modes. - * - * Exact copy of xf86Mode.c's. */ -_X_EXPORT void +void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags) { if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN)) @@ -205,7 +199,7 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags) /** * Allocates and returns a copy of pMode, including pointers within pMode. */ -_X_EXPORT DisplayModePtr +DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode) { DisplayModePtr pNew; @@ -229,7 +223,7 @@ xf86DuplicateMode(const DisplayModeRec *pMode) * * \param modeList doubly-linked mode list */ -_X_EXPORT DisplayModePtr +DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList) { DisplayModePtr first = NULL, last = NULL; @@ -260,10 +254,8 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList) * * This doesn't use Crtc values, as it might be used on ModeRecs without the * Crtc values set. So, it's assumed that the other numbers are enough. - * - * This isn't in xf86Modes.c, but it might deserve to be there. */ -_X_EXPORT Bool +Bool xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2) { if (pMode1->Clock == pMode2->Clock && @@ -285,7 +277,6 @@ xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2) } } -/* exact copy of xf86Mode.c */ static void add(char **p, char *new) { @@ -296,10 +287,8 @@ add(char **p, char *new) /** * Print out a modeline. - * - * Convenient VRefresh printing was added, though, compared to xf86Mode.c */ -_X_EXPORT void +void xf86PrintModeline(int scrnIndex,DisplayModePtr mode) { char tmp[256]; @@ -345,12 +334,15 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode) * * \bug only V_INTERLACE and V_DBLSCAN are supported. Is that enough? */ -_X_EXPORT void +void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags) { DisplayModePtr mode; + if (flags == (V_INTERLACE | V_DBLSCAN)) + return; + for (mode = modeList; mode != NULL; mode = mode->next) { if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE)) mode->status = MODE_NO_INTERLACE; @@ -364,7 +356,7 @@ xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, * * \param modeList doubly-linked list of modes. */ -_X_EXPORT void +void xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList, int maxX, int maxY, int maxPitch) { @@ -391,7 +383,7 @@ xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList, * * \param modeList doubly-linked list of modes. */ -_X_EXPORT void +void xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon) { @@ -436,7 +428,7 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, * \param max pointer to maximums of clock ranges * \param n_ranges number of ranges. */ -_X_EXPORT void +void xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList, int *min, int *max, int n_ranges) { @@ -469,7 +461,7 @@ xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList, * * \param modeList doubly-linked list of modes. */ -_X_EXPORT void +void xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList) { DisplayModePtr mode; @@ -501,7 +493,7 @@ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList) * \param bandwidth bandwidth in MHz. * \param depth color depth. */ -_X_EXPORT void +void xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, unsigned int bandwidth, int depth) { @@ -535,20 +527,12 @@ xf86ModeIsReduced(const DisplayModeRec *mode) * * \param modeList doubly-linked list of modes. */ -_X_EXPORT void +void xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList) { - DisplayModePtr mode; - - for (mode = modeList; mode != NULL; mode = mode->next) { - /* gratuitous duplication from pre-randr validation code */ - if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) && - ((mode->HTotal - mode->HDisplay) == 160) && - ((mode->HSyncEnd - mode->HDisplay) == 80) && - ((mode->HSyncEnd - mode->HSyncStart) == 32) && - ((mode->VSyncStart - mode->VDisplay) == 3)) - mode->status = MODE_NO_REDUCED; - } + for (; modeList != NULL; modeList = modeList->next) + if (xf86ModeIsReduced(modeList)) + modeList->status = MODE_NO_REDUCED; } /** @@ -558,7 +542,7 @@ xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList) * \param verbose determines whether the reason for mode invalidation is * printed. */ -_X_EXPORT void +void xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList, Bool verbose) { @@ -592,7 +576,7 @@ xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList, * * \param modes doubly-linked mode list. */ -_X_EXPORT DisplayModePtr +DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new) { if (modes == NULL) @@ -658,7 +642,7 @@ xf86GetConfigModes (XF86ConfModeLinePtr conf_mode) /** * Build a mode list from a monitor configuration */ -_X_EXPORT DisplayModePtr +DisplayModePtr xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor) { DisplayModePtr modes = NULL; @@ -690,8 +674,8 @@ xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor) /** * Build a mode list containing all of the default modes */ -_X_EXPORT DisplayModePtr -xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) +DisplayModePtr +xf86GetDefaultModes (void) { DisplayModePtr head = NULL, mode; int i; @@ -700,13 +684,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) { const DisplayModeRec *defMode = &xf86DefaultModes[i]; - if (!interlaceAllowed && (defMode->Flags & V_INTERLACE)) - continue; - if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN)) - continue; - mode = xf86DuplicateMode(defMode); - head = xf86ModesAdd(head, mode); } return head; diff --git a/driver/xf86-video-nv/compat/modes/xf86Modes.h b/driver/xf86-video-nv/compat/modes/xf86Modes.h index 2fb6a374d..908f59b48 100644 --- a/driver/xf86-video-nv/compat/modes/xf86Modes.h +++ b/driver/xf86-video-nv/compat/modes/xf86Modes.h @@ -40,75 +40,75 @@ #include "xf86Rename.h" #endif -double xf86ModeHSync(const DisplayModeRec *mode); -double xf86ModeVRefresh(const DisplayModeRec *mode); -unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth); +extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec *mode); +extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec *mode); +extern _X_EXPORT unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth); -int +extern _X_EXPORT int xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation); -int +extern _X_EXPORT int xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation); -DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode); -DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, +extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode); +extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList); -void xf86SetModeDefaultName(DisplayModePtr mode); -void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); -Bool xf86ModesEqual(const DisplayModeRec *pMode1, +extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode); +extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); +extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2); -void xf86PrintModeline(int scrnIndex,DisplayModePtr mode); -DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); +extern _X_EXPORT void xf86PrintModeline(int scrnIndex,DisplayModePtr mode); +extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); -DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC); -DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, +extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC); +extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced); -DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins); +extern _X_EXPORT DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins); -Bool +extern _X_EXPORT Bool xf86ModeIsReduced(const DisplayModeRec *mode); -void +extern _X_EXPORT void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags); -void +extern _X_EXPORT void xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList, int *min, int *max, int n_ranges); -void +extern _X_EXPORT void xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList, int maxX, int maxY, int maxPitch); -void +extern _X_EXPORT void xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon); -void +extern _X_EXPORT void xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, unsigned int bandwidth, int depth); -void +extern _X_EXPORT void xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList); -void +extern _X_EXPORT void xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList, Bool verbose); -void +extern _X_EXPORT void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags); -void +extern _X_EXPORT void xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList); -DisplayModePtr +extern _X_EXPORT DisplayModePtr xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor); -DisplayModePtr -xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed); +extern _X_EXPORT DisplayModePtr +xf86GetDefaultModes (void); -void +extern _X_EXPORT void xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC); #endif /* _XF86MODES_H_ */ diff --git a/driver/xf86-video-nv/compat/modes/xf86RandR12.c b/driver/xf86-video-nv/compat/modes/xf86RandR12.c index 6f93a0dc3..c2465bce3 100644 --- a/driver/xf86-video-nv/compat/modes/xf86RandR12.c +++ b/driver/xf86-video-nv/compat/modes/xf86RandR12.c @@ -55,6 +55,13 @@ typedef struct _xf86RandR12Info { int pointerY; Rotation rotation; /* current mode */ Rotation supported_rotations; /* driver supported */ + + /* Used to wrap EnterVT so we can re-probe the outputs when a laptop unsuspends + * (actually, any time that we switch back into our VT). + * + * See https://bugs.freedesktop.org/show_bug.cgi?id=21554 + */ + xf86EnterVTProc *orig_EnterVT; } XF86RandRInfoRec, *XF86RandRInfoPtr; #ifdef RANDR_12_INTERFACE @@ -460,7 +467,9 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations) { xf86ProbeOutputModes (scrp, 0, 0); xf86SetScrnInfoModes (scrp); +#ifdef XFreeXDGA xf86DiDGAReInit (pScreen); +#endif } for (mode = scrp->modes; ; mode = mode->next) @@ -588,7 +597,7 @@ xf86RandR12SetMode (ScreenPtr pScreen, return ret; } -_X_EXPORT Bool +Bool xf86RandR12SetConfig (ScreenPtr pScreen, Rotation rotation, int rate, @@ -740,7 +749,7 @@ finish: return ret; } -_X_EXPORT Rotation +Rotation xf86RandR12GetRotation(ScreenPtr pScreen) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); @@ -748,12 +757,12 @@ xf86RandR12GetRotation(ScreenPtr pScreen) return randrp->rotation; } -_X_EXPORT Bool +Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + xf86CrtcConfigPtr config; + XF86RandRInfoPtr randrp; int c; int width, height; int mmWidth, mmHeight; @@ -763,6 +772,8 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) return TRUE; #endif + config = XF86_CRTC_CONFIG_PTR(pScrn); + randrp = XF86RANDRINFO(pScreen); /* * Compute size of screen */ @@ -798,7 +809,6 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) else { xf86OutputPtr output = config->output[config->compat_output]; - xf86CrtcPtr crtc = output->crtc; if (output->conf_monitor && (output->conf_monitor->mon_width > 0 && @@ -810,17 +820,6 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) mmWidth = output->conf_monitor->mon_width; mmHeight = output->conf_monitor->mon_height; } - else if (crtc && crtc->mode.HDisplay && - output->mm_width && output->mm_height) - { - /* - * If the output has a mode and a declared size, use that - * to scale the screen size - */ - DisplayModePtr mode = &crtc->mode; - mmWidth = output->mm_width * width / mode->HDisplay; - mmHeight = output->mm_height * height / mode->VDisplay; - } else { /* @@ -866,7 +865,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) } -_X_EXPORT Bool +Bool xf86RandR12Init (ScreenPtr pScreen) { rrScrPrivPtr rp; @@ -924,7 +923,7 @@ xf86RandR12Init (ScreenPtr pScreen) return TRUE; } -_X_EXPORT void +void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations) { XF86RandRInfoPtr randrp; @@ -950,7 +949,7 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations) randrp->supported_rotations = rotations; } -_X_EXPORT void +void xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms) { XF86RandRInfoPtr randrp; @@ -975,7 +974,7 @@ xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms) #endif } -_X_EXPORT void +void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y) { ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; @@ -1258,8 +1257,58 @@ xf86RandR12CrtcSetGamma (ScreenPtr pScreen, if (!crtc->scrn->vtSema) return TRUE; - crtc->funcs->gamma_set(crtc, randr_crtc->gammaRed, randr_crtc->gammaGreen, - randr_crtc->gammaBlue, randr_crtc->gammaSize); + /* Realloc local gamma if needed. */ + if (randr_crtc->gammaSize != crtc->gamma_size) { + CARD16 *tmp_ptr; + tmp_ptr = realloc(crtc->gamma_red, 3 * crtc->gamma_size * sizeof (CARD16)); + if (!tmp_ptr) + return FALSE; + crtc->gamma_red = tmp_ptr; + crtc->gamma_green = crtc->gamma_red + crtc->gamma_size; + crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size; + } + + crtc->gamma_size = randr_crtc->gammaSize; + memcpy (crtc->gamma_red, randr_crtc->gammaRed, crtc->gamma_size * sizeof (CARD16)); + memcpy (crtc->gamma_green, randr_crtc->gammaGreen, crtc->gamma_size * sizeof (CARD16)); + memcpy (crtc->gamma_blue, randr_crtc->gammaBlue, crtc->gamma_size * sizeof (CARD16)); + + /* Only set it when the crtc is actually running. + * Otherwise it will be set when it's activated. + */ + if (crtc->active) + crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green, + crtc->gamma_blue, crtc->gamma_size); + + return TRUE; +} + +static Bool +xf86RandR12CrtcGetGamma (ScreenPtr pScreen, + RRCrtcPtr randr_crtc) +{ + xf86CrtcPtr crtc = randr_crtc->devPrivate; + + if (!crtc->gamma_size) + return FALSE; + + if (!crtc->gamma_red || !crtc->gamma_green || !crtc->gamma_blue) + return FALSE; + + /* Realloc randr gamma if needed. */ + if (randr_crtc->gammaSize != crtc->gamma_size) { + CARD16 *tmp_ptr; + tmp_ptr = realloc(randr_crtc->gammaRed, 3 * crtc->gamma_size * sizeof (CARD16)); + if (!tmp_ptr) + return FALSE; + randr_crtc->gammaRed = tmp_ptr; + randr_crtc->gammaGreen = randr_crtc->gammaRed + crtc->gamma_size; + randr_crtc->gammaBlue = randr_crtc->gammaGreen + crtc->gamma_size; + } + randr_crtc->gammaSize = crtc->gamma_size; + memcpy (randr_crtc->gammaRed, crtc->gamma_red, crtc->gamma_size * sizeof (CARD16)); + memcpy (randr_crtc->gammaGreen, crtc->gamma_green, crtc->gamma_size * sizeof (CARD16)); + memcpy (randr_crtc->gammaBlue, crtc->gamma_blue, crtc->gamma_size * sizeof (CARD16)); return TRUE; } @@ -1479,7 +1528,9 @@ xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations) return TRUE; xf86ProbeOutputModes (pScrn, 0, 0); xf86SetScrnInfoModes (pScrn); +#ifdef XFreeXDGA xf86DiDGAReInit (pScreen); +#endif return xf86RandR12SetInfo12 (pScreen); } @@ -1547,7 +1598,7 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen) * to DGA, VidMode or hot key. Tell RandR */ -_X_EXPORT void +void xf86RandR12TellChanged (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -1645,16 +1696,83 @@ xf86RandR13SetPanning (ScreenPtr pScreen, } } +/* + * Compatibility with XF86VidMode's gamma changer. This necessarily clobbers + * any per-crtc setup. You asked for it... + */ + +static void +gamma_to_ramp(float gamma, CARD16 *ramp, int size) +{ + int i; + + for (i = 0; i < size; i++) { + if (gamma == 1.0) + ramp[i] = i << 8; + else + ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), 1. / gamma) + * (double)(size - 1) * 256); + } +} + +static int +xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma) +{ + CARD16 *points, *red, *green, *blue; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc; + int size = max(0, crtc->gammaSize); + + if (!size) + return Success; + + points = xcalloc(size, 3 * sizeof(CARD16)); + if (!points) + return BadAlloc; + + red = points; + green = points + size; + blue = points + 2 * size; + + gamma_to_ramp(gamma.red, red, size); + gamma_to_ramp(gamma.green, green, size); + gamma_to_ramp(gamma.blue, blue, size); + RRCrtcGammaSet(crtc, red, green, blue); + + xfree(points); + + pScrn->gamma = gamma; + + return Success; +} + +static Bool +xf86RandR12EnterVT (int screen_index, int flags) +{ + ScreenPtr pScreen = screenInfo.screens[screen_index]; + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + + if (randrp->orig_EnterVT) { + if (!randrp->orig_EnterVT (screen_index, flags)) + return FALSE; + } + + return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */ +} + static Bool xf86RandR12Init12 (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; rrScrPrivPtr rp = rrGetScrPriv(pScreen); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); rp->rrGetInfo = xf86RandR12GetInfo12; rp->rrScreenSetSize = xf86RandR12ScreenSetSize; rp->rrCrtcSet = xf86RandR12CrtcSet; rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma; + rp->rrCrtcGetGamma = xf86RandR12CrtcGetGamma; rp->rrOutputSetProperty = xf86RandR12OutputSetProperty; rp->rrOutputValidateMode = xf86RandR12OutputValidateMode; #if RANDR_13_INTERFACE @@ -1665,6 +1783,11 @@ xf86RandR12Init12 (ScreenPtr pScreen) rp->rrModeDestroy = xf86RandR12ModeDestroy; rp->rrSetConfig = NULL; pScrn->PointerMoved = xf86RandR12PointerMoved; + pScrn->ChangeGamma = xf86RandR12ChangeGamma; + + randrp->orig_EnterVT = pScrn->EnterVT; + pScrn->EnterVT = xf86RandR12EnterVT; + if (!xf86RandR12CreateObjects12 (pScreen)) return FALSE; @@ -1678,7 +1801,7 @@ xf86RandR12Init12 (ScreenPtr pScreen) #endif -_X_EXPORT Bool +Bool xf86RandR12PreInit (ScrnInfoPtr pScrn) { return TRUE; diff --git a/driver/xf86-video-nv/compat/modes/xf86RandR12.h b/driver/xf86-video-nv/compat/modes/xf86RandR12.h index 17a2dcc7f..c8d9918cf 100644 --- a/driver/xf86-video-nv/compat/modes/xf86RandR12.h +++ b/driver/xf86-video-nv/compat/modes/xf86RandR12.h @@ -28,15 +28,15 @@ #include "xf86Rename.h" #endif -Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen); -Bool xf86RandR12Init(ScreenPtr pScreen); -void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation); -void xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms); -Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, +extern _X_EXPORT Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen); +extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen); +extern _X_EXPORT void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation); +extern _X_EXPORT void xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms); +extern _X_EXPORT Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize); -Rotation xf86RandR12GetRotation(ScreenPtr pScreen); -void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y); -Bool xf86RandR12PreInit (ScrnInfoPtr pScrn); -void xf86RandR12TellChanged (ScreenPtr pScreen); +extern _X_EXPORT Rotation xf86RandR12GetRotation(ScreenPtr pScreen); +extern _X_EXPORT void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y); +extern _X_EXPORT Bool xf86RandR12PreInit (ScrnInfoPtr pScrn); +extern _X_EXPORT void xf86RandR12TellChanged (ScreenPtr pScreen); #endif /* _XF86_RANDR_H_ */ diff --git a/driver/xf86-video-nv/compat/modes/xf86Rotate.c b/driver/xf86-video-nv/compat/modes/xf86Rotate.c index 6be77d556..9e65c9969 100644 --- a/driver/xf86-video-nv/compat/modes/xf86Rotate.c +++ b/driver/xf86-video-nv/compat/modes/xf86Rotate.c @@ -40,8 +40,7 @@ #include "xf86Modes.h" #include "xf86RandR12.h" #include "X11/extensions/render.h" -#define DPMS_SERVER -#include "X11/extensions/dpms.h" +#include "X11/extensions/dpmsconst.h" #include "X11/Xatom.h" /* borrowed from composite extension, move to Render and publish? */ @@ -198,6 +197,7 @@ xf86RotatePrepare (ScreenPtr pScreen) DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, xf86_config->rotation_damage); xf86_config->rotation_damage_registered = TRUE; + EnableLimitedSchedulingLatency(); } xf86CrtcDamageShadow (crtc); @@ -263,11 +263,12 @@ xf86RotateBlockHandler(int screenNum, pointer blockData, ScreenPtr pScreen = screenInfo.screens[screenNum]; ScrnInfoPtr pScrn = xf86Screens[screenNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + Bool rotation_active; + rotation_active = xf86RotateRedisplay(pScreen); pScreen->BlockHandler = xf86_config->BlockHandler; (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask); - if (xf86RotateRedisplay(pScreen)) - { + if (rotation_active) { /* Re-wrap if rotation is still happening */ xf86_config->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = xf86RotateBlockHandler; @@ -307,13 +308,14 @@ xf86RotateDestroy (xf86CrtcPtr crtc) DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, xf86_config->rotation_damage); xf86_config->rotation_damage_registered = FALSE; + DisableLimitedSchedulingLatency(); } DamageDestroy (xf86_config->rotation_damage); xf86_config->rotation_damage = NULL; } } -_X_EXPORT void +void xf86RotateFreeShadow(ScrnInfoPtr pScrn) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -331,7 +333,7 @@ xf86RotateFreeShadow(ScrnInfoPtr pScrn) } } -_X_EXPORT void +void xf86RotateCloseScreen (ScreenPtr screen) { ScrnInfoPtr scrn = xf86Screens[screen->myNum]; @@ -371,7 +373,7 @@ xf86CrtcFitsScreen (xf86CrtcPtr crtc, struct pict_f_transform *crtc_to_fb) 0 <= b.y1 && b.y2 <= pScrn->virtualY); } -_X_EXPORT Bool +Bool xf86CrtcRotate (xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; diff --git a/driver/xf86-video-nv/compat/modes/xf86cvt.c b/driver/xf86-video-nv/compat/modes/xf86cvt.c index e9c74aa62..1da5fe50b 100644 --- a/driver/xf86-video-nv/compat/modes/xf86cvt.c +++ b/driver/xf86-video-nv/compat/modes/xf86cvt.c @@ -63,7 +63,7 @@ * want that. -- libv * */ -_X_EXPORT DisplayModePtr +DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced) { diff --git a/driver/xf86-video-nv/compat/modes/xf86gtf.c b/driver/xf86-video-nv/compat/modes/xf86gtf.c index fed56bd12..9d5d50a2d 100644 --- a/driver/xf86-video-nv/compat/modes/xf86gtf.c +++ b/driver/xf86-video-nv/compat/modes/xf86gtf.c @@ -102,7 +102,7 @@ * XServer of fbset mode descriptions, from what I can tell). */ -_X_EXPORT DisplayModePtr +DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins) { DisplayModeRec *mode = xnfcalloc(1, sizeof(DisplayModeRec)); diff --git a/driver/xf86-video-nv/compat/parser/xf86Optrec.h b/driver/xf86-video-nv/compat/parser/xf86Optrec.h index 183b85720..5ccf7285b 100644 --- a/driver/xf86-video-nv/compat/parser/xf86Optrec.h +++ b/driver/xf86-video-nv/compat/parser/xf86Optrec.h @@ -64,6 +64,9 @@ #ifndef _xf86Optrec_h_ #define _xf86Optrec_h_ #include <stdio.h> +#include <string.h> + +#include <X11/Xfuncproto.h> /* * all records that need to be linked lists should contain a GenericList as @@ -89,24 +92,21 @@ typedef struct XF86OptionRec, *XF86OptionPtr; -XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val); -XF86OptionPtr xf86optionListDup(XF86OptionPtr opt); -void xf86optionListFree(XF86OptionPtr opt); -char *xf86optionName(XF86OptionPtr opt); -char *xf86optionValue(XF86OptionPtr opt); -XF86OptionPtr xf86newOption(char *name, char *value); -XF86OptionPtr xf86nextOption(XF86OptionPtr list); -XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name); -char *xf86findOptionValue(XF86OptionPtr list, const char *name); -int xf86findOptionBoolean (XF86OptionPtr, const char *, int); -XF86OptionPtr xf86optionListCreate(const char **options, int count, int used); -XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail); -char *xf86configStrdup (const char *s); -int xf86nameCompare (const char *s1, const char *s2); -char *xf86uLongToString(unsigned long i); -void xf86debugListOptions(XF86OptionPtr); -XF86OptionPtr xf86parseOption(XF86OptionPtr head); -void xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs); +extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val); +extern _X_EXPORT XF86OptionPtr xf86optionListDup(XF86OptionPtr opt); +extern _X_EXPORT void xf86optionListFree(XF86OptionPtr opt); +extern _X_EXPORT char *xf86optionName(XF86OptionPtr opt); +extern _X_EXPORT char *xf86optionValue(XF86OptionPtr opt); +extern _X_EXPORT XF86OptionPtr xf86newOption(char *name, char *value); +extern _X_EXPORT XF86OptionPtr xf86nextOption(XF86OptionPtr list); +extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name); +extern _X_EXPORT char *xf86findOptionValue(XF86OptionPtr list, const char *name); +extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used); +extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail); +extern _X_EXPORT int xf86nameCompare (const char *s1, const char *s2); +extern _X_EXPORT char *xf86uLongToString(unsigned long i); +extern _X_EXPORT XF86OptionPtr xf86parseOption(XF86OptionPtr head); +extern _X_EXPORT void xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs); #endif /* _xf86Optrec_h_ */ diff --git a/driver/xf86-video-nv/compat/parser/xf86Parser.h b/driver/xf86-video-nv/compat/parser/xf86Parser.h index 1c7b285c8..603080066 100644 --- a/driver/xf86-video-nv/compat/parser/xf86Parser.h +++ b/driver/xf86-video-nv/compat/parser/xf86Parser.h @@ -72,7 +72,6 @@ typedef struct { char *file_logfile; char *file_modulepath; - char *file_inputdevs; char *file_fontpath; char *file_comment; char *file_xkbdir; @@ -457,29 +456,29 @@ xf86ConfigSymTabRec, *xf86ConfigSymTabPtr; /* * prototypes for public functions */ -extern const char *xf86openConfigFile (const char *, const char *, +extern _X_EXPORT const char *xf86openConfigFile (const char *, const char *, const char *); -extern void xf86setBuiltinConfig(const char *config[]); -extern XF86ConfigPtr xf86readConfigFile (void); -extern void xf86closeConfigFile (void); -extern void xf86freeConfig (XF86ConfigPtr p); -extern int xf86writeConfigFile (const char *, XF86ConfigPtr); -XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p); -XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list); -XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p); -XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p); -XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p); -XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p); -XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p); -XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); -XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, +extern _X_EXPORT void xf86setBuiltinConfig(const char *config[]); +extern _X_EXPORT XF86ConfigPtr xf86readConfigFile (void); +extern _X_EXPORT void xf86closeConfigFile (void); +extern _X_EXPORT void xf86freeConfig (XF86ConfigPtr p); +extern _X_EXPORT int xf86writeConfigFile (const char *, XF86ConfigPtr); +extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p); +extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list); +extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p); +extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p); +extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p); +extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p); +extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p); +extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); +extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, XF86ConfVideoAdaptorPtr p); -GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new); -int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2); +extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new); +extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2); -int xf86pathIsAbsolute(const char *path); -int xf86pathIsSafe(const char *path); -char *xf86addComment(char *cur, char *add); +extern _X_EXPORT int xf86pathIsAbsolute(const char *path); +extern _X_EXPORT int xf86pathIsSafe(const char *path); +extern _X_EXPORT char *xf86addComment(char *cur, char *add); #endif /* _xf86Parser_h_ */ diff --git a/driver/xf86-video-nv/config.h.in b/driver/xf86-video-nv/config.h.in index cd7099e4a..da255b3dc 100644 --- a/driver/xf86-video-nv/config.h.in +++ b/driver/xf86-video-nv/config.h.in @@ -2,6 +2,9 @@ #include "xorg-server.h" +/* X server doesn't have built-in mode code, so we need to build it */ +#undef BUILD_XMODES + /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H @@ -32,17 +35,8 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* XV hooks take a DrawablePtr */ -#undef HAVE_XV_DRAWABLE - -/* Major version */ -#undef NV_MAJOR_VERSION - -/* Minor version */ -#undef NV_MINOR_VERSION - -/* Patch version */ -#undef NV_PATCHLEVEL +/* xextproto 7.1 available */ +#undef HAVE_XEXTPROTO_71 /* Name of package */ #undef PACKAGE @@ -62,11 +56,17 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Major version of this package */ +#undef PACKAGE_VERSION_MAJOR + +/* Minor version of this package */ +#undef PACKAGE_VERSION_MINOR + +/* Patch version of this package */ +#undef PACKAGE_VERSION_PATCHLEVEL + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Use the libc wrapper */ -#undef USE_LIBC_WRAPPER - /* Version number of package */ #undef VERSION diff --git a/driver/xf86-video-nv/configure b/driver/xf86-video-nv/configure index 97cbb0397..a8f7c034f 100644 --- a/driver/xf86-video-nv/configure +++ b/driver/xf86-video-nv/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for xf86-video-nv 2.1.13. +# Generated by GNU Autoconf 2.62 for xf86-video-nv 2.1.15. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # @@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='xf86-video-nv' PACKAGE_TARNAME='xf86-video-nv' -PACKAGE_VERSION='2.1.13' -PACKAGE_STRING='xf86-video-nv 2.1.13' +PACKAGE_VERSION='2.1.15' +PACKAGE_STRING='xf86-video-nv 2.1.15' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' ac_unique_file="Makefile.am" @@ -900,6 +900,10 @@ LIBTOOL PKG_CONFIG XORG_CFLAGS XORG_LIBS +XEXT_CFLAGS +XEXT_LIBS +HAVE_XEXTPROTO_71_TRUE +HAVE_XEXTPROTO_71_FALSE PCIACCESS_CFLAGS PCIACCESS_LIBS BUILD_XMODES_TRUE @@ -921,6 +925,8 @@ FILE_MAN_DIR MISC_MAN_DIR DRIVER_MAN_DIR ADMIN_MAN_DIR +CHANGELOG_CMD +distcleancheck_listfiles LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -957,6 +963,8 @@ FFLAGS PKG_CONFIG XORG_CFLAGS XORG_LIBS +XEXT_CFLAGS +XEXT_LIBS PCIACCESS_CFLAGS PCIACCESS_LIBS' @@ -1511,7 +1519,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xf86-video-nv 2.1.13 to adapt to many kinds of systems. +\`configure' configures xf86-video-nv 2.1.15 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1581,7 +1589,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xf86-video-nv 2.1.13:";; + short | recursive ) echo "Configuration of xf86-video-nv 2.1.15:";; esac cat <<\_ACEOF @@ -1631,6 +1639,8 @@ Some influential environment variables: PKG_CONFIG path to pkg-config utility XORG_CFLAGS C compiler flags for XORG, overriding pkg-config XORG_LIBS linker flags for XORG, overriding pkg-config + XEXT_CFLAGS C compiler flags for XEXT, overriding pkg-config + XEXT_LIBS linker flags for XEXT, overriding pkg-config PCIACCESS_CFLAGS C compiler flags for PCIACCESS, overriding pkg-config PCIACCESS_LIBS @@ -1702,7 +1712,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xf86-video-nv configure 2.1.13 +xf86-video-nv configure 2.1.15 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1716,7 +1726,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xf86-video-nv $as_me 2.1.13, which was +It was created by xf86-video-nv $as_me 2.1.15, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -2086,6 +2096,20 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" + +# Require xorg-macros: XORG_RELEASE_VERSION XORG_CHANGELOG + + + + + + + + + + + + ac_aux_dir= for ac_dir in . "$srcdir"/.; do if test -f "$ac_dir/install-sh"; then @@ -2370,7 +2394,7 @@ fi # Define the identity of the package. PACKAGE='xf86-video-nv' - VERSION='2.1.13' + VERSION='2.1.15' cat >>confdefs.h <<_ACEOF @@ -4429,7 +4453,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4432 "configure"' > conftest.$ac_ext + echo '#line 4456 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7537,11 +7561,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7540: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7564: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7544: \$? = $ac_status" >&5 + echo "$as_me:7568: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7827,11 +7851,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7830: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7854: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7834: \$? = $ac_status" >&5 + echo "$as_me:7858: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7931,11 +7955,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7934: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7958: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7938: \$? = $ac_status" >&5 + echo "$as_me:7962: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10331,7 +10355,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10334 "configure" +#line 10358 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10431,7 +10455,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10434 "configure" +#line 10458 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12840,11 +12864,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12843: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12867: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12847: \$? = $ac_status" >&5 + echo "$as_me:12871: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12944,11 +12968,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12947: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12971: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12951: \$? = $ac_status" >&5 + echo "$as_me:12975: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14527,11 +14551,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14530: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14554: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14534: \$? = $ac_status" >&5 + echo "$as_me:14558: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14631,11 +14655,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14634: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14658: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14638: \$? = $ac_status" >&5 + echo "$as_me:14662: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16846,11 +16870,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16849: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16873: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16853: \$? = $ac_status" >&5 + echo "$as_me:16877: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17136,11 +17160,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17139: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17163: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17143: \$? = $ac_status" >&5 + echo "$as_me:17167: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17240,11 +17264,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17243: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17267: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17247: \$? = $ac_status" >&5 + echo "$as_me:17271: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21216,6 +21240,91 @@ else $as_echo "yes" >&6; } : fi + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for XEXT" >&5 +$as_echo_n "checking for XEXT... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$XEXT_CFLAGS"; then + pkg_cv_XEXT_CFLAGS="$XEXT_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xextproto >= 7.0.99.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "xextproto >= 7.0.99.1") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_XEXT_CFLAGS=`$PKG_CONFIG --cflags "xextproto >= 7.0.99.1" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$XEXT_LIBS"; then + pkg_cv_XEXT_LIBS="$XEXT_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xextproto >= 7.0.99.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "xextproto >= 7.0.99.1") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_XEXT_LIBS=`$PKG_CONFIG --libs "xextproto >= 7.0.99.1" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XEXT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xextproto >= 7.0.99.1"` + else + XEXT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xextproto >= 7.0.99.1"` + fi + # Put the nasty error message in config.log where it belongs + echo "$XEXT_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + HAVE_XEXTPROTO_71="no" +elif test $pkg_failed = untried; then + HAVE_XEXTPROTO_71="no" +else + XEXT_CFLAGS=$pkg_cv_XEXT_CFLAGS + XEXT_LIBS=$pkg_cv_XEXT_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_XEXTPROTO_71="yes"; +cat >>confdefs.h <<\_ACEOF +#define HAVE_XEXTPROTO_71 1 +_ACEOF + +fi + + +if test "$HAVE_XEXTPROTO_71" = "yes" ; then + HAVE_XEXTPROTO_71_TRUE= + HAVE_XEXTPROTO_71_FALSE='#' +else + HAVE_XEXTPROTO_71_TRUE='#' + HAVE_XEXTPROTO_71_FALSE= +fi + sdkdir=$(pkg-config --variable=sdkdir xorg-server) # Checks for libraries. @@ -21809,6 +21918,14 @@ _ACEOF +CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \ +mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \ +echo 'git directory not found: installing possibly empty changelog.' >&2)" + +distcleancheck_listfiles='find . -type f ! -name ChangeLog -print' + + + ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile compat/Makefile" cat >confcache <<\_ACEOF @@ -21943,6 +22060,13 @@ $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${HAVE_XEXTPROTO_71_TRUE}" && test -z "${HAVE_XEXTPROTO_71_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_XEXTPROTO_71\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"HAVE_XEXTPROTO_71\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${BUILD_XMODES_TRUE}" && test -z "${BUILD_XMODES_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_XMODES\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -22272,7 +22396,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xf86-video-nv $as_me 2.1.13, which was +This file was extended by xf86-video-nv $as_me 2.1.15, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22325,7 +22449,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -xf86-video-nv config.status 2.1.13 +xf86-video-nv config.status 2.1.15 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/driver/xf86-video-nv/configure.ac b/driver/xf86-video-nv/configure.ac index bd261112b..ce0b8848a 100644 --- a/driver/xf86-video-nv/configure.ac +++ b/driver/xf86-video-nv/configure.ac @@ -22,12 +22,17 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-nv], - 2.1.13, + 2.1.15, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-nv) AC_CONFIG_SRCDIR([Makefile.am]) AM_CONFIG_HEADER([config.h]) + +# Require xorg-macros: XORG_RELEASE_VERSION XORG_CHANGELOG +m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.2) + AC_CONFIG_AUX_DIR(.) AM_INIT_AUTOMAKE([dist-bzip2]) @@ -61,6 +66,10 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Checks for pkg-config packages PKG_CHECK_MODULES(XORG, [xorg-server >= 1.2 xproto fontsproto $REQUIRED_MODULES]) +PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], + HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]), + HAVE_XEXTPROTO_71="no") +AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ]) sdkdir=$(pkg-config --variable=sdkdir xorg-server) # Checks for libraries. @@ -129,6 +138,7 @@ AC_SUBST([DRIVER_NAME]) XORG_MANPAGE_SECTIONS XORG_RELEASE_VERSION +XORG_CHANGELOG AC_OUTPUT([ Makefile diff --git a/driver/xf86-video-nv/ltmain.sh b/driver/xf86-video-nv/ltmain.sh index fccf69e28..248cd4047 100644 --- a/driver/xf86-video-nv/ltmain.sh +++ b/driver/xf86-video-nv/ltmain.sh @@ -2127,6 +2127,17 @@ EOF ;; esac for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" diff --git a/driver/xf86-video-nv/man/Makefile.in b/driver/xf86-video-nv/man/Makefile.in index fcefe610f..94eae54a3 100644 --- a/driver/xf86-video-nv/man/Makefile.in +++ b/driver/xf86-video-nv/man/Makefile.in @@ -101,6 +101,7 @@ BUILD_XMODES_TRUE = @BUILD_XMODES_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -125,6 +126,8 @@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ GREP = @GREP@ +HAVE_XEXTPROTO_71_FALSE = @HAVE_XEXTPROTO_71_FALSE@ +HAVE_XEXTPROTO_71_TRUE = @HAVE_XEXTPROTO_71_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -161,6 +164,8 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +XEXT_CFLAGS = @XEXT_CFLAGS@ +XEXT_LIBS = @XEXT_LIBS@ XMODES_CFLAGS = @XMODES_CFLAGS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ @@ -184,6 +189,7 @@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ diff --git a/driver/xf86-video-nv/src/Makefile.in b/driver/xf86-video-nv/src/Makefile.in index 50cc1d157..3ac1358fc 100644 --- a/driver/xf86-video-nv/src/Makefile.in +++ b/driver/xf86-video-nv/src/Makefile.in @@ -126,6 +126,7 @@ BUILD_XMODES_TRUE = @BUILD_XMODES_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -150,6 +151,8 @@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ GREP = @GREP@ +HAVE_XEXTPROTO_71_FALSE = @HAVE_XEXTPROTO_71_FALSE@ +HAVE_XEXTPROTO_71_TRUE = @HAVE_XEXTPROTO_71_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -186,6 +189,8 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +XEXT_CFLAGS = @XEXT_CFLAGS@ +XEXT_LIBS = @XEXT_LIBS@ XMODES_CFLAGS = @XMODES_CFLAGS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_LIBS = @XORG_LIBS@ @@ -209,6 +214,7 @@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ diff --git a/driver/xf86-video-nv/src/g80_dac.c b/driver/xf86-video-nv/src/g80_dac.c index 404f178f5..307e41253 100644 --- a/driver/xf86-video-nv/src/g80_dac.c +++ b/driver/xf86-video-nv/src/g80_dac.c @@ -27,8 +27,13 @@ #include <unistd.h> +#ifdef HAVE_XEXTPROTO_71 +#include <X11/extensions/dpmsconst.h> +#else #define DPMS_SERVER #include <X11/extensions/dpms.h> +#endif + #include <xf86_OSproc.h> #include "g80_type.h" diff --git a/driver/xf86-video-nv/src/g80_display.c b/driver/xf86-video-nv/src/g80_display.c index cf4631d47..3cbaac314 100644 --- a/driver/xf86-video-nv/src/g80_display.c +++ b/driver/xf86-video-nv/src/g80_display.c @@ -146,26 +146,97 @@ G80CalcPLL(float pclk, int *pNA, int *pMA, int *pNB, int *pMB, int *pP) } static void +G80CalcPLL2(float pclk, int *pN, int *pM, int *pPL) +{ + const float refclk = 27000.0f; + const int minN = 8, maxN = 255; + const int minM = 1, maxM = 255; + const int minPL = 1, maxPL = 63; + const int minU = 25000, maxU = 50000; + const int minVco = 500000; + int maxVco = 1000000; + int lowPL, highPL, pl; + float vco, bestError = FLT_MAX; + + vco = pclk + pclk / 50; + + if(maxVco < vco) maxVco = vco; + + highPL = (maxVco + vco - 1) / pclk; + if(highPL > maxPL) highPL = maxPL; + if(highPL < minPL) highPL = minPL; + + lowPL = minVco / vco; + if(lowPL > maxPL) lowPL = maxPL; + if(lowPL < minPL) lowPL = minPL; + + for(pl = highPL; pl >= lowPL; pl--) { + int m; + + for(m = minM; m <= maxM; m++) { + int n; + float freq, error; + + if(refclk / m < minU) break; + if(refclk / m > maxU) continue; + + n = rint(pclk * pl * m / refclk); + if(n > maxN) break; + if(n < minN) continue; + + freq = refclk * (n / (float)m) / pl; + error = fabsf(pclk - freq); + if(error < bestError) { + *pN = n; + *pM = m; + *pPL = pl; + bestError = error; + } + } + } +} + +static void G80CrtcSetPClk(xf86CrtcPtr crtc) { G80Ptr pNv = G80PTR(crtc->scrn); G80CrtcPrivPtr pPriv = crtc->driver_private; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); const int headOff = 0x800 * pPriv->head; - int lo_n, lo_m, hi_n, hi_m, p, i; - CARD32 lo = pNv->reg[(0x00614104+headOff)/4]; - CARD32 hi = pNv->reg[(0x00614108+headOff)/4]; + int i; + + if(pPriv->pclk == 0) + return; + + if(pNv->architecture <= 0xa0 || + pNv->architecture == 0xaa || + pNv->architecture == 0xac) { + int lo_n, lo_m, hi_n, hi_m, p, i; + CARD32 lo = pNv->reg[(0x00614104+headOff)/4]; + CARD32 hi = pNv->reg[(0x00614108+headOff)/4]; + + pNv->reg[(0x00614100+headOff)/4] = 0x10000610; + lo &= 0xff00ff00; + hi &= 0x8000ff00; - pNv->reg[(0x00614100+headOff)/4] = 0x10000610; - lo &= 0xff00ff00; - hi &= 0x8000ff00; + G80CalcPLL(pPriv->pclk, &lo_n, &lo_m, &hi_n, &hi_m, &p); - G80CalcPLL(pPriv->pclk, &lo_n, &lo_m, &hi_n, &hi_m, &p); + lo |= (lo_m << 16) | lo_n; + hi |= (p << 28) | (hi_m << 16) | hi_n; + pNv->reg[(0x00614104+headOff)/4] = lo; + pNv->reg[(0x00614108+headOff)/4] = hi; + } else { + int n, m, pl; + CARD32 r = pNv->reg[(0x00614104+headOff)/4]; + + pNv->reg[(0x00614100+headOff)/4] = 0x50000610; + r &= 0xffc00000; - lo |= (lo_m << 16) | lo_n; - hi |= (p << 28) | (hi_m << 16) | hi_n; - pNv->reg[(0x00614104+headOff)/4] = lo; - pNv->reg[(0x00614108+headOff)/4] = hi; + G80CalcPLL2(pPriv->pclk, &n, &m, &pl); + r |= pl << 16 | m << 8 | n; + + pNv->reg[(0x00614104+headOff)/4] = r; + } pNv->reg[(0x00614200+headOff)/4] = 0; for(i = 0; i < xf86_config->num_output; i++) { @@ -235,6 +306,8 @@ G80DispPreInit(ScrnInfoPtr pScrn) pNv->reg[0x006101D8/4] = pNv->reg[0x0061B000/4]; pNv->reg[0x006101E0/4] = pNv->reg[0x0061C000/4]; pNv->reg[0x006101E4/4] = pNv->reg[0x0061C800/4]; + pNv->reg[0x006101E8/4] = pNv->reg[0x0061D000/4]; + pNv->reg[0x006101EC/4] = pNv->reg[0x0061D800/4]; pNv->reg[0x0061A004/4] = 0x80550000; pNv->reg[0x0061A010/4] = 0x00000001; pNv->reg[0x0061A804/4] = 0x80550000; diff --git a/driver/xf86-video-nv/src/g80_driver.c b/driver/xf86-video-nv/src/g80_driver.c index ad8a4245e..13e417aaa 100644 --- a/driver/xf86-video-nv/src/g80_driver.c +++ b/driver/xf86-video-nv/src/g80_driver.c @@ -28,16 +28,24 @@ #include <string.h> +#include <xf86.h> #include <xf86_OSproc.h> +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 #include <xf86Resources.h> -#include <xf86RandR12.h> +#endif #include <mipointer.h> #include <mibstore.h> #include <micmap.h> #include <xf86cmap.h> #include <fb.h> +#ifdef HAVE_XEXTPROTO_71 +#include <X11/extensions/dpmsconst.h> +#else #define DPMS_SERVER #include <X11/extensions/dpms.h> +#endif + +#include <xf86RandR12.h> #include "nv_const.h" #include "g80_type.h" @@ -51,56 +59,6 @@ #define G80_REG_SIZE (1024 * 1024 * 16) #define G80_RESERVED_VIDMEM 0xd000 -static const char *fbSymbols[] = { - "fbPictureInit", - "fbScreenInit", - NULL -}; - -static const char *xaaSymbols[] = { - "XAACopyROP", - "XAACreateInfoRec", - "XAADestroyInfoRec", - "XAAFallbackOps", - "XAAInit", - "XAAPatternROP", - NULL -}; - -static const char *exaSymbols[] = { - "exaDriverAlloc", - "exaDriverInit", - "exaDriverFini", - NULL -}; - -static const char *i2cSymbols[] = { - "xf86CreateI2CBusRec", - "xf86I2CBusInit", - NULL -}; - -static const char *ramdacSymbols[] = { - "xf86CreateCursorInfoRec", - "xf86DestroyCursorInfoRec", - "xf86InitCursor", - NULL -}; - -static const char *ddcSymbols[] = { - "xf86PrintEDID", - "xf86DoEDID_DDC2", - "xf86SetDDCproperties", - NULL -}; - -static const char *int10Symbols[] = { - "xf86FreeInt10", - "xf86InitInt10", - "xf86ExecX86int10", - NULL -}; - typedef enum { OPTION_HW_CURSOR, OPTION_NOACCEL, @@ -243,7 +201,6 @@ G80PreInit(ScrnInfoPtr pScrn, int flags) pNv->int10 = NULL; pNv->int10Mode = 0; if(xf86LoadSubModule(pScrn, "int10")) { - xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); pNv->int10 = xf86InitInt10(pEnt->index); } @@ -275,8 +232,10 @@ G80PreInit(ScrnInfoPtr pScrn, int flags) } /* Disable VGA access */ +#ifndef XSERVER_LIBPCIACCESS xf86SetOperatingState(resVgaIo, pEnt->index, ResUnusedOpr); xf86SetOperatingState(resVgaMem, pEnt->index, ResDisableOpr); +#endif pScrn->monitor = pScrn->confScreen->monitor; @@ -360,11 +319,13 @@ G80PreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MMIO registers mapped at %p\n", (void*)pNv->reg); +#ifndef XSERVER_LIBPCIACCESS if(xf86RegisterResources(pEnt->index, NULL, ResExclusive)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86RegisterResources() found " "resource conflicts\n"); goto fail; } +#endif pNv->architecture = pNv->reg[0] >> 20 & 0x1ff; tmp = pNv->reg[0x0010020C/4]; @@ -434,7 +395,6 @@ G80PreInit(ScrnInfoPtr pScrn, int flags) if(!xf86LoadSubModule(pScrn, "i2c")) goto fail; if(!xf86LoadSubModule(pScrn, "ddc")) goto fail; - xf86LoaderReqSymLists(i2cSymbols, ddcSymbols, NULL); if(!G80DispPreInit(pScrn)) goto fail; /* Read the DDC routing table and create outputs */ @@ -465,17 +425,14 @@ G80PreInit(ScrnInfoPtr pScrn, int flags) /* Load fb */ if(!xf86LoadSubModule(pScrn, "fb")) goto fail; - xf86LoaderReqSymLists(fbSymbols, NULL); if(!pNv->NoAccel) { switch(pNv->AccelMethod) { case XAA: if(!xf86LoadSubModule(pScrn, "xaa")) goto fail; - xf86LoaderReqSymLists(xaaSymbols, NULL); break; case EXA: if(!xf86LoadSubModule(pScrn, "exa")) goto fail; - xf86LoaderReqSymLists(exaSymbols, NULL); break; } } @@ -486,9 +443,7 @@ G80PreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to load ramdac. " "Falling back to software cursor.\n"); pNv->HWCursor = FALSE; - } else { - xf86LoaderReqSymLists(ramdacSymbols, NULL); - } + } } return TRUE; diff --git a/driver/xf86-video-nv/src/g80_output.c b/driver/xf86-video-nv/src/g80_output.c index 420a73ed8..b2d8b077d 100644 --- a/driver/xf86-video-nv/src/g80_output.c +++ b/driver/xf86-video-nv/src/g80_output.c @@ -127,6 +127,11 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv) "VGA%d: invalid port type %d\n", or, portType); break; } + if(port >= G80_NUM_I2C_PORTS) { + xf86DrvMsg(scrnIndex, X_WARNING, + "VGA%d: unrecognized port %d\n", or, port); + break; + } if(pNv->i2cMap[port].dac != -1) { xf86DrvMsg(scrnIndex, X_WARNING, "DDC routing table corrupt! DAC %i -> %i for " @@ -152,6 +157,11 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv) "DVI%d: invalid port type %d\n", or, portType); break; } + if(port >= G80_NUM_I2C_PORTS) { + xf86DrvMsg(scrnIndex, X_WARNING, + "DVI%d: unrecognized port %d\n", or, port); + break; + } if(pNv->i2cMap[port].sor != -1) xf86DrvMsg(scrnIndex, X_WARNING, "DDC routing table corrupt! SOR %i -> %i for " @@ -181,6 +191,11 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv) "LVDS: invalid port type %d\n", portType); break; } + if(port >= G80_NUM_I2C_PORTS) { + xf86DrvMsg(scrnIndex, X_WARNING, + "LVDS: unrecognized port %d\n", port); + break; + } pNv->lvds.i2cPort = port; break; @@ -217,8 +232,11 @@ fail: static CARD32 i2cAddr(const int port) { - const CARD32 base = (port > 3) ? 0x0000E1E0 : 0x0000E138; - return base + port * 0x18; + const CARD32 addrs[G80_NUM_I2C_PORTS] = { + 0xE138, 0xE150, 0xE168, 0xE180, 0xE254, 0xE274, 0xE764, 0xE780, 0xE79C, + 0xE7B8 + }; + return addrs[port]; } static void G80_I2CPutBits(I2CBusPtr b, int clock, int data) diff --git a/driver/xf86-video-nv/src/g80_sor.c b/driver/xf86-video-nv/src/g80_sor.c index c1ef42d09..185761f80 100644 --- a/driver/xf86-video-nv/src/g80_sor.c +++ b/driver/xf86-video-nv/src/g80_sor.c @@ -25,8 +25,13 @@ #include "config.h" #endif +#ifdef HAVE_XEXTPROTO_71 +#include <X11/extensions/dpmsconst.h> +#else #define DPMS_SERVER #include <X11/extensions/dpms.h> +#endif + #include <X11/Xatom.h> #include "g80_type.h" diff --git a/driver/xf86-video-nv/src/g80_type.h b/driver/xf86-video-nv/src/g80_type.h index 0cebae794..9bb07a44a 100644 --- a/driver/xf86-video-nv/src/g80_type.h +++ b/driver/xf86-video-nv/src/g80_type.h @@ -7,7 +7,7 @@ #include <xf86Crtc.h> #include <xf86int10.h> -#define G80_NUM_I2C_PORTS 6 +#define G80_NUM_I2C_PORTS 10 typedef enum Head { HEAD0 = 0, diff --git a/driver/xf86-video-nv/src/nv_driver.c b/driver/xf86-video-nv/src/nv_driver.c index 2e1003dad..ad0a33d2a 100644 --- a/driver/xf86-video-nv/src/nv_driver.c +++ b/driver/xf86-video-nv/src/nv_driver.c @@ -124,7 +124,7 @@ _X_EXPORT DriverRec NV = { #endif }; -/* Known cards as of 2008/08/26 */ +/* Known cards as of 2009/05/15 */ static SymTabRec NVKnownChipsets[] = { @@ -288,6 +288,7 @@ static SymTabRec NVKnownChipsets[] = { 0x10DE0147, "GeForce 6700 XL" }, { 0x10DE0148, "GeForce Go 6600" }, { 0x10DE0149, "GeForce Go 6600 GT" }, + { 0x10DE014A, "Quadro NVS 440" }, { 0x10DE014C, "Quadro FX 550" }, { 0x10DE014D, "Quadro FX 550" }, { 0x10DE014E, "Quadro FX 540" }, @@ -322,6 +323,7 @@ static SymTabRec NVKnownChipsets[] = { 0x10DE0099, "GeForce Go 7800 GTX" }, { 0x10DE009D, "Quadro FX 4500" }, + { 0x10DE01D0, "GeForce 7350 LE" }, { 0x10DE01D1, "GeForce 7300 LE" }, { 0x10DE01D3, "GeForce 7300 SE" }, { 0x10DE01D6, "GeForce Go 7200" }, @@ -335,6 +337,7 @@ static SymTabRec NVKnownChipsets[] = { 0x10DE01DE, "Quadro FX 350" }, { 0x10DE01DF, "GeForce 7300 GS" }, + { 0x10DE0390, "GeForce 7650 GS" }, { 0x10DE0391, "GeForce 7600 GT" }, { 0x10DE0392, "GeForce 7600 GS" }, { 0x10DE0393, "GeForce 7300 GT" }, @@ -351,6 +354,10 @@ static SymTabRec NVKnownChipsets[] = { 0x10DE0290, "GeForce 7900 GTX" }, { 0x10DE0291, "GeForce 7900 GT" }, { 0x10DE0292, "GeForce 7900 GS" }, + { 0x10DE0293, "GeForce 7950 GX2" }, + { 0x10DE0294, "GeForce 7950 GX2" }, + { 0x10DE0295, "GeForce 7950 GT"}, + { 0x10DE0297, "GeForce Go 7950 GTX" }, { 0x10DE0298, "GeForce Go 7900 GS" }, { 0x10DE0299, "GeForce Go 7900 GTX" }, { 0x10DE029A, "Quadro FX 2500M" }, @@ -364,8 +371,14 @@ static SymTabRec NVKnownChipsets[] = { 0x10DE0241, "GeForce 6150 LE" }, { 0x10DE0242, "GeForce 6100" }, { 0x10DE0244, "GeForce Go 6150" }, + { 0x10DE0245, "Quadro NVS 210S / NVIDIA GeForce 6150LE" }, { 0x10DE0247, "GeForce Go 6100" }, + { 0x10DE03D0, "GeForce 6150SE" }, + { 0x10DE03D1, "GeForce 6100 nForce 405" }, + { 0x10DE03D2, "GeForce 6100 nForce 400" }, + { 0x10DE03D5, "GeForce 6100 nForce 420" }, + /*************** G8x ***************/ { 0x10DE0191, "GeForce 8800 GTX" }, { 0x10DE0193, "GeForce 8800 GTS" }, @@ -669,20 +682,6 @@ nvSetup(pointer module, pointer opts, int *errmaj, int *errmin) ); /* - * Modules that this driver always requires may be loaded here - * by calling LoadSubModule(). - */ - - /* - * Tell the loader about symbols from other modules that this module - * might refer to. - */ - LoaderRefSymLists(vgahwSymbols, xaaSymbols, fbSymbols, - ramdacSymbols, shadowSymbols, - i2cSymbols, ddcSymbols, vbeSymbols, - fbdevHWSymbols, int10Symbols, NULL); - - /* * The return value must be non-NULL on success even though there * is no TearDownProc. */ @@ -810,8 +809,12 @@ NVIsG80(int chipType) case 0x0620: case 0x0630: case 0x0640: + case 0x0650: case 0x06e0: case 0x06f0: + case 0x0a60: + case 0x0a70: + case 0x0ca0: return TRUE; } @@ -1239,11 +1242,9 @@ Bool NVI2CInit(ScrnInfoPtr pScrn) char *mod = "i2c"; if (xf86LoadSubModule(pScrn, mod)) { - xf86LoaderReqSymLists(i2cSymbols,NULL); mod = "ddc"; if(xf86LoadSubModule(pScrn, mod)) { - xf86LoaderReqSymLists(ddcSymbols, NULL); return NVDACi2cInit(pScrn); } } @@ -1342,15 +1343,16 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) /* Initialize the card through int10 interface if needed */ if (xf86LoadSubModule(pScrn, "int10")) { - xf86LoaderReqSymLists(int10Symbols, NULL); #if !defined(__alpha__) && !defined(__powerpc__) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); pNv->pInt = xf86InitInt10(pNv->pEnt->index); #endif } +#ifndef XSERVER_LIBPCIACCESS xf86SetOperatingState(resVgaIo, pNv->pEnt->index, ResUnusedOpr); xf86SetOperatingState(resVgaMem, pNv->pEnt->index, ResDisableOpr); +#endif /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -1478,8 +1480,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86LoaderReqSymLists(vgahwSymbols, NULL); - /* * Allocate a vgaHWRec */ @@ -1548,7 +1548,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86LoaderReqSymLists(fbdevHWSymbols, NULL); if (!fbdevHWInit(pScrn, pNv->PciInfo, NULL)) { xf86FreeInt10(pNv->pInt); return FALSE; @@ -1656,7 +1655,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) "enabled.\n"); return FALSE; } - xf86LoaderReqSymLists(vbeModeSymbols, NULL); pNv->pVbe = VBEExtendedInit(NULL, pNv->pEnt->index, SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH); if (!pNv->pVbe) return FALSE; @@ -1731,6 +1729,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pNv->IOAddress); +#ifndef XSERVER_LIBPCIACCESS if (xf86RegisterResources(pNv->pEnt->index, NULL, ResExclusive)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86RegisterResources() found resource conflicts\n"); @@ -1738,6 +1737,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) NVFreeRec(pScrn); return FALSE; } +#endif switch (pNv->Chipset & 0x0ff0) { case 0x0100: /* GeForce 256 */ @@ -1988,8 +1988,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86LoaderReqSymLists(fbSymbols, NULL); - /* Load XAA if needed */ if (!pNv->NoAccel) { if (!xf86LoadSubModule(pScrn, "xaa")) { @@ -1997,7 +1995,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) NVFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(xaaSymbols, NULL); } /* Load ramdac if needed */ @@ -2007,7 +2004,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) NVFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(ramdacSymbols, NULL); } /* Load shadowfb if needed */ @@ -2017,7 +2013,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) NVFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(shadowSymbols, NULL); } pNv->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel; diff --git a/driver/xf86-video-nv/src/nv_include.h b/driver/xf86-video-nv/src/nv_include.h index 071a4a070..a0d5ad18b 100644 --- a/driver/xf86-video-nv/src/nv_include.h +++ b/driver/xf86-video-nv/src/nv_include.h @@ -1,19 +1,17 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.9 2000/10/06 12:31:03 eich Exp $ */ - #ifndef __NV_INCLUDE_H__ #define __NV_INCLUDE_H__ -#if !USE_LIBC_WRAPPER #include <string.h> #include <math.h> -#endif +#include <unistd.h> /* All drivers should typically include these */ #include "xf86.h" #include "xf86_OSproc.h" + +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 #include "xf86Resources.h" -#if USE_LIBC_WRAPPER -#include "xf86_ansic.h" +#include "xf86RAC.h" #endif #include "compiler.h" @@ -35,8 +33,6 @@ #include "vbe.h" -#include "xf86RAC.h" - #include "nv_const.h" #include "dixstruct.h" @@ -55,7 +51,6 @@ #include "vgaHW.h" #include "xf86Cursor.h" -#include "xf86DDC.h" #include "region.h" diff --git a/driver/xf86-video-nv/src/nv_video.c b/driver/xf86-video-nv/src/nv_video.c index 1a428fb6e..6b13e5fa2 100644 --- a/driver/xf86-video-nv/src/nv_video.c +++ b/driver/xf86-video-nv/src/nv_video.c @@ -1,15 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c,v 1.23 2004/03/20 22:07:06 mvojkovi Exp $ */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "xf86.h" #include "xf86_OSproc.h" -#include "xf86Resources.h" -#if USE_LIBC_WRAPPER -#include "xf86_ansic.h" -#endif #include "compiler.h" #include "xf86PciInfo.h" #include "xf86Pci.h" @@ -83,11 +77,7 @@ static int NVGetBlitPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); static void NVStopOverlayVideo(ScrnInfoPtr, pointer, Bool); static void NVStopBlitVideo(ScrnInfoPtr, pointer, Bool); -#if HAVE_XV_DRAWABLE static int NVPutImage( ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer, DrawablePtr); -#else -static int NVPutImage( ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); -#endif static void NVQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); static int NVQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); @@ -1012,10 +1002,8 @@ static int NVPutImage short height, Bool Sync, RegionPtr clipBoxes, - pointer data -#if HAVE_XV_DRAWABLE - , DrawablePtr pDraw -#endif + pointer data, + DrawablePtr pDraw ) { NVPortPrivPtr pPriv = (NVPortPrivPtr)data; diff --git a/driver/xf86-video-nv/src/riva_driver.c b/driver/xf86-video-nv/src/riva_driver.c index e06299581..afe0972db 100644 --- a/driver/xf86-video-nv/src/riva_driver.c +++ b/driver/xf86-video-nv/src/riva_driver.c @@ -23,12 +23,11 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_driver.c,v 1.5 2003/11/03 05:11:26 tsi Exp $ */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "nv_const.h" #include "riva_include.h" #include "xf86int10.h" @@ -61,133 +60,6 @@ static void RivaRestore(ScrnInfoPtr pScrn); static Bool RivaModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -/* - * List of symbols from other modules that this module references. This - * list is used to tell the loader that it is OK for symbols here to be - * unresolved providing that it hasn't been told that they haven't been - * told that they are essential via a call to xf86LoaderReqSymbols() or - * xf86LoaderReqSymLists(). The purpose is this is to avoid warnings about - * unresolved symbols that are not required. - */ - -static const char *vgahwSymbols[] = { - "vgaHWUnmapMem", - "vgaHWDPMSSet", - "vgaHWFreeHWRec", - "vgaHWGetHWRec", - "vgaHWGetIndex", - "vgaHWInit", - "vgaHWMapMem", - "vgaHWProtect", - "vgaHWRestore", - "vgaHWSave", - "vgaHWSaveScreen", - NULL -}; - -static const char *fbSymbols[] = { - "fbPictureInit", - "fbScreenInit", - NULL -}; - -static const char *xaaSymbols[] = { - "XAAGetCopyROP", - "XAACreateInfoRec", - "XAADestroyInfoRec", - "XAAGetFallbackOps", - "XAAInit", - "XAAGetPatternROP", - NULL -}; - -static const char *ramdacSymbols[] = { - "xf86CreateCursorInfoRec", - "xf86DestroyCursorInfoRec", - "xf86InitCursor", - NULL -}; - -static const char *ddcSymbols[] = { - "xf86PrintEDID", - "xf86DoEDID_DDC2", - "xf86SetDDCproperties", - NULL -}; - -#ifdef XFree86LOADER -static const char *vbeSymbols[] = { - "VBEInit", - "vbeFree", - "vbeDoEDID", - NULL -}; -#endif - -static const char *i2cSymbols[] = { - "xf86CreateI2CBusRec", - "xf86I2CBusInit", - NULL -}; - -static const char *shadowSymbols[] = { - "ShadowFBInit", - NULL -}; - -static const char *fbdevHWSymbols[] = { - "fbdevHWInit", - "fbdevHWUseBuildinMode", - - "fbdevHWGetVidmem", - - /* colormap */ - "fbdevHWLoadPaletteWeak", - - /* ScrnInfo hooks */ - "fbdevHWAdjustFrameWeak", - "fbdevHWEnterVT", - "fbdevHWLeaveVTWeak", - "fbdevHWModeInit", - "fbdevHWSave", - "fbdevHWSwitchModeWeak", - "fbdevHWValidModeWeak", - - "fbdevHWMapMMIO", - "fbdevHWMapVidmem", - - NULL -}; - -static const char *int10Symbols[] = { - "xf86FreeInt10", - "xf86InitInt10", - NULL -}; - - -#ifdef XFree86LOADER - -static MODULESETUPPROTO(rivaSetup); - -static XF86ModuleVersionInfo rivaVersRec = -{ - "riva", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - NV_MAJOR_VERSION, NV_MINOR_VERSION, NV_PATCHLEVEL, - ABI_CLASS_VIDEODRV, /* This is a video driver */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_VIDEODRV, - {0,0,0,0} -}; - -_X_EXPORT XF86ModuleData riva128ModuleData = { &rivaVersRec, rivaSetup, NULL }; -#endif - - typedef enum { OPTION_SW_CURSOR, OPTION_HW_CURSOR, @@ -253,30 +125,6 @@ RivaFreeRec(ScrnInfoPtr pScrn) pScrn->driverPrivate = NULL; } - -#ifdef XFree86LOADER - -static pointer -rivaSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - - /* This module should be loaded only once, but check to be sure. */ - - if (!setupDone) { - setupDone = TRUE; - - LoaderRefSymLists(vgahwSymbols, xaaSymbols, fbSymbols, - ramdacSymbols, shadowSymbols, - i2cSymbols, ddcSymbols, vbeSymbols, - fbdevHWSymbols, int10Symbols, NULL); - } - return (pointer)1; -} - - -#endif /* XFree86LOADER */ - _X_EXPORT const OptionInfoRec * RivaAvailableOptions(int chipid, int busid) { @@ -467,11 +315,9 @@ Bool RivaI2CInit(ScrnInfoPtr pScrn) char *mod = "i2c"; if (xf86LoadSubModule(pScrn, mod)) { - xf86LoaderReqSymLists(i2cSymbols,NULL); mod = "ddc"; if(xf86LoadSubModule(pScrn, mod)) { - xf86LoaderReqSymLists(ddcSymbols, NULL); return RivaDACi2cInit(pScrn); } } @@ -535,28 +381,32 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) /* Find the PCI info for this screen */ pRiva->PciInfo = xf86GetPciInfoForEntity(pRiva->pEnt->index); +#if !XSERVER_LIBPCIACCESS pRiva->PciTag = pciTag(pRiva->PciInfo->bus, pRiva->PciInfo->device, pRiva->PciInfo->func); +#endif pRiva->Primary = xf86IsPrimaryPci(pRiva->PciInfo); /* Initialize the card through int10 interface if needed */ if (xf86LoadSubModule(pScrn, "int10")) { - xf86LoaderReqSymLists(int10Symbols, NULL); #if !defined(__alpha__) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); pRiva->pInt = xf86InitInt10(pRiva->pEnt->index); #endif } +#ifndef XSERVER_LIBPCIACCESS xf86SetOperatingState(resVgaIo, pRiva->pEnt->index, ResUnusedOpr); xf86SetOperatingState(resVgaMem, pRiva->pEnt->index, ResDisableOpr); +#endif /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; - pRiva->ChipRev = pRiva->PciInfo->chipRev; - if((pRiva->PciInfo->vendor != 0x12D2) || (pRiva->PciInfo->chipType != 0x0018)) + pRiva->ChipRev = CHIP_REVISION(pRiva->PciInfo); + if(VENDOR_ID(pRiva->PciInfo) != PCI_VENDOR_NVIDIA_SGS || + DEVICE_ID(pRiva->PciInfo) != PCI_CHIP_RIVA128) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "This is not a RIVA 128\n"); xf86FreeInt10(pRiva->pInt); @@ -627,8 +477,6 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86LoaderReqSymLists(vgahwSymbols, NULL); - /* * Allocate a vgaHWRec */ @@ -695,7 +543,6 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86LoaderReqSymLists(fbdevHWSymbols, NULL); if (!fbdevHWInit(pScrn, pRiva->PciInfo, NULL)) { xf86FreeInt10(pRiva->pInt); return FALSE; @@ -746,8 +593,8 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) } else { int i = 1; pRiva->FbBaseReg = i; - if (pRiva->PciInfo->memBase[i] != 0) { - pRiva->FbAddress = pRiva->PciInfo->memBase[i] & 0xff800000; + if (MEMBASE(pRiva->PciInfo, i) != 0) { + pRiva->FbAddress = MEMBASE(pRiva->PciInfo, i) & 0xff800000; from = X_PROBED; } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -774,8 +621,8 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) from = X_CONFIG; } else { int i = 0; - if (pRiva->PciInfo->memBase[i] != 0) { - pRiva->IOAddress = pRiva->PciInfo->memBase[i] & 0xffffc000; + if (MEMBASE(pRiva->PciInfo, i) != 0) { + pRiva->IOAddress = MEMBASE(pRiva->PciInfo, i) & 0xffffc000; from = X_PROBED; } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -788,6 +635,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pRiva->IOAddress); +#ifndef XSERVER_LIBPCIACCESS if (xf86RegisterResources(pRiva->pEnt->index, NULL, ResExclusive)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86RegisterResources() found resource conflicts\n"); @@ -795,7 +643,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) RivaFreeRec(pScrn); return FALSE; } - +#endif Riva3Setup(pScrn); /* @@ -918,8 +766,6 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86LoaderReqSymLists(fbSymbols, NULL); - /* Load XAA if needed */ if (!pRiva->NoAccel) { if (!xf86LoadSubModule(pScrn, "xaa")) { @@ -927,7 +773,6 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) RivaFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(xaaSymbols, NULL); } /* Load ramdac if needed */ @@ -937,7 +782,6 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) RivaFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(ramdacSymbols, NULL); } /* Load shadowfb if needed */ @@ -947,7 +791,6 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) RivaFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymLists(shadowSymbols, NULL); } pRiva->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel; @@ -972,22 +815,34 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags) static Bool RivaMapMem(ScrnInfoPtr pScrn) { - RivaPtr pRiva; - - pRiva = RivaPTR(pScrn); + RivaPtr pRiva = RivaPTR(pScrn); /* * Map IO registers to virtual address space */ +#if XSERVER_LIBPCIACCESS + void *tmp; + + pci_device_map_range(pRiva->PciInfo, pRiva->IOAddress, 0x1000000, + PCI_DEV_MAP_FLAG_WRITABLE, &tmp); + pRiva->IOBase = tmp; + pci_device_map_range(pRiva->PciInfo, pRiva->FbAddress, pRiva->FbMapSize, + PCI_DEV_MAP_FLAG_WRITABLE | + PCI_DEV_MAP_FLAG_WRITE_COMBINE, + &tmp); + pRiva->FbBase = tmp; +#else pRiva->IOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO | VIDMEM_READSIDEEFFECT, pRiva->PciTag, pRiva->IOAddress, 0x1000000); - if (pRiva->IOBase == NULL) - return FALSE; - pRiva->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pRiva->PciTag, pRiva->FbAddress, pRiva->FbMapSize); +#endif + + if (pRiva->IOBase == NULL) + return FALSE; + if (pRiva->FbBase == NULL) return FALSE; @@ -1030,10 +885,15 @@ RivaUnmapMem(ScrnInfoPtr pScrn) /* * Unmap IO registers to virtual address space */ +#if XSERVER_LIBPCIACCESS + pci_device_unmap_range(pRiva->PciInfo, pRiva->IOBase, 0x1000000); + pci_device_unmap_range(pRiva->PciInfo, pRiva->FbBase, pRiva->FbMapSize); +#else xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pRiva->IOBase, 0x1000000); - pRiva->IOBase = NULL; - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pRiva->FbBase, pRiva->FbMapSize); +#endif + + pRiva->IOBase = NULL; pRiva->FbBase = NULL; pRiva->FbStart = NULL; @@ -1396,4 +1256,3 @@ RivaSave(ScrnInfoPtr pScrn) (*pRiva->Save)(pScrn, vgaReg, rivaReg, pRiva->Primary); } - diff --git a/driver/xf86-video-nv/src/riva_include.h b/driver/xf86-video-nv/src/riva_include.h index 675899b1f..04c35a662 100644 --- a/driver/xf86-video-nv/src/riva_include.h +++ b/driver/xf86-video-nv/src/riva_include.h @@ -1,18 +1,15 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_include.h $ */ - #ifndef __RIVA_INCLUDE_H__ #define __RIVA_INCLUDE_H__ -#if !USE_LIBC_WRAPPER #include <string.h> -#endif /* All drivers should typically include these */ #include "xf86.h" #include "xf86_OSproc.h" + +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 #include "xf86Resources.h" -#if USE_LIBC_WRAPPER -#include "xf86_ansic.h" +#include "xf86RAC.h" #endif #include "compiler.h" @@ -34,7 +31,6 @@ #include "vbe.h" -#include "xf86RAC.h" #include "riva_const.h" diff --git a/driver/xf86-video-nv/src/riva_type.h b/driver/xf86-video-nv/src/riva_type.h index 5a1317f34..456f8138d 100644 --- a/driver/xf86-video-nv/src/riva_type.h +++ b/driver/xf86-video-nv/src/riva_type.h @@ -56,8 +56,8 @@ typedef struct { #else pciVideoPtr PciInfo; PCITAG PciTag; -#endif xf86AccessRec Access; +#endif int ChipRev; Bool Primary; CARD32 IOAddress; |