diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-11-05 13:32:59 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-11-05 13:32:59 +0000 |
commit | bf781c5ff285301ad70ffc5f4321b8906f71edd8 (patch) | |
tree | 3b770f4bf9a8cd11dd9f14e7f758991a73a52d78 /xserver/Xext | |
parent | e59d0622d3162f7b5a7420ef87dbebb200348c37 (diff) |
Update to xserver 1.11.2
Diffstat (limited to 'xserver/Xext')
-rw-r--r-- | xserver/Xext/Makefile.am | 10 | ||||
-rw-r--r-- | xserver/Xext/Makefile.in | 147 | ||||
-rw-r--r-- | xserver/Xext/bigreq.c | 18 | ||||
-rw-r--r-- | xserver/Xext/geext.c | 12 | ||||
-rw-r--r-- | xserver/Xext/panoramiX.c | 42 | ||||
-rw-r--r-- | xserver/Xext/panoramiX.h | 4 | ||||
-rw-r--r-- | xserver/Xext/panoramiXprocs.c | 50 | ||||
-rw-r--r-- | xserver/Xext/panoramiXsrv.h | 22 | ||||
-rw-r--r-- | xserver/Xext/saver.c | 88 | ||||
-rw-r--r-- | xserver/Xext/security.c | 2 | ||||
-rw-r--r-- | xserver/Xext/shape.c | 54 | ||||
-rw-r--r-- | xserver/Xext/shm.c | 569 | ||||
-rw-r--r-- | xserver/Xext/sync.c | 970 | ||||
-rw-r--r-- | xserver/Xext/syncsdk.h | 47 | ||||
-rw-r--r-- | xserver/Xext/syncsrv.h | 37 | ||||
-rw-r--r-- | xserver/Xext/xcalibrate.c | 297 | ||||
-rw-r--r-- | xserver/Xext/xcmisc.c | 26 | ||||
-rw-r--r-- | xserver/Xext/xf86bigfont.c | 97 | ||||
-rw-r--r-- | xserver/Xext/xselinux_hooks.c | 32 | ||||
-rw-r--r-- | xserver/Xext/xtest.c | 58 | ||||
-rw-r--r-- | xserver/Xext/xvdisp.c | 4 | ||||
-rw-r--r-- | xserver/Xext/xvdix.h | 12 | ||||
-rw-r--r-- | xserver/Xext/xvmain.c | 21 | ||||
-rw-r--r-- | xserver/Xext/xvmc.c | 17 |
24 files changed, 1387 insertions, 1249 deletions
diff --git a/xserver/Xext/Makefile.am b/xserver/Xext/Makefile.am index e444fd08f..cb432e00e 100644 --- a/xserver/Xext/Makefile.am +++ b/xserver/Xext/Makefile.am @@ -15,7 +15,7 @@ INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod AM_CFLAGS = $(DIX_CFLAGS) if XORG -sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h +sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h syncsdk.h endif # Sources always included in libXextbuiltin.la & libXext.la @@ -26,6 +26,7 @@ BUILTIN_SRCS = \ sleepuntil.c \ sleepuntil.h \ sync.c \ + syncsdk.h \ syncsrv.h \ xcmisc.c \ xtest.c @@ -93,12 +94,6 @@ if XCSECURITY BUILTIN_SRCS += $(XCSECURITY_SRCS) endif -XCALIBRATE_SRCS = xcalibrate.c -if XCALIBRATE -BUILTIN_SRCS += $(XCALIBRATE_SRCS) -# XCalibrate needs tslib -endif - # XF86 Big Font extension BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h if XF86BIGFONT @@ -131,7 +126,6 @@ EXTRA_DIST = \ $(XACE_SRCS) \ $(XCSECURITY_SRCS) \ $(XSELINUX_SRCS) \ - $(XCALIBRATE_SRCS) \ $(XINERAMA_SRCS) \ $(BIGFONT_SRCS) \ $(DPMS_SRCS) \ diff --git a/xserver/Xext/Makefile.in b/xserver/Xext/Makefile.in index 1a3603b58..abda9c222 100644 --- a/xserver/Xext/Makefile.in +++ b/xserver/Xext/Makefile.in @@ -48,15 +48,17 @@ host_triplet = @host@ @XSELINUX_TRUE@am__append_9 = $(XSELINUX_SRCS) @XSELINUX_TRUE@am__append_10 = $(SELINUX_LIBS) @XCSECURITY_TRUE@am__append_11 = $(XCSECURITY_SRCS) -@XCALIBRATE_TRUE@am__append_12 = $(XCALIBRATE_SRCS) -@XF86BIGFONT_TRUE@am__append_13 = $(BIGFONT_SRCS) -@DPMSExtension_TRUE@am__append_14 = $(DPMS_SRCS) +@XF86BIGFONT_TRUE@am__append_12 = $(BIGFONT_SRCS) +@DPMSExtension_TRUE@am__append_13 = $(DPMS_SRCS) subdir = Xext DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ - $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/configure.ac + $(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/xorg-tls.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(install_sh) -d @@ -75,13 +77,13 @@ am__DEPENDENCIES_1 = am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) libXext_la_DEPENDENCIES = $(am__DEPENDENCIES_3) am__libXext_la_SOURCES_DIST = bigreq.c geext.c shape.c sleepuntil.c \ - sleepuntil.h sync.c syncsrv.h xcmisc.c xtest.c shm.c shmint.h \ - panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h \ + sleepuntil.h sync.c syncsdk.h syncsrv.h xcmisc.c xtest.c shm.c \ + shmint.h panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h \ panoramiXprocs.c panoramiXSwap.c xace.c xace.h xacestr.h \ - security.c securitysrv.h xcalibrate.c xf86bigfont.c \ - xf86bigfontsrv.h xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h \ - xvdisp.h xres.c saver.c xselinux_ext.c xselinux_hooks.c \ - xselinux_label.c xselinux.h xselinuxint.h dpms.c dpmsproc.h + security.c securitysrv.h xf86bigfont.c xf86bigfontsrv.h \ + xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h xres.c \ + saver.c xselinux_ext.c xselinux_hooks.c xselinux_label.c \ + xselinux.h xselinuxint.h dpms.c dpmsproc.h am__objects_1 = shm.lo @MITSHM_TRUE@am__objects_2 = $(am__objects_1) am__objects_3 = panoramiX.lo panoramiXprocs.lo panoramiXSwap.lo @@ -90,38 +92,35 @@ am__objects_5 = xace.lo @XACE_TRUE@am__objects_6 = $(am__objects_5) am__objects_7 = security.lo @XCSECURITY_TRUE@am__objects_8 = $(am__objects_7) -am__objects_9 = xcalibrate.lo -@XCALIBRATE_TRUE@am__objects_10 = $(am__objects_9) -am__objects_11 = xf86bigfont.lo -@XF86BIGFONT_TRUE@am__objects_12 = $(am__objects_11) -am__objects_13 = bigreq.lo geext.lo shape.lo sleepuntil.lo sync.lo \ +am__objects_9 = xf86bigfont.lo +@XF86BIGFONT_TRUE@am__objects_10 = $(am__objects_9) +am__objects_11 = bigreq.lo geext.lo shape.lo sleepuntil.lo sync.lo \ xcmisc.lo xtest.lo $(am__objects_2) $(am__objects_4) \ - $(am__objects_6) $(am__objects_8) $(am__objects_10) \ - $(am__objects_12) -am__objects_14 = xvmain.lo xvdisp.lo xvmc.lo -@XV_TRUE@am__objects_15 = $(am__objects_14) -am__objects_16 = xres.lo -@RES_TRUE@am__objects_17 = $(am__objects_16) -am__objects_18 = saver.lo -@SCREENSAVER_TRUE@am__objects_19 = $(am__objects_18) -am__objects_20 = xselinux_ext.lo xselinux_hooks.lo xselinux_label.lo -@XSELINUX_TRUE@am__objects_21 = $(am__objects_20) -am__objects_22 = dpms.lo -@DPMSExtension_TRUE@am__objects_23 = $(am__objects_22) -am__objects_24 = $(am__objects_15) $(am__objects_17) $(am__objects_19) \ - $(am__objects_21) $(am__objects_23) -am_libXext_la_OBJECTS = $(am__objects_13) $(am__objects_24) + $(am__objects_6) $(am__objects_8) $(am__objects_10) +am__objects_12 = xvmain.lo xvdisp.lo xvmc.lo +@XV_TRUE@am__objects_13 = $(am__objects_12) +am__objects_14 = xres.lo +@RES_TRUE@am__objects_15 = $(am__objects_14) +am__objects_16 = saver.lo +@SCREENSAVER_TRUE@am__objects_17 = $(am__objects_16) +am__objects_18 = xselinux_ext.lo xselinux_hooks.lo xselinux_label.lo +@XSELINUX_TRUE@am__objects_19 = $(am__objects_18) +am__objects_20 = dpms.lo +@DPMSExtension_TRUE@am__objects_21 = $(am__objects_20) +am__objects_22 = $(am__objects_13) $(am__objects_15) $(am__objects_17) \ + $(am__objects_19) $(am__objects_21) +am_libXext_la_OBJECTS = $(am__objects_11) $(am__objects_22) libXext_la_OBJECTS = $(am_libXext_la_OBJECTS) @XORG_FALSE@am_libXext_la_rpath = @XORG_TRUE@am_libXext_la_rpath = libXextbuiltin_la_LIBADD = am__libXextbuiltin_la_SOURCES_DIST = bigreq.c geext.c shape.c \ - sleepuntil.c sleepuntil.h sync.c syncsrv.h xcmisc.c xtest.c \ - shm.c shmint.h panoramiX.c panoramiX.h panoramiXh.h \ + sleepuntil.c sleepuntil.h sync.c syncsdk.h syncsrv.h xcmisc.c \ + xtest.c shm.c shmint.h panoramiX.c panoramiX.h panoramiXh.h \ panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c xace.c xace.h \ - xacestr.h security.c securitysrv.h xcalibrate.c xf86bigfont.c \ + xacestr.h security.c securitysrv.h xf86bigfont.c \ xf86bigfontsrv.h -@XORG_TRUE@am_libXextbuiltin_la_OBJECTS = $(am__objects_13) +@XORG_TRUE@am_libXextbuiltin_la_OBJECTS = $(am__objects_11) libXextbuiltin_la_OBJECTS = $(am_libXextbuiltin_la_OBJECTS) @XORG_TRUE@am_libXextbuiltin_la_rpath = @XORG_TRUE@libXextmodule_la_DEPENDENCIES = $(am__DEPENDENCIES_3) @@ -129,7 +128,7 @@ am__libXextmodule_la_SOURCES_DIST = xvmain.c xvdisp.c xvmc.c xvdix.h \ xvmcext.h xvdisp.h xres.c saver.c xselinux_ext.c \ xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h \ dpms.c dpmsproc.h -@XORG_TRUE@am_libXextmodule_la_OBJECTS = $(am__objects_24) +@XORG_TRUE@am_libXextmodule_la_OBJECTS = $(am__objects_22) libXextmodule_la_OBJECTS = $(am_libXextmodule_la_OBJECTS) @XORG_TRUE@am_libXextmodule_la_rpath = DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include @@ -137,6 +136,9 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ @@ -146,7 +148,7 @@ DIST_SOURCES = $(am__libXext_la_SOURCES_DIST) \ $(am__libXextbuiltin_la_SOURCES_DIST) \ $(am__libXextmodule_la_SOURCES_DIST) am__sdk_HEADERS_DIST = xvdix.h xvmcext.h geext.h geint.h shmint.h \ - panoramiXsrv.h panoramiX.h xace.h xacestr.h + syncsdk.h panoramiXsrv.h panoramiX.h xace.h xacestr.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -164,8 +166,8 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ AGP_FALSE = @AGP_FALSE@ AGP_TRUE = @AGP_TRUE@ -AIGLX_FALSE = @AIGLX_FALSE@ -AIGLX_TRUE = @AIGLX_TRUE@ +AIGLX_DRI_LOADER_FALSE = @AIGLX_DRI_LOADER_FALSE@ +AIGLX_DRI_LOADER_TRUE = @AIGLX_DRI_LOADER_TRUE@ ALLOCA = @ALLOCA@ ALPHA_VIDEO_FALSE = @ALPHA_VIDEO_FALSE@ ALPHA_VIDEO_TRUE = @ALPHA_VIDEO_TRUE@ @@ -178,7 +180,6 @@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ -ARM_BACKTRACE_CFLAGS = @ARM_BACKTRACE_CFLAGS@ ARM_VIDEO_FALSE = @ARM_VIDEO_FALSE@ ARM_VIDEO_TRUE = @ARM_VIDEO_TRUE@ AS = @AS@ @@ -191,18 +192,19 @@ BSD_APM_FALSE = @BSD_APM_FALSE@ BSD_APM_TRUE = @BSD_APM_TRUE@ BSD_KQUEUE_APM_FALSE = @BSD_KQUEUE_APM_FALSE@ BSD_KQUEUE_APM_TRUE = @BSD_KQUEUE_APM_TRUE@ -BUILDDOCS_FALSE = @BUILDDOCS_FALSE@ -BUILDDOCS_TRUE = @BUILDDOCS_TRUE@ BUILD_DATE = @BUILD_DATE@ BUILD_KDRIVEFBDEVLIB_FALSE = @BUILD_KDRIVEFBDEVLIB_FALSE@ BUILD_KDRIVEFBDEVLIB_TRUE = @BUILD_KDRIVEFBDEVLIB_TRUE@ BUILD_TIME = @BUILD_TIME@ +BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHANGELOG_CMD = @CHANGELOG_CMD@ +CLIENTIDS_FALSE = @CLIENTIDS_FALSE@ +CLIENTIDS_TRUE = @CLIENTIDS_TRUE@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ COMPOSITE_FALSE = @COMPOSITE_FALSE@ COMPOSITE_TRUE = @COMPOSITE_TRUE@ @@ -219,12 +221,7 @@ CONFIG_WSCONS_TRUE = @CONFIG_WSCONS_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DARWIN_LIBS = @DARWIN_LIBS@ DBE_FALSE = @DBE_FALSE@ DBE_TRUE = @DBE_TRUE@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -259,7 +256,6 @@ DMX_BUILD_USB_FALSE = @DMX_BUILD_USB_FALSE@ DMX_BUILD_USB_TRUE = @DMX_BUILD_USB_TRUE@ DMX_FALSE = @DMX_FALSE@ DMX_TRUE = @DMX_TRUE@ -DOLT_BASH = @DOLT_BASH@ DOXYGEN = @DOXYGEN@ DPMSExtension_FALSE = @DPMSExtension_FALSE@ DPMSExtension_TRUE = @DPMSExtension_TRUE@ @@ -280,7 +276,7 @@ DRI_LIBS = @DRI_LIBS@ DRI_TRUE = @DRI_TRUE@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -289,11 +285,12 @@ ENABLE_DEVEL_DOCS_FALSE = @ENABLE_DEVEL_DOCS_FALSE@ ENABLE_DEVEL_DOCS_TRUE = @ENABLE_DEVEL_DOCS_TRUE@ ENABLE_DOCS_FALSE = @ENABLE_DOCS_FALSE@ ENABLE_DOCS_TRUE = @ENABLE_DOCS_TRUE@ +ENABLE_UNIT_TESTS_FALSE = @ENABLE_UNIT_TESTS_FALSE@ +ENABLE_UNIT_TESTS_TRUE = @ENABLE_UNIT_TESTS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ FBDEVHW_FALSE = @FBDEVHW_FALSE@ FBDEVHW_TRUE = @FBDEVHW_TRUE@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FONT100DPIDIR = @FONT100DPIDIR@ @@ -306,11 +303,10 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@ FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_LIBS = @GLIB_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_FALSE = @GLX_FALSE@ +GLX_TLS = @GLX_TLS@ GLX_TRUE = @GLX_TRUE@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -323,12 +319,16 @@ HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ HAVE_FOP_FALSE = @HAVE_FOP_FALSE@ HAVE_FOP_TRUE = @HAVE_FOP_TRUE@ +HAVE_LD_WRAP_FALSE = @HAVE_LD_WRAP_FALSE@ +HAVE_LD_WRAP_TRUE = @HAVE_LD_WRAP_TRUE@ HAVE_STYLESHEETS_FALSE = @HAVE_STYLESHEETS_FALSE@ HAVE_STYLESHEETS_TRUE = @HAVE_STYLESHEETS_TRUE@ HAVE_XMLTO_FALSE = @HAVE_XMLTO_FALSE@ HAVE_XMLTO_TEXT_FALSE = @HAVE_XMLTO_TEXT_FALSE@ HAVE_XMLTO_TEXT_TRUE = @HAVE_XMLTO_TEXT_TRUE@ HAVE_XMLTO_TRUE = @HAVE_XMLTO_TRUE@ +HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ +HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@ HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@ HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@ @@ -374,7 +374,10 @@ KDRIVE_MOUSE_TRUE = @KDRIVE_MOUSE_TRUE@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KDRIVE_TRUE = @KDRIVE_TRUE@ -LAUNCHD_ID_PREFIX = @LAUNCHD_ID_PREFIX@ +KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@ +KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@ +KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -393,19 +396,19 @@ LINUX_ALPHA_FALSE = @LINUX_ALPHA_FALSE@ LINUX_ALPHA_TRUE = @LINUX_ALPHA_TRUE@ LINUX_IA64_FALSE = @LINUX_IA64_FALSE@ LINUX_IA64_TRUE = @LINUX_IA64_TRUE@ +LIPO = @LIPO@ LNXACPI_FALSE = @LNXACPI_FALSE@ LNXACPI_TRUE = @LNXACPI_TRUE@ LNXAPM_FALSE = @LNXAPM_FALSE@ LNXAPM_TRUE = @LNXAPM_TRUE@ LN_S = @LN_S@ -LTCOMPILE = @LTCOMPILE@ -LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ @@ -415,6 +418,7 @@ NEED_STRLCAT_FALSE = @NEED_STRLCAT_FALSE@ NEED_STRLCAT_TRUE = @NEED_STRLCAT_TRUE@ NEED_VSNPRINTF_FALSE = @NEED_VSNPRINTF_FALSE@ NEED_VSNPRINTF_TRUE = @NEED_VSNPRINTF_TRUE@ +NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ @@ -426,6 +430,8 @@ OBJEXT = @OBJEXT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OS_LIB = @OS_LIB@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -436,7 +442,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ -PERL = @PERL@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ @@ -478,6 +483,7 @@ SPECIAL_DTRACE_OBJECTS_FALSE = @SPECIAL_DTRACE_OBJECTS_FALSE@ SPECIAL_DTRACE_OBJECTS_TRUE = @SPECIAL_DTRACE_OBJECTS_TRUE@ STANDALONE_XPBPROXY_FALSE = @STANDALONE_XPBPROXY_FALSE@ STANDALONE_XPBPROXY_TRUE = @STANDALONE_XPBPROXY_TRUE@ +STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ SYSCONFDIR = @SYSCONFDIR@ @@ -487,8 +493,6 @@ TSLIB_LIBS = @TSLIB_LIBS@ TSLIB_TRUE = @TSLIB_TRUE@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ -UNITTESTS_FALSE = @UNITTESTS_FALSE@ -UNITTESTS_TRUE = @UNITTESTS_TRUE@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VBE_FALSE = @VBE_FALSE@ VBE_TRUE = @VBE_TRUE@ @@ -505,8 +509,6 @@ XAA_FALSE = @XAA_FALSE@ XAA_TRUE = @XAA_TRUE@ XACE_FALSE = @XACE_FALSE@ XACE_TRUE = @XACE_TRUE@ -XCALIBRATE_FALSE = @XCALIBRATE_FALSE@ -XCALIBRATE_TRUE = @XCALIBRATE_TRUE@ XCSECURITY_FALSE = @XCSECURITY_FALSE@ XCSECURITY_TRUE = @XCSECURITY_TRUE@ XDMAUTH_FALSE = @XDMAUTH_FALSE@ @@ -542,6 +544,11 @@ XINERAMA_TRUE = @XINERAMA_TRUE@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@ +XKB_DFLT_MODEL = @XKB_DFLT_MODEL@ +XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@ +XKB_DFLT_RULES = @XKB_DFLT_RULES@ +XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ @@ -573,6 +580,7 @@ XORG_TRUE = @XORG_TRUE@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_FALSE = @XQUARTZ_FALSE@ +XQUARTZ_LIBS = @XQUARTZ_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XQUARTZ_SPARKLE_FALSE = @XQUARTZ_SPARKLE_FALSE@ XQUARTZ_SPARKLE_TRUE = @XQUARTZ_SPARKLE_TRUE@ @@ -591,6 +599,7 @@ XSERVER_DTRACE_FALSE = @XSERVER_DTRACE_FALSE@ XSERVER_DTRACE_TRUE = @XSERVER_DTRACE_TRUE@ XSERVER_LIBS = @XSERVER_LIBS@ XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XSLTPROC = @XSLTPROC@ XSL_STYLESHEET = @XSL_STYLESHEET@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ @@ -635,13 +644,11 @@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@ am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@ am__include = @am__include@ @@ -703,17 +710,17 @@ target_alias = @target_alias@ INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod AM_CFLAGS = $(DIX_CFLAGS) @XORG_TRUE@sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h \ -@XORG_TRUE@ $(am__append_6) $(am__append_8) +@XORG_TRUE@ syncsdk.h $(am__append_6) $(am__append_8) # Sources always included in libXextbuiltin.la & libXext.la BUILTIN_SRCS = bigreq.c geext.c shape.c sleepuntil.c sleepuntil.h \ - sync.c syncsrv.h xcmisc.c xtest.c $(am__append_1) \ + sync.c syncsdk.h syncsrv.h xcmisc.c xtest.c $(am__append_1) \ $(am__append_5) $(am__append_7) $(am__append_11) \ - $(am__append_12) $(am__append_13) + $(am__append_12) # Sources always included in libXextmodule.la & libXext.la. That's right, zero. MODULE_SRCS = $(am__append_2) $(am__append_3) $(am__append_4) \ - $(am__append_9) $(am__append_14) + $(am__append_9) $(am__append_13) MODULE_LIBS = $(am__append_10) # Optional sources included if extension enabled by configure.ac rules @@ -743,8 +750,6 @@ XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xsel # Security extension: multi-level security to protect clients from each other XCSECURITY_SRCS = security.c securitysrv.h -XCALIBRATE_SRCS = xcalibrate.c -# XCalibrate needs tslib # XF86 Big Font extension BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h @@ -766,7 +771,6 @@ EXTRA_DIST = \ $(XACE_SRCS) \ $(XCSECURITY_SRCS) \ $(XSELINUX_SRCS) \ - $(XCALIBRATE_SRCS) \ $(XINERAMA_SRCS) \ $(BIGFONT_SRCS) \ $(DPMS_SRCS) \ @@ -840,7 +844,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sleepuntil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sync.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcalibrate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcmisc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86bigfont.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xres.Plo@am__quote@ diff --git a/xserver/Xext/bigreq.c b/xserver/Xext/bigreq.c index ce3734e8d..a540bcbcb 100644 --- a/xserver/Xext/bigreq.c +++ b/xserver/Xext/bigreq.c @@ -40,18 +40,8 @@ from The Open Group. #include "opaque.h" #include "modinit.h" -static DISPATCH_PROC(ProcBigReqDispatch); - void BigReqExtensionInit(INITARGS); -void -BigReqExtensionInit(INITARGS) -{ - AddExtension(XBigReqExtensionName, 0, 0, - ProcBigReqDispatch, ProcBigReqDispatch, - NULL, StandardMinorOpcode); -} - static int ProcBigReqDispatch (ClientPtr client) { @@ -78,3 +68,11 @@ ProcBigReqDispatch (ClientPtr client) WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep); return Success; } + +void +BigReqExtensionInit(INITARGS) +{ + AddExtension(XBigReqExtensionName, 0, 0, + ProcBigReqDispatch, ProcBigReqDispatch, + NULL, StandardMinorOpcode); +} diff --git a/xserver/Xext/geext.c b/xserver/Xext/geext.c index 74ade58ba..18f8ffeac 100644 --- a/xserver/Xext/geext.c +++ b/xserver/Xext/geext.c @@ -28,14 +28,11 @@ #endif #include "windowstr.h" #include <X11/extensions/ge.h> -#include "registry.h" #include "geint.h" #include "geext.h" #include "protocol-versions.h" -#define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) - DevPrivateKeyRec GEClientPrivateKeyRec; int RT_GECLIENT = 0; @@ -52,6 +49,7 @@ static const int version_requests[] = { static void SGEGenericEvent(xEvent* from, xEvent* to); #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) +#define EXT_MASK(ext) ((ext) & 0x7F) /************************************************************/ /* request handlers */ @@ -194,8 +192,8 @@ SGEGenericEvent(xEvent* from, xEvent* to) return; } - if (GEExtensions[gefrom->extension & 0x7F].evswap) - GEExtensions[gefrom->extension & 0x7F].evswap(gefrom, geto); + if (GEExtensions[EXT_MASK(gefrom->extension)].evswap) + GEExtensions[EXT_MASK(gefrom->extension)].evswap(gefrom, geto); } /* Init extension, register at server. @@ -244,11 +242,11 @@ void GERegisterExtension(int extension, void (*ev_swap)(xGenericEvent* from, xGenericEvent* to)) { - if ((extension & 0x7F) >= MAXEXTENSIONS) + if (EXT_MASK(extension) >= MAXEXTENSIONS) FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n"); /* extension opcodes are > 128, might as well save some space here */ - GEExtensions[extension & 0x7f].evswap = ev_swap; + GEExtensions[EXT_MASK(extension)].evswap = ev_swap; } diff --git a/xserver/Xext/panoramiX.c b/xserver/Xext/panoramiX.c index b73c53f19..00afe94f1 100644 --- a/xserver/Xext/panoramiX.c +++ b/xserver/Xext/panoramiX.c @@ -53,6 +53,12 @@ Equipment Corporation. #include "servermd.h" #include "resource.h" #include "picturestr.h" +#ifdef XFIXES +#include "xfixesint.h" +#endif +#ifdef COMPOSITE +#include "compint.h" +#endif #include "modinit.h" #include "protocol-versions.h" @@ -77,11 +83,11 @@ static DepthPtr PanoramiXDepths; static int PanoramiXNumVisuals; static VisualPtr PanoramiXVisuals; -unsigned long XRC_DRAWABLE; -unsigned long XRT_WINDOW; -unsigned long XRT_PIXMAP; -unsigned long XRT_GC; -unsigned long XRT_COLORMAP; +RESTYPE XRC_DRAWABLE; +RESTYPE XRT_WINDOW; +RESTYPE XRT_PIXMAP; +RESTYPE XRT_GC; +RESTYPE XRT_COLORMAP; static Bool VisualsEqual(VisualPtr, ScreenPtr, VisualPtr); XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual; @@ -387,7 +393,7 @@ static void XineramaInitData(ScreenPtr pScreen) int i, w, h; RegionNull(&PanoramiXScreenRegion); - for (i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { BoxRec TheBox; RegionRec ScreenRegion; @@ -407,7 +413,7 @@ static void XineramaInitData(ScreenPtr pScreen) PanoramiXPixWidth = screenInfo.screens[0]->x + screenInfo.screens[0]->width; PanoramiXPixHeight = screenInfo.screens[0]->y + screenInfo.screens[0]->height; - for (i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { pScreen = screenInfo.screens[i]; w = pScreen->x + pScreen->width; h = pScreen->y + pScreen->height; @@ -472,7 +478,7 @@ void PanoramiXExtensionInit(int argc, char *argv[]) * run in non-PanoramiXeen mode. */ - for (i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { pScreen = screenInfo.screens[i]; pScreenPriv = malloc(sizeof(PanoramiXScreenRec)); dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, @@ -581,6 +587,13 @@ void PanoramiXExtensionInit(int argc, char *argv[]) ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor; PanoramiXRenderInit (); +#ifdef XFIXES + PanoramiXFixesInit (); +#endif +#ifdef COMPOSITE + PanoramiXCompositeInit (); +#endif + } extern Bool CreateConnectionBlock(void); @@ -727,7 +740,7 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth) int j, k; Bool found = FALSE; - for (j = 1; j < PanoramiXNumScreens; j++) { + FOR_NSCREENS_FORWARD_SKIP(j) { pScreen = screenInfo.screens[j]; for (k = 0; k < pScreen->numDepths; k++) { if (pScreen->allowedDepths[k].depth == pDepth->depth) { @@ -760,7 +773,7 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual) int j, k; Bool found = FALSE; - for (j = 1; j < PanoramiXNumScreens; j++) { + FOR_NSCREENS_FORWARD_SKIP(j) { pScreen = screenInfo.screens[j]; found = FALSE; @@ -823,7 +836,7 @@ PanoramiXConsolidate(void) saver = malloc(sizeof(PanoramiXRes)); saver->type = XRT_WINDOW; - for (i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { ScreenPtr pScreen = screenInfo.screens[i]; root->info[i].id = pScreen->root->drawable.id; root->u.win.class = InputOutput; @@ -882,6 +895,9 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry) int i; PanoramiXRenderReset (); +#ifdef XFIXES + PanoramiXFixesReset (); +#endif screenInfo.numScreens = PanoramiXNumScreens; for (i = 256; i--; ) ProcVector[i] = SavedProcVector[i]; @@ -1058,7 +1074,7 @@ ProcXineramaQueryScreens(ClientPtr client) xXineramaScreenInfo scratch; int i; - for(i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { scratch.x_org = screenInfo.screens[i]->x; scratch.y_org = screenInfo.screens[i]->y; scratch.width = screenInfo.screens[i]->width; @@ -1163,7 +1179,7 @@ XineramaGetImageData( depth = (format == XYPixmap) ? 1 : pDraw->depth; - for(i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { BoxRec TheBox; ScreenPtr pScreen; pDraw = pDrawables[i]; diff --git a/xserver/Xext/panoramiX.h b/xserver/Xext/panoramiX.h index a8684f0d2..71651e558 100644 --- a/xserver/Xext/panoramiX.h +++ b/xserver/Xext/panoramiX.h @@ -44,7 +44,7 @@ Equipment Corporation. #include <X11/extensions/panoramiXproto.h> #undef _PANORAMIX_SERVER #include "gcstruct.h" - +#include "dixstruct.h" typedef struct _PanoramiXInfo { XID id ; @@ -70,9 +70,11 @@ typedef struct { } PanoramiXRes; #define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++) +#define FOR_NSCREENS_FORWARD_SKIP(j) for(j = 1; j < PanoramiXNumScreens; j++) #define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--) #define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j) #define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared) +#define IS_ROOT_DRAWABLE(d) (((d)->type == XRT_WINDOW) && (d)->u.win.root) #endif /* _PANORAMIX_H_ */ diff --git a/xserver/Xext/panoramiXprocs.c b/xserver/Xext/panoramiXprocs.c index d84316895..9ea461173 100644 --- a/xserver/Xext/panoramiXprocs.c +++ b/xserver/Xext/panoramiXprocs.c @@ -120,9 +120,7 @@ int PanoramiXCreateWindow(ClientPtr client) newWin->u.win.visibility = VisibilityNotViewable; newWin->u.win.class = stuff->class; newWin->u.win.root = FALSE; - newWin->info[0].id = stuff->wid; - for(j = 1; j < PanoramiXNumScreens; j++) - newWin->info[j].id = FakeClientID(client->index); + panoramix_setup_ids(newWin, client, stuff->wid); if (stuff->class == InputOnly) stuff->visual = CopyFromParent; @@ -663,9 +661,7 @@ int PanoramiXCreatePixmap(ClientPtr client) newPix->type = XRT_PIXMAP; newPix->u.pix.shared = FALSE; - newPix->info[0].id = stuff->pid; - for(j = 1; j < PanoramiXNumScreens; j++) - newPix->info[j].id = FakeClientID(client->index); + panoramix_setup_ids(newPix, client, stuff->pid); FOR_NSCREENS_BACKWARD(j) { stuff->pid = newPix->info[j].id; @@ -767,9 +763,7 @@ int PanoramiXCreateGC(ClientPtr client) return BadAlloc; newGC->type = XRT_GC; - newGC->info[0].id = stuff->gc; - for(j = 1; j < PanoramiXNumScreens; j++) - newGC->info[j].id = FakeClientID(client->index); + panoramix_setup_ids(newGC, client, stuff->gc); FOR_NSCREENS_BACKWARD(j) { stuff->gc = newGC->info[j].id; @@ -1334,7 +1328,7 @@ int PanoramiXPolyLine(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq)); if (npoint > 0){ origPts = malloc(npoint * sizeof(xPoint)); @@ -1394,7 +1388,7 @@ int PanoramiXPolySegment(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq); if(nsegs & 4) return BadLength; @@ -1457,7 +1451,7 @@ int PanoramiXPolyRectangle(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq); if(nrects & 4) return BadLength; @@ -1519,7 +1513,7 @@ int PanoramiXPolyArc(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); narcs = (client->req_len << 2) - sizeof(xPolyArcReq); if(narcs % sizeof(xArc)) return BadLength; @@ -1579,7 +1573,7 @@ int PanoramiXFillPoly(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq)); if (count > 0){ @@ -1640,7 +1634,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq); if(things & 4) return BadLength; @@ -1701,7 +1695,7 @@ int PanoramiXPolyFillArc(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq); if (narcs % sizeof(xArc)) return BadLength; @@ -1761,7 +1755,7 @@ int PanoramiXPutImage(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); orig_x = stuff->dstX; orig_y = stuff->dstY; @@ -1824,7 +1818,7 @@ int PanoramiXGetImage(ClientPtr client) format = stuff->format; planemask = stuff->planeMask; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); if(isRoot) { if( /* check for being onscreen */ @@ -1846,7 +1840,7 @@ int PanoramiXGetImage(ClientPtr client) } drawables[0] = pDraw; - for(i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, DixGetAttrAccess); if (rc != Success) @@ -1962,7 +1956,7 @@ PanoramiXPolyText8(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); orig_x = stuff->x; orig_y = stuff->y; @@ -2003,7 +1997,7 @@ PanoramiXPolyText16(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); orig_x = stuff->x; orig_y = stuff->y; @@ -2044,7 +2038,7 @@ int PanoramiXImageText8(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); orig_x = stuff->x; orig_y = stuff->y; @@ -2085,7 +2079,7 @@ int PanoramiXImageText16(ClientPtr client) if (result != Success) return result; - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; + isRoot = IS_ROOT_DRAWABLE(draw); orig_x = stuff->x; orig_y = stuff->y; @@ -2121,9 +2115,7 @@ int PanoramiXCreateColormap(ClientPtr client) return BadAlloc; newCmap->type = XRT_COLORMAP; - newCmap->info[0].id = stuff->mid; - for(j = 1; j < PanoramiXNumScreens; j++) - newCmap->info[j].id = FakeClientID(client->index); + panoramix_setup_ids(newCmap, client, stuff->mid); orig_visual = stuff->visual; FOR_NSCREENS_BACKWARD(j){ @@ -2192,11 +2184,9 @@ PanoramiXCopyColormapAndFree(ClientPtr client) return BadAlloc; newCmap->type = XRT_COLORMAP; - newCmap->info[0].id = stuff->mid; - for(j = 1; j < PanoramiXNumScreens; j++) - newCmap->info[j].id = FakeClientID(client->index); + panoramix_setup_ids(newCmap, client, stuff->mid); - FOR_NSCREENS_BACKWARD(j){ + FOR_NSCREENS_BACKWARD(j) { stuff->srcCmap = cmap->info[j].id; stuff->mid = newCmap->info[j].id; result = (* SavedProcVector[X_CopyColormapAndFree])(client); diff --git a/xserver/Xext/panoramiXsrv.h b/xserver/Xext/panoramiXsrv.h index 5b1a3a990..6fc903b88 100644 --- a/xserver/Xext/panoramiXsrv.h +++ b/xserver/Xext/panoramiXsrv.h @@ -21,11 +21,12 @@ extern _X_EXPORT int XineramaDeleteResource(pointer, XID); extern _X_EXPORT void XineramaReinitData(ScreenPtr); -extern _X_EXPORT unsigned long XRC_DRAWABLE; -extern _X_EXPORT unsigned long XRT_WINDOW; -extern _X_EXPORT unsigned long XRT_PIXMAP; -extern _X_EXPORT unsigned long XRT_GC; -extern _X_EXPORT unsigned long XRT_COLORMAP; +extern _X_EXPORT RESTYPE XRC_DRAWABLE; +extern _X_EXPORT RESTYPE XRT_WINDOW; +extern _X_EXPORT RESTYPE XRT_PIXMAP; +extern _X_EXPORT RESTYPE XRT_GC; +extern _X_EXPORT RESTYPE XRT_COLORMAP; +extern _X_EXPORT RESTYPE XRT_PICTURE; /* * Drivers are allowed to wrap this function. Each wrapper can decide that the @@ -50,4 +51,15 @@ extern _X_EXPORT void XineramaGetImageData( Bool isRoot ); +static inline void panoramix_setup_ids(PanoramiXRes *resource, + ClientPtr client, XID base_id) +{ + int j; + + resource->info[0].id = base_id; + FOR_NSCREENS_FORWARD_SKIP(j) { + resource->info[j].id = FakeClientID(client->index); + } +} + #endif /* _PANORAMIXSRV_H_ */ diff --git a/xserver/Xext/saver.c b/xserver/Xext/saver.c index 6d91ddf5e..18886038a 100644 --- a/xserver/Xext/saver.c +++ b/xserver/Xext/saver.c @@ -62,20 +62,6 @@ in this Software without prior written authorization from the X Consortium. static int ScreenSaverEventBase = 0; -static DISPATCH_PROC(ProcScreenSaverQueryInfo); -static DISPATCH_PROC(ProcScreenSaverDispatch); -static DISPATCH_PROC(ProcScreenSaverQueryVersion); -static DISPATCH_PROC(ProcScreenSaverSelectInput); -static DISPATCH_PROC(ProcScreenSaverSetAttributes); -static DISPATCH_PROC(ProcScreenSaverUnsetAttributes); -static DISPATCH_PROC(ProcScreenSaverSuspend); -static DISPATCH_PROC(SProcScreenSaverDispatch); -static DISPATCH_PROC(SProcScreenSaverQueryInfo); -static DISPATCH_PROC(SProcScreenSaverQueryVersion); -static DISPATCH_PROC(SProcScreenSaverSelectInput); -static DISPATCH_PROC(SProcScreenSaverSetAttributes); -static DISPATCH_PROC(SProcScreenSaverUnsetAttributes); -static DISPATCH_PROC(SProcScreenSaverSuspend); static Bool ScreenSaverHandle ( ScreenPtr /* pScreen */, @@ -237,45 +223,6 @@ static DevPrivateKeyRec ScreenPrivateKeyRec; #define New(t) (malloc(sizeof (t))) -/**************** - * ScreenSaverExtensionInit - * - * Called from InitExtensions in main() or from QueryExtension() if the - * extension is dynamically loaded. - * - ****************/ - -void -ScreenSaverExtensionInit(INITARGS) -{ - ExtensionEntry *extEntry; - int i; - ScreenPtr pScreen; - - if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) - return; - - AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr"); - SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents, - "SaverEvent"); - SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend, - "SaverSuspend"); - - for (i = 0; i < screenInfo.numScreens; i++) - { - pScreen = screenInfo.screens[i]; - SetScreenPrivate (pScreen, NULL); - } - if (AttrType && SaverEventType && SuspendType && - (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, - ProcScreenSaverDispatch, SProcScreenSaverDispatch, - NULL, StandardMinorOpcode))) - { - ScreenSaverEventBase = extEntry->eventBase; - EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent; - } -} - static void CheckScreenPrivate (ScreenPtr pScreen) { @@ -1412,7 +1359,7 @@ ProcScreenSaverSuspend (ClientPtr client) return Success; } -static DISPATCH_PROC((*NormalVector[])) = { +static int (*NormalVector[]) (ClientPtr /* client */) = { ProcScreenSaverQueryVersion, ProcScreenSaverQueryInfo, ProcScreenSaverSelectInput, @@ -1513,7 +1460,7 @@ SProcScreenSaverSuspend (ClientPtr client) return ProcScreenSaverSuspend (client); } -static DISPATCH_PROC((*SwappedVector[])) = { +static int (*SwappedVector[]) (ClientPtr /* client */) = { SProcScreenSaverQueryVersion, SProcScreenSaverQueryInfo, SProcScreenSaverSelectInput, @@ -1531,3 +1478,34 @@ SProcScreenSaverDispatch (ClientPtr client) return (*SwappedVector[stuff->data])(client); return BadRequest; } + +void +ScreenSaverExtensionInit(INITARGS) +{ + ExtensionEntry *extEntry; + int i; + ScreenPtr pScreen; + + if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) + return; + + AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr"); + SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents, + "SaverEvent"); + SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend, + "SaverSuspend"); + + for (i = 0; i < screenInfo.numScreens; i++) + { + pScreen = screenInfo.screens[i]; + SetScreenPrivate (pScreen, NULL); + } + if (AttrType && SaverEventType && SuspendType && + (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, + ProcScreenSaverDispatch, SProcScreenSaverDispatch, + NULL, StandardMinorOpcode))) + { + ScreenSaverEventBase = extEntry->eventBase; + EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent; + } +} diff --git a/xserver/Xext/security.c b/xserver/Xext/security.c index 7eb95de74..8673880d1 100644 --- a/xserver/Xext/security.c +++ b/xserver/Xext/security.c @@ -154,8 +154,6 @@ SecurityLookupRequestName(ClientPtr client) } -#define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) - /* SecurityDeleteAuthorization * * Arguments: diff --git a/xserver/Xext/shape.c b/xserver/Xext/shape.c index ac95328b8..115fc07ed 100644 --- a/xserver/Xext/shape.c +++ b/xserver/Xext/shape.c @@ -68,26 +68,6 @@ static void SShapeNotifyEvent( * externally by the Xfixes extension and are now defined in window.h */ -static DISPATCH_PROC(ProcShapeCombine); -static DISPATCH_PROC(ProcShapeDispatch); -static DISPATCH_PROC(ProcShapeGetRectangles); -static DISPATCH_PROC(ProcShapeInputSelected); -static DISPATCH_PROC(ProcShapeMask); -static DISPATCH_PROC(ProcShapeOffset); -static DISPATCH_PROC(ProcShapeQueryExtents); -static DISPATCH_PROC(ProcShapeQueryVersion); -static DISPATCH_PROC(ProcShapeRectangles); -static DISPATCH_PROC(ProcShapeSelectInput); -static DISPATCH_PROC(SProcShapeCombine); -static DISPATCH_PROC(SProcShapeDispatch); -static DISPATCH_PROC(SProcShapeGetRectangles); -static DISPATCH_PROC(SProcShapeInputSelected); -static DISPATCH_PROC(SProcShapeMask); -static DISPATCH_PROC(SProcShapeOffset); -static DISPATCH_PROC(SProcShapeQueryExtents); -static DISPATCH_PROC(SProcShapeQueryVersion); -static DISPATCH_PROC(SProcShapeRectangles); -static DISPATCH_PROC(SProcShapeSelectInput); #ifdef PANORAMIX #include "panoramiX.h" @@ -122,23 +102,6 @@ typedef struct _ShapeEvent { * ****************/ -void -ShapeExtensionInit(void) -{ - ExtensionEntry *extEntry; - - ClientType = CreateNewResourceType(ShapeFreeClient, "ShapeClient"); - ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent"); - if (ClientType && ShapeEventType && - (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, - ProcShapeDispatch, SProcShapeDispatch, - NULL, StandardMinorOpcode))) - { - ShapeEventBase = extEntry->eventBase; - EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; - } -} - static int RegionOperate ( ClientPtr client, @@ -1278,3 +1241,20 @@ SProcShapeDispatch (ClientPtr client) return BadRequest; } } + +void +ShapeExtensionInit(void) +{ + ExtensionEntry *extEntry; + + ClientType = CreateNewResourceType(ShapeFreeClient, "ShapeClient"); + ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent"); + if (ClientType && ShapeEventType && + (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, + ProcShapeDispatch, SProcShapeDispatch, + NULL, StandardMinorOpcode))) + { + ShapeEventBase = extEntry->eventBase; + EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; + } +} diff --git a/xserver/Xext/shm.c b/xserver/Xext/shm.c index 3230d83c6..4141a8fe6 100644 --- a/xserver/Xext/shm.c +++ b/xserver/Xext/shm.c @@ -120,20 +120,6 @@ static void SShmCompletionEvent( static Bool ShmDestroyPixmap (PixmapPtr pPixmap); -static DISPATCH_PROC(ProcShmAttach); -static DISPATCH_PROC(ProcShmCreatePixmap); -static DISPATCH_PROC(ProcShmDetach); -static DISPATCH_PROC(ProcShmDispatch); -static DISPATCH_PROC(ProcShmGetImage); -static DISPATCH_PROC(ProcShmPutImage); -static DISPATCH_PROC(ProcShmQueryVersion); -static DISPATCH_PROC(SProcShmAttach); -static DISPATCH_PROC(SProcShmCreatePixmap); -static DISPATCH_PROC(SProcShmDetach); -static DISPATCH_PROC(SProcShmDispatch); -static DISPATCH_PROC(SProcShmGetImage); -static DISPATCH_PROC(SProcShmPutImage); -static DISPATCH_PROC(SProcShmQueryVersion); static unsigned char ShmReqCode; int ShmCompletionCode; @@ -254,56 +240,6 @@ ShmRegisterPrivates(void) return TRUE; } -void -ShmExtensionInit(INITARGS) -{ - ExtensionEntry *extEntry; - int i; - -#ifdef MUST_CHECK_FOR_SHM_SYSCALL - if (!CheckForShmSyscall()) - { - ErrorF("MIT-SHM extension disabled due to lack of kernel support\n"); - return; - } -#endif - - if (!ShmRegisterPrivates()) - return; - - sharedPixmaps = xFalse; - { - sharedPixmaps = xTrue; - for (i = 0; i < screenInfo.numScreens; i++) - { - ShmScrPrivateRec *screen_priv = ShmInitScreenPriv(screenInfo.screens[i]); - if (!screen_priv->shmFuncs) - screen_priv->shmFuncs = &miFuncs; - if (!screen_priv->shmFuncs->CreatePixmap) - sharedPixmaps = xFalse; - } - if (sharedPixmaps) - for (i = 0; i < screenInfo.numScreens; i++) - { - ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(screenInfo.screens[i]); - screen_priv->destroyPixmap = screenInfo.screens[i]->DestroyPixmap; - screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; - } - } - ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg"); - if (ShmSegType && - (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, - ProcShmDispatch, SProcShmDispatch, - ShmResetProc, StandardMinorOpcode))) - { - ShmReqCode = (unsigned char)extEntry->base; - ShmCompletionCode = extEntry->eventBase; - BadShmSegCode = extEntry->errorBase; - SetResourceTypeErrorValue(ShmSegType, BadShmSegCode); - EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; - } -} - /*ARGSUSED*/ static void ShmResetProc(ExtensionEntry *extEntry) @@ -581,6 +517,226 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC, } } +static int +ProcShmPutImage(ClientPtr client) +{ + GCPtr pGC; + DrawablePtr pDraw; + long length; + ShmDescPtr shmdesc; + REQUEST(xShmPutImageReq); + + REQUEST_SIZE_MATCH(xShmPutImageReq); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); + VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client); + if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse)) + return BadValue; + if (stuff->format == XYBitmap) + { + if (stuff->depth != 1) + return BadMatch; + length = PixmapBytePad(stuff->totalWidth, 1); + } + else if (stuff->format == XYPixmap) + { + if (pDraw->depth != stuff->depth) + return BadMatch; + length = PixmapBytePad(stuff->totalWidth, 1); + length *= stuff->depth; + } + else if (stuff->format == ZPixmap) + { + if (pDraw->depth != stuff->depth) + return BadMatch; + length = PixmapBytePad(stuff->totalWidth, stuff->depth); + } + else + { + client->errorValue = stuff->format; + return BadValue; + } + + /* + * There's a potential integer overflow in this check: + * VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, + * client); + * the version below ought to avoid it + */ + if (stuff->totalHeight != 0 && + length > (shmdesc->size - stuff->offset)/stuff->totalHeight) { + client->errorValue = stuff->totalWidth; + return BadValue; + } + if (stuff->srcX > stuff->totalWidth) + { + client->errorValue = stuff->srcX; + return BadValue; + } + if (stuff->srcY > stuff->totalHeight) + { + client->errorValue = stuff->srcY; + return BadValue; + } + if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) + { + client->errorValue = stuff->srcWidth; + return BadValue; + } + if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) + { + client->errorValue = stuff->srcHeight; + return BadValue; + } + + if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || + ((stuff->format != ZPixmap) && + (stuff->srcX < screenInfo.bitmapScanlinePad) && + ((stuff->format == XYBitmap) || + ((stuff->srcY == 0) && + (stuff->srcHeight == stuff->totalHeight))))) && + ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth)) + (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, + stuff->dstX, stuff->dstY, + stuff->totalWidth, stuff->srcHeight, + stuff->srcX, stuff->format, + shmdesc->addr + stuff->offset + + (stuff->srcY * length)); + else + doShmPutImage(pDraw, pGC, stuff->depth, stuff->format, + stuff->totalWidth, stuff->totalHeight, + stuff->srcX, stuff->srcY, + stuff->srcWidth, stuff->srcHeight, + stuff->dstX, stuff->dstY, + shmdesc->addr + stuff->offset); + + if (stuff->sendEvent) + { + xShmCompletionEvent ev; + + ev.type = ShmCompletionCode; + ev.drawable = stuff->drawable; + ev.minorEvent = X_ShmPutImage; + ev.majorEvent = ShmReqCode; + ev.shmseg = stuff->shmseg; + ev.offset = stuff->offset; + WriteEventsToClient(client, 1, (xEvent *) &ev); + } + + return Success; +} + +static int +ProcShmGetImage(ClientPtr client) +{ + DrawablePtr pDraw; + long lenPer = 0, length; + Mask plane = 0; + xShmGetImageReply xgi; + ShmDescPtr shmdesc; + int n, rc; + + REQUEST(xShmGetImageReq); + + REQUEST_SIZE_MATCH(xShmGetImageReq); + if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) + { + client->errorValue = stuff->format; + return BadValue; + } + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; + VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); + if (pDraw->type == DRAWABLE_WINDOW) + { + if( /* check for being viewable */ + !((WindowPtr) pDraw)->realized || + /* check for being on screen */ + pDraw->x + stuff->x < 0 || + pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width || + pDraw->y + stuff->y < 0 || + pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height || + /* check for being inside of border */ + stuff->x < - wBorderWidth((WindowPtr)pDraw) || + stuff->x + (int)stuff->width > + wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || + stuff->y < -wBorderWidth((WindowPtr)pDraw) || + stuff->y + (int)stuff->height > + wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height + ) + return BadMatch; + xgi.visual = wVisual(((WindowPtr)pDraw)); + } + else + { + if (stuff->x < 0 || + stuff->x+(int)stuff->width > pDraw->width || + stuff->y < 0 || + stuff->y+(int)stuff->height > pDraw->height + ) + return BadMatch; + xgi.visual = None; + } + xgi.type = X_Reply; + xgi.length = 0; + xgi.sequenceNumber = client->sequence; + xgi.depth = pDraw->depth; + if(stuff->format == ZPixmap) + { + length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; + } + else + { + lenPer = PixmapBytePad(stuff->width, 1) * stuff->height; + plane = ((Mask)1) << (pDraw->depth - 1); + /* only planes asked for */ + length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); + } + + VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); + xgi.size = length; + + if (length == 0) + { + /* nothing to do */ + } + else if (stuff->format == ZPixmap) + { + (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, + stuff->width, stuff->height, + stuff->format, stuff->planeMask, + shmdesc->addr + stuff->offset); + } + else + { + + length = stuff->offset; + for (; plane; plane >>= 1) + { + if (stuff->planeMask & plane) + { + (*pDraw->pScreen->GetImage)(pDraw, + stuff->x, stuff->y, + stuff->width, stuff->height, + stuff->format, plane, + shmdesc->addr + length); + length += lenPer; + } + } + } + + if (client->swapped) { + swaps(&xgi.sequenceNumber, n); + swapl(&xgi.length, n); + swapl(&xgi.visual, n); + swapl(&xgi.size, n); + } + WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi); + + return Success; +} + #ifdef PANORAMIX static int ProcPanoramiXShmPutImage(ClientPtr client) @@ -692,7 +848,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) return BadAlloc; drawables[0] = pDraw; - for(i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, DixReadAccess); if (rc != Success) @@ -816,9 +972,7 @@ CreatePmap: newPix->type = XRT_PIXMAP; newPix->u.pix.shared = TRUE; - newPix->info[0].id = stuff->pid; - for(j = 1; j < PanoramiXNumScreens; j++) - newPix->info[j].id = FakeClientID(client->index); + panoramix_setup_ids(newPix, client, stuff->pid); result = Success; @@ -837,7 +991,6 @@ CreatePmap: pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = newPix->info[j].id; if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) { - (*pScreen->DestroyPixmap)(pMap); result = BadAlloc; break; } @@ -848,241 +1001,16 @@ CreatePmap: } if(result == BadAlloc) { - while(j--) { - (*pScreen->DestroyPixmap)(pMap); + while(j--) FreeResource(newPix->info[j].id, RT_NONE); - } free(newPix); } else AddResource(stuff->pid, XRT_PIXMAP, newPix); return result; } - #endif -static int -ProcShmPutImage(ClientPtr client) -{ - GCPtr pGC; - DrawablePtr pDraw; - long length; - ShmDescPtr shmdesc; - REQUEST(xShmPutImageReq); - - REQUEST_SIZE_MATCH(xShmPutImageReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); - VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client); - if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse)) - return BadValue; - if (stuff->format == XYBitmap) - { - if (stuff->depth != 1) - return BadMatch; - length = PixmapBytePad(stuff->totalWidth, 1); - } - else if (stuff->format == XYPixmap) - { - if (pDraw->depth != stuff->depth) - return BadMatch; - length = PixmapBytePad(stuff->totalWidth, 1); - length *= stuff->depth; - } - else if (stuff->format == ZPixmap) - { - if (pDraw->depth != stuff->depth) - return BadMatch; - length = PixmapBytePad(stuff->totalWidth, stuff->depth); - } - else - { - client->errorValue = stuff->format; - return BadValue; - } - - /* - * There's a potential integer overflow in this check: - * VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, - * client); - * the version below ought to avoid it - */ - if (stuff->totalHeight != 0 && - length > (shmdesc->size - stuff->offset)/stuff->totalHeight) { - client->errorValue = stuff->totalWidth; - return BadValue; - } - if (stuff->srcX > stuff->totalWidth) - { - client->errorValue = stuff->srcX; - return BadValue; - } - if (stuff->srcY > stuff->totalHeight) - { - client->errorValue = stuff->srcY; - return BadValue; - } - if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) - { - client->errorValue = stuff->srcWidth; - return BadValue; - } - if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) - { - client->errorValue = stuff->srcHeight; - return BadValue; - } - - if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || - ((stuff->format != ZPixmap) && - (stuff->srcX < screenInfo.bitmapScanlinePad) && - ((stuff->format == XYBitmap) || - ((stuff->srcY == 0) && - (stuff->srcHeight == stuff->totalHeight))))) && - ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth)) - (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, - stuff->dstX, stuff->dstY, - stuff->totalWidth, stuff->srcHeight, - stuff->srcX, stuff->format, - shmdesc->addr + stuff->offset + - (stuff->srcY * length)); - else - doShmPutImage(pDraw, pGC, stuff->depth, stuff->format, - stuff->totalWidth, stuff->totalHeight, - stuff->srcX, stuff->srcY, - stuff->srcWidth, stuff->srcHeight, - stuff->dstX, stuff->dstY, - shmdesc->addr + stuff->offset); - - if (stuff->sendEvent) - { - xShmCompletionEvent ev; - - ev.type = ShmCompletionCode; - ev.drawable = stuff->drawable; - ev.minorEvent = X_ShmPutImage; - ev.majorEvent = ShmReqCode; - ev.shmseg = stuff->shmseg; - ev.offset = stuff->offset; - WriteEventsToClient(client, 1, (xEvent *) &ev); - } - - return Success; -} - - - -static int -ProcShmGetImage(ClientPtr client) -{ - DrawablePtr pDraw; - long lenPer = 0, length; - Mask plane = 0; - xShmGetImageReply xgi; - ShmDescPtr shmdesc; - int n, rc; - - REQUEST(xShmGetImageReq); - - REQUEST_SIZE_MATCH(xShmGetImageReq); - if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) - { - client->errorValue = stuff->format; - return BadValue; - } - rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixReadAccess); - if (rc != Success) - return rc; - VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); - if (pDraw->type == DRAWABLE_WINDOW) - { - if( /* check for being viewable */ - !((WindowPtr) pDraw)->realized || - /* check for being on screen */ - pDraw->x + stuff->x < 0 || - pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width || - pDraw->y + stuff->y < 0 || - pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height || - /* check for being inside of border */ - stuff->x < - wBorderWidth((WindowPtr)pDraw) || - stuff->x + (int)stuff->width > - wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || - stuff->y < -wBorderWidth((WindowPtr)pDraw) || - stuff->y + (int)stuff->height > - wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height - ) - return BadMatch; - xgi.visual = wVisual(((WindowPtr)pDraw)); - } - else - { - if (stuff->x < 0 || - stuff->x+(int)stuff->width > pDraw->width || - stuff->y < 0 || - stuff->y+(int)stuff->height > pDraw->height - ) - return BadMatch; - xgi.visual = None; - } - xgi.type = X_Reply; - xgi.length = 0; - xgi.sequenceNumber = client->sequence; - xgi.depth = pDraw->depth; - if(stuff->format == ZPixmap) - { - length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; - } - else - { - lenPer = PixmapBytePad(stuff->width, 1) * stuff->height; - plane = ((Mask)1) << (pDraw->depth - 1); - /* only planes asked for */ - length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); - } - - VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); - xgi.size = length; - - if (length == 0) - { - /* nothing to do */ - } - else if (stuff->format == ZPixmap) - { - (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, - stuff->width, stuff->height, - stuff->format, stuff->planeMask, - shmdesc->addr + stuff->offset); - } - else - { - - length = stuff->offset; - for (; plane; plane >>= 1) - { - if (stuff->planeMask & plane) - { - (*pDraw->pScreen->GetImage)(pDraw, - stuff->x, stuff->y, - stuff->width, stuff->height, - stuff->format, plane, - shmdesc->addr + length); - length += lenPer; - } - } - } - - if (client->swapped) { - swaps(&xgi.sequenceNumber, n); - swapl(&xgi.length, n); - swapl(&xgi.visual, n); - swapl(&xgi.size, n); - } - WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi); - - return Success; -} - static PixmapPtr fbShmCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, char *addr) @@ -1179,7 +1107,6 @@ CreatePmap: { return Success; } - pDraw->pScreen->DestroyPixmap(pMap); } return BadAlloc; } @@ -1342,3 +1269,53 @@ SProcShmDispatch (ClientPtr client) return BadRequest; } } + +void +ShmExtensionInit(INITARGS) +{ + ExtensionEntry *extEntry; + int i; + +#ifdef MUST_CHECK_FOR_SHM_SYSCALL + if (!CheckForShmSyscall()) + { + ErrorF("MIT-SHM extension disabled due to lack of kernel support\n"); + return; + } +#endif + + if (!ShmRegisterPrivates()) + return; + + sharedPixmaps = xFalse; + { + sharedPixmaps = xTrue; + for (i = 0; i < screenInfo.numScreens; i++) + { + ShmScrPrivateRec *screen_priv = ShmInitScreenPriv(screenInfo.screens[i]); + if (!screen_priv->shmFuncs) + screen_priv->shmFuncs = &miFuncs; + if (!screen_priv->shmFuncs->CreatePixmap) + sharedPixmaps = xFalse; + } + if (sharedPixmaps) + for (i = 0; i < screenInfo.numScreens; i++) + { + ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(screenInfo.screens[i]); + screen_priv->destroyPixmap = screenInfo.screens[i]->DestroyPixmap; + screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; + } + } + ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg"); + if (ShmSegType && + (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, + ProcShmDispatch, SProcShmDispatch, + ShmResetProc, StandardMinorOpcode))) + { + ShmReqCode = (unsigned char)extEntry->base; + ShmCompletionCode = extEntry->eventBase; + BadShmSegCode = extEntry->errorBase; + SetResourceTypeErrorValue(ShmSegType, BadShmSegCode); + EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; + } +} diff --git a/xserver/Xext/sync.c b/xserver/Xext/sync.c index deb98694e..36dd27888 100644 --- a/xserver/Xext/sync.c +++ b/xserver/Xext/sync.c @@ -59,14 +59,16 @@ PERFORMANCE OF THIS SOFTWARE. #include <X11/X.h> #include <X11/Xproto.h> #include <X11/Xmd.h> -#include "misc.h" +#include "scrnintstr.h" #include "os.h" #include "extnsionst.h" #include "dixstruct.h" +#include "pixmapstr.h" #include "resource.h" #include "opaque.h" #include <X11/extensions/syncproto.h> #include "syncsrv.h" +#include "syncsdk.h" #include "protocol-versions.h" #include <stdio.h> @@ -85,11 +87,22 @@ static RESTYPE RTCounter = 0; static RESTYPE RTAwait; static RESTYPE RTAlarm; static RESTYPE RTAlarmClient; +static RESTYPE RTFence; static int SyncNumSystemCounters = 0; static SyncCounter **SysCounterList = NULL; +static int SyncNumInvalidCounterWarnings = 0; +#define MAX_INVALID_COUNTER_WARNINGS 5 + +static const char *WARN_INVALID_COUNTER_COMPARE = +"Warning: Non-counter XSync object using Counter-only\n" +" comparison. Result will never be true.\n"; + +static const char *WARN_INVALID_COUNTER_ALARM = +"Warning: Non-counter XSync object used in alarm. This is\n" +" the result of a programming error in the X server.\n"; #define IsSystemCounter(pCounter) \ - (pCounter && (pCounter->client == NULL)) + (pCounter && (pCounter->sync.client == NULL)) /* these are all the alarm attributes that pertain to the alarm's trigger */ #define XSyncCAAllTrigger \ @@ -101,54 +114,41 @@ static void SyncInitServerTime(void); static void SyncInitIdleTime(void); -static DISPATCH_PROC(ProcSyncAwait); -static DISPATCH_PROC(ProcSyncChangeAlarm); -static DISPATCH_PROC(ProcSyncChangeCounter); -static DISPATCH_PROC(ProcSyncCreateAlarm); -static DISPATCH_PROC(ProcSyncCreateCounter); -static DISPATCH_PROC(ProcSyncDestroyAlarm); -static DISPATCH_PROC(ProcSyncDestroyCounter); -static DISPATCH_PROC(ProcSyncDispatch); -static DISPATCH_PROC(ProcSyncGetPriority); -static DISPATCH_PROC(ProcSyncInitialize); -static DISPATCH_PROC(ProcSyncListSystemCounters); -static DISPATCH_PROC(ProcSyncQueryAlarm); -static DISPATCH_PROC(ProcSyncQueryCounter); -static DISPATCH_PROC(ProcSyncSetCounter); -static DISPATCH_PROC(ProcSyncSetPriority); -static DISPATCH_PROC(SProcSyncAwait); -static DISPATCH_PROC(SProcSyncChangeAlarm); -static DISPATCH_PROC(SProcSyncChangeCounter); -static DISPATCH_PROC(SProcSyncCreateAlarm); -static DISPATCH_PROC(SProcSyncCreateCounter); -static DISPATCH_PROC(SProcSyncDestroyAlarm); -static DISPATCH_PROC(SProcSyncDestroyCounter); -static DISPATCH_PROC(SProcSyncDispatch); -static DISPATCH_PROC(SProcSyncGetPriority); -static DISPATCH_PROC(SProcSyncInitialize); -static DISPATCH_PROC(SProcSyncListSystemCounters); -static DISPATCH_PROC(SProcSyncQueryAlarm); -static DISPATCH_PROC(SProcSyncQueryCounter); -static DISPATCH_PROC(SProcSyncSetCounter); -static DISPATCH_PROC(SProcSyncSetPriority); +static Bool +SyncCheckWarnIsCounter(const SyncObject* pSync, const char *warning) +{ + if (pSync && (SYNC_COUNTER != pSync->type)) + { + if (SyncNumInvalidCounterWarnings++ < MAX_INVALID_COUNTER_WARNINGS) + { + ErrorF("%s", warning); + ErrorF(" Counter type: %d\n", pSync->type); + } + + return FALSE; + } + + return TRUE; +} /* Each counter maintains a simple linked list of triggers that are * interested in the counter. The two functions below are used to * delete and add triggers on this list. */ static void -SyncDeleteTriggerFromCounter(SyncTrigger *pTrigger) +SyncDeleteTriggerFromSyncObject(SyncTrigger *pTrigger) { SyncTriggerList *pCur; SyncTriggerList *pPrev; + SyncCounter *pCounter; - /* pCounter needs to be stored in pTrigger before calling here. */ + /* pSync needs to be stored in pTrigger before calling here. */ - if (!pTrigger->pCounter) + if (!pTrigger->pSync) return; pPrev = NULL; - pCur = pTrigger->pCounter->pTriglist; + pCur = pTrigger->pSync->pTriglist; while (pCur) { @@ -157,7 +157,7 @@ SyncDeleteTriggerFromCounter(SyncTrigger *pTrigger) if (pPrev) pPrev->next = pCur->next; else - pTrigger->pCounter->pTriglist = pCur->next; + pTrigger->pSync->pTriglist = pCur->next; free(pCur); break; @@ -167,21 +167,30 @@ SyncDeleteTriggerFromCounter(SyncTrigger *pTrigger) pCur = pCur->next; } - if (IsSystemCounter(pTrigger->pCounter)) - SyncComputeBracketValues(pTrigger->pCounter); + if (SYNC_COUNTER == pTrigger->pSync->type) + { + pCounter = (SyncCounter *)pTrigger->pSync; + + if (IsSystemCounter(pCounter)) + SyncComputeBracketValues(pCounter); + } else if (SYNC_FENCE == pTrigger->pSync->type) { + SyncFence* pFence = (SyncFence*) pTrigger->pSync; + pFence->funcs.DeleteTrigger(pTrigger); + } } static int -SyncAddTriggerToCounter(SyncTrigger *pTrigger) +SyncAddTriggerToSyncObject(SyncTrigger *pTrigger) { SyncTriggerList *pCur; + SyncCounter *pCounter; - if (!pTrigger->pCounter) + if (!pTrigger->pSync) return Success; /* don't do anything if it's already there */ - for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next) + for (pCur = pTrigger->pSync->pTriglist; pCur; pCur = pCur->next) { if (pCur->pTrigger == pTrigger) return Success; @@ -191,96 +200,153 @@ SyncAddTriggerToCounter(SyncTrigger *pTrigger) return BadAlloc; pCur->pTrigger = pTrigger; - pCur->next = pTrigger->pCounter->pTriglist; - pTrigger->pCounter->pTriglist = pCur; + pCur->next = pTrigger->pSync->pTriglist; + pTrigger->pSync->pTriglist = pCur; - if (IsSystemCounter(pTrigger->pCounter)) - SyncComputeBracketValues(pTrigger->pCounter); + if (SYNC_COUNTER == pTrigger->pSync->type) + { + pCounter = (SyncCounter *)pTrigger->pSync; + + if (IsSystemCounter(pCounter)) + SyncComputeBracketValues(pCounter); + } else if (SYNC_FENCE == pTrigger->pSync->type) { + SyncFence* pFence = (SyncFence*) pTrigger->pSync; + pFence->funcs.AddTrigger(pTrigger); + } return Success; } -/* Below are four possible functions that can be plugged into - * pTrigger->CheckTrigger, corresponding to the four possible - * test-types. These functions are called after the counter's - * value changes but are also passed the old counter value - * so they can inspect both the old and new values. - * (PositiveTransition and NegativeTransition need to see both - * pieces of information.) These functions return the truth value - * of the trigger. +/* Below are five possible functions that can be plugged into + * pTrigger->CheckTrigger for counter sync objects, corresponding to + * the four possible test-types, and the one possible function that + * can be plugged into pTrigger->CheckTrigger for fence sync objects. + * These functions are called after the sync object's state changes + * but are also passed the old state so they can inspect both the old + * and new values. (PositiveTransition and NegativeTransition need to + * see both pieces of information.) These functions return the truth + * value of the trigger. * - * All of them include the condition pTrigger->pCounter == NULL. - * This is because the spec says that a trigger with a counter value + * All of them include the condition pTrigger->pSync == NULL. + * This is because the spec says that a trigger with a sync value * of None is always TRUE. */ static Bool SyncCheckTriggerPositiveComparison(SyncTrigger *pTrigger, CARD64 oldval) { - return (pTrigger->pCounter == NULL || - XSyncValueGreaterOrEqual(pTrigger->pCounter->value, - pTrigger->test_value)); + SyncCounter *pCounter; + + /* Non-counter sync objects should never get here because they + * never trigger this comparison. */ + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE)) + return FALSE; + + pCounter = (SyncCounter *)pTrigger->pSync; + + return (pCounter == NULL || + XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value)); } static Bool SyncCheckTriggerNegativeComparison(SyncTrigger *pTrigger, CARD64 oldval) { - return (pTrigger->pCounter == NULL || - XSyncValueLessOrEqual(pTrigger->pCounter->value, - pTrigger->test_value)); + SyncCounter *pCounter; + + /* Non-counter sync objects should never get here because they + * never trigger this comparison. */ + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE)) + return FALSE; + + pCounter = (SyncCounter *)pTrigger->pSync; + + return (pCounter == NULL || + XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value)); } static Bool SyncCheckTriggerPositiveTransition(SyncTrigger *pTrigger, CARD64 oldval) { - return (pTrigger->pCounter == NULL || + SyncCounter *pCounter; + + /* Non-counter sync objects should never get here because they + * never trigger this comparison. */ + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE)) + return FALSE; + + pCounter = (SyncCounter *)pTrigger->pSync; + + return (pCounter == NULL || (XSyncValueLessThan(oldval, pTrigger->test_value) && - XSyncValueGreaterOrEqual(pTrigger->pCounter->value, - pTrigger->test_value))); + XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value))); } static Bool SyncCheckTriggerNegativeTransition(SyncTrigger *pTrigger, CARD64 oldval) { - return (pTrigger->pCounter == NULL || + SyncCounter *pCounter; + + /* Non-counter sync objects should never get here because they + * never trigger this comparison. */ + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE)) + return FALSE; + + pCounter = (SyncCounter *)pTrigger->pSync; + + return (pCounter == NULL || (XSyncValueGreaterThan(oldval, pTrigger->test_value) && - XSyncValueLessOrEqual(pTrigger->pCounter->value, - pTrigger->test_value))); + XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value))); +} + +static Bool +SyncCheckTriggerFence(SyncTrigger *pTrigger, CARD64 unused) +{ + SyncFence* pFence = (SyncFence*) pTrigger->pSync; + (void)unused; + + return (pFence == NULL || + pFence->funcs.CheckTriggered(pFence)); } static int -SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XSyncCounter counter, - Mask changes) +SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XID syncObject, + RESTYPE resType, Mask changes) { - SyncCounter *pCounter = pTrigger->pCounter; + SyncObject *pSync = pTrigger->pSync; + SyncCounter *pCounter = NULL; int rc; - Bool newcounter = FALSE; + Bool newSyncObject = FALSE; if (changes & XSyncCACounter) { - if (counter == None) - pCounter = NULL; - else if (Success != (rc = dixLookupResourceByType ((pointer *)&pCounter, - counter, RTCounter, client, DixReadAccess))) + if (syncObject == None) + pSync = NULL; + else if (Success != (rc = dixLookupResourceByType ((pointer *)&pSync, + syncObject, resType, client, DixReadAccess))) { - client->errorValue = counter; + client->errorValue = syncObject; return rc; } - if (pCounter != pTrigger->pCounter) + if (pSync != pTrigger->pSync) { /* new counter for trigger */ - SyncDeleteTriggerFromCounter(pTrigger); - pTrigger->pCounter = pCounter; - newcounter = TRUE; + SyncDeleteTriggerFromSyncObject(pTrigger); + pTrigger->pSync = pSync; + newSyncObject = TRUE; } } /* if system counter, ask it what the current value is */ - if (IsSystemCounter(pCounter)) + if (pSync && SYNC_COUNTER == pSync->type) { - (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter, - &pCounter->value); + pCounter = (SyncCounter *)pSync; + + if (IsSystemCounter(pCounter)) + { + (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter, + &pCounter->value); + } } if (changes & XSyncCAValueType) @@ -295,30 +361,33 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XSyncCounter counter, if (changes & XSyncCATestType) { - if (pTrigger->test_type != XSyncPositiveTransition && - pTrigger->test_type != XSyncNegativeTransition && - pTrigger->test_type != XSyncPositiveComparison && - pTrigger->test_type != XSyncNegativeComparison) + + if (pSync && SYNC_FENCE == pSync->type) { - client->errorValue = pTrigger->test_type; - return BadValue; + pTrigger->CheckTrigger = SyncCheckTriggerFence; } - /* select appropriate CheckTrigger function */ - - switch (pTrigger->test_type) + else { - case XSyncPositiveTransition: - pTrigger->CheckTrigger = SyncCheckTriggerPositiveTransition; - break; - case XSyncNegativeTransition: - pTrigger->CheckTrigger = SyncCheckTriggerNegativeTransition; - break; - case XSyncPositiveComparison: - pTrigger->CheckTrigger = SyncCheckTriggerPositiveComparison; - break; - case XSyncNegativeComparison: - pTrigger->CheckTrigger = SyncCheckTriggerNegativeComparison; - break; + /* select appropriate CheckTrigger function */ + + switch (pTrigger->test_type) + { + case XSyncPositiveTransition: + pTrigger->CheckTrigger = SyncCheckTriggerPositiveTransition; + break; + case XSyncNegativeTransition: + pTrigger->CheckTrigger = SyncCheckTriggerNegativeTransition; + break; + case XSyncPositiveComparison: + pTrigger->CheckTrigger = SyncCheckTriggerPositiveComparison; + break; + case XSyncNegativeComparison: + pTrigger->CheckTrigger = SyncCheckTriggerNegativeComparison; + break; + default: + client->errorValue = pTrigger->test_type; + return BadValue; + } } } @@ -345,12 +414,12 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XSyncCounter counter, /* we wait until we're sure there are no errors before registering * a new counter on a trigger */ - if (newcounter) + if (newSyncObject) { - if ((rc = SyncAddTriggerToCounter(pTrigger)) != Success) + if ((rc = SyncAddTriggerToSyncObject(pTrigger)) != Success) return rc; } - else if (IsSystemCounter(pCounter)) + else if (pCounter && IsSystemCounter(pCounter)) { SyncComputeBracketValues(pCounter); } @@ -368,16 +437,22 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm) SyncAlarmClientList *pcl; xSyncAlarmNotifyEvent ane; SyncTrigger *pTrigger = &pAlarm->trigger; + SyncCounter *pCounter; + + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_ALARM)) + return; + + pCounter = (SyncCounter *)pTrigger->pSync; UpdateCurrentTime(); ane.type = SyncEventBase + XSyncAlarmNotify; ane.kind = XSyncAlarmNotify; ane.alarm = pAlarm->alarm_id; - if (pTrigger->pCounter) + if (pTrigger->pSync && SYNC_COUNTER == pTrigger->pSync->type) { - ane.counter_value_hi = XSyncValueHigh32(pTrigger->pCounter->value); - ane.counter_value_lo = XSyncValueLow32(pTrigger->pCounter->value); + ane.counter_value_hi = XSyncValueHigh32(pCounter->value); + ane.counter_value_lo = XSyncValueLow32(pCounter->value); } else { /* XXX what else can we do if there's no counter? */ @@ -420,14 +495,25 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait, SyncTrigger *pTrigger = &(*ppAwait)->trigger; pev->type = SyncEventBase + XSyncCounterNotify; pev->kind = XSyncCounterNotify; - pev->counter = pTrigger->pCounter->id; + pev->counter = pTrigger->pSync->id; pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value); pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value); - pev->counter_value_lo = XSyncValueLow32(pTrigger->pCounter->value); - pev->counter_value_hi = XSyncValueHigh32(pTrigger->pCounter->value); + if (SYNC_COUNTER == pTrigger->pSync->type) + { + SyncCounter *pCounter = (SyncCounter *)pTrigger->pSync; + + pev->counter_value_lo = XSyncValueLow32(pCounter->value); + pev->counter_value_hi = XSyncValueHigh32(pCounter->value); + } + else + { + pev->counter_value_lo = 0; + pev->counter_value_hi = 0; + } + pev->time = currentTime.milliseconds; pev->count = num_events - i - 1; /* events remaining */ - pev->destroyed = pTrigger->pCounter->beingDestroyed; + pev->destroyed = pTrigger->pSync->beingDestroyed; } /* swapping will be taken care of by this */ WriteEventsToClient(client, num_events, (xEvent *)pEvents); @@ -445,7 +531,7 @@ SyncAlarmCounterDestroyed(SyncTrigger *pTrigger) pAlarm->state = XSyncAlarmInactive; SyncSendAlarmNotifyEvents(pAlarm); - pTrigger->pCounter = NULL; + pTrigger->pSync = NULL; } @@ -456,8 +542,14 @@ static void SyncAlarmTriggerFired(SyncTrigger *pTrigger) { SyncAlarm *pAlarm = (SyncAlarm *)pTrigger; + SyncCounter *pCounter; CARD64 new_test_value; + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_ALARM)) + return; + + pCounter = (SyncCounter *)pTrigger->pSync; + /* no need to check alarm unless it's active */ if (pAlarm->state != XSyncAlarmActive) return; @@ -467,7 +559,7 @@ SyncAlarmTriggerFired(SyncTrigger *pTrigger) * no change is made to value (test-value) and the alarm * state is changed to Inactive before the event is generated." */ - if (pAlarm->trigger.pCounter == NULL + if (pCounter == NULL || (XSyncValueIsZero(pAlarm->delta) && (pAlarm->trigger.test_type == XSyncPositiveComparison || pAlarm->trigger.test_type == XSyncNegativeComparison))) @@ -480,6 +572,13 @@ SyncAlarmTriggerFired(SyncTrigger *pTrigger) Bool overflow; CARD64 oldvalue; SyncTrigger *paTrigger = &pAlarm->trigger; + SyncCounter *paCounter; + + if (!SyncCheckWarnIsCounter(paTrigger->pSync, + WARN_INVALID_COUNTER_ALARM)) + return; + + paCounter = (SyncCounter *)pTrigger->pSync; /* "The alarm is updated by repeatedly adding delta to the * value of the trigger and re-initializing it until it @@ -495,7 +594,7 @@ SyncAlarmTriggerFired(SyncTrigger *pTrigger) pAlarm->delta, &overflow); } while (!overflow && (*paTrigger->CheckTrigger)(paTrigger, - paTrigger->pCounter->value)); + paCounter->value)); new_test_value = paTrigger->test_value; paTrigger->test_value = oldvalue; @@ -562,46 +661,51 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger) * always generated if the counter for one of the triggers is * destroyed." */ - if (pAwait->trigger.pCounter->beingDestroyed) + if (pAwait->trigger.pSync->beingDestroyed) { ppAwait[num_events++] = pAwait; continue; } + + if (SYNC_COUNTER == pAwait->trigger.pSync->type) + { + SyncCounter *pCounter = (SyncCounter *) pAwait->trigger.pSync; - /* "The difference between the counter and the test value is - * calculated by subtracting the test value from the value of - * the counter." - */ - XSyncValueSubtract(&diff, pAwait->trigger.pCounter->value, - pAwait->trigger.test_value, &overflow); + /* "The difference between the counter and the test value is + * calculated by subtracting the test value from the value of + * the counter." + */ + XSyncValueSubtract(&diff, pCounter->value, + pAwait->trigger.test_value, &overflow); - /* "If the difference lies outside the range for an INT64, an - * event is not generated." - */ - if (overflow) - continue; - diffgreater = XSyncValueGreaterThan(diff, pAwait->event_threshold); - diffequal = XSyncValueEqual(diff, pAwait->event_threshold); - - /* "If the test-type is PositiveTransition or - * PositiveComparison, a CounterNotify event is generated if - * the difference is at least event-threshold. If the test-type - * is NegativeTransition or NegativeComparison, a CounterNotify - * event is generated if the difference is at most - * event-threshold." - */ + /* "If the difference lies outside the range for an INT64, an + * event is not generated." + */ + if (overflow) + continue; + diffgreater = XSyncValueGreaterThan(diff, pAwait->event_threshold); + diffequal = XSyncValueEqual(diff, pAwait->event_threshold); + + /* "If the test-type is PositiveTransition or + * PositiveComparison, a CounterNotify event is generated if + * the difference is at least event-threshold. If the test-type + * is NegativeTransition or NegativeComparison, a CounterNotify + * event is generated if the difference is at most + * event-threshold." + */ - if ( ((pAwait->trigger.test_type == XSyncPositiveComparison || - pAwait->trigger.test_type == XSyncPositiveTransition) - && (diffgreater || diffequal)) - || - ((pAwait->trigger.test_type == XSyncNegativeComparison || - pAwait->trigger.test_type == XSyncNegativeTransition) - && (!diffgreater) /* less or equal */ - ) - ) - { - ppAwait[num_events++] = pAwait; + if ( ((pAwait->trigger.test_type == XSyncPositiveComparison || + pAwait->trigger.test_type == XSyncPositiveTransition) + && (diffgreater || diffequal)) + || + ((pAwait->trigger.test_type == XSyncNegativeComparison || + pAwait->trigger.test_type == XSyncNegativeTransition) + && (!diffgreater) /* less or equal */ + ) + ) + { + ppAwait[num_events++] = pAwait; + } } } if (num_events) @@ -630,7 +734,7 @@ SyncChangeCounter(SyncCounter *pCounter, CARD64 newval) pCounter->value = newval; /* run through triggers to see if any become true */ - for (ptl = pCounter->pTriglist; ptl; ptl = pnext) + for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) { pnext = ptl->next; if ((*ptl->pTrigger->CheckTrigger)(ptl->pTrigger, oldval)) @@ -697,17 +801,15 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents) */ pClients->delete_id = FakeClientID(client->index); - if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm)) - { - free(pClients); - return BadAlloc; - } /* link it into list after we know all the allocations succeed */ - pClients->next = pAlarm->pEventClients; pAlarm->pEventClients = pClients; pClients->client = client; + + if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm)) + return BadAlloc; + return Success; } @@ -722,7 +824,8 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm *pAlarm, Mask mask, XSyncCounter counter; Mask origmask = mask; - counter = pAlarm->trigger.pCounter ? pAlarm->trigger.pCounter->id : None; + counter = + pAlarm->trigger.pSync ? pAlarm->trigger.pSync->id : None; while (mask) { @@ -802,7 +905,7 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm *pAlarm, Mask mask, } /* postpone this until now, when we're sure nothing else can go wrong */ - if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter, + if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter, RTCounter, origmask & XSyncCAAllTrigger)) != Success) return status; @@ -811,27 +914,52 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm *pAlarm, Mask mask, return Success; } +static SyncObject * +SyncCreate(ClientPtr client, XID id, unsigned char type) +{ + SyncObject *pSync; + + switch (type) { + case SYNC_COUNTER: + pSync = malloc(sizeof(SyncCounter)); + break; + case SYNC_FENCE: + pSync = (SyncObject*)dixAllocateObjectWithPrivates(SyncFence, + PRIVATE_SYNC_FENCE); + break; + default: + return NULL; + } + + if (!pSync) + return NULL; + + pSync->client = client; + pSync->id = id; + pSync->pTriglist = NULL; + pSync->beingDestroyed = FALSE; + pSync->type = type; + + return pSync; +} + static SyncCounter * SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue) { SyncCounter *pCounter; - if (!(pCounter = malloc(sizeof(SyncCounter)))) + if (!(pCounter = (SyncCounter *)SyncCreate(client, + id, + SYNC_COUNTER))) return NULL; + pCounter->value = initialvalue; + pCounter->pSysCounterInfo = NULL; + if (!AddResource(id, RTCounter, (pointer) pCounter)) - { - free(pCounter); return NULL; - } - pCounter->client = client; - pCounter->id = id; - pCounter->value = initialvalue; - pCounter->pTriglist = NULL; - pCounter->beingDestroyed = FALSE; - pCounter->pSysCounterInfo = NULL; return pCounter; } @@ -882,7 +1010,7 @@ SyncCreateSystemCounter( psci = malloc(sizeof(SysCounterInfo)); if (!psci) { - FreeResource(pCounter->id, RT_NONE); + FreeResource(pCounter->sync.id, RT_NONE); return pCounter; } pCounter->pSysCounterInfo = psci; @@ -902,7 +1030,7 @@ void SyncDestroySystemCounter(pointer pSysCounter) { SyncCounter *pCounter = (SyncCounter *)pSysCounter; - FreeResource(pCounter->id, RT_NONE); + FreeResource(pCounter->sync.id, RT_NONE); } static void @@ -926,7 +1054,7 @@ SyncComputeBracketValues(SyncCounter *pCounter) XSyncMaxValue(&psci->bracket_greater); XSyncMinValue(&psci->bracket_less); - for (pCur = pCounter->pTriglist; pCur; pCur = pCur->next) + for (pCur = pCounter->sync.pTriglist; pCur; pCur = pCur->next) { pTrigger = pCur->pTrigger; @@ -1021,7 +1149,7 @@ FreeAlarm(void *addr, XID id) while (pAlarm->pEventClients) FreeResource(pAlarm->pEventClients->delete_id, RT_NONE); - SyncDeleteTriggerFromCounter(&pAlarm->trigger); + SyncDeleteTriggerFromSyncObject(&pAlarm->trigger); free(pAlarm); return Success; @@ -1038,9 +1166,9 @@ FreeCounter(void *env, XID id) SyncCounter *pCounter = (SyncCounter *) env; SyncTriggerList *ptl, *pnext; - pCounter->beingDestroyed = TRUE; + pCounter->sync.beingDestroyed = TRUE; /* tell all the counter's triggers that the counter has been destroyed */ - for (ptl = pCounter->pTriglist; ptl; ptl = pnext) + for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) { (*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger); pnext = ptl->next; @@ -1099,9 +1227,9 @@ FreeAwait(void *addr, XID id) /* If the counter is being destroyed, FreeCounter will delete * the trigger list itself, so don't do it here. */ - SyncCounter *pCounter = pAwait->trigger.pCounter; - if (pCounter && !pCounter->beingDestroyed) - SyncDeleteTriggerFromCounter(&pAwait->trigger); + SyncObject *pSync = pAwait->trigger.pSync; + if (pSync && !pSync->beingDestroyed) + SyncDeleteTriggerFromSyncObject(&pAwait->trigger); } free(pAwaitUnion); return Success; @@ -1210,7 +1338,7 @@ ProcSyncListSystemCounters(ClientPtr client) char *pname_in_reply; SysCounterInfo *psci = SysCounterList[i]->pSysCounterInfo; - walklist->counter = SysCounterList[i]->id; + walklist->counter = SysCounterList[i]->sync.id; walklist->resolution_hi = XSyncValueHigh32(psci->resolution); walklist->resolution_lo = XSyncValueLow32(psci->resolution); namelen = strlen(psci->name); @@ -1423,10 +1551,67 @@ ProcSyncDestroyCounter(ClientPtr client) client->errorValue = stuff->counter; return BadAccess; } - FreeResource(pCounter->id, RT_NONE); + FreeResource(pCounter->sync.id, RT_NONE); return Success; } +static SyncAwaitUnion* +SyncAwaitPrologue(ClientPtr client, int items) +{ + SyncAwaitUnion *pAwaitUnion; + + /* all the memory for the entire await list is allocated + * here in one chunk + */ + pAwaitUnion = malloc((items+1) * sizeof(SyncAwaitUnion)); + if (!pAwaitUnion) + return NULL; + + /* first item is the header, remainder are real wait conditions */ + + pAwaitUnion->header.delete_id = FakeClientID(client->index); + pAwaitUnion->header.client = client; + pAwaitUnion->header.num_waitconditions = 0; + + if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion)) + return NULL; + + return pAwaitUnion; +} + +static void +SyncAwaitEpilogue(ClientPtr client, int items, SyncAwaitUnion *pAwaitUnion) +{ + SyncAwait *pAwait; + int i; + + IgnoreClient(client); + + /* see if any of the triggers are already true */ + + pAwait = &(pAwaitUnion+1)->await; /* skip over header */ + for (i = 0; i < items; i++, pAwait++) + { + CARD64 value; + + /* don't have to worry about NULL counters because the request + * errors before we get here out if they occur + */ + switch (pAwait->trigger.pSync->type) { + case SYNC_COUNTER: + value = ((SyncCounter *)pAwait->trigger.pSync)->value; + break; + default: + XSyncIntToValue(&value, 0); + } + + if ((*pAwait->trigger.CheckTrigger)(&pAwait->trigger, value)) + { + (*pAwait->trigger.TriggerFired)(&pAwait->trigger); + break; /* once is enough */ + } + } +} /* * ** Await @@ -1458,28 +1643,12 @@ ProcSyncAwait(ClientPtr client) return BadValue; } - pProtocolWaitConds = (xSyncWaitCondition *) & stuff[1]; - - /* all the memory for the entire await list is allocated - * here in one chunk - */ - pAwaitUnion = malloc((items+1) * sizeof(SyncAwaitUnion)); - if (!pAwaitUnion) - return BadAlloc; - - /* first item is the header, remainder are real wait conditions */ - - pAwaitUnion->header.delete_id = FakeClientID(client->index); - if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion)) - { - free(pAwaitUnion); + if (!(pAwaitUnion = SyncAwaitPrologue(client, items))) return BadAlloc; - } /* don't need to do any more memory allocation for this request! */ - pAwaitUnion->header.client = client; - pAwaitUnion->header.num_waitconditions = 0; + pProtocolWaitConds = (xSyncWaitCondition *) & stuff[1]; pAwait = &(pAwaitUnion+1)->await; /* skip over header */ for (i = 0; i < items; i++, pProtocolWaitConds++, pAwait++) @@ -1487,7 +1656,7 @@ ProcSyncAwait(ClientPtr client) if (pProtocolWaitConds->counter == None) /* XXX protocol change */ { /* this should take care of removing any triggers created by - * this request that have already been registered on counters + * this request that have already been registered on sync objects */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); client->errorValue = pProtocolWaitConds->counter; @@ -1495,7 +1664,7 @@ ProcSyncAwait(ClientPtr client) } /* sanity checks are in SyncInitTrigger */ - pAwait->trigger.pCounter = NULL; + pAwait->trigger.pSync = NULL; pAwait->trigger.value_type = pProtocolWaitConds->value_type; XSyncIntsToValue(&pAwait->trigger.wait_value, pProtocolWaitConds->wait_value_lo, @@ -1503,11 +1672,12 @@ ProcSyncAwait(ClientPtr client) pAwait->trigger.test_type = pProtocolWaitConds->test_type; status = SyncInitTrigger(client, &pAwait->trigger, - pProtocolWaitConds->counter, XSyncCAAllTrigger); + pProtocolWaitConds->counter, RTCounter, + XSyncCAAllTrigger); if (status != Success) { /* this should take care of removing any triggers created by - * this request that have already been registered on counters + * this request that have already been registered on sync objects */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); return status; @@ -1522,23 +1692,8 @@ ProcSyncAwait(ClientPtr client) pAwaitUnion->header.num_waitconditions++; } - IgnoreClient(client); - - /* see if any of the triggers are already true */ + SyncAwaitEpilogue(client, items, pAwaitUnion); - pAwait = &(pAwaitUnion+1)->await; /* skip over header */ - for (i = 0; i < items; i++, pAwait++) - { - /* don't have to worry about NULL counters because the request - * errors before we get here out if they occur - */ - if ((*pAwait->trigger.CheckTrigger)(&pAwait->trigger, - pAwait->trigger.pCounter->value)) - { - (*pAwait->trigger.TriggerFired)(&pAwait->trigger); - break; /* once is enough */ - } - } return Success; } @@ -1618,13 +1773,14 @@ ProcSyncCreateAlarm(ClientPtr client) /* set up defaults */ pTrigger = &pAlarm->trigger; - pTrigger->pCounter = NULL; + pTrigger->pSync = NULL; pTrigger->value_type = XSyncAbsolute; XSyncIntToValue(&pTrigger->wait_value, 0L); pTrigger->test_type = XSyncPositiveComparison; pTrigger->TriggerFired = SyncAlarmTriggerFired; pTrigger->CounterDestroyed = SyncAlarmCounterDestroyed; - status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger); + status = SyncInitTrigger(client, pTrigger, None, RTCounter, + XSyncCAAllTrigger); if (status != Success) { free(pAlarm); @@ -1646,22 +1802,31 @@ ProcSyncCreateAlarm(ClientPtr client) } if (!AddResource(stuff->id, RTAlarm, pAlarm)) - { - free(pAlarm); return BadAlloc; - } /* see if alarm already triggered. NULL counter will not trigger * in CreateAlarm and sets alarm state to Inactive. */ - if (!pTrigger->pCounter) + if (!pTrigger->pSync) { pAlarm->state = XSyncAlarmInactive; /* XXX protocol change */ } - else if ((*pTrigger->CheckTrigger)(pTrigger, pTrigger->pCounter->value)) + else { - (*pTrigger->TriggerFired)(pTrigger); + SyncCounter *pCounter; + + if (!SyncCheckWarnIsCounter(pTrigger->pSync, + WARN_INVALID_COUNTER_ALARM)) + { + FreeResource(stuff->id, RT_NONE); + return BadAlloc; + } + + pCounter = (SyncCounter *)pTrigger->pSync; + + if ((*pTrigger->CheckTrigger)(pTrigger, pCounter->value)) + (*pTrigger->TriggerFired)(pTrigger); } return Success; @@ -1675,6 +1840,7 @@ ProcSyncChangeAlarm(ClientPtr client) { REQUEST(xSyncChangeAlarmReq); SyncAlarm *pAlarm; + SyncCounter *pCounter = NULL; long vmask; int len, status; @@ -1695,13 +1861,16 @@ ProcSyncChangeAlarm(ClientPtr client) (CARD32 *)&stuff[1])) != Success) return status; + if (SyncCheckWarnIsCounter(pAlarm->trigger.pSync, + WARN_INVALID_COUNTER_ALARM)) + pCounter = (SyncCounter *)pAlarm->trigger.pSync; + /* see if alarm already triggered. NULL counter WILL trigger * in ChangeAlarm. */ - if (!pAlarm->trigger.pCounter || - (*pAlarm->trigger.CheckTrigger)(&pAlarm->trigger, - pAlarm->trigger.pCounter->value)) + if (!pCounter || + (*pAlarm->trigger.CheckTrigger)(&pAlarm->trigger, pCounter->value)) { (*pAlarm->trigger.TriggerFired)(&pAlarm->trigger); } @@ -1729,7 +1898,7 @@ ProcSyncQueryAlarm(ClientPtr client) rep.sequenceNumber = client->sequence; pTrigger = &pAlarm->trigger; - rep.counter = (pTrigger->pCounter) ? pTrigger->pCounter->id : None; + rep.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None; #if 0 /* XXX unclear what to do, depends on whether relative value-types * are "consumed" immediately and are considered absolute from then @@ -1785,6 +1954,231 @@ ProcSyncDestroyAlarm(ClientPtr client) return Success; } +static int +ProcSyncCreateFence(ClientPtr client) +{ + REQUEST(xSyncCreateFenceReq); + DrawablePtr pDraw; + SyncFence *pFence; + int rc; + + REQUEST_SIZE_MATCH(xSyncCreateFenceReq); + + rc = dixLookupDrawable(&pDraw, stuff->d, client, M_ANY, DixGetAttrAccess); + if (rc != Success) + return rc; + + LEGAL_NEW_RESOURCE(stuff->fid, client); + + if (!(pFence = (SyncFence *)SyncCreate(client, + stuff->fid, + SYNC_FENCE))) + return BadAlloc; + + miSyncInitFence(pDraw->pScreen, pFence, stuff->initially_triggered); + + if (!AddResource(stuff->fid, RTFence, (pointer) pFence)) + return BadAlloc; + + return client->noClientException; +} + +static int +FreeFence(void *obj, XID id) +{ + SyncFence *pFence = (SyncFence *) obj; + + miSyncDestroyFence(pFence); + + return Success; +} + +int SyncVerifyFence(SyncFence **ppSyncFence, XID fid, + ClientPtr client, Mask mode) +{ + int rc = dixLookupResourceByType((pointer *)ppSyncFence, fid, RTFence, + client, mode); + + if (rc != Success) + client->errorValue = fid; + + return rc; +} + +static int +ProcSyncTriggerFence(ClientPtr client) +{ + REQUEST(xSyncTriggerFenceReq); + SyncFence *pFence; + int rc; + + REQUEST_SIZE_MATCH(xSyncTriggerFenceReq); + + rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid, RTFence, + client, DixWriteAccess); + if (rc != Success) + return rc; + + miSyncTriggerFence(pFence); + + return client->noClientException; +} + +static int +ProcSyncResetFence(ClientPtr client) +{ + REQUEST(xSyncResetFenceReq); + SyncFence *pFence; + int rc; + + REQUEST_SIZE_MATCH(xSyncResetFenceReq); + + rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid, RTFence, + client, DixWriteAccess); + if (rc != Success) + return rc; + + if (pFence->funcs.CheckTriggered(pFence) != TRUE) + return BadMatch; + + pFence->funcs.Reset(pFence); + + return client->noClientException; +} + +static int +ProcSyncDestroyFence(ClientPtr client) +{ + REQUEST(xSyncDestroyFenceReq); + SyncFence *pFence; + int rc; + + REQUEST_SIZE_MATCH(xSyncDestroyFenceReq); + + rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid, RTFence, + client, DixDestroyAccess); + if (rc != Success) + return rc; + + FreeResource(stuff->fid, RT_NONE); + return client->noClientException; +} + +static int +ProcSyncQueryFence(ClientPtr client) +{ + REQUEST(xSyncQueryFenceReq); + xSyncQueryFenceReply rep; + SyncFence *pFence; + int rc; + + REQUEST_SIZE_MATCH(xSyncQueryFenceReq); + + rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid, + RTFence, client, DixReadAccess); + if (rc != Success) + return rc; + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + rep.triggered = pFence->funcs.CheckTriggered(pFence); + + if (client->swapped) + { + char n; + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + } + + WriteToClient(client, sizeof(xSyncQueryFenceReply), (char *) &rep); + return client->noClientException; +} + +static int +ProcSyncAwaitFence(ClientPtr client) +{ + REQUEST(xSyncAwaitFenceReq); + SyncAwaitUnion *pAwaitUnion; + SyncAwait *pAwait; + /* Use CARD32 rather than XSyncFence because XIDs are hard-coded to + * CARD32 in protocol definitions */ + CARD32 *pProtocolFences; + int status; + int len; + int items; + int i; + + REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq); + + len = client->req_len << 2; + len -= sz_xSyncAwaitFenceReq; + items = len / sizeof(CARD32); + + if (items * sizeof(CARD32) != len) + { + return BadLength; + } + if (items == 0) + { + client->errorValue = items; + return BadValue; + } + + if (!(pAwaitUnion = SyncAwaitPrologue(client, items))) + return BadAlloc; + + /* don't need to do any more memory allocation for this request! */ + + pProtocolFences = (CARD32 *) & stuff[1]; + + pAwait = &(pAwaitUnion+1)->await; /* skip over header */ + for (i = 0; i < items; i++, pProtocolFences++, pAwait++) + { + if (*pProtocolFences == None) + { + /* this should take care of removing any triggers created by + * this request that have already been registered on sync objects + */ + FreeResource(pAwaitUnion->header.delete_id, RT_NONE); + client->errorValue = *pProtocolFences; + return SyncErrorBase + XSyncBadFence; + } + + pAwait->trigger.pSync = NULL; + /* Provide acceptable values for these unused fields to + * satisfy SyncInitTrigger's validation logic + */ + pAwait->trigger.value_type = XSyncAbsolute; + XSyncIntToValue(&pAwait->trigger.wait_value, 0); + pAwait->trigger.test_type = 0; + + status = SyncInitTrigger(client, &pAwait->trigger, + *pProtocolFences, RTFence, + XSyncCAAllTrigger); + if (status != Success) + { + /* this should take care of removing any triggers created by + * this request that have already been registered on sync objects + */ + FreeResource(pAwaitUnion->header.delete_id, RT_NONE); + return status; + } + /* this is not a mistake -- same function works for both cases */ + pAwait->trigger.TriggerFired = SyncAwaitTriggerFired; + pAwait->trigger.CounterDestroyed = SyncAwaitTriggerFired; + /* event_threshold is unused for fence syncs */ + XSyncIntToValue(&pAwait->event_threshold, 0); + pAwait->pHeader = &pAwaitUnion->header; + pAwaitUnion->header.num_waitconditions++; + } + + SyncAwaitEpilogue(client, items, pAwaitUnion); + + return client->noClientException; +} + /* * ** Given an extension request, call the appropriate request procedure */ @@ -1823,6 +2217,18 @@ ProcSyncDispatch(ClientPtr client) return ProcSyncSetPriority(client); case X_SyncGetPriority: return ProcSyncGetPriority(client); + case X_SyncCreateFence: + return ProcSyncCreateFence(client); + case X_SyncTriggerFence: + return ProcSyncTriggerFence(client); + case X_SyncResetFence: + return ProcSyncResetFence(client); + case X_SyncDestroyFence: + return ProcSyncDestroyFence(client); + case X_SyncQueryFence: + return ProcSyncQueryFence(client); + case X_SyncAwaitFence: + return ProcSyncAwaitFence(client); default: return BadRequest; } @@ -2022,6 +2428,83 @@ SProcSyncGetPriority(ClientPtr client) return ProcSyncGetPriority(client); } +static int +SProcSyncCreateFence(ClientPtr client) +{ + REQUEST(xSyncCreateFenceReq); + char n; + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xSyncCreateFenceReq); + swapl(&stuff->fid, n); + + return ProcSyncCreateFence(client); +} + +static int +SProcSyncTriggerFence(ClientPtr client) +{ + REQUEST(xSyncTriggerFenceReq); + char n; + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xSyncTriggerFenceReq); + swapl(&stuff->fid, n); + + return ProcSyncTriggerFence(client); +} + +static int +SProcSyncResetFence(ClientPtr client) +{ + REQUEST(xSyncResetFenceReq); + char n; + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xSyncResetFenceReq); + swapl(&stuff->fid, n); + + return ProcSyncResetFence(client); +} + +static int +SProcSyncDestroyFence(ClientPtr client) +{ + REQUEST(xSyncDestroyFenceReq); + char n; + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xSyncDestroyFenceReq); + swapl(&stuff->fid, n); + + return ProcSyncDestroyFence(client); +} + +static int +SProcSyncQueryFence(ClientPtr client) +{ + REQUEST(xSyncQueryFenceReq); + char n; + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xSyncQueryFenceReq); + swapl(&stuff->fid, n); + + return ProcSyncQueryFence(client); +} + +static int +SProcSyncAwaitFence(ClientPtr client) +{ + REQUEST(xSyncAwaitFenceReq); + char n; + + swaps(&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq); + SwapRestL(stuff); + + return ProcSyncAwaitFence(client); +} static int SProcSyncDispatch(ClientPtr client) @@ -2058,6 +2541,18 @@ SProcSyncDispatch(ClientPtr client) return SProcSyncSetPriority(client); case X_SyncGetPriority: return SProcSyncGetPriority(client); + case X_SyncCreateFence: + return SProcSyncCreateFence(client); + case X_SyncTriggerFence: + return SProcSyncTriggerFence(client); + case X_SyncResetFence: + return SProcSyncResetFence(client); + case X_SyncDestroyFence: + return SProcSyncDestroyFence(client); + case X_SyncQueryFence: + return SProcSyncQueryFence(client); + case X_SyncAwaitFence: + return SProcSyncAwaitFence(client); default: return BadRequest; } @@ -2111,7 +2606,6 @@ SyncResetProc(ExtensionEntry *extEntry) RTCounter = 0; } - /* * ** Initialise the extension. */ @@ -2119,6 +2613,10 @@ void SyncExtensionInit(void) { ExtensionEntry *extEntry; + int s; + + for (s = 0; s < screenInfo.numScreens; s++) + miSyncSetup(screenInfo.screens[s]); if (RTCounter == 0) { @@ -2126,6 +2624,7 @@ SyncExtensionInit(void) } RTAlarm = CreateNewResourceType(FreeAlarm, "SyncAlarm"); RTAwait = CreateNewResourceType(FreeAwait, "SyncAwait"); + RTFence = CreateNewResourceType(FreeFence, "SyncFence"); if (RTAwait) RTAwait |= RC_NEVERRETAIN; RTAlarmClient = CreateNewResourceType(FreeAlarmClient, "SyncAlarmClient"); @@ -2152,6 +2651,7 @@ SyncExtensionInit(void) SetResourceTypeErrorValue(RTCounter, SyncErrorBase + XSyncBadCounter); SetResourceTypeErrorValue(RTAlarm, SyncErrorBase + XSyncBadAlarm); + SetResourceTypeErrorValue(RTFence, SyncErrorBase + XSyncBadFence); /* * Although SERVERTIME is implemented by the OS layer, we initialise it @@ -2295,7 +2795,7 @@ static void IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask) { XSyncValue idle, old_idle; - SyncTriggerList *list = IdleTimeCounter->pTriglist; + SyncTriggerList *list = IdleTimeCounter->sync.pTriglist; SyncTrigger *trig; if (!pIdleTimeValueLess && !pIdleTimeValueGreater) @@ -2316,7 +2816,7 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask) * immediately so we can reschedule. */ - for (list = IdleTimeCounter->pTriglist; list; list = list->next) { + for (list = IdleTimeCounter->sync.pTriglist; list; list = list->next) { trig = list->pTrigger; if (trig->CheckTrigger(trig, old_idle)) { AdjustWaitForDelay(wt, 0); @@ -2350,7 +2850,7 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask) idle, &overflow); timeout = min(timeout, XSyncValueLow32 (value)); } else { - for (list = IdleTimeCounter->pTriglist; list; list = list->next) { + for (list = IdleTimeCounter->sync.pTriglist; list; list = list->next) { trig = list->pTrigger; if (trig->CheckTrigger(trig, old_idle)) { timeout = min(timeout, 0); diff --git a/xserver/Xext/syncsdk.h b/xserver/Xext/syncsdk.h new file mode 100644 index 000000000..a72c58500 --- /dev/null +++ b/xserver/Xext/syncsdk.h @@ -0,0 +1,47 @@ +/* + * Copyright © 2010 NVIDIA Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef _SYNCSDK_H_ +#define _SYNCSDK_H_ + +#include "misync.h" + +extern _X_EXPORT int +SyncVerifyFence(SyncFence **ppFence, XID fid, ClientPtr client, Mask mode); + +#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \ + do { \ + int rc; \ + rc = SyncVerifyFence(&(pFence), (fid), (client), (mode)); \ + if (Success != rc) return rc; \ + } while (0) + +#define VERIFY_SYNC_FENCE_OR_NONE(pFence, fid, client, mode) \ + do { \ + pFence = 0; \ + if (None != fid) \ + VERIFY_SYNC_FENCE((pFence), (fid), (client), (mode)); \ + } while (0) + +#endif /* _SYNCSDK_H_ */ + diff --git a/xserver/Xext/syncsrv.h b/xserver/Xext/syncsrv.h index 6d0e3d64a..7ca1fba26 100644 --- a/xserver/Xext/syncsrv.h +++ b/xserver/Xext/syncsrv.h @@ -51,16 +51,8 @@ PERFORMANCE OF THIS SOFTWARE. #ifndef _SYNCSRV_H_ #define _SYNCSRV_H_ -#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */ - -typedef struct _SyncCounter { - ClientPtr client; /* Owning client. 0 for system counters */ - XSyncCounter id; /* resource ID */ - CARD64 value; /* counter value */ - struct _SyncTriggerList *pTriglist; /* list of triggers */ - Bool beingDestroyed; /* in process of going away */ - struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */ -} SyncCounter; +#include "misync.h" +#include "misyncstr.h" /* * The System Counter interface @@ -92,29 +84,6 @@ typedef struct _SysCounterInfo { -typedef struct _SyncTrigger { - SyncCounter *pCounter; - CARD64 wait_value; /* wait value */ - unsigned int value_type; /* Absolute or Relative */ - unsigned int test_type; /* transition or Comparision type */ - CARD64 test_value; /* trigger event threshold value */ - Bool (*CheckTrigger)( - struct _SyncTrigger * /*pTrigger*/, - CARD64 /*newval*/ - ); - void (*TriggerFired)( - struct _SyncTrigger * /*pTrigger*/ - ); - void (*CounterDestroyed)( - struct _SyncTrigger * /*pTrigger*/ - ); -} SyncTrigger; - -typedef struct _SyncTriggerList { - SyncTrigger *pTrigger; - struct _SyncTriggerList *next; -} SyncTriggerList; - typedef struct _SyncAlarmClientList { ClientPtr client; XID delete_id; @@ -148,7 +117,6 @@ typedef union { SyncAwait await; } SyncAwaitUnion; - extern pointer SyncCreateSystemCounter( char * /* name */, CARD64 /* inital_value */, @@ -171,6 +139,7 @@ extern void SyncChangeCounter( extern void SyncDestroySystemCounter( pointer pCounter ); + extern void InitServertime(void); extern void SyncExtensionInit(void); diff --git a/xserver/Xext/xcalibrate.c b/xserver/Xext/xcalibrate.c deleted file mode 100644 index bff1c3168..000000000 --- a/xserver/Xext/xcalibrate.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright © 2003 Philip Blundell - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Philip Blundell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Philip Blundell makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * PHILIP BLUNDELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL PHILIP BLUNDELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_KDRIVE_CONFIG_H -#include <kdrive-config.h> -#endif - - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "os.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "swaprep.h" -#include "protocol-versions.h" - -#include <X11/extensions/xcalibrateproto.h> -#include <X11/extensions/xcalibratewire.h> - -extern void (*tslib_raw_event_hook)(int x, int y, int pressure, void *closure); -extern void *tslib_raw_event_closure; - -static CARD8 XCalibrateReqCode; -int XCalibrateEventBase; -int XCalibrateReqBase; -int XCalibrateErrorBase; - -static ClientPtr xcalibrate_client; - -static void -xcalibrate_event_hook (int x, int y, int pressure, void *closure) -{ - ClientPtr pClient = (ClientPtr) closure; - xXCalibrateRawTouchscreenEvent ev; - - ev.type = XCalibrateEventBase + X_XCalibrateRawTouchscreen; - ev.x = x; - ev.y = y; - ev.pressure = pressure; - - WriteEventsToClient (pClient, 1, (xEvent *) &ev); -} - -static int -ProcXCalibrateQueryVersion (ClientPtr client) -{ - REQUEST(xXCalibrateQueryVersionReq); - xXCalibrateQueryVersionReply rep; - CARD16 client_major, client_minor; /* not used */ - - REQUEST_SIZE_MATCH (xXCalibrateQueryVersionReq); - - client_major = stuff->majorVersion; - client_minor = stuff->minorVersion; - - fprintf(stderr, "%s(): called\n", __func__); - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_XCALIBRATE_MAJOR_VERSION; - rep.minorVersion = SERVER_XCALIBRATE_MINOR_VERSION; - if (client->swapped) { - int n; - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.majorVersion, n); - swaps(&rep.minorVersion, n); - } - WriteToClient(client, sizeof (xXCalibrateQueryVersionReply), (char *)&rep); - return Success; -} - -static int -SProcXCalibrateQueryVersion (ClientPtr client) -{ - REQUEST(xXCalibrateQueryVersionReq); - int n; - - REQUEST_SIZE_MATCH (xXCalibrateQueryVersionReq); - swaps(&stuff->majorVersion,n); - swaps(&stuff->minorVersion,n); - return ProcXCalibrateQueryVersion(client); -} - -static int -ProcXCalibrateSetRawMode (ClientPtr client) -{ - REQUEST(xXCalibrateRawModeReq); - xXCalibrateRawModeReply rep; - - REQUEST_SIZE_MATCH (xXCalibrateRawModeReq); - - memset (&rep, 0, sizeof (rep)); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - - if (stuff->on) - { - if (xcalibrate_client == NULL) - { - /* Start calibrating. */ - xcalibrate_client = client; - tslib_raw_event_hook = xcalibrate_event_hook; - tslib_raw_event_closure = client; - rep.status = GrabSuccess; - } - else - { - rep.status = AlreadyGrabbed; - } - } - else - { - if (xcalibrate_client == client) - { - /* Stop calibrating. */ - xcalibrate_client = NULL; - tslib_raw_event_hook = NULL; - tslib_raw_event_closure = NULL; - rep.status = GrabSuccess; - - /* Cycle input off and on to reload configuration. */ - KdDisableInput (); - KdEnableInput (); - } - else - { - rep.status = AlreadyGrabbed; - } - } - - if (client->swapped) - { - int n; - - swaps (&rep.sequenceNumber, n); - swaps (&rep.status, n); - } - WriteToClient(client, sizeof (rep), (char *) &rep); - return Success; -} - -static int -SProcXCalibrateSetRawMode (ClientPtr client) -{ - REQUEST(xXCalibrateRawModeReq); - int n; - - REQUEST_SIZE_MATCH (xXCalibrateRawModeReq); - - swaps(&stuff->on, n); - - return ProcXCalibrateSetRawMode(client); -} - -static int -ProcXCalibrateScreenToCoord (ClientPtr client) -{ - REQUEST(xXCalibrateScreenToCoordReq); - xXCalibrateScreenToCoordReply rep; - - REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq); - - memset (&rep, 0, sizeof (rep)); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.x = stuff->x; - rep.y = stuff->y; - - KdScreenToPointerCoords(&rep.x, &rep.y); - - if (client->swapped) - { - int n; - - swaps (&rep.x, n); - swaps (&rep.y, n); - } - WriteToClient(client, sizeof (rep), (char *) &rep); - return Success; -} - -static int -SProcXCalibrateScreenToCoord (ClientPtr client) -{ - REQUEST(xXCalibrateScreenToCoordReq); - int n; - - REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq); - - swaps(&stuff->x, n); - swaps(&stuff->y, n); - - return ProcXCalibrateScreenToCoord(client); -} - -static int -ProcXCalibrateDispatch (ClientPtr client) -{ - REQUEST(xReq); - switch (stuff->data) { - case X_XCalibrateQueryVersion: - return ProcXCalibrateQueryVersion(client); - case X_XCalibrateRawMode: - return ProcXCalibrateSetRawMode(client); - case X_XCalibrateScreenToCoord: - return ProcXCalibrateScreenToCoord(client); - - default: break; - } - - return BadRequest; -} - -static int -SProcXCalibrateDispatch (ClientPtr client) -{ - REQUEST(xReq); - int n; - - swaps(&stuff->length,n); - - switch (stuff->data) { - case X_XCalibrateQueryVersion: - return SProcXCalibrateQueryVersion(client); - case X_XCalibrateRawMode: - return SProcXCalibrateSetRawMode(client); - case X_XCalibrateScreenToCoord: - return SProcXCalibrateScreenToCoord(client); - - default: break; - } - - return BadRequest; -} - -static void -XCalibrateClientCallback (CallbackListPtr *list, - pointer closure, - pointer data) -{ - NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; - ClientPtr pClient = clientinfo->client; - - if (clientinfo->setup == NULL - && xcalibrate_client != NULL - && xcalibrate_client == pClient) - { - /* Stop calibrating. */ - xcalibrate_client = NULL; - tslib_raw_event_hook = NULL; - tslib_raw_event_closure = NULL; - } -} - -void -XCalibrateExtensionInit(void) -{ - ExtensionEntry *extEntry; - - if (!AddCallback (&ClientStateCallback, XCalibrateClientCallback, 0)) - return; - - extEntry = AddExtension(XCALIBRATE_NAME, XCalibrateNumberEvents, XCalibrateNumberErrors, - ProcXCalibrateDispatch, SProcXCalibrateDispatch, - NULL, StandardMinorOpcode); - - if (!extEntry) - return; - - XCalibrateReqCode = (unsigned char)extEntry->base; - XCalibrateEventBase = extEntry->eventBase; - XCalibrateErrorBase = extEntry->errorBase; - - xcalibrate_client = 0; -} diff --git a/xserver/Xext/xcmisc.c b/xserver/Xext/xcmisc.c index 986c870a5..378afccca 100644 --- a/xserver/Xext/xcmisc.c +++ b/xserver/Xext/xcmisc.c @@ -46,24 +46,6 @@ from The Open Group. #define UINT32_MAX 0xffffffffU #endif -static DISPATCH_PROC(ProcXCMiscDispatch); -static DISPATCH_PROC(ProcXCMiscGetVersion); -static DISPATCH_PROC(ProcXCMiscGetXIDList); -static DISPATCH_PROC(ProcXCMiscGetXIDRange); -static DISPATCH_PROC(SProcXCMiscDispatch); -static DISPATCH_PROC(SProcXCMiscGetVersion); -static DISPATCH_PROC(SProcXCMiscGetXIDList); -static DISPATCH_PROC(SProcXCMiscGetXIDRange); - -void XCMiscExtensionInit(INITARGS); - -void -XCMiscExtensionInit(INITARGS) -{ - AddExtension(XCMiscExtensionName, 0, 0, - ProcXCMiscDispatch, SProcXCMiscDispatch, - NULL, StandardMinorOpcode); -} static int ProcXCMiscGetVersion(ClientPtr client) @@ -215,3 +197,11 @@ SProcXCMiscDispatch (ClientPtr client) return BadRequest; } } + +void +XCMiscExtensionInit(INITARGS) +{ + AddExtension(XCMiscExtensionName, 0, 0, + ProcXCMiscDispatch, SProcXCMiscDispatch, + NULL, StandardMinorOpcode); +} diff --git a/xserver/Xext/xf86bigfont.c b/xserver/Xext/xf86bigfont.c index 8f0ddd93d..de8274469 100644 --- a/xserver/Xext/xf86bigfont.c +++ b/xserver/Xext/xf86bigfont.c @@ -50,7 +50,7 @@ #ifdef SVR4 #include <sys/sysmacros.h> #endif -#if defined(__CYGWIN__) || defined(__SCO__) +#if defined(__CYGWIN__) #include <sys/param.h> #include <sys/sysmacros.h> #endif @@ -80,12 +80,6 @@ static void XF86BigfontResetProc( ExtensionEntry * /* extEntry */ ); -static DISPATCH_PROC(ProcXF86BigfontDispatch); -static DISPATCH_PROC(ProcXF86BigfontQueryVersion); -static DISPATCH_PROC(ProcXF86BigfontQueryFont); -static DISPATCH_PROC(SProcXF86BigfontDispatch); -static DISPATCH_PROC(SProcXF86BigfontQueryVersion); -static DISPATCH_PROC(SProcXF86BigfontQueryFont); #ifdef HAS_SHM @@ -143,51 +137,6 @@ CheckForShmSyscall(void) #endif -void -XFree86BigfontExtensionInit(void) -{ - if (AddExtension(XF86BIGFONTNAME, - XF86BigfontNumberEvents, - XF86BigfontNumberErrors, - ProcXF86BigfontDispatch, - SProcXF86BigfontDispatch, - XF86BigfontResetProc, - StandardMinorOpcode)) { -#ifdef HAS_SHM -#ifdef MUST_CHECK_FOR_SHM_SYSCALL - /* - * Note: Local-clients will not be optimized without shared memory - * support. Remote-client optimization does not depend on shared - * memory support. Thus, the extension is still registered even - * when shared memory support is not functional. - */ - if (!CheckForShmSyscall()) { - ErrorF(XF86BIGFONTNAME " extension local-client optimization disabled due to lack of shared memory support in the kernel\n"); - return; - } -#endif - - srand((unsigned int) time(NULL)); - signature = ((unsigned int) (65536.0/(RAND_MAX+1.0) * rand()) << 16) - + (unsigned int) (65536.0/(RAND_MAX+1.0) * rand()); - /* fprintf(stderr, "signature = 0x%08X\n", signature); */ - - FontShmdescIndex = AllocateFontPrivateIndex(); - -#if !defined(CSRG_BASED) && !defined(__CYGWIN__) - pagesize = SHMLBA; -#else -# ifdef _SC_PAGESIZE - pagesize = sysconf(_SC_PAGESIZE); -# else - pagesize = getpagesize(); -# endif -#endif -#endif - } -} - - /* ========== Management of shared memory segments ========== */ #ifdef HAS_SHM @@ -755,3 +704,47 @@ SProcXF86BigfontDispatch( return BadRequest; } } + +void +XFree86BigfontExtensionInit(void) +{ + if (AddExtension(XF86BIGFONTNAME, + XF86BigfontNumberEvents, + XF86BigfontNumberErrors, + ProcXF86BigfontDispatch, + SProcXF86BigfontDispatch, + XF86BigfontResetProc, + StandardMinorOpcode)) { +#ifdef HAS_SHM +#ifdef MUST_CHECK_FOR_SHM_SYSCALL + /* + * Note: Local-clients will not be optimized without shared memory + * support. Remote-client optimization does not depend on shared + * memory support. Thus, the extension is still registered even + * when shared memory support is not functional. + */ + if (!CheckForShmSyscall()) { + ErrorF(XF86BIGFONTNAME " extension local-client optimization disabled due to lack of shared memory support in the kernel\n"); + return; + } +#endif + + srand((unsigned int) time(NULL)); + signature = ((unsigned int) (65536.0/(RAND_MAX+1.0) * rand()) << 16) + + (unsigned int) (65536.0/(RAND_MAX+1.0) * rand()); + /* fprintf(stderr, "signature = 0x%08X\n", signature); */ + + FontShmdescIndex = AllocateFontPrivateIndex(); + +#if !defined(CSRG_BASED) && !defined(__CYGWIN__) + pagesize = SHMLBA; +#else +# ifdef _SC_PAGESIZE + pagesize = sysconf(_SC_PAGESIZE); +# else + pagesize = getpagesize(); +# endif +#endif +#endif + } +} diff --git a/xserver/Xext/xselinux_hooks.c b/xserver/Xext/xselinux_hooks.c index 560e1e9bf..f1d8e5d2f 100644 --- a/xserver/Xext/xselinux_hooks.c +++ b/xserver/Xext/xselinux_hooks.c @@ -40,6 +40,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "propertyst.h" #include "extnsionst.h" #include "xacestr.h" +#include "client.h" #include "../os/osdep.h" #define _XSELINUX_NEED_FLASK_MAP #include "xselinuxint.h" @@ -129,26 +130,25 @@ SELinuxLabelClient(ClientPtr client) /* For local clients, try and determine the executable name */ if (XaceIsLocal(client)) { - struct ucred creds; - socklen_t len = sizeof(creds); - char path[PATH_MAX + 1]; - size_t bytes; - - memset(&creds, 0, sizeof(creds)); - if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &creds, &len) < 0) - goto finish; + /* Get cached command name if CLIENTIDS is enabled. */ + const char *cmdname = GetClientCmdName(client); + Bool cached = (cmdname != NULL); + /* If CLIENTIDS is disabled, figure out the command name from + * scratch. */ + if (!cmdname) + { + pid_t pid = DetermineClientPid(client); + if (pid != -1) + DetermineClientCmd(pid, &cmdname, NULL); + } - snprintf(path, PATH_MAX + 1, "/proc/%d/cmdline", creds.pid); - fd = open(path, O_RDONLY); - if (fd < 0) + if (!cmdname) goto finish; - bytes = read(fd, path, PATH_MAX + 1); - close(fd); - if (bytes <= 0) - goto finish; + strncpy(subj->command, cmdname, COMMAND_LEN - 1); - strncpy(subj->command, path, COMMAND_LEN - 1); + if (!cached) + free((void *) cmdname); /* const char * */ } finish: diff --git a/xserver/Xext/xtest.c b/xserver/Xext/xtest.c index 7268768b0..cc675c116 100644 --- a/xserver/Xext/xtest.c +++ b/xserver/Xext/xtest.c @@ -52,6 +52,8 @@ #include "mipointer.h" #include "xserver-properties.h" #include "exevents.h" +#include "eventstr.h" +#include "inpututils.h" #include "modinit.h" @@ -60,7 +62,7 @@ extern int DeviceValuator; /* XTest events are sent during request processing and may be interruped by * a SIGIO. We need a separate event list to avoid events overwriting each * other's memory */ -static EventListPtr xtest_evlist; +static InternalEvent* xtest_evlist; /** * xtestpointer @@ -84,26 +86,6 @@ static int XTestSwapFakeInput( xReq * /* req */ ); -static DISPATCH_PROC(ProcXTestCompareCursor); -static DISPATCH_PROC(ProcXTestDispatch); -static DISPATCH_PROC(ProcXTestFakeInput); -static DISPATCH_PROC(ProcXTestGetVersion); -static DISPATCH_PROC(ProcXTestGrabControl); -static DISPATCH_PROC(SProcXTestCompareCursor); -static DISPATCH_PROC(SProcXTestDispatch); -static DISPATCH_PROC(SProcXTestFakeInput); -static DISPATCH_PROC(SProcXTestGetVersion); -static DISPATCH_PROC(SProcXTestGrabControl); - -void -XTestExtensionInit(INITARGS) -{ - AddExtension(XTestExtensionName, 0, 0, - ProcXTestDispatch, SProcXTestDispatch, - NULL, StandardMinorOpcode); - - xtest_evlist = InitEventList(GetMaximumEventsNum()); -} static int ProcXTestGetVersion(ClientPtr client) @@ -173,6 +155,7 @@ ProcXTestFakeInput(ClientPtr client) WindowPtr root; Bool extension = FALSE; deviceValuator *dv = NULL; + ValuatorMask mask; int valuators[MAX_VALUATORS] = {0}; int numValuators = 0; int firstValuator = 0; @@ -392,10 +375,7 @@ ProcXTestFakeInput(ClientPtr client) if (!dev->valuator) return BadDevice; - /* broken lib, XI events have root uninitialized */ - if (extension || ev->u.keyButtonPointer.root == None) - root = GetCurrentRootWindow(dev); - else + if (!(extension || ev->u.keyButtonPointer.root == None)) { rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root, client, DixGetAttrAccess); @@ -433,23 +413,23 @@ ProcXTestFakeInput(ClientPtr client) switch(type) { case MotionNotify: - nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, - firstValuator, numValuators, valuators); + valuator_mask_set_range(&mask, firstValuator, numValuators, valuators); + nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, &mask); break; case ButtonPress: case ButtonRelease: + valuator_mask_set_range(&mask, firstValuator, numValuators, valuators); nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail, - flags, firstValuator, - numValuators, valuators); + flags, &mask); break; case KeyPress: case KeyRelease: - nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail); + nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL); break; } for (i = 0; i < nevents; i++) - mieqProcessDeviceEvent(dev, (InternalEvent*)(xtest_evlist+i)->event, NULL); + mieqProcessDeviceEvent(dev, &xtest_evlist[i], NULL); if (need_ptr_update) miPointerUpdateSprite(dev); @@ -699,3 +679,19 @@ GetXTestDevice(DeviceIntPtr master) return NULL; } +static void +XTestExtensionTearDown(ExtensionEntry *e) +{ + FreeEventList(xtest_evlist, GetMaximumEventsNum()); + xtest_evlist = NULL; +} + +void +XTestExtensionInit(INITARGS) +{ + AddExtension(XTestExtensionName, 0, 0, + ProcXTestDispatch, SProcXTestDispatch, + XTestExtensionTearDown, StandardMinorOpcode); + + xtest_evlist = InitEventList(GetMaximumEventsNum()); +} diff --git a/xserver/Xext/xvdisp.c b/xserver/Xext/xvdisp.c index deddebd4b..b96843159 100644 --- a/xserver/Xext/xvdisp.c +++ b/xserver/Xext/xvdisp.c @@ -1918,7 +1918,7 @@ void XineramifyXv(void) MatchingAdaptors[0] = refAdapt; isOverlay = hasOverlay(refAdapt); - for(j = 1; j < PanoramiXNumScreens; j++) + FOR_NSCREENS_FORWARD_SKIP(j) MatchingAdaptors[j] = matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay); /* now create a resource for each port */ @@ -1927,7 +1927,7 @@ void XineramifyXv(void) if(!port) break; - for(k = 0; k < PanoramiXNumScreens; k++) { + FOR_NSCREENS(k) { if(MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j)) port->info[k].id = MatchingAdaptors[k]->base_id + j; else diff --git a/xserver/Xext/xvdix.h b/xserver/Xext/xvdix.h index a2106150e..e9c22bf65 100644 --- a/xserver/Xext/xvdix.h +++ b/xserver/Xext/xvdix.h @@ -64,12 +64,12 @@ extern _X_EXPORT int XvReqCode; extern _X_EXPORT int XvEventBase; extern _X_EXPORT int XvErrorBase; -extern _X_EXPORT unsigned long XvRTPort; -extern _X_EXPORT unsigned long XvRTEncoding; -extern _X_EXPORT unsigned long XvRTGrab; -extern _X_EXPORT unsigned long XvRTVideoNotify; -extern _X_EXPORT unsigned long XvRTVideoNotifyList; -extern _X_EXPORT unsigned long XvRTPortNotify; +extern _X_EXPORT RESTYPE XvRTPort; +extern _X_EXPORT RESTYPE XvRTEncoding; +extern _X_EXPORT RESTYPE XvRTGrab; +extern _X_EXPORT RESTYPE XvRTVideoNotify; +extern _X_EXPORT RESTYPE XvRTVideoNotifyList; +extern _X_EXPORT RESTYPE XvRTPortNotify; #endif typedef struct { diff --git a/xserver/Xext/xvmain.c b/xserver/Xext/xvmain.c index 12b4c5184..d21a56c3e 100644 --- a/xserver/Xext/xvmain.c +++ b/xserver/Xext/xvmain.c @@ -115,14 +115,12 @@ int XvReqCode; int XvEventBase; int XvErrorBase; -unsigned long XvRTPort; -unsigned long XvRTEncoding; -unsigned long XvRTGrab; -unsigned long XvRTVideoNotify; -unsigned long XvRTVideoNotifyList; -unsigned long XvRTPortNotify; - - +RESTYPE XvRTPort; +RESTYPE XvRTEncoding; +RESTYPE XvRTGrab; +RESTYPE XvRTVideoNotify; +RESTYPE XvRTVideoNotifyList; +RESTYPE XvRTPortNotify; /* EXTERNAL */ @@ -1112,12 +1110,7 @@ XvdiMatchPort( while (nf--) { - if ((pf->depth == pDraw->depth) -#if 0 - && ((pDraw->type == DRAWABLE_PIXMAP) || - (wVisual(((WindowPtr)pDraw)) == pf->visual)) -#endif - ) + if (pf->depth == pDraw->depth) return Success; pf++; } diff --git a/xserver/Xext/xvmc.c b/xserver/Xext/xvmc.c index 8fbdfaedd..bc78b55ae 100644 --- a/xserver/Xext/xvmc.c +++ b/xserver/Xext/xvmc.c @@ -42,9 +42,9 @@ unsigned long XvMCGeneration = 0; int XvMCReqCode; int XvMCEventBase; -unsigned long XvMCRTContext; -unsigned long XvMCRTSurface; -unsigned long XvMCRTSubpicture; +static RESTYPE XvMCRTContext; +static RESTYPE XvMCRTSurface; +static RESTYPE XvMCRTSubpicture; typedef struct { int num_adaptors; @@ -487,8 +487,8 @@ ProcXvMCListSubpictureTypes(ClientPtr client) pScreen = pPort->pAdaptor->pScreen; - if(XvMCScreenKey == NULL) /* No XvMC adaptors */ - return BadMatch; + if (!dixPrivateKeyRegistered(XvMCScreenKey)) + return BadMatch; /* No XvMC adaptors */ if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) return BadMatch; /* None this screen */ @@ -668,8 +668,8 @@ XvMCExtensionInit(void) { ExtensionEntry *extEntry; - if(XvMCScreenKey == NULL) /* nobody supports it */ - return; + if (!dixPrivateKeyRegistered(XvMCScreenKey)) + return; if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes, "XvMCRTContext"))) @@ -746,7 +746,8 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id) XvMCAdaptorPtr adaptor = NULL; int i; - if(XvMCScreenKey == NULL) return NULL; + if (!dixPrivateKeyRegistered(XvMCScreenKey)) + return NULL; if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) return NULL; |