diff options
Diffstat (limited to 'xorg-server/hw/xfree86/dri2')
-rw-r--r-- | xorg-server/hw/xfree86/dri2/Makefile.am | 16 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/dri2/Makefile.in | 725 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/dri2/dri2.c | 493 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/dri2/dri2.h | 81 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/dri2/dri2ext.c | 361 |
5 files changed, 1676 insertions, 0 deletions
diff --git a/xorg-server/hw/xfree86/dri2/Makefile.am b/xorg-server/hw/xfree86/dri2/Makefile.am new file mode 100644 index 000000000..e5bd16bd2 --- /dev/null +++ b/xorg-server/hw/xfree86/dri2/Makefile.am @@ -0,0 +1,16 @@ +libdri2_la_LTLIBRARIES = libdri2.la +libdri2_la_CFLAGS = \ + -DHAVE_XORG_CONFIG_H \ + @GL_CFLAGS@ \ + @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ + -I$(top_srcdir)/hw/xfree86/common \ + -I$(top_srcdir)/hw/xfree86/os-support/bus + +libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ +libdri2_ladir = $(moduledir)/extensions +libdri2_la_SOURCES = \ + dri2.c \ + dri2.h \ + dri2ext.c + +sdk_HEADERS = dri2.h diff --git a/xorg-server/hw/xfree86/dri2/Makefile.in b/xorg-server/hw/xfree86/dri2/Makefile.in new file mode 100644 index 000000000..c37499cf3 --- /dev/null +++ b/xorg-server/hw/xfree86/dri2/Makefile.in @@ -0,0 +1,725 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = hw/xfree86/dri2 +DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xgl-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdri2_ladir)" "$(DESTDIR)$(sdkdir)" +libdri2_laLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(libdri2_la_LTLIBRARIES) +libdri2_la_LIBADD = +am_libdri2_la_OBJECTS = libdri2_la-dri2.lo libdri2_la-dri2ext.lo +libdri2_la_OBJECTS = $(am_libdri2_la_OBJECTS) +libdri2_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdri2_la_CFLAGS) \ + $(CFLAGS) $(libdri2_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libdri2_la_SOURCES) +DIST_SOURCES = $(libdri2_la_SOURCES) +sdkHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(sdk_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPDEFAULTDIR = @APPDEFAULTDIR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD = @LAUNCHD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +MKFONTDIR = @MKFONTDIR@ +MKFONTSCALE = @MKFONTSCALE@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ +XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ +XGLMODULES_LIBS = @XGLMODULES_LIBS@ +XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ +XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ +XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ +XGL_LIBS = @XGL_LIBS@ +XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ +XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ +XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ +XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS = @XORG_OS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ +XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ +XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +ft_config = @ft_config@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +xglmoduledir = @xglmoduledir@ +xpconfigdir = @xpconfigdir@ +libdri2_la_LTLIBRARIES = libdri2.la +libdri2_la_CFLAGS = \ + -DHAVE_XORG_CONFIG_H \ + @GL_CFLAGS@ \ + @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ + -I$(top_srcdir)/hw/xfree86/common \ + -I$(top_srcdir)/hw/xfree86/os-support/bus + +libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ +libdri2_ladir = $(moduledir)/extensions +libdri2_la_SOURCES = \ + dri2.c \ + dri2.h \ + dri2ext.c + +sdk_HEADERS = dri2.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dri2/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xfree86/dri2/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libdri2_laLTLIBRARIES: $(libdri2_la_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdri2_ladir)" || $(MKDIR_P) "$(DESTDIR)$(libdri2_ladir)" + @list='$(libdri2_la_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libdri2_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdri2_ladir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libdri2_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdri2_ladir)/$$f"; \ + else :; fi; \ + done + +uninstall-libdri2_laLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libdri2_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdri2_ladir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdri2_ladir)/$$p"; \ + done + +clean-libdri2_laLTLIBRARIES: + -test -z "$(libdri2_la_LTLIBRARIES)" || rm -f $(libdri2_la_LTLIBRARIES) + @list='$(libdri2_la_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libdri2.la: $(libdri2_la_OBJECTS) $(libdri2_la_DEPENDENCIES) + $(libdri2_la_LINK) -rpath $(libdri2_ladir) $(libdri2_la_OBJECTS) $(libdri2_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri2_la-dri2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri2_la-dri2ext.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libdri2_la-dri2.lo: dri2.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -MT libdri2_la-dri2.lo -MD -MP -MF $(DEPDIR)/libdri2_la-dri2.Tpo -c -o libdri2_la-dri2.lo `test -f 'dri2.c' || echo '$(srcdir)/'`dri2.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libdri2_la-dri2.Tpo $(DEPDIR)/libdri2_la-dri2.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dri2.c' object='libdri2_la-dri2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -c -o libdri2_la-dri2.lo `test -f 'dri2.c' || echo '$(srcdir)/'`dri2.c + +libdri2_la-dri2ext.lo: dri2ext.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -MT libdri2_la-dri2ext.lo -MD -MP -MF $(DEPDIR)/libdri2_la-dri2ext.Tpo -c -o libdri2_la-dri2ext.lo `test -f 'dri2ext.c' || echo '$(srcdir)/'`dri2ext.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libdri2_la-dri2ext.Tpo $(DEPDIR)/libdri2_la-dri2ext.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dri2ext.c' object='libdri2_la-dri2ext.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -c -o libdri2_la-dri2ext.lo `test -f 'dri2ext.c' || echo '$(srcdir)/'`dri2ext.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-sdkHEADERS: $(sdk_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)" + @list='$(sdk_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \ + $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \ + done + +uninstall-sdkHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(sdk_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \ + rm -f "$(DESTDIR)$(sdkdir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdri2_ladir)" "$(DESTDIR)$(sdkdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libdri2_laLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-libdri2_laLTLIBRARIES install-sdkHEADERS + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libdri2_laLTLIBRARIES uninstall-sdkHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libdri2_laLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libdri2_laLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-sdkHEADERS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libdri2_laLTLIBRARIES uninstall-sdkHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c new file mode 100644 index 000000000..74aef7196 --- /dev/null +++ b/xorg-server/hw/xfree86/dri2/dri2.c @@ -0,0 +1,493 @@ +/* + * Copyright © 2007 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- + * ware"), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, provided that the above copyright + * notice(s) and this permission notice appear in all copies of the Soft- + * ware and that both the above copyright notice(s) and this permission + * notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- + * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY + * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN + * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- + * QUENTIAL 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 PERFOR- + * MANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization of + * the copyright holder. + * + * Authors: + * Kristian Høgsberg (krh@redhat.com) + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <xf86drm.h> +#include "xf86Module.h" +#include "scrnintstr.h" +#include "windowstr.h" +#include "region.h" +#include "damage.h" +#include "dri2.h" +#include <GL/internal/dri_sarea.h> + +#include "xf86.h" + +static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKey; +static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKey; +static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKey; + +typedef struct _DRI2DrawablePriv { + unsigned int refCount; + unsigned int boHandle; + unsigned int dri2Handle; +} DRI2DrawablePrivRec, *DRI2DrawablePrivPtr; + +typedef struct _DRI2Screen { + int fd; + drmBO sareaBO; + void *sarea; + unsigned int sareaSize; + const char *driverName; + unsigned int nextHandle; + + __DRIEventBuffer *buffer; + int locked; + + DRI2GetPixmapHandleProcPtr getPixmapHandle; + DRI2BeginClipNotifyProcPtr beginClipNotify; + DRI2EndClipNotifyProcPtr endClipNotify; + + ClipNotifyProcPtr ClipNotify; + HandleExposuresProcPtr HandleExposures; +} DRI2ScreenRec, *DRI2ScreenPtr; + +static DRI2ScreenPtr +DRI2GetScreen(ScreenPtr pScreen) +{ + return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey); +} + +static void * +DRI2ScreenAllocEvent(DRI2ScreenPtr ds, size_t size) +{ + unsigned int *pad, mask = ds->buffer->size - 1; + size_t pad_size; + void *p; + + if ((ds->buffer->head & mask) + size > ds->buffer->size) { + /* The requested event size would wrap the buffer, so pad to + * the end and allocate the event from the start. */ + pad_size = ds->buffer->size - (ds->buffer->head & mask); + pad = (unsigned int *) + (ds->buffer->data + (ds->buffer->prealloc & mask)); + *pad = DRI2_EVENT_HEADER(DRI2_EVENT_PAD, pad_size); + ds->buffer->prealloc += pad_size; + } + + p = ds->buffer->data + (ds->buffer->prealloc & mask); + ds->buffer->prealloc += size; + + return p; +} + +static void +DRI2ScreenCommitEvents(DRI2ScreenPtr ds) +{ + ds->buffer->head = ds->buffer->prealloc; +} + +static void +DRI2PostDrawableConfig(DrawablePtr pDraw) +{ + ScreenPtr pScreen = pDraw->pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + DRI2DrawablePrivPtr pPriv; + WindowPtr pWin; + PixmapPtr pPixmap; + BoxPtr pBox; + BoxRec pixmapBox; + int nBox; + int i; + __DRIDrawableConfigEvent *e; + size_t size; + + if (pDraw->type == DRAWABLE_WINDOW) { + pWin = (WindowPtr) pDraw; + pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); + + nBox = REGION_NUM_RECTS(&pWin->clipList); + pBox = REGION_RECTS(&pWin->clipList); + + pPixmap = pScreen->GetWindowPixmap(pWin); + } else { + pPixmap = (PixmapPtr) pDraw; + pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey); + + pixmapBox.x1 = 0; + pixmapBox.y1 = 0; + pixmapBox.x2 = pDraw->width; + pixmapBox.y2 = pDraw->height; + nBox = 1; + pBox = &pixmapBox; + } + + if (!pPriv) + return; + + size = sizeof *e + nBox * sizeof e->rects[0]; + + e = DRI2ScreenAllocEvent(ds, size); + e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_DRAWABLE_CONFIG, size); + e->drawable = pPriv->dri2Handle; + e->x = pDraw->x - pPixmap->screen_x; + e->y = pDraw->y - pPixmap->screen_y; + e->width = pDraw->width; + e->height = pDraw->height; + + e->num_rects = nBox; + for (i = 0; i < nBox; i++) { + e->rects[i].x1 = pBox->x1 - pPixmap->screen_x; + e->rects[i].y1 = pBox->y1 - pPixmap->screen_y; + e->rects[i].x2 = pBox->x2 - pPixmap->screen_x; + e->rects[i].y2 = pBox->y2 - pPixmap->screen_y; + pBox++; + } +} + +static void +DRI2PostBufferAttach(DrawablePtr pDraw, Bool force) +{ + ScreenPtr pScreen = pDraw->pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + DRI2DrawablePrivPtr pPriv; + WindowPtr pWin; + PixmapPtr pPixmap; + __DRIBufferAttachEvent *e; + size_t size; + unsigned int flags; + unsigned int boHandle; + + if (pDraw->type == DRAWABLE_WINDOW) { + pWin = (WindowPtr) pDraw; + pPixmap = pScreen->GetWindowPixmap(pWin); + pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); + } else { + pPixmap = (PixmapPtr) pDraw; + pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey); + } + + if (!pPriv) + return; + + boHandle = ds->getPixmapHandle(pPixmap, &flags); + if (boHandle == pPriv->boHandle && !force) + return; + + pPriv->boHandle = boHandle; + size = sizeof *e; + e = DRI2ScreenAllocEvent(ds, size); + e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_BUFFER_ATTACH, size); + e->drawable = pPriv->dri2Handle; + e->buffer.attachment = DRI_DRAWABLE_BUFFER_FRONT_LEFT; + e->buffer.handle = pPriv->boHandle; + e->buffer.pitch = pPixmap->devKind; + e->buffer.cpp = pPixmap->drawable.bitsPerPixel / 8; + e->buffer.flags = flags; +} + +static void +DRI2ClipNotify(WindowPtr pWin, int dx, int dy) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + if (!ds->locked) { + ds->beginClipNotify(pScreen); + ds->locked = 1; + } + + if (ds->ClipNotify) { + pScreen->ClipNotify = ds->ClipNotify; + pScreen->ClipNotify(pWin, dx, dy); + pScreen->ClipNotify = DRI2ClipNotify; + } + + DRI2PostDrawableConfig(&pWin->drawable); + DRI2PostBufferAttach(&pWin->drawable, FALSE); +} + +static void +DRI2HandleExposures(WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + if (ds->HandleExposures) { + pScreen->HandleExposures = ds->HandleExposures; + pScreen->HandleExposures(pWin); + pScreen->HandleExposures = DRI2HandleExposures; + } + + DRI2ScreenCommitEvents(ds); + + if (ds->locked) { + ds->endClipNotify(pScreen); + ds->locked = 0; + } +} + +void +DRI2CloseScreen(ScreenPtr pScreen) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + pScreen->ClipNotify = ds->ClipNotify; + pScreen->HandleExposures = ds->HandleExposures; + + drmBOUnmap(ds->fd, &ds->sareaBO); + drmBOUnreference(ds->fd, &ds->sareaBO); + + xfree(ds); + dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL); +} + +Bool +DRI2CreateDrawable(DrawablePtr pDraw, + unsigned int *handle, unsigned int *head) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); + WindowPtr pWin; + PixmapPtr pPixmap; + DRI2DrawablePrivPtr pPriv; + DevPrivateKey key; + PrivateRec **devPrivates; + + if (pDraw->type == DRAWABLE_WINDOW) { + pWin = (WindowPtr) pDraw; + devPrivates = &pWin->devPrivates; + key = dri2WindowPrivateKey; + } else { + pPixmap = (PixmapPtr) pDraw; + devPrivates = &pPixmap->devPrivates; + key = dri2PixmapPrivateKey; + } + + pPriv = dixLookupPrivate(devPrivates, key); + if (pPriv != NULL) { + pPriv->refCount++; + } else { + pPriv = xalloc(sizeof *pPriv); + pPriv->refCount = 1; + pPriv->boHandle = 0; + pPriv->dri2Handle = ds->nextHandle++; + dixSetPrivate(devPrivates, key, pPriv); + } + + *handle = pPriv->dri2Handle; + *head = ds->buffer->head; + + DRI2PostDrawableConfig(pDraw); + DRI2PostBufferAttach(pDraw, TRUE); + DRI2ScreenCommitEvents(ds); + + return TRUE; +} + +void +DRI2DestroyDrawable(DrawablePtr pDraw) +{ + PixmapPtr pPixmap; + WindowPtr pWin; + DRI2DrawablePrivPtr pPriv; + DevPrivateKey key; + PrivateRec **devPrivates; + + if (pDraw->type == DRAWABLE_WINDOW) { + pWin = (WindowPtr) pDraw; + devPrivates = &pWin->devPrivates; + key = dri2WindowPrivateKey; + } else { + pPixmap = (PixmapPtr) pDraw; + devPrivates = &pPixmap->devPrivates; + key = dri2PixmapPrivateKey; + } + + pPriv = dixLookupPrivate(devPrivates, key); + if (pPriv == NULL) + return; + + pPriv->refCount--; + if (pPriv->refCount == 0) { + dixSetPrivate(devPrivates, key, NULL); + xfree(pPriv); + } +} + +void +DRI2ReemitDrawableInfo(DrawablePtr pDraw, unsigned int *head) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); + + *head = ds->buffer->head; + + DRI2PostDrawableConfig(pDraw); + DRI2PostBufferAttach(pDraw, TRUE); + DRI2ScreenCommitEvents(ds); +} + +Bool +DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName, + unsigned int *sareaHandle) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + if (ds == NULL) + return FALSE; + + *fd = ds->fd; + *driverName = ds->driverName; + *sareaHandle = ds->sareaBO.handle; + + return TRUE; +} + +Bool +DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + if (ds == NULL || drmAuthMagic(ds->fd, magic)) + return FALSE; + + return TRUE; +} + +unsigned int +DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pPixmap->drawable.pScreen); + + return ds->getPixmapHandle(pPixmap, flags); +} + +static void * +DRI2SetupSAREA(ScreenPtr pScreen, size_t driverSareaSize) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + unsigned long mask; + const size_t event_buffer_size = 32 * 1024; + + ds->sareaSize = + sizeof(*ds->buffer) + event_buffer_size + + driverSareaSize + + sizeof (unsigned int); + + mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE | + DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_SHAREABLE; + + if (drmBOCreate(ds->fd, ds->sareaSize, 1, NULL, mask, 0, &ds->sareaBO)) + return NULL; + + if (drmBOMap(ds->fd, &ds->sareaBO, + DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, &ds->sarea)) { + drmBOUnreference(ds->fd, &ds->sareaBO); + return NULL; + } + + xf86DrvMsg(pScreen->myNum, X_INFO, + "[DRI2] Allocated %d byte SAREA, BO handle 0x%08x\n", + ds->sareaSize, ds->sareaBO.handle); + memset(ds->sarea, 0, ds->sareaSize); + + ds->buffer = ds->sarea; + ds->buffer->block_header = + DRI2_SAREA_BLOCK_HEADER(DRI2_SAREA_BLOCK_EVENT_BUFFER, + sizeof *ds->buffer + event_buffer_size); + ds->buffer->size = event_buffer_size; + + return DRI2_SAREA_BLOCK_NEXT(ds->buffer); +} + +void * +DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) +{ + DRI2ScreenPtr ds; + void *p; + + ds = xalloc(sizeof *ds); + if (!ds) + return NULL; + + ds->fd = info->fd; + ds->driverName = info->driverName; + ds->nextHandle = 1; + + ds->getPixmapHandle = info->getPixmapHandle; + ds->beginClipNotify = info->beginClipNotify; + ds->endClipNotify = info->endClipNotify; + + ds->ClipNotify = pScreen->ClipNotify; + pScreen->ClipNotify = DRI2ClipNotify; + ds->HandleExposures = pScreen->HandleExposures; + pScreen->HandleExposures = DRI2HandleExposures; + + dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds); + + p = DRI2SetupSAREA(pScreen, info->driverSareaSize); + if (p == NULL) { + xfree(ds); + return NULL; + } + + xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n"); + + return p; +} + +extern ExtensionModule dri2ExtensionModule; + +static pointer +DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + LoadExtension(&dri2ExtensionModule, FALSE); + } else { + if (errmaj) + *errmaj = LDR_ONCEONLY; + } + + return (pointer) 1; +} + +static XF86ModuleVersionInfo DRI2VersRec = +{ + "dri2", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_EXTENSION, + ABI_EXTENSION_VERSION, + MOD_CLASS_NONE, + { 0, 0, 0, 0 } +}; + +_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL }; + diff --git a/xorg-server/hw/xfree86/dri2/dri2.h b/xorg-server/hw/xfree86/dri2/dri2.h new file mode 100644 index 000000000..85b3da41c --- /dev/null +++ b/xorg-server/hw/xfree86/dri2/dri2.h @@ -0,0 +1,81 @@ +/* + * Copyright © 2007 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- + * ware"), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, provided that the above copyright + * notice(s) and this permission notice appear in all copies of the Soft- + * ware and that both the above copyright notice(s) and this permission + * notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- + * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY + * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN + * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- + * QUENTIAL 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 PERFOR- + * MANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization of + * the copyright holder. + * + * Authors: + * Kristian Høgsberg (krh@redhat.com) + */ + +#ifndef _DRI2_H_ +#define _DRI2_H_ + +typedef unsigned int (*DRI2GetPixmapHandleProcPtr)(PixmapPtr p, + unsigned int *flags); +typedef void (*DRI2BeginClipNotifyProcPtr)(ScreenPtr pScreen); +typedef void (*DRI2EndClipNotifyProcPtr)(ScreenPtr pScreen); + +typedef struct { + unsigned int version; /* Version of this struct */ + int fd; + size_t driverSareaSize; + const char *driverName; + DRI2GetPixmapHandleProcPtr getPixmapHandle; + DRI2BeginClipNotifyProcPtr beginClipNotify; + DRI2EndClipNotifyProcPtr endClipNotify; +} DRI2InfoRec, *DRI2InfoPtr; + +void *DRI2ScreenInit(ScreenPtr pScreen, + DRI2InfoPtr info); + +void DRI2CloseScreen(ScreenPtr pScreen); + +Bool DRI2Connect(ScreenPtr pScreen, + int *fd, + const char **driverName, + unsigned int *sareaHandle); + +Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic); + +unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap, + unsigned int *flags); + +void DRI2Lock(ScreenPtr pScreen); +void DRI2Unlock(ScreenPtr pScreen); + +Bool DRI2CreateDrawable(DrawablePtr pDraw, + unsigned int *handle, + unsigned int *head); + +void DRI2DestroyDrawable(DrawablePtr pDraw); + +void DRI2ReemitDrawableInfo(DrawablePtr pDraw, + unsigned int *head); + +Bool DRI2PostDamage(DrawablePtr pDrawable, + struct drm_clip_rect *rects, int numRects); + +#endif diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c new file mode 100644 index 000000000..4ae0fda3a --- /dev/null +++ b/xorg-server/hw/xfree86/dri2/dri2ext.c @@ -0,0 +1,361 @@ +/* + * Copyright © 2008 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- + * ware"), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, provided that the above copyright + * notice(s) and this permission notice appear in all copies of the Soft- + * ware and that both the above copyright notice(s) and this permission + * notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- + * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY + * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN + * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- + * QUENTIAL 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 PERFOR- + * MANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization of + * the copyright holder. + * + * Authors: + * Kristian Høgsberg (krh@redhat.com) + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#define NEED_REPLIES +#include <X11/X.h> +#include <X11/Xproto.h> +#include <X11/extensions/dri2proto.h> +#include "dixstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "extnsionst.h" +#include "xf86drm.h" +#include "dri2.h" + +/* The only xf86 include */ +#include "xf86Module.h" + +static ExtensionEntry *dri2Extension; +static RESTYPE dri2DrawableRes; + +static Bool +validScreen(ClientPtr client, int screen, ScreenPtr *pScreen) +{ + if (screen >= screenInfo.numScreens) { + client->errorValue = screen; + return FALSE; + } + + *pScreen = screenInfo.screens[screen]; + + return TRUE; +} + +static Bool +validDrawable(ClientPtr client, XID drawable, + DrawablePtr *pDrawable, int *status) +{ + *status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess); + if (*status != Success) { + client->errorValue = drawable; + return FALSE; + } + + return TRUE; +} + +static int +ProcDRI2QueryVersion(ClientPtr client) +{ + REQUEST(xDRI2QueryVersionReq); + xDRI2QueryVersionReply rep; + int n; + + if (client->swapped) + swaps(&stuff->length, n); + + REQUEST_SIZE_MATCH(xDRI2QueryVersionReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.majorVersion = DRI2_MAJOR; + rep.minorVersion = DRI2_MINOR; + + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.majorVersion, n); + swapl(&rep.minorVersion, n); + } + + WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep); + + return client->noClientException; +} + +static int +ProcDRI2Connect(ClientPtr client) +{ + REQUEST(xDRI2ConnectReq); + xDRI2ConnectReply rep; + ScreenPtr pScreen; + int fd; + const char *driverName; + char *busId = NULL; + unsigned int sareaHandle; + + REQUEST_SIZE_MATCH(xDRI2ConnectReq); + if (!validScreen(client, stuff->screen, &pScreen)) + return BadValue; + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.driverNameLength = 0; + rep.busIdLength = 0; + rep.sareaHandle = 0; + + if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle)) + goto fail; + + busId = drmGetBusid(fd); + if (busId == NULL) + goto fail; + + rep.driverNameLength = strlen(driverName); + rep.busIdLength = strlen(busId); + rep.sareaHandle = sareaHandle; + rep.length = (rep.driverNameLength + 3) / 4 + (rep.busIdLength + 3) / 4; + + fail: + WriteToClient(client, sizeof(xDRI2ConnectReply), &rep); + WriteToClient(client, rep.driverNameLength, driverName); + WriteToClient(client, rep.busIdLength, busId); + drmFreeBusid(busId); + + return client->noClientException; +} + +static int +ProcDRI2AuthConnection(ClientPtr client) +{ + REQUEST(xDRI2AuthConnectionReq); + xDRI2AuthConnectionReply rep; + ScreenPtr pScreen; + + REQUEST_SIZE_MATCH(xDRI2AuthConnectionReq); + if (!validScreen(client, stuff->screen, &pScreen)) + return BadValue; + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.authenticated = 1; + + if (!DRI2AuthConnection(pScreen, stuff->magic)) { + ErrorF("DRI2: Failed to authenticate %lu\n", + (unsigned long) stuff->magic); + rep.authenticated = 0; + } + + WriteToClient(client, sizeof(xDRI2AuthConnectionReply), &rep); + + return client->noClientException; +} + +static int +ProcDRI2CreateDrawable(ClientPtr client) +{ + REQUEST(xDRI2CreateDrawableReq); + xDRI2CreateDrawableReply rep; + DrawablePtr pDrawable; + unsigned int handle, head; + int status; + + REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq); + + if (!validDrawable(client, stuff->drawable, &pDrawable, &status)) + return status; + + if (!DRI2CreateDrawable(pDrawable, &handle, &head)) + return BadMatch; + + if (!AddResource(stuff->drawable, dri2DrawableRes, pDrawable)) { + DRI2DestroyDrawable(pDrawable); + return BadAlloc; + } + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.handle = handle; + rep.head = head; + + WriteToClient(client, sizeof(xDRI2CreateDrawableReply), &rep); + + return client->noClientException; +} + +static int +ProcDRI2DestroyDrawable(ClientPtr client) +{ + REQUEST(xDRI2DestroyDrawableReq); + DrawablePtr pDrawable; + int status; + + REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq); + if (!validDrawable(client, stuff->drawable, &pDrawable, &status)) + return status; + + FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE); + + return client->noClientException; +} + +static int +ProcDRI2ReemitDrawableInfo(ClientPtr client) +{ + REQUEST(xDRI2ReemitDrawableInfoReq); + xDRI2ReemitDrawableInfoReply rep; + DrawablePtr pDrawable; + unsigned int head; + int status; + + REQUEST_SIZE_MATCH(xDRI2ReemitDrawableInfoReq); + if (!validDrawable(client, stuff->drawable, &pDrawable, &status)) + return status; + + DRI2ReemitDrawableInfo(pDrawable, &head); + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.head = head; + + WriteToClient(client, sizeof(xDRI2ReemitDrawableInfoReply), &rep); + + return client->noClientException; +} + +static int +ProcDRI2Dispatch (ClientPtr client) +{ + REQUEST(xReq); + + switch (stuff->data) { + case X_DRI2QueryVersion: + return ProcDRI2QueryVersion(client); + } + + if (!LocalClient(client)) + return BadRequest; + + switch (stuff->data) { + case X_DRI2Connect: + return ProcDRI2Connect(client); + case X_DRI2AuthConnection: + return ProcDRI2AuthConnection(client); + case X_DRI2CreateDrawable: + return ProcDRI2CreateDrawable(client); + case X_DRI2DestroyDrawable: + return ProcDRI2DestroyDrawable(client); + case X_DRI2ReemitDrawableInfo: + return ProcDRI2ReemitDrawableInfo(client); + default: + return BadRequest; + } +} + +static int +SProcDRI2Connect(ClientPtr client) +{ + REQUEST(xDRI2ConnectReq); + xDRI2ConnectReply rep; + int n; + + /* If the client is swapped, it's not local. Talk to the hand. */ + + swaps(&stuff->length, n); + if (sizeof(*stuff) / 4 != client->req_len) + return BadLength; + + rep.sequenceNumber = client->sequence; + swaps(&rep.sequenceNumber, n); + rep.length = 0; + rep.driverNameLength = 0; + rep.busIdLength = 0; + rep.sareaHandle = 0; + + return client->noClientException; +} + +static int +SProcDRI2Dispatch (ClientPtr client) +{ + REQUEST(xReq); + + /* + * Only local clients are allowed DRI access, but remote clients + * still need these requests to find out cleanly. + */ + switch (stuff->data) + { + case X_DRI2QueryVersion: + return ProcDRI2QueryVersion(client); + case X_DRI2Connect: + return SProcDRI2Connect(client); + default: + return BadRequest; + } +} + +static void +DRI2ResetProc (ExtensionEntry *extEntry) +{ +} + +static int DRI2DrawableGone(pointer p, XID id) +{ + DrawablePtr pDrawable = p; + + DRI2DestroyDrawable(pDrawable); + + return Success; +} + +static void +DRI2ExtensionInit(void) +{ + dri2Extension = AddExtension(DRI2_NAME, + DRI2NumberEvents, + DRI2NumberErrors, + ProcDRI2Dispatch, + SProcDRI2Dispatch, + DRI2ResetProc, + StandardMinorOpcode); + + dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone); +} + +extern Bool noDRI2Extension; + +_X_HIDDEN ExtensionModule dri2ExtensionModule = { + DRI2ExtensionInit, + DRI2_NAME, + &noDRI2Extension, + NULL, + NULL +}; |