aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/modes
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/modes')
-rw-r--r--xorg-server/hw/xfree86/modes/Makefile.am13
-rw-r--r--xorg-server/hw/xfree86/modes/Makefile.in110
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c260
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.h161
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Cursors.c13
-rw-r--r--xorg-server/hw/xfree86/modes/xf86DiDGA.c4
-rw-r--r--xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c437
-rw-r--r--xorg-server/hw/xfree86/modes/xf86EdidModes.c47
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.c82
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.h58
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c167
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.h18
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Rotate.c40
-rw-r--r--xorg-server/hw/xfree86/modes/xf86cvt.c2
-rw-r--r--xorg-server/hw/xfree86/modes/xf86gtf.c2
15 files changed, 1101 insertions, 313 deletions
diff --git a/xorg-server/hw/xfree86/modes/Makefile.am b/xorg-server/hw/xfree86/modes/Makefile.am
index 331e4061c..9236426bf 100644
--- a/xorg-server/hw/xfree86/modes/Makefile.am
+++ b/xorg-server/hw/xfree86/modes/Makefile.am
@@ -1,19 +1,24 @@
-noinst_LIBRARIES = libxf86modes.a
+noinst_LTLIBRARIES = libxf86modes.la
-libxf86modes_a_SOURCES = \
+if DGA
+DGA_SRCS = xf86DiDGA.c
+endif
+
+libxf86modes_la_SOURCES = \
xf86Crtc.c \
xf86Crtc.h \
xf86Cursors.c \
xf86cvt.c \
xf86gtf.c \
- xf86DiDGA.c \
+ xf86DisplayIDModes.c \
xf86EdidModes.c \
xf86Modes.c \
xf86Modes.h \
xf86RandR12.c \
xf86RandR12.h \
xf86Rename.h \
- xf86Rotate.c
+ xf86Rotate.c \
+ $(DGA_SRCS)
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
diff --git a/xorg-server/hw/xfree86/modes/Makefile.in b/xorg-server/hw/xfree86/modes/Makefile.in
index 89ed8cadb..b094ff16d 100644
--- a/xorg-server/hw/xfree86/modes/Makefile.in
+++ b/xorg-server/hw/xfree86/modes/Makefile.in
@@ -39,8 +39,11 @@ subdir = hw/xfree86/modes
DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -50,18 +53,21 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
$(top_builddir)/include/xorg-config.h \
$(top_builddir)/include/xkb-config.h \
$(top_builddir)/include/xwin-config.h \
- $(top_builddir)/include/kdrive-config.h
+ $(top_builddir)/include/kdrive-config.h \
+ $(top_builddir)/include/version-config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libxf86modes_a_AR = $(AR) $(ARFLAGS)
-libxf86modes_a_LIBADD =
-am_libxf86modes_a_OBJECTS = xf86Crtc.$(OBJEXT) xf86Cursors.$(OBJEXT) \
- xf86cvt.$(OBJEXT) xf86gtf.$(OBJEXT) xf86DiDGA.$(OBJEXT) \
- xf86EdidModes.$(OBJEXT) xf86Modes.$(OBJEXT) \
- xf86RandR12.$(OBJEXT) xf86Rotate.$(OBJEXT)
-libxf86modes_a_OBJECTS = $(am_libxf86modes_a_OBJECTS)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libxf86modes_la_LIBADD =
+am__libxf86modes_la_SOURCES_DIST = xf86Crtc.c xf86Crtc.h xf86Cursors.c \
+ xf86cvt.c xf86gtf.c xf86DisplayIDModes.c xf86EdidModes.c \
+ xf86Modes.c xf86Modes.h xf86RandR12.c xf86RandR12.h \
+ xf86Rename.h xf86Rotate.c xf86DiDGA.c
+@DGA_TRUE@am__objects_1 = xf86DiDGA.lo
+am_libxf86modes_la_OBJECTS = xf86Crtc.lo xf86Cursors.lo xf86cvt.lo \
+ xf86gtf.lo xf86DisplayIDModes.lo xf86EdidModes.lo xf86Modes.lo \
+ xf86RandR12.lo xf86Rotate.lo $(am__objects_1)
+libxf86modes_la_OBJECTS = $(am_libxf86modes_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -72,8 +78,8 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(libxf86modes_a_SOURCES)
-DIST_SOURCES = $(libxf86modes_a_SOURCES)
+SOURCES = $(libxf86modes_la_SOURCES)
+DIST_SOURCES = $(am__libxf86modes_la_SOURCES_DIST)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -105,6 +111,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_MAKEFLAGS = @AM_MAKEFLAGS@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
@@ -125,9 +132,12 @@ CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CXX = @CXX@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -156,7 +166,9 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_CFLAGS = @DRI_CFLAGS@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DRI_LIBS = @DRI_LIBS@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
DUMPBIN = @DUMPBIN@
@@ -165,9 +177,13 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -206,12 +222,13 @@ LTCOMPILE = @LTCOMPILE@
LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAIN_LIB = @MAIN_LIB@
+MAKEFLAGS = @MAKEFLAGS@
MAKEINFO = @MAKEINFO@
MAKE_HTML = @MAKE_HTML@
MAKE_PDF = @MAKE_PDF@
MAKE_PS = @MAKE_PS@
MAKE_TEXT = @MAKE_TEXT@
-MESA_SOURCE = @MESA_SOURCE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
@@ -231,7 +248,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
@@ -241,6 +257,7 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PROJECTROOT = @PROJECTROOT@
PS2PDF = @PS2PDF@
+Q = @Q@
RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
@@ -254,11 +271,10 @@ STRIP = @STRIP@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_LIBS = @TSLIB_LIBS@
UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
-VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
-VENDOR_NAME = @VENDOR_NAME@
+V = @V@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
-VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
+WINDRES = @WINDRES@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -294,6 +310,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
XPBPROXY_LIBS = @XPBPROXY_LIBS@
+XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -318,7 +335,6 @@ YFLAGS = @YFLAGS@
__XCONFIGFILE__ = @__XCONFIGFILE__@
abi_ansic = @abi_ansic@
abi_extension = @abi_extension@
-abi_font = @abi_font@
abi_videodrv = @abi_videodrv@
abi_xinput = @abi_xinput@
abs_builddir = @abs_builddir@
@@ -341,6 +357,7 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
+distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
driverdir = @driverdir@
dvidir = @dvidir@
@@ -372,27 +389,31 @@ psdir = @psdir@
sbindir = @sbindir@
sdkdir = @sdkdir@
sharedstatedir = @sharedstatedir@
+shavedir = @shavedir@
srcdir = @srcdir@
+symbol_visibility = @symbol_visibility@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-noinst_LIBRARIES = libxf86modes.a
-libxf86modes_a_SOURCES = \
+noinst_LTLIBRARIES = libxf86modes.la
+@DGA_TRUE@DGA_SRCS = xf86DiDGA.c
+libxf86modes_la_SOURCES = \
xf86Crtc.c \
xf86Crtc.h \
xf86Cursors.c \
xf86cvt.c \
xf86gtf.c \
- xf86DiDGA.c \
+ xf86DisplayIDModes.c \
xf86EdidModes.c \
xf86Modes.c \
xf86Modes.h \
xf86RandR12.c \
xf86RandR12.h \
xf86Rename.h \
- xf86Rotate.c
+ xf86Rotate.c \
+ $(DGA_SRCS)
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
@@ -442,12 +463,16 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
-clean-noinstLIBRARIES:
- -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libxf86modes.a: $(libxf86modes_a_OBJECTS) $(libxf86modes_a_DEPENDENCIES)
- -rm -f libxf86modes.a
- $(libxf86modes_a_AR) libxf86modes.a $(libxf86modes_a_OBJECTS) $(libxf86modes_a_LIBADD)
- $(RANLIB) libxf86modes.a
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxf86modes.la: $(libxf86modes_la_OBJECTS) $(libxf86modes_la_DEPENDENCIES)
+ $(LINK) $(libxf86modes_la_OBJECTS) $(libxf86modes_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -455,15 +480,16 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Crtc.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursors.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DiDGA.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86EdidModes.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Modes.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RandR12.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Rotate.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86cvt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86gtf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Crtc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursors.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DiDGA.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DisplayIDModes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86EdidModes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Modes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RandR12.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Rotate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86cvt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86gtf.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -596,7 +622,7 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(sdkdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -628,7 +654,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -700,7 +726,7 @@ uninstall-am: uninstall-sdkHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLIBRARIES ctags distclean \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index e9bde36e3..8d636af48 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/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)
{
@@ -257,9 +267,11 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
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;
}
@@ -341,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++)
@@ -350,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;
@@ -366,6 +384,8 @@ done:
crtc->transformPresent = saved_transform_present;
}
+ free(adjusted_mode);
+
if (didLock)
crtc->funcs->unlock (crtc);
@@ -376,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)
{
@@ -386,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;
@@ -420,6 +440,7 @@ typedef enum {
OPTION_IGNORE,
OPTION_ROTATE,
OPTION_PANNING,
+ OPTION_PRIMARY,
} OutputOpts;
static OptionInfoRec xf86OutputOptions[] = {
@@ -436,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 },
};
@@ -444,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 },
};
@@ -560,7 +582,7 @@ xf86OutputInitialRotation (xf86OutputPtr output)
return RR_Rotate_0;
}
-_X_EXPORT xf86OutputPtr
+xf86OutputPtr
xf86OutputCreate (ScrnInfoPtr scrn,
const xf86OutputFuncsRec *funcs,
const char *name)
@@ -568,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;
@@ -613,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;
@@ -639,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)
@@ -649,7 +684,7 @@ xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
}
}
-_X_EXPORT void
+void
xf86OutputDestroy (xf86OutputPtr output)
{
ScrnInfoPtr scrn = output->scrn;
@@ -725,7 +760,6 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen)
/*
* Called at ScreenInit time to set up
*/
-_X_EXPORT
#ifdef RANDR_13_INTERFACE
int
#else
@@ -1484,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);
@@ -1630,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
@@ -1668,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
@@ -1745,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
@@ -1840,7 +1879,7 @@ SetCompatOutput(xf86CrtcConfigPtr config)
return output;
}
-_X_EXPORT void
+void
xf86SetScrnInfoModes (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -1885,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;
@@ -2181,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
@@ -2196,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);
@@ -2231,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");
@@ -2291,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
*/
@@ -2310,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)
{
/*
@@ -2429,7 +2568,7 @@ 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);
@@ -2507,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;
@@ -2570,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);
@@ -2643,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);
@@ -2681,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];
@@ -2697,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);
@@ -2719,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)
@@ -2727,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
@@ -2754,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;
@@ -2822,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;
@@ -2834,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;
@@ -2853,7 +2993,7 @@ static char *_xf86ConnectorNames[] = {
"Component", "LFP", "Proprietary",
"HDMI", "DisplayPort",
};
-_X_EXPORT char *
+char *
xf86ConnectorGetName(xf86ConnectorType connector)
{
return _xf86ConnectorNames[connector];
@@ -2938,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,
@@ -3015,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/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h
index 0a596bc49..69afaa5d1 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.h
+++ b/xorg-server/hw/xfree86/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/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c
index fbd61e9fd..fc4df8477 100644
--- a/xorg-server/hw/xfree86/modes/xf86Cursors.c
+++ b/xorg-server/hw/xfree86/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;
@@ -651,7 +650,7 @@ xf86_reload_cursors (ScreenPtr screen)
/**
* Clean up CRTC-based cursor code
*/
-_X_EXPORT void
+void
xf86_cursors_fini (ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
diff --git a/xorg-server/hw/xfree86/modes/xf86DiDGA.c b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
index f40d0abef..0964cefa7 100644
--- a/xorg-server/hw/xfree86/modes/xf86DiDGA.c
+++ b/xorg-server/hw/xfree86/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/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c b/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c
new file mode 100644
index 000000000..182d43e0e
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c
@@ -0,0 +1,437 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Adam Jackson <ajax@redhat.com>
+ */
+
+#include "xorg-config.h"
+#include "xf86.h"
+#include "xf86str.h"
+#include "edid.h"
+#include "xf86DDC.h"
+
+typedef void (*did_proc)(int scrnIndex, unsigned char *data, void *closure);
+
+#define DID_PRODUCT_ID 0x00
+#define DID_DISPLAY_PARAMETERS 0x01
+#define DID_COLOR_INFO 0x02
+#define DID_TIMING_1_DETAILED 0x03
+#define DID_TIMING_2_DETAILED 0x04
+#define DID_TIMING_3_SHORT 0x05
+#define DID_TIMING_4_DMT 0x06
+#define DID_TIMING_VESA 0x07
+#define DID_TIMING_CEA 0x08
+#define DID_TIMING_RANGE_LIMITS 0x09
+#define DID_PRODUCT_SERIAL 0x0A
+#define DID_ASCII_STRING 0x0B
+#define DID_DISPLAY_DEVICE 0x0C
+#define DID_POWER_SEQUENCING 0x0D
+#define DID_TRANSFER_INFO 0x0E
+#define DID_DISPLAY_INTERFACE 0x0F
+#define DID_STEREO 0x10
+#define DID_VENDOR 0x7F
+
+#define extract_le16(x, i) ((x[i+1] << 8) + (x[i]))
+#define extract_le24(x, i) ((x[i+2] << 16) + (x[i+1] << 8) + (x[i]))
+
+static DisplayModePtr
+modeCalloc(void)
+{
+ return xcalloc(1, sizeof(DisplayModeRec));
+}
+
+/*
+ * How awesome is it to have two detailed timing formats, neither of which
+ * are compatible with the format in EDID? So awesome.
+ */
+
+static void
+didDetailedTiming1(int i, unsigned char *x, MonPtr mon)
+{
+ DisplayModePtr m = modeCalloc();
+
+ if (!m)
+ return;
+
+ m->Clock = extract_le24(x, 0);
+
+ m->HDisplay = extract_le16(x, 4);
+ m->HSyncStart = m->HDisplay + (extract_le16(x, 8) & 0x7f);
+ m->HSyncEnd = m->HSyncStart + extract_le16(x, 10);
+ m->HTotal = m->HDisplay + extract_le16(x, 6);
+ m->Flags |= (x[9] & 0x80) ? V_PHSYNC : V_NHSYNC;
+
+ m->VDisplay = extract_le16(x, 12);
+ m->VSyncStart = m->VDisplay + (extract_le16(x, 16) & 0x7f);
+ m->VSyncEnd = m->VSyncStart + extract_le16(x, 18);
+ m->VTotal = m->VDisplay + extract_le16(x, 14);
+ m->Flags |= (x[17] & 0x80) ? V_PVSYNC : V_NVSYNC;
+
+ m->type = M_T_DRIVER;
+ if (x[3] & 0x80)
+ m->type |= M_T_PREFERRED;
+
+ /* XXX double check handling of this */
+ if (x[3] & 0x10)
+ m->Flags |= V_INTERLACE;
+
+ mon->Modes = xf86ModesAdd(mon->Modes, m);
+}
+
+/* XXX no sync bits. what to do? */
+static void
+didDetailedTiming2(int i, unsigned char *x, MonPtr mon)
+{
+ DisplayModePtr mode = modeCalloc();
+
+ if (!mode)
+ return;
+
+ mode->Clock = extract_le24(x, 0);
+
+ /* horiz sizes are in character cells, not pixels, hence * 8 */
+ mode->HDisplay = ((extract_le16(x, 4) & 0x01ff) + 1) * 8;
+ mode->HSyncStart = mode->HDisplay + (((x[6] & 0xf0) >> 4) + 1) * 8;
+ mode->HSyncEnd = mode->HSyncStart + ((x[6] & 0x0f) + 1) * 8;
+ mode->HTotal = mode->HDisplay + ((x[5] >> 1) + 1) * 8;
+
+ mode->VDisplay = extract_le16(x, 7) & 0x07ff;
+ mode->VSyncStart = mode->VDisplay + (x[10] >> 4) + 1;
+ mode->VSyncEnd = mode->VSyncStart + (x[10] & 0x0f) + 1;
+ mode->VTotal = mode->VDisplay + x[9];
+
+ mode->status = M_T_DRIVER;
+ if (x[3] & 0x80)
+ mode->status |= M_T_PREFERRED;
+
+ /* XXX double check handling of this */
+ if (x[3] & 0x10)
+ mode->Flags |= V_INTERLACE;
+
+ mon->Modes = xf86ModesAdd(mon->Modes, mode);
+}
+
+static void
+didShortTiming(int i, unsigned char *x, MonPtr mon)
+{
+ DisplayModePtr m;
+ int w, h, r;
+
+ w = (x[1] + 1) * 8;
+ switch (x[0] & 0x0f) {
+ case 0:
+ h = w;
+ break;
+ case 1:
+ h = (w * 4) / 5;
+ break;
+ case 2:
+ h = (w * 3) / 4;
+ break;
+ case 3:
+ h = (w * 9) / 15;
+ break;
+ case 4:
+ h = (w * 9) / 16;
+ break;
+ case 5:
+ h = (w * 10) / 16;
+ break;
+ default:
+ return;
+ }
+ r = (x[2] & 0x7f) + 1;
+
+ m = xf86CVTMode(w, h, r, !!(x[0] & 0x10), !!(x[2] & 0x80));
+
+ m->type = M_T_DRIVER;
+ if (x[0] & 0x80)
+ m->type |= M_T_PREFERRED;
+
+ mon->Modes = xf86ModesAdd(mon->Modes, m);
+}
+
+static void
+didDMTTiming(int i, unsigned char *x, void *closure)
+{
+ MonPtr mon = closure;
+
+ mon->Modes = xf86ModesAdd(mon->Modes,
+ xf86DuplicateMode(DMTModes + *x));
+}
+
+#define RB 1
+#define INT 2
+static const struct did_dmt {
+ short w, h, r, f;
+} did_dmt[] = {
+ /* byte 3 */
+ { 640, 350, 85, 0 },
+ { 640, 400, 85, 0 },
+ { 720, 400, 85, 0 },
+ { 640, 480, 60, 0 },
+ { 640, 480, 72, 0 },
+ { 640, 480, 75, 0 },
+ { 640, 480, 85, 0 },
+ { 800, 600, 56, 0 },
+ /* byte 4 */
+ { 800, 600, 60, 0 },
+ { 800, 600, 72, 0 },
+ { 800, 600, 75, 0 },
+ { 800, 600, 85, 0 },
+ { 800, 600, 120, RB },
+ { 848, 480, 60, 0 },
+ { 1024, 768, 43, INT },
+ { 1024, 768, 60, 0 },
+ /* byte 5 */
+ { 1024, 768, 70, 0 },
+ { 1024, 768, 75, 0 },
+ { 1024, 768, 85, 0 },
+ { 1024, 768, 120, RB },
+ { 1152, 864, 75, 0 },
+ { 1280, 768, 60, RB },
+ { 1280, 768, 60, 0 },
+ { 1280, 768, 75, 0 },
+ /* byte 6 */
+ { 1280, 768, 85, 0 },
+ { 1280, 768, 120, RB },
+ { 1280, 800, 60, RB },
+ { 1280, 800, 60, 0 },
+ { 1280, 800, 75, 0 },
+ { 1280, 800, 85, 0 },
+ { 1280, 800, 120, RB },
+ { 1280, 960, 60, 0 },
+ /* byte 7 */
+ { 1280, 960, 85, 0 },
+ { 1280, 960, 120, RB },
+ { 1280, 1024, 60, 0 },
+ { 1280, 1024, 75, 0 },
+ { 1280, 1024, 85, 0 },
+ { 1280, 1024, 120, RB },
+ { 1360, 768, 60, 0 },
+ { 1360, 768, 120, RB },
+ /* byte 8 */
+ { 1400, 1050, 60, RB },
+ { 1400, 1050, 60, 0 },
+ { 1400, 1050, 75, 0 },
+ { 1400, 1050, 85, 0 },
+ { 1400, 1050, 120, RB },
+ { 1440, 900, 60, RB },
+ { 1440, 900, 60, 0 },
+ { 1440, 900, 75, 0 },
+ /* byte 9 */
+ { 1440, 900, 85, 0 },
+ { 1440, 900, 120, RB },
+ { 1600, 1200, 60, 0 },
+ { 1600, 1200, 65, 0 },
+ { 1600, 1200, 70, 0 },
+ { 1600, 1200, 75, 0 },
+ { 1600, 1200, 85, 0 },
+ { 1600, 1200, 120, RB },
+ /* byte a */
+ { 1680, 1050, 60, RB },
+ { 1680, 1050, 60, 0 },
+ { 1680, 1050, 75, 0 },
+ { 1680, 1050, 85, 0 },
+ { 1680, 1050, 120, RB },
+ { 1792, 1344, 60, 0 },
+ { 1792, 1344, 75, 0 },
+ { 1792, 1344, 120, RB },
+ /* byte b */
+ { 1856, 1392, 60, 0 },
+ { 1856, 1392, 75, 0 },
+ { 1856, 1392, 120, RB },
+ { 1920, 1200, 60, RB },
+ { 1920, 1200, 60, 0 },
+ { 1920, 1200, 75, 0 },
+ { 1920, 1200, 85, 0 },
+ { 1920, 1200, 120, RB },
+ /* byte c */
+ { 1920, 1440, 60, 0 },
+ { 1920, 1440, 75, 0 },
+ { 1920, 1440, 120, RB },
+ { 2560, 1600, 60, RB },
+ { 2560, 1600, 60, 0 },
+ { 2560, 1600, 75, 0 },
+ { 2560, 1600, 85, 0 },
+ { 2560, 1600, 120, RB },
+};
+
+static void
+didVesaTiming(int scrn, unsigned char *x, MonPtr mon)
+{
+ int i, j;
+
+ x += 3;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 8; j++)
+ if (x[i] & (1 << j)) {
+ const struct did_dmt *d = &(did_dmt[i * 8 + j]);
+ if (d->f == INT)
+ continue;
+ mon->Modes = xf86ModesAdd(mon->Modes,
+ FindDMTMode(d->w, d->h, d->r,
+ d->f == RB));
+ }
+
+}
+
+static void
+handleDisplayIDBlock(int scrnIndex, unsigned char *x, void *closure)
+{
+ MonPtr mon = closure;
+
+ switch (x[0]) {
+ case DID_DISPLAY_PARAMETERS:
+ /* w/h are in decimillimeters */
+ mon->widthmm = (extract_le16(x, 3) + 5) / 10;
+ mon->heightmm = (extract_le16(x, 5) + 5) / 10;
+ /* XXX pixel count, feature flags, gamma, aspect, color depth */
+ break;
+
+ case DID_TIMING_RANGE_LIMITS:
+ {
+ int n;
+
+ mon->maxPixClock = max(mon->maxPixClock, extract_le24(x, 6) * 10);
+
+ n = mon->nHsync++;
+ if (n < MAX_HSYNC) {
+ mon->hsync[n].lo = x[9];
+ mon->hsync[n].hi = x[10];
+ } else {
+ n = MAX_HSYNC;
+ }
+ n = mon->nVrefresh++;
+ if (n < MAX_VREFRESH) {
+ mon->vrefresh[n].lo = x[13];
+ mon->vrefresh[n].hi = x[14];
+ } else {
+ n = MAX_VREFRESH;
+ }
+ break;
+ }
+
+ case DID_TIMING_1_DETAILED:
+ {
+ int i;
+ for (i = 0; i < x[2]; i += 20)
+ didDetailedTiming1(scrnIndex, x + i + 3, mon);
+ break;
+ }
+
+ case DID_TIMING_2_DETAILED:
+ {
+ int i;
+ for (i = 0; i < x[2]; i += 11)
+ didDetailedTiming2(scrnIndex, x + i + 3, mon);
+ break;
+ }
+
+ case DID_TIMING_3_SHORT:
+ {
+ int i;
+ for (i = 0; i < x[2]; i += 3)
+ didShortTiming(scrnIndex, x + i + 3, mon);
+ break;
+ }
+
+ case DID_TIMING_4_DMT:
+ {
+ int i;
+ for (i = 0; i < x[2]; i++)
+ didDMTTiming(scrnIndex, x + i + 3, mon);
+ break;
+ }
+
+ case DID_TIMING_VESA:
+ didVesaTiming(scrnIndex, x, mon);
+ break;
+
+ /* XXX pixel format, ar, orientation, subpixel, dot pitch, bit depth */
+ case DID_DISPLAY_DEVICE:
+
+ /* XXX interface, links, color encoding, ss, drm */
+ case DID_DISPLAY_INTERFACE:
+
+ /* XXX stereo */
+ case DID_STEREO:
+
+ /* nothing interesting in these */
+ case DID_COLOR_INFO:
+ case DID_PRODUCT_SERIAL:
+ case DID_ASCII_STRING:
+ case DID_POWER_SEQUENCING:
+ case DID_TRANSFER_INFO:
+ case DID_VENDOR:
+ break;
+
+ /* warn about anything else */
+ default:
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Unknown DisplayID block type %hx\n", x[0]);
+ break;
+ }
+}
+
+static void
+forEachDisplayIDBlock(int scrnIndex, unsigned char *did, did_proc proc,
+ void *closure)
+{
+ int num_extensions = did[3];
+ int section_size = did[1];
+ unsigned char *block;
+
+ do {
+ if ((did[0] & 0xf0) != 0x10) /* not 1.x, abort */
+ return;
+ /* XXX also, checksum */
+
+ block = did + 4;
+
+ while (section_size > 0) {
+ int block_size = (block[2] + 2);
+
+ proc(scrnIndex, block, closure);
+
+ section_size -= block_size;
+ block += block_size;
+ }
+
+ did += (did[1] + 5);
+ } while (num_extensions--);
+}
+
+/*
+ * Fill out MonPtr with xf86MonPtr information.
+ */
+void
+xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC)
+{
+ if (!mon || !DDC)
+ return;
+
+ mon->DDC = DDC;
+
+ forEachDisplayIDBlock(scrnIndex, DDC->rawData, handleDisplayIDBlock, mon);
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86EdidModes.c b/xorg-server/hw/xfree86/modes/xf86EdidModes.c
index 6256fda0e..6e11f9a3d 100644
--- a/xorg-server/hw/xfree86/modes/xf86EdidModes.c
+++ b/xorg-server/hw/xfree86/modes/xf86EdidModes.c
@@ -160,6 +160,11 @@ static Bool quirk_detailed_v_in_cm (int scrnIndex, xf86MonPtr DDC)
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;
}
@@ -333,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 */
@@ -443,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;
@@ -486,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;
@@ -853,7 +866,7 @@ xf86DDCSetPreferredRefresh(int scrnIndex, DisplayModePtr modes,
best->type |= M_T_PREFERRED;
}
-_X_EXPORT DisplayModePtr
+DisplayModePtr
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
{
int i;
@@ -929,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/xorg-server/hw/xfree86/modes/xf86Modes.c b/xorg-server/hw/xfree86/modes/xf86Modes.c
index 1522fa731..d105b48ab 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.c
+++ b/xorg-server/hw/xfree86/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/xorg-server/hw/xfree86/modes/xf86Modes.h b/xorg-server/hw/xfree86/modes/xf86Modes.h
index 2fb6a374d..908f59b48 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.h
+++ b/xorg-server/hw/xfree86/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/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index 454649213..c2465bce3 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/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,7 +757,7 @@ xf86RandR12GetRotation(ScreenPtr pScreen)
return randrp->rotation;
}
-_X_EXPORT Bool
+Bool
xf86RandR12CreateScreenResources (ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -800,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 &&
@@ -812,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
{
/*
@@ -868,7 +865,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
}
-_X_EXPORT Bool
+Bool
xf86RandR12Init (ScreenPtr pScreen)
{
rrScrPrivPtr rp;
@@ -926,7 +923,7 @@ xf86RandR12Init (ScreenPtr pScreen)
return TRUE;
}
-_X_EXPORT void
+void
xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
{
XF86RandRInfoPtr randrp;
@@ -952,7 +949,7 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
randrp->supported_rotations = rotations;
}
-_X_EXPORT void
+void
xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms)
{
XF86RandRInfoPtr randrp;
@@ -977,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];
@@ -1260,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;
}
@@ -1481,7 +1528,9 @@ xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
return TRUE;
xf86ProbeOutputModes (pScrn, 0, 0);
xf86SetScrnInfoModes (pScrn);
+#ifdef XFreeXDGA
xf86DiDGAReInit (pScreen);
+#endif
return xf86RandR12SetInfo12 (pScreen);
}
@@ -1549,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];
@@ -1647,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
@@ -1667,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;
@@ -1680,7 +1801,7 @@ xf86RandR12Init12 (ScreenPtr pScreen)
#endif
-_X_EXPORT Bool
+Bool
xf86RandR12PreInit (ScrnInfoPtr pScrn)
{
return TRUE;
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.h b/xorg-server/hw/xfree86/modes/xf86RandR12.h
index 17a2dcc7f..c8d9918cf 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.h
+++ b/xorg-server/hw/xfree86/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/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c
index bb17df431..d9face1cb 100644
--- a/xorg-server/hw/xfree86/modes/xf86Rotate.c
+++ b/xorg-server/hw/xfree86/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? */
@@ -146,6 +145,37 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
}
static void
+xf86CrtcShadowClear (xf86CrtcPtr crtc)
+{
+ PixmapPtr dst_pixmap = crtc->rotatedPixmap;
+ ScrnInfoPtr scrn = crtc->scrn;
+ ScreenPtr screen = scrn->pScreen;
+ PicturePtr dst;
+ PictFormatPtr format = compWindowFormat (WindowTable[screen->myNum]);
+ static xRenderColor black = { 0, 0, 0, 0 };
+ xRectangle rect;
+ int error;
+
+ if (!dst_pixmap)
+ return;
+ dst = CreatePicture (None,
+ &dst_pixmap->drawable,
+ format,
+ 0L,
+ NULL,
+ serverClient,
+ &error);
+ if (!dst)
+ return;
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = dst_pixmap->drawable.width;
+ rect.height = dst_pixmap->drawable.height;
+ CompositeRects (PictOpSrc, dst, &black, 1, &rect);
+ FreePicture (dst, None);
+}
+
+static void
xf86CrtcDamageShadow (xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn = crtc->scrn;
@@ -316,7 +346,7 @@ xf86RotateDestroy (xf86CrtcPtr crtc)
}
}
-_X_EXPORT void
+void
xf86RotateFreeShadow(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -334,7 +364,7 @@ xf86RotateFreeShadow(ScrnInfoPtr pScrn)
}
}
-_X_EXPORT void
+void
xf86RotateCloseScreen (ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
@@ -374,7 +404,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/xorg-server/hw/xfree86/modes/xf86cvt.c b/xorg-server/hw/xfree86/modes/xf86cvt.c
index e9c74aa62..1da5fe50b 100644
--- a/xorg-server/hw/xfree86/modes/xf86cvt.c
+++ b/xorg-server/hw/xfree86/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/xorg-server/hw/xfree86/modes/xf86gtf.c b/xorg-server/hw/xfree86/modes/xf86gtf.c
index fed56bd12..9d5d50a2d 100644
--- a/xorg-server/hw/xfree86/modes/xf86gtf.c
+++ b/xorg-server/hw/xfree86/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));